diff --git a/src/THcDC.cxx b/src/THcDC.cxx index 675071ae260cea5dff531d056acbe359b0fb39aa..7f0cba2805e8cf4774c1d518b59960960ad89c54 100644 --- a/src/THcDC.cxx +++ b/src/THcDC.cxx @@ -209,6 +209,7 @@ THaAnalysisObject::EStatus THcDC::Init( const TDatime& date ) // Should probably put this in ReadDatabase as we will know the // maximum number of hits after setting up the detector map + cout << " DC tdc ref time cut = " << fTDC_RefTimeCut << endl; InitHitList(fDetMap, "THcRawDCHit", fDetMap->GetTotNumChan()+1, fTDC_RefTimeCut, 0); @@ -528,6 +529,8 @@ Int_t THcDC::Decode( const THaEvData& evdata ) } fNhits = DecodeToHitList(evdata, !present); + + if(!gHaCuts->Result("Pedestal_event")) { // Let each plane get its hits Int_t nexthit = 0; @@ -537,11 +540,6 @@ Int_t THcDC::Decode( const THaEvData& evdata ) } - // Let each chamber get its hits - for(UInt_t ic=0;ic<fNChambers;ic++) { - fChambers[ic]->ProcessHits(); - fNthits += fChambers[ic]->GetNHits(); - } // fRawHitList is TClones array of THcRawDCHit objects Int_t counter=0; if (fdebugprintrawdc) { @@ -577,11 +575,19 @@ Int_t THcDC::CoarseTrack( TClonesArray& tracks ) // Apply corrections and reconstruct the complete hits. // // static const Double_t sqrt2 = TMath::Sqrt(2.); - if (fdebugprintdecodeddc) { - for(UInt_t i=0;i<fNChambers;i++) { - fChambers[i]->PrintDecode(); - } - } + // + // Subtract starttimes from each plane hit + for(Int_t ip=0;ip<fNPlanes;ip++) { + fPlanes[ip]->SubtractStartTime(); + } + // + // Let each chamber get its hits + for(UInt_t ic=0;ic<fNChambers;ic++) { + fChambers[ic]->ProcessHits(); + fNthits += fChambers[ic]->GetNHits(); + if (fdebugprintdecodeddc)fChambers[ic]->PrintDecode(); + } + // for(UInt_t i=0;i<fNChambers;i++) { fChambers[i]->FindSpacePoints(); fChambers[i]->CorrectHitTimes(); @@ -1201,6 +1207,8 @@ void THcDC::TrackFit() // } +// +// Double_t THcDC::DpsiFun(Double_t ray[4], Int_t plane) { /* diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index d3cdd19c2a5c95a713957fcd0ea99b0c28737e08..263a3fc574a890a804398d360b66c29c89ab776a 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -325,17 +325,9 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // Assumes that the hit list is sorted by plane, so we stop when the // plane doesn't agree and return the index for the next hit. - Double_t StartTime = 0.0; - // Would be nice to have a way to determine that the hodoscope decode was - // actually called for this event. - if( fglHod ) StartTime = fglHod->GetStartTime(); - //cout << "Start time " << StartTime << endl; - - //Int_t nTDCHits=0; fHits->Clear(); Int_t nrawhits = rawhits->GetLast()+1; - // cout << "THcDriftChamberPlane::ProcessHits " << fPlaneNum << " " << nexthit << "/" << nrawhits << endl; fNRawhits=0; Int_t ihit = nexthit; Int_t nextHit = 0; @@ -346,7 +338,6 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) } Int_t wireNum = hit->fCounter; THcDCWire* wire = GetWire(wireNum); - // Int_t reftime = hit->GetReference(0); for(UInt_t mhit=0; mhit<hit->GetRawTdcHit().GetNHits(); mhit++) { fNRawhits++; /* Sort into early, late and ontime */ @@ -357,13 +348,7 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) } else if (rawtdc > fTdcWinMax) { // Increment late count } else { - Double_t time = -StartTime // (comes from h_trans_scin - - rawtdc*fNSperChan + fPlaneTimeZero - fTzeroWire[wireNum-1]; // fNSperChan > 0 for 1877 - // (cout << " Plane = " << GetName() << " wire = " << wireNum << " " << fPlaneTimeZero << " " << fTzeroWire[wireNum-1] << endl; - // < 0 for Caen1190. - // - (rawtdc-reftime)*fNSperChan + fPlaneTimeZero; - // How do we get this start time from the hodoscope to here - // (or at least have it ready by coarse process) + Double_t time = - rawtdc*fNSperChan + fPlaneTimeZero - fTzeroWire[wireNum-1]; // fNSperChan > 0 for 1877 new( (*fHits)[nextHit++] ) THcDCHit(wire, rawnorefcorrtdc,rawtdc, time, this); break; // Take just the first hit in the time window } @@ -372,3 +357,14 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) } return(ihit); } +Int_t THcDriftChamberPlane::SubtractStartTime() +{ + Double_t StartTime = 0.0; + if( fglHod ) StartTime = fglHod->GetStartTime(); + for(Int_t ihit=0;ihit<GetNHits();ihit++) { + THcDCHit *thishit = (THcDCHit*) fHits->At(ihit); + Double_t temptime= thishit->GetTime()-StartTime; + thishit->SetTime(temptime); + } + return 0; +} diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index 85ef9accf27db6e16f01dc6bdd60aac955d977e7..db23cbaeb2db77c537de3a89682f7a3b83807900 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -42,6 +42,9 @@ public: virtual Int_t ProcessHits(TClonesArray* rawhits, Int_t nexthit); + virtual Int_t SubtractStartTime(); + + // Get and Set functions Int_t GetNWires() const { return fWires->GetLast()+1; } THcDCWire* GetWire(Int_t i) const