Skip to content
Snippets Groups Projects
Commit 22d46e08 authored by Stephen A. Wood's avatar Stephen A. Wood
Browse files

Supply dedx needed by UsingScin method of track selection.

  There is some unclear code in the track selection that could
  do with improvement.
parent 787f3e17
No related branches found
No related tags found
No related merge requests found
...@@ -457,16 +457,13 @@ Int_t THcHallCSpectrometer::TrackCalc() ...@@ -457,16 +457,13 @@ Int_t THcHallCSpectrometer::TrackCalc()
if ( fSelUsingScin == 1 ){ if ( fSelUsingScin == 1 ){
if( fNtracks > 0 ) { if( fNtracks > 0 ) {
Double_t ft; //, fShowerEnergy;
Int_t itrack; //, fGoodTimeIndex = -1; Int_t itrack; //, fGoodTimeIndex = -1;
Int_t fRawIndex, fGoodRawPad;
fGoodTrack = -1; fGoodTrack = -1;
chi2Min = 10000000000.0; chi2Min = 10000000000.0;
Double_t y2Dmin = 100.; Double_t y2Dmin = 100.;
Double_t x2Dmin = 100.; Double_t x2Dmin = 100.;
fRawIndex = -1;
for ( itrack = 0; itrack < fNtracks; itrack++ ){ for ( itrack = 0; itrack < fNtracks; itrack++ ){
Double_t chi2PerDeg; Double_t chi2PerDeg;
...@@ -490,24 +487,23 @@ Int_t THcHallCSpectrometer::TrackCalc() ...@@ -490,24 +487,23 @@ Int_t THcHallCSpectrometer::TrackCalc()
y2Hits[j] = -1; y2Hits[j] = -1;
} }
Int_t rawindex = 0;
for (Int_t ip = 0; ip < fNPlanes; ip++ ){ for (Int_t ip = 0; ip < fNPlanes; ip++ ){
for (UInt_t ihit = 0; ihit < fHodo->GetNScinHits(ip); ihit++ ){ for (UInt_t ihit = 0; ihit < fHodo->GetNScinHits(ip); ihit++ ){
fRawIndex ++;
cout << itrack << " " << fRawIndex << endl;
// fGoodRawPad = fHodo->GetGoodRawPad(fRawIndex)-1; // goodRawPad = fHodo->GetGoodRawPad(rawindex)-1;
fGoodRawPad = fHodo->GetGoodRawPad(fRawIndex); // Kind of a fragile way to get the paddle number
cout << itrack << " " << fRawIndex << " " << fGoodRawPad << endl; Int_t goodRawPad = fHodo->GetGoodRawPad(rawindex);
if ( ip == 2 ){ if ( ip == 2 ){
x2Hits[fGoodRawPad] = 0; x2Hits[goodRawPad] = 0;
} }
if ( ip == 3 ){ if ( ip == 3 ){
y2Hits[fGoodRawPad] = 0; y2Hits[goodRawPad] = 0;
} }
rawindex ++;
} // loop over hits of a plane } // loop over hits of a plane
} // loop over planes } // loop over planes
...@@ -520,19 +516,29 @@ Int_t THcHallCSpectrometer::TrackCalc() ...@@ -520,19 +516,29 @@ Int_t THcHallCSpectrometer::TrackCalc()
if ( fNtracks > 1 ){ // Plane 4 if ( fNtracks > 1 ){ // Plane 4
Double_t zap = 0.; Double_t zap = 0.;
ft = 0; Int_t ft = 0;
// What is this doing? There must be a simpler way.
// Why stop at ft==6? Something identifying the paddle
// with hits that is closest to where the track passes?
for (UInt_t i = 0; i < fHodo->GetNPaddles(3); i++ ){ for (UInt_t i = 0; i < fHodo->GetNPaddles(3); i++ ){
if ( y2Hits[i] == 0 ) { if ( y2Hits[i] == 0 ) {
y2D[itrack] = TMath::Abs((Int_t)hitCnt4-(Int_t)i-1); y2D[itrack] = TMath::Abs((Int_t)hitCnt4-(Int_t)i-1);
ft ++; ft ++;
#if 0
if ( ft == 1 ) zap = y2D[itrack]; if ( ft == 1 ) zap = y2D[itrack];
if ( ( ft == 2 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack]; if ( ( ft == 2 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack];
if ( ( ft == 3 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack]; if ( ( ft == 3 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack];
if ( ( ft == 4 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack]; if ( ( ft == 4 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack];
if ( ( ft == 5 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack]; if ( ( ft == 5 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack];
if ( ( ft == 6 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack]; if ( ( ft == 6 ) && ( y2D[itrack] < zap ) ) zap = y2D[itrack];
#else
if (ft==1) {
zap = y2D[itrack];
} else if (ft>=2 && ft<=6) {
if(y2D[itrack] < zap) zap = y2D[itrack];
}
#endif
} // condition for fHodScinHit[4][i] } // condition for fHodScinHit[4][i]
} // loop over 10 } // loop over 10
...@@ -551,18 +557,26 @@ Int_t THcHallCSpectrometer::TrackCalc() ...@@ -551,18 +557,26 @@ Int_t THcHallCSpectrometer::TrackCalc()
if ( fNtracks > 1 ){ // Plane 3 (2X) if ( fNtracks > 1 ){ // Plane 3 (2X)
Double_t zap = 0.; Double_t zap = 0.;
ft = 0; Int_t ft = 0;
for (UInt_t i = 0; i < fHodo->GetNPaddles(2); i++ ){ for (UInt_t i = 0; i < fHodo->GetNPaddles(2); i++ ){
if ( x2Hits[i] == 0 ) { if ( x2Hits[i] == 0 ) {
x2D[itrack] = TMath::Abs((Int_t)hitCnt3-(Int_t)i-1); x2D[itrack] = TMath::Abs((Int_t)hitCnt3-(Int_t)i-1);
ft ++; ft ++;
#if 0
if ( ft == 1 ) zap = x2D[itrack]; if ( ft == 1 ) zap = x2D[itrack];
if ( ( ft == 2 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack]; if ( ( ft == 2 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack];
if ( ( ft == 3 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack]; if ( ( ft == 3 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack];
if ( ( ft == 4 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack]; if ( ( ft == 4 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack];
if ( ( ft == 5 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack]; if ( ( ft == 5 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack];
if ( ( ft == 6 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack]; if ( ( ft == 6 ) && ( x2D[itrack] < zap ) ) zap = x2D[itrack];
#else
if (ft==1) {
zap = x2D[itrack];
} else if (ft>=2 && ft<=6) {
if(x2D[itrack] < zap) zap = x2D[itrack];
}
#endif
} // condition for fHodScinHit[4][i] } // condition for fHodScinHit[4][i]
} // loop over 16 } // loop over 16
......
...@@ -1106,6 +1106,9 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks ) ...@@ -1106,6 +1106,9 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
// ** See if there are any good time measurements in the plane. // ** See if there are any good time measurements in the plane.
if ( fTOFCalc[ihhit].good_scin_time ){ if ( fTOFCalc[ihhit].good_scin_time ){
fGoodPlaneTime[ip] = kTRUE; fGoodPlaneTime[ip] = kTRUE;
fTOFCalc[ihhit].dedx = fdEdX[itrack][fNScinHit[itrack]-1];
} else {
fTOFCalc[ihhit].dedx = 0.0;
} }
// Can this be done after looping over hits and planes? // Can this be done after looping over hits and planes?
...@@ -1232,10 +1235,15 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks ) ...@@ -1232,10 +1235,15 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks )
} }
} }
Double_t fptime = FPTimeSum/nFPTimeSum; Double_t fptime = FPTimeSum/nFPTimeSum;
// This can't be right. Plus if there are no hits, then
// it is undefined.
Double_t dedx=0.0;
for(UInt_t ih=0;ih<fTOFCalc.size();ih++) {
if(fTOFCalc[ih].good_scin_time) {
dedx = fTOFCalc[ih].dedx;
break;
}
}
theTrack->SetDedx(dedx);
theTrack->SetFPTime(fptime); theTrack->SetFPTime(fptime);
theTrack->SetBeta(beta); theTrack->SetBeta(beta);
theTrack->SetBetaChi2( betaChiSq ); theTrack->SetBetaChi2( betaChiSq );
......
...@@ -245,6 +245,7 @@ protected: ...@@ -245,6 +245,7 @@ protected:
Bool_t good_tdc_neg; Bool_t good_tdc_neg;
Double_t scin_time; Double_t scin_time;
Double_t scin_sigma; Double_t scin_sigma;
Double_t dedx;
TOFCalc() : good_scin_time(kFALSE), good_tdc_pos(kFALSE), TOFCalc() : good_scin_time(kFALSE), good_tdc_pos(kFALSE),
good_tdc_neg(kFALSE) {} good_tdc_neg(kFALSE) {}
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment