diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index 5408b4fa6b18612f704bf8be454e63b552032c0a..f836582ce22e81fbc21117a9923e256b2b16741a 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -15,6 +15,7 @@ #include "THcParmList.h" #include "THcHitList.h" #include "THcDriftChamber.h" +#include "THcHodoscope.h" #include "TClass.h" #include <cstring> @@ -115,6 +116,14 @@ Int_t THcDriftChamberPlane::ReadDatabase( const TDatime& date ) //if( something < 0 ) wire->SetFlag(1); } + THaApparatus* app = GetApparatus(); + const char* nm = "hod"; + if( !app || + !(fglHod = dynamic_cast<THcHodoscope*>(app->GetDetector(nm))) ) { + Warning(Here(here),"Hodoscope \"%s\" not found. " + "Event-by-event time offsets will NOT be used!!",nm); + } + return kOK; } //_____________________________________________________________________________ @@ -175,6 +184,12 @@ 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(); @@ -206,7 +221,7 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // Are we choose the same hit that ENGINE chooses? // cout << "Extra hit " << fPlaneNum << " " << wireNum << " " << rawtdc << endl; } else { - Double_t time = // -hstart_time (comes from h_trans_scin + Double_t time = -StartTime // (comes from h_trans_scin - rawtdc*fNSperChan + fPlaneTimeZero; // How do we get this start time from the hodoscope to here // (or at least have it ready by coarse process) diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index 152796d2dc4b0c4ab8717219df98d9e17def3b05..7307a4acf649f75679223878d27d2607747c3798 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -20,6 +20,7 @@ class THaEvData; class THcDCWire; class THcDCHit; class THcDCTimeToDistConv; +class THcHodoscope; /*class THaSignalHit;*/ @@ -73,6 +74,8 @@ class THcDriftChamberPlane : public THaSubDetector { THcDCTimeToDistConv* fTTDConv; // Time-to-distance converter for this plane's wires + THcHodoscope* fglHod; // Hodoscope to get start time + ClassDef(THcDriftChamberPlane,0) }; #endif diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index a56dbb8197eff0745af48686d4820025503b9643..68681246a4ceeb0de062354bb5d4d4be4874d0d1 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -575,6 +575,8 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) cout << endl; #endif + fStartTime = 500; // Drift Chamber will need this + return nhits; } diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 609b8ed853bd035f5b8ce14aef5728f7ea6265e8..2f3577d8314fcccb597e1c0ea820d607bef4e909 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -32,6 +32,7 @@ public: virtual Int_t ApplyCorrections( void ); // Int_t GetNHits() const { return fNhit; } + Double_t GetStartTime() const { return fStartTime; } Int_t GetScinIndex(Int_t nPlane, Int_t nPaddle); Int_t GetScinIndex(Int_t nSide, Int_t nPlane, Int_t nPaddle); Double_t GetPathLengthCentral(); @@ -50,7 +51,8 @@ protected: // Per-event data - + Double_t fStartTime; + // Potential Hall C parameters. Mostly here for demonstration Int_t fNPlanes,fMaxScinPerPlane,fMaxHodoScin; // number of planes; max number of scin/plane; product of the first two Double_t fStartTimeCenter, fStartTimeSlop, fScinTdcToTime;