Skip to content
Snippets Groups Projects
Commit 84bd549e authored by hallc-online's avatar hallc-online
Browse files

Modified THcHallCSpectrometer.cxx and THcHodoscope.cxx

The change was made so that NonTrackingDetector could have information
on the "best" track in their FineProcess method.

In THcHallCSpectrometer::FindVertices the "best" track will be selected
and the Track object will its SetIndex method to set the index to 0 for
the best track. The other track will have index=1 or greater.

In the NonTrackingDetector FineProcess, the track that is selected to
be the "best" can be found by looping through the tracks checking
track index using Track.GetIndex() for find the track with Index=0.

In  the NonTrackingDetector's CoarseProcess they need to set quantities
for the Track object needed for selection of "best" track for the
"prune" and "usingscin" track selection methods.

1) In THcHallCSpectrometer:
  a) Moved selection methods of "best" track from TrackCalc to FindVertices.
  b) Removed setting of Golden Track in the selection methods.
  c) Add setting of Track Index=0 for "best" track in each selection method.
  d) Modified TrackCalc method to loop through Track object and find
     the track with Index=0 and set the Golden Track equal to this Track.

2) In THcHodoscope.cxx
  a) Moved all calculations in FineProcess into CoarseProcess
  b) CoarseProcess calculates the scintillator Beta for each Track
     and does Track->SetBeta.
  c) In determination "zcor" for corrected hits times
      use fBetaNominal instead fBetap from track. Still use Track
      to get distance.
  c) Eliminate fBetap variable which was using the Track momentum
  d) Add variable fBeta which is just from scintillator times.
  e) In FineProcess fill fBeta with the the beta associated
     with the "best" track determined by selecting Track with index=0
parent a7ebb0d5
No related branches found
No related tags found
No related merge requests found
......@@ -357,44 +357,6 @@ Int_t THcHallCSpectrometer::FindVertices( TClonesArray& tracks )
}
// ------------------ Moving it to TrackCalc --------------------
/*
// If enabled, sort the tracks by chi2/ndof
if( GetTrSorting() )
fTracks->Sort();
// Find the "Golden Track".
if( GetNTracks() > 0 ) {
// Select first track in the array. If there is more than one track
// and track sorting is enabled, then this is the best fit track
// (smallest chi2/ndof). Otherwise, it is the track with the best
// geometrical match (smallest residuals) between the U/V clusters
// in the upper and lower VDCs (old behavior).
//
// Chi2/dof is a well-defined quantity, and the track selected in this
// way is immediately physically meaningful. The geometrical match
// criterion is mathematically less well defined and not usually used
// in track reconstruction. Hence, chi2 sortiing is preferable, albeit
// obviously slower.
fGoldenTrack = static_cast<THaTrack*>( fTracks->At(0) );
fTrkIfo = *fGoldenTrack;
fTrk = fGoldenTrack;
} else
fGoldenTrack = NULL;
*/
// ------------------ Moving it to TrackCalc --------------------
return 0;
}
//_____________________________________________________________________________
Int_t THcHallCSpectrometer::TrackCalc()
{
if ( ( fSelUsingScin == 0 ) && ( fSelUsingPrune == 0 ) ) {
BestTrackSimple();
} else if (fSelUsingPrune !=0) {
......@@ -403,37 +365,44 @@ Int_t THcHallCSpectrometer::TrackCalc()
BestTrackUsingScin();
}
return TrackTimes( fTracks );
return 0;
}
//_____________________________________________________________________________
Int_t THcHallCSpectrometer::BestTrackSimple()
Int_t THcHallCSpectrometer::TrackCalc()
{
if( GetTrSorting() )
fTracks->Sort();
// Find the "Golden Track".
// if( GetNTracks() > 0 ) {
if( fNtracks > 0 ) {
// Select first track in the array. If there is more than one track
// and track sorting is enabled, then this is the best fit track
// (smallest chi2/ndof). Otherwise, it is the track with the best
// geometrical match (smallest residuals) between the U/V clusters
// in the upper and lower VDCs (old behavior).
//
// Chi2/dof is a well-defined quantity, and the track selected in this
// way is immediately physically meaningful. The geometrical match
// criterion is mathematically less well defined and not usually used
// in track reconstruction. Hence, chi2 sortiing is preferable, albeit
// obviously slower.
fGoldenTrack = static_cast<THaTrack*>( fTracks->At(0) );
Int_t hit_gold_track=0; // find track with index =0 which is best track
for (Int_t itrack = 0; itrack < fNtracks; itrack++ ){
THaTrack* aTrack = static_cast<THaTrack*>( fTracks->At(itrack) );
if (aTrack->GetIndex()==0) hit_gold_track=itrack;
}
fGoldenTrack = static_cast<THaTrack*>( fTracks->At(hit_gold_track) );
fTrkIfo = *fGoldenTrack;
fTrk = fGoldenTrack;
} else
fGoldenTrack = NULL;
return TrackTimes( fTracks );
}
//_____________________________________________________________________________
Int_t THcHallCSpectrometer::BestTrackSimple()
{
if( GetTrSorting() ) fTracks->Sort();
// Assign index=0 to the best track,
for (Int_t itrack = 0; itrack < fNtracks; itrack++ ){
THaTrack* aTrack = static_cast<THaTrack*>( fTracks->At(itrack) );
aTrack->SetIndex(1);
if (itrack==0) aTrack->SetIndex(0);
}
return(0);
}
......@@ -571,18 +540,19 @@ Int_t THcHallCSpectrometer::BestTrackUsingScin()
fGoodTrack = iitrack;
chi2Min = chi2PerDeg;
fGoldenTrack = aTrack;
fTrkIfo = *fGoldenTrack;
fTrk = fGoldenTrack;
}
}
} // loop over trakcs
// Set index for fGoodTrack = 0
for (Int_t iitrack = 0; iitrack < fNtracks; iitrack++ ){
THaTrack* aTrack = dynamic_cast<THaTrack*>( fTracks->At(iitrack) );
aTrack->SetIndex(1);
if (iitrack==fGoodTrack) aTrack->SetIndex(0);
}
//
}
} else // Condition for fNtrack > 0
fGoldenTrack = NULL;
}
return(0);
}
......@@ -804,13 +774,16 @@ Int_t THcHallCSpectrometer::BestTrackUsingPrune()
chi2Min = chi2PerDeg;
}
}
// Set index=0 for fGoodTrack
for (Int_t iitrack = 0; iitrack < fNtracks; iitrack++ ){
THaTrack* aTrack = dynamic_cast<THaTrack*>( fTracks->At(iitrack) );
aTrack->SetIndex(1);
if (iitrack==fGoodTrack) aTrack->SetIndex(0);
}
//
fGoldenTrack = static_cast<THaTrack*>( fTracks->At(fGoodTrack) );
fTrkIfo = *fGoldenTrack;
fTrk = fGoldenTrack;
} else // Condition for fNtrack > 0
fGoldenTrack = NULL;
}
return(0);
}
......
......@@ -258,7 +258,6 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date )
// Int_t plen=strlen(parname);
cout << " readdatabse hodo fnplanes = " << fNPlanes << endl;
fBetaP = 0.;
fBetaNoTrk = 0.;
fBetaNoTrkChiSq = 0.;
......@@ -467,7 +466,7 @@ Int_t THcHodoscope::DefineVariables( EMode mode )
RVarDef vars[] = {
// Move these into THcHallCSpectrometer using track fTracks
{"betap", "betaP", "fBetaP"},
{"beta", "Beta including track info", "fBeta"},
{"betanotrack", "Beta from scintillator hits", "fBetaNoTrk"},
{"betachisqnotrack", "Chi square of beta from scintillator hits", "fBetaNoTrkChiSq"},
{"fpHitsTime", "Time at focal plane from all hits", "fFPTimeAll"},
......@@ -551,7 +550,7 @@ void THcHodoscope::ClearEvent()
*
*/
fBetaP = 0.;
fBeta = 0.0;
fBetaNoTrk = 0.0;
fBetaNoTrkChiSq = 0.0;
fStartTime = 0.0;
......@@ -865,17 +864,9 @@ Double_t THcHodoscope::TimeWalkCorrection(const Int_t& paddle,
return(0.0);
}
//_____________________________________________________________________________
Int_t THcHodoscope::CoarseProcess( TClonesArray& tracks )
{
ApplyCorrections();
return 0;
}
//_____________________________________________________________________________
Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
Int_t THcHodoscope::CoarseProcess( TClonesArray& tracks )
{
Int_t ntracks = tracks.GetLast()+1; // Number of reconstructed tracks
......@@ -915,8 +906,6 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
// timeAtFP[itrack] = 0.;
Double_t sumFPTime = 0.; // Line 138
fNScinHit.push_back(0);
Double_t p = theTrack->GetP(); // Line 142
fBetaP = p/( TMath::Sqrt( p * p + fPartMass * fPartMass) );
//! Calculate all corrected hit times and histogram
//! This uses a copy of code below. Results are save in time_pos,neg
......@@ -1000,7 +989,7 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
( fPlanes[ip]->GetSize() * 0.5 + fPlanes[ip]->GetHodoSlop() ) ){ // Line 293
fTOFPInfo[ihhit].onTrack = kTRUE;
Double_t zcor = zposition/(29.979*fBetaP)*
Double_t zcor = zposition/(29.979*fBetaNominal)*
TMath::Sqrt(1. + theTrack->GetTheta()*theTrack->GetTheta()
+ theTrack->GetPhi()*theTrack->GetPhi());
fTOFPInfo[ihhit].zcor = zcor;
......@@ -1625,6 +1614,19 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
}
//_____________________________________________________________________________
Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
{
Int_t Ntracks = tracks.GetLast()+1; // Number of reconstructed tracks
for (Int_t itrk=0; itrk<Ntracks; itrk++) {
THaTrack* theTrack = static_cast<THaTrack*>( tracks[itrk] );
if (theTrack->GetIndex()==0) {
fBeta=theTrack->GetBeta();
}
} //over tracks
return 0;
}
//_____________________________________________________________________________
Int_t THcHodoscope::GetScinIndex( Int_t nPlane, Int_t nPaddle ) {
// GN: Return the index of a scintillator given the plane # and the paddle #
// This assumes that both planes and
......
......@@ -93,11 +93,8 @@ public:
Int_t GetTdcOffset(Int_t ip) const { return fTdcOffset[ip];}
// Double_t GetBeta() const {return fBeta[];}
Double_t GetBeta() const {return fBeta;}
// Not used
//Double_t GetBeta(Int_t itrack) const {return fBeta[itrack];} // Ahmed
// Int_t GetEvent(){ return fCheckEvent;}
Double_t GetHodoPosSigma(Int_t iii) const {return fHodoPosSigma[iii];}
Double_t GetHodoNegSigma(Int_t iii) const {return fHodoNegSigma[iii];}
......@@ -132,7 +129,7 @@ protected:
Double_t fFPTimeAll;
Int_t fNfptimes;
Double_t fBetaP;
Double_t fBeta;
Double_t fBetaNoTrk;
Double_t fBetaNoTrkChiSq;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment