diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index 585fc0c509f2aaed0cb4458a293145842a1325d6..a9ee3ff0d99b11c11546f0338eda30ccda898a93 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -121,7 +121,7 @@ void THcHodoscope::Setup(const char* name, const char* description) strcpy(desc, description); strcat(desc, " Plane "); strcat(desc, fPlaneNames[i]); - fPlanes[i] = new THcScintillatorPlane(fPlaneNames[i], desc, i+1,fNPlanes,this); // Number planes starting from zero!! + fPlanes[i] = new THcScintillatorPlane(fPlaneNames[i], desc, i+1, this); // Number planes starting from zero!! cout << "Created Scintillator Plane " << fPlaneNames[i] << ", " << desc << endl; } @@ -378,6 +378,7 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) cout << " readdatabse hodo fnplanes = " << fNPlanes << endl; fNPaddle = new UInt_t [fNPlanes]; + fFPTime = new Double_t [fNPlanes]; fPlaneCenter = new Double_t[fNPlanes]; fPlaneSpacing = new Double_t[fNPlanes]; @@ -428,6 +429,7 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) fxHiScin = new Int_t [fNHodoscopes]; fyLoScin = new Int_t [fNHodoscopes]; fyHiScin = new Int_t [fNHodoscopes]; + fHodoSlop = new Double_t [fNPlanes]; DBRequest list[]={ {"start_time_center", &fStartTimeCenter, kDouble}, @@ -456,6 +458,7 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) {"track_eff_test_num_scin_planes", &fTrackEffTestNScinPlanes, kInt}, {"cer_npe", &fNCerNPE, kDouble, 0, 1}, {"normalized_energy_tot", &fNormETot, kDouble, 0, 1}, + {"hodo_slop", fHodoSlop, kDouble, fNPlanes}, {0} }; @@ -588,6 +591,7 @@ void THcHodoscope::DeleteArrays() delete [] fxLoScin; fxLoScin = NULL; delete [] fxHiScin; fxHiScin = NULL; + delete [] fHodoSlop; fHodoSlop = NULL; delete [] fNPaddle; fNPaddle = NULL; delete [] fHodoVelLight; fHodoVelLight = NULL; diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 012272cda8b498dd3f5cda21b3a6ee66a279e74c..2c2f0ee30a8623f8453a509bf586c15ad4eeb857 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -74,6 +74,7 @@ public: Double_t GetNScinHits(Int_t iii){return fNScinHits[iii];} UInt_t GetNPaddles(Int_t iii) { return fNPaddle[iii];} + Double_t GetHodoSlop(Int_t iii) { return fHodoSlop[iii];} Double_t GetPlaneCenter(Int_t iii) { return fPlaneCenter[iii];} Double_t GetPlaneSpacing(Int_t iii) { return fPlaneSpacing[iii];} @@ -165,6 +166,7 @@ protected: Double_t fNormETot; Double_t fNCerNPE; + Double_t* fHodoSlop; Int_t fTestSum; Int_t fTrackEffTestNScinPlanes; Int_t fGoodScinHits; diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index f1037a6e23cc0cf7675f939a4d12e4131575010c..e9355f94f3e51ab1d5c1bed7387e9395ac3538b6 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -50,34 +50,7 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, fScinTime = new Double_t [fMaxHits]; fScinSigma = new Double_t [fMaxHits]; fScinZpos = new Double_t [fMaxHits]; -} -//______________________________________________________________________________ -THcScintillatorPlane::THcScintillatorPlane( const char* name, - const char* description, - const Int_t planenum, - const Int_t totplanes, - THaDetectorBase* parent ) - : THaSubDetector(name,description,parent) -{ - // Normal constructor with name and description - fPosTDCHits = new TClonesArray("THcSignalHit",16); - fNegTDCHits = new TClonesArray("THcSignalHit",16); - fPosADCHits = new TClonesArray("THcSignalHit",16); - fNegADCHits = new TClonesArray("THcSignalHit",16); - frPosTDCHits = new TClonesArray("THcSignalHit",16); - frNegTDCHits = new TClonesArray("THcSignalHit",16); - frPosADCHits = new TClonesArray("THcSignalHit",16); - frNegADCHits = new TClonesArray("THcSignalHit",16); - fPlaneNum = planenum; - fTotPlanes = totplanes; - fNScinHits = 0; - // - fMaxHits=53; - - fpTimes = new Double_t [fMaxHits]; - fScinTime = new Double_t [fMaxHits]; - fScinSigma = new Double_t [fMaxHits]; - fScinZpos = new Double_t [fMaxHits]; + fPosCenter = NULL; } //______________________________________________________________________________ @@ -96,6 +69,7 @@ THcScintillatorPlane::~THcScintillatorPlane() delete fScinTime; delete fScinSigma; delete fScinZpos; + delete fPosCenter; } @@ -158,35 +132,37 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) strcpy(tmpright,"top"); } - Double_t tmpdouble[fTotPlanes]; - DBRequest list[]={ - {Form("scin_%s_zpos",GetName()), &fZpos, kDouble}, - {Form("scin_%s_dzpos",GetName()), &fDzpos, kDouble}, - {Form("scin_%s_size",GetName()), &fSize, kDouble}, - {Form("scin_%s_spacing",GetName()), &fSpacing, kDouble}, - {Form("scin_%s_%s",GetName(),tmpleft), &fPosLeft,kDouble}, - {Form("scin_%s_%s",GetName(),tmpright), &fPosRight,kDouble}, - {Form("scin_%s_offset",GetName()), &fPosOffset, kDouble}, - {Form("scin_%s_center",GetName()), &fPosCenter[0],kDouble,fNelem}, - // this is from Xhodo.param... - {"hodo_slop",&tmpdouble[0],kDouble,fTotPlanes}, - {0} - }; - gHcParms->LoadParmValues((DBRequest*)&list,prefix); - // fetch the parameter from the temporary list - fHodoSlop=tmpdouble[fPlaneNum-1]; - cout <<" plane num = "<<fPlaneNum<<endl; - cout <<" nelem = "<<fNelem<<endl; - cout <<" zpos = "<<fZpos<<endl; - cout <<" dzpos = "<<fDzpos<<endl; - cout <<" spacing = "<<fSpacing<<endl; - cout <<" size = "<<fSize<<endl; - cout <<" hodoslop = "<<fHodoSlop<<endl; - cout <<"PosLeft = "<<fPosLeft<<endl; - cout <<"PosRight = "<<fPosRight<<endl; - cout <<"PosOffset = "<<fPosOffset<<endl; - cout <<"PosCenter[0] = "<<fPosCenter[0]<<endl; + delete [] fPosCenter; fPosCenter = new Double_t[fNelem]; + + DBRequest list[]={ + {Form("scin_%s_zpos",GetName()), &fZpos, kDouble}, + {Form("scin_%s_dzpos",GetName()), &fDzpos, kDouble}, + {Form("scin_%s_size",GetName()), &fSize, kDouble}, + {Form("scin_%s_spacing",GetName()), &fSpacing, kDouble}, + {Form("scin_%s_%s",GetName(),tmpleft), &fPosLeft,kDouble}, + {Form("scin_%s_%s",GetName(),tmpright), &fPosRight,kDouble}, + {Form("scin_%s_offset",GetName()), &fPosOffset, kDouble}, + {Form("scin_%s_center",GetName()), fPosCenter,kDouble,fNelem}, + {0} + }; + gHcParms->LoadParmValues((DBRequest*)&list,prefix); + // fetch the parameter from the temporary list + // Retrieve parameters we need from parent class + fHodoSlop= ((THcHodoscope*) GetParent())->GetHodoSlop(fPlaneNum-1); + + cout <<" plane num = "<<fPlaneNum<<endl; + cout <<" nelem = "<<fNelem<<endl; + cout <<" zpos = "<<fZpos<<endl; + cout <<" dzpos = "<<fDzpos<<endl; + cout <<" spacing = "<<fSpacing<<endl; + cout <<" size = "<<fSize<<endl; + cout <<" hodoslop = "<<fHodoSlop<<endl; + cout <<"PosLeft = "<<fPosLeft<<endl; + cout <<"PosRight = "<<fPosRight<<endl; + cout <<"PosOffset = "<<fPosOffset<<endl; + cout <<"PosCenter[0] = "<<fPosCenter[0]<<endl; + // Think we will make special methods to pass most // How generic do we want to make this class? // The way we get parameter data is going to be pretty specific to diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index a81f8d54a402e81a78e7e4be50ea72915bae55a6..106794e04fc9b3f36db612657e0ccd4a3f246e9a 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -23,8 +23,6 @@ class THcScintillatorPlane : public THaSubDetector { public: THcScintillatorPlane( const char* name, const char* description, Int_t planenum, THaDetectorBase* parent = NULL); - THcScintillatorPlane( const char* name, const char* description, - Int_t planenum, Int_t totplanes, THaDetectorBase* parent = NULL); virtual ~THcScintillatorPlane(); virtual void Clear( Option_t* opt="" ); @@ -93,7 +91,7 @@ class THcScintillatorPlane : public THaSubDetector { Double_t fPosLeft; /* NOTE: "left" = "top" for a Y scintillator */ Double_t fPosRight; /* NOTE: "right" = "bottom" for a Y scintillator */ Double_t fPosOffset; - Double_t fPosCenter[16]; /* array with centers for all scintillators in the plane */ + Double_t *fPosCenter; /* array with centers for all scintillators in the plane */ Double_t fTolerance; /* need this for PulseHeightCorrection */