diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index c111664c8b1bd75c18a0637745932ed7199b4609..a25ea124a627c73499f154c9cf39061c9d25af83 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -92,13 +92,14 @@ Int_t THcDriftChamberPlane::ReadDatabase( const TDatime& date ) UInt_t NumDriftMapBins; Double_t DriftMapFirstBin; Double_t DriftMapBinSize; - + fUsingTzeroPerWire=0; prefix[0]=tolower(GetParent()->GetPrefix()[0]); prefix[1]='\0'; DBRequest list[]={ {"driftbins", &NumDriftMapBins, kInt}, {"drift1stbin", &DriftMapFirstBin, kDouble}, {"driftbinsz", &DriftMapBinSize, kDouble}, + {"_using_tzero_per_wire", &fUsingTzeroPerWire, kInt,0,1}, {0} }; gHcParms->LoadParmValues((DBRequest*)&list,prefix); @@ -110,6 +111,7 @@ Int_t THcDriftChamberPlane::ReadDatabase( const TDatime& date ) }; gHcParms->LoadParmValues((DBRequest*)&list2,prefix); + // Retrieve parameters we need from parent class THcDC* fParent; @@ -130,6 +132,25 @@ Int_t THcDriftChamberPlane::ReadDatabase( const TDatime& date ) fNSperChan = fParent->GetNSperChan(); + if (fUsingTzeroPerWire==1) { + fTzeroWire = new Double_t [fNWires]; + DBRequest list3[]={ + {Form("tzero%s",GetName()),fTzeroWire,kDouble,fNWires}, + {0} + }; + gHcParms->LoadParmValues((DBRequest*)&list3,prefix); + printf(" using tzero per wire plane = %s nwires = %d \n",GetName(),fNWires); + for (Int_t iw=0;iw < fNWires;iw++) { + printf("%d %f ",iw+1,fTzeroWire[iw]) ; + if ( iw!=0 && iw%8 == 0) printf("\n") ; + } + } else { + fTzeroWire = new Double_t [fNWires]; + for (Int_t iw=0;iw < fNWires;iw++) { + fTzeroWire[iw]=0.0; + } + } + // Calculate Geometry Constants // Do we want to move all this to the Chamber of DC Package leve // as that is where these things will be needed? @@ -322,7 +343,8 @@ Int_t THcDriftChamberPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // Increment late count } else { Double_t time = -StartTime // (comes from h_trans_scin - - rawtdc*fNSperChan + fPlaneTimeZero; // fNSperChan > 0 for 1877 + - 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 diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index ac753ac827bbc13feb19e436a7a28f784712d231..78b9b22e02de5868a287a2fa498ed3f5ebffc458 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -79,6 +79,7 @@ protected: Int_t fPlaneNum; Int_t fPlaneIndex; /* Index of this plane within it's chamber */ Int_t fChamberNum; + Int_t fUsingTzeroPerWire; Int_t fNRawhits; Int_t fNWires; Int_t fWireOrder; @@ -104,6 +105,8 @@ protected: Double_t fNSperChan; /* TDC bin size */ + Double_t* fTzeroWire; + virtual Int_t ReadDatabase( const TDatime& date ); virtual Int_t DefineVariables( EMode mode = kDefine );