diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 39a3ce42e139f39cc088cf577ee7eb82e9beebd2..76da20a3fbb2e250eee149b2149eed251d3d04b7 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -590,6 +590,7 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) EstimateFocalPlaneTime(); if (fdebugprintscinraw == 1) { + cout << " Event number = " << evdata.GetEvNum()<<endl; for(UInt_t ihit = 0; ihit < fNRawHits ; ihit++) { THcRawHodoHit* hit = (THcRawHodoHit *) fRawHitList->At(ihit); cout << ihit << " : " << hit->fPlane << ":" << hit->fCounter << " : " @@ -638,12 +639,10 @@ void THcHodoscope::EstimateFocalPlaneTime( void ) timehist[k]++; } } - ihit++; } } // Find the bin with most hits - ihit=0; Int_t binmax=0; Int_t maxhit=0; for(Int_t i=0;i<200;i++) { @@ -655,8 +654,9 @@ void THcHodoscope::EstimateFocalPlaneTime( void ) ihit = 0; Double_t fpTimeSum = 0.0; - Int_t jhit = 0; fNfptimes=0; + Int_t Ngood_hits_plane=0; + Double_t Plane_fptime_sum=0.0; fNoTrkPlaneInfo.clear(); fNoTrkHitInfo.clear(); @@ -665,30 +665,34 @@ void THcHodoscope::EstimateFocalPlaneTime( void ) fNoTrkPlaneInfo[ip].goodplanetime = kFALSE; Int_t nphits=fPlanes[ip]->GetNScinHits(); TClonesArray* hodoHits = fPlanes[ip]->GetHits(); + Ngood_hits_plane=0; + Plane_fptime_sum=0.0; for(Int_t i=0;i<nphits;i++) { fNoTrkHitInfo.push_back(NoTrkHitInfo()); - fNoTrkHitInfo[jhit].goodtwotimes = kFALSE; - fNoTrkHitInfo[jhit].goodscintime = kFALSE; + fNoTrkHitInfo[i].goodtwotimes = kFALSE; + fNoTrkHitInfo[i].goodscintime = kFALSE; Double_t tmin = 0.5*binmax; Double_t postime=((THcHodoHit*) hodoHits->At(i))->GetPosTOFCorrectedTime(); Double_t negtime=((THcHodoHit*) hodoHits->At(i))->GetNegTOFCorrectedTime(); if ((postime>tmin) && (postime<tmin+fTofTolerance) && (negtime>tmin) && (negtime<tmin+fTofTolerance)) { - fNoTrkHitInfo[jhit].goodtwotimes = kTRUE; - fNoTrkHitInfo[jhit].goodscintime = kTRUE; + fNoTrkHitInfo[i].goodtwotimes = kTRUE; + fNoTrkHitInfo[i].goodscintime = kTRUE; // Both tubes fired Int_t index=((THcHodoHit*)hodoHits->At(i))->GetPaddleNumber()-1; Double_t fptime = ((THcHodoHit*)hodoHits->At(i))->GetScinCorrectedTime() - (fPlanes[ip]->GetZpos()+(index%2)*fPlanes[ip]->GetDzpos()) / (29.979 * fBetaNominal); if(TMath::Abs(fptime-fStartTimeCenter)<=fStartTimeSlop) { - // Should also fill the all FP times histogram + Ngood_hits_plane++; + Plane_fptime_sum+=fptime; fpTimeSum += fptime; fNfptimes++; fNoTrkPlaneInfo[ip].goodplanetime = kTRUE; } } - jhit++; + fPlanes[ip]->SetFpTime(Plane_fptime_sum/float(Ngood_hits_plane)); + fPlanes[ip]->SetNGoodHits(Ngood_hits_plane); } ihit++; } diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index 782876a1fcc57d3778a8668dc0df1581c53ad23d..3b783411663a66b0c6236a97da3dc8b085737416 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -226,8 +226,9 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) {"negtdchits", "List of Negative TDC hits", "frNegTDCHits.THcSignalHit.GetPaddleNumber()"}, {"posadchits", "List of Positive ADC hits", "frPosADCHits.THcSignalHit.GetPaddleNumber()"}, {"negadchits", "List of Negative ADC hits", "frNegADCHits.THcSignalHit.GetPaddleNumber()"}, - // {"fptime", "Time at focal plane", // "GetFpTime()"}, - {"nhits", "Number of hits", "GetNScinHits() "}, + {"fptime", "Time at focal plane", "GetFpTime()"}, + {"nhits", "Number of paddle hits (passed TDC Min and Max cuts for both ends)", "GetNScinHits() "}, + {"ngoodhits", "Number of paddle hits (passed tof tolerance and used to determine the focal plane time )", "GetNGoodHits() "}, { 0 } }; diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index 17bf5f366ed371eb006d9ffc2d857e2fbf4600b3..a3a1a3d7abb7e41cb75c10c406f999923f24160f 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -40,7 +40,8 @@ class THcScintillatorPlane : public THaSubDetector { virtual void CalculatePedestals( ); Int_t GetNelem() {return fNelem;}; // return number of paddles in this plane - Int_t GetNScinHits() {return fNScinHits;}; // # hits in plane (that pass min/max TDC cuts) + Int_t GetNScinHits() {return fNScinHits;}; // Get # hits in plane (that pass min/max TDC cuts) + Int_t GetNGoodHits() {return fNGoodHits;}; // Get # hits in plane (used in determining focal plane time) Double_t GetSpacing() {return fSpacing;}; // spacing of paddles Double_t GetSize() {return fSize;}; // paddle size Double_t GetHodoSlop() {return fHodoSlop;}; // hodo slop @@ -50,6 +51,10 @@ class THcScintillatorPlane : public THaSubDetector { Double_t GetPosRight() {return fPosRight;}; Double_t GetPosOffset() {return fPosOffset;}; Double_t GetPosCenter(Int_t PaddleNo) {return fPosCenter[PaddleNo];}; // counting from zero! + Double_t GetFpTime() {return fFptime;}; + + void SetFpTime(Double_t f) {fFptime=f;}; + void SetNGoodHits(Int_t ng) {fNGoodHits=ng;}; TClonesArray* fParentHitList; @@ -67,7 +72,8 @@ class THcScintillatorPlane : public THaSubDetector { UInt_t fTotPlanes; /* so we can read variables that are not indexed by plane id */ UInt_t fNelem; /* Need since we don't inherit from detector base class */ - Int_t fNScinHits; /* Number of hits in this plane */ + Int_t fNScinHits; /* number of hits in plane (that pass min/max TDC cuts) */ + Int_t fNGoodHits; /* number of hits in plane (used in determining focal plane time) */ Int_t fMaxHits; /* maximum number of hits to be considered - useful for dimensioning arrays */ Double_t fSpacing; /* paddle spacing */ Double_t fSize; /* paddle size */ @@ -95,6 +101,7 @@ class THcScintillatorPlane : public THaSubDetector { Double_t *fHodoSigma; Double_t fTolerance; /* need this for Focal Plane Time estimation */ + Double_t fFptime; /* Pedestal Quantities */ Int_t fNPedestalEvents; /* Number of pedestal events */ Int_t fMinPeds; /* Only analyze/update if num events > */