From a4186aebb55bf90b3f80d54f5fbc1e3b22016284 Mon Sep 17 00:00:00 2001 From: hallc-online <hallc-online@jlab.org> Date: Mon, 17 Apr 2017 13:49:03 -0400 Subject: [PATCH] Modified THcDriftChamberPlane.cxx and THcDriftChamberPlane.h Main purpose was to have option for per wire tzero offsets Modified THcDriftChamberPlane.h ------------------------------ 1) added fUsingTzeroPerWire as parameter flag to switch on per wire tzero offsets when parameter equals 1 2) fTzeroWire is array of tzero offsets for each wire in plane Modified THcDriftChamberPlane.cxx ------------------------------ 1) THcDriftChamberPlane::ReadDatabase a)set a default value of fUsingTzeroPerWire=0 b)added to DBRequest list option to read in fUsingTzeroPerWire c) if fUsingTzeroPerWire=1 then separate DBRequest to read in fTzeroWire d) if fUsingTzeroPerWire=0 then all fTzeroWire=0 2) THcDriftChamberPlane::ProcessHits ------------------------------------ a) Modify calcualation of drift time to subtract fTzeroWire Double_t time = -StartTime- rawtdc*fNSperChan + fPlaneTimeZero - fTzeroWire[wireNum-1]; --- src/THcDriftChamberPlane.cxx | 26 ++++++++++++++++++++++++-- src/THcDriftChamberPlane.h | 3 +++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index c111664..a25ea12 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 ac753ac..78b9b22 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 ); -- GitLab