diff --git a/src/THcHallCSpectrometer.cxx b/src/THcHallCSpectrometer.cxx index 073c516d6966a093bbf46166d667e1b0c23ed972..da832fe91ac5b76b3aff000cab4c342d9c84b83d 100644 --- a/src/THcHallCSpectrometer.cxx +++ b/src/THcHallCSpectrometer.cxx @@ -427,7 +427,7 @@ Int_t THcHallCSpectrometer::TrackCalc() Double_t fHitPos4, fHitPos3, fHitDist3, fHitDist4; //, fChi2Min; Int_t i, j, itrack, ip, ihit; //, fGoodTimeIndex = -1; Int_t fHitCnt4, fHitCnt3, fRawIndex, fGoodRawPad; - + fChi2Min = 10000000000.0; fGoodTrack = -1; fY2Dmin = 100.; fX2Dmin = 100.; fZap = 0.; @@ -448,7 +448,7 @@ Int_t THcHallCSpectrometer::TrackCalc() ( goodTrack->GetEnergy() < fSelEtMax ) ) { - for ( j = 0; j < 16; j++ ){ + for ( j = 0; j < fHodo->GetNPaddles(2); j++ ){ f2XHits[j] = -1; f2YHits[j] = -1; } @@ -473,9 +473,9 @@ Int_t THcHallCSpectrometer::TrackCalc() } // loop over planes fHitPos4 = goodTrack->GetY() + goodTrack->GetPhi() * ( fScin2YZpos + 0.5 * fScin2YdZpos ); - fHitCnt4 = TMath::Nint( ( fHodo->GetHodoCenter4() - fHitPos4 ) / fHodo->GetScin2YSpacing() ) + 1; - fHitCnt4 = TMath::Max( TMath::Min(fHitCnt4,TMath::Nint(10) ) , 1); // scin_2y_nr = 10 - fHitDist4 = fHitPos4 - ( fHodo->GetHodoCenter4() - fHodo->GetScin2YSpacing() * ( fHitCnt4 - 1 ) ); + fHitCnt4 = TMath::Nint( ( fHodo->GetPlaneCenter(3) - fHitPos4 ) / fHodo->GetPlaneSpacing(3) ) + 1; + fHitCnt4 = TMath::Max( TMath::Min(fHitCnt4,TMath::Nint( fHodo->GetNPaddles(3) ) ) , 1); // scin_2y_nr = 10 + fHitDist4 = fHitPos4 - ( fHodo->GetPlaneCenter(3) - fHodo->GetPlaneSpacing(3) * ( fHitCnt4 - 1 ) ); //---------------------------------------------------------------- @@ -483,7 +483,7 @@ Int_t THcHallCSpectrometer::TrackCalc() fZap = 0.; ft = 0; - for ( i = 0; i < 10; i++ ){ + for ( i = 0; i < fHodo->GetNPaddles(3); i++ ){ if ( f2YHits[i] == 0 ) { fY2D[itrack] = TMath::Abs(fHitCnt4-i-1); ft ++; @@ -503,16 +503,16 @@ Int_t THcHallCSpectrometer::TrackCalc() if ( fNtracks == 1 ) fY2D[itrack] = 0.; fHitPos3 = goodTrack->GetX() + goodTrack->GetTheta() * ( fScin2XZpos + 0.5 * fScin2XdZpos ); - fHitCnt3 = TMath::Nint( ( fHitPos3 - fHodo->GetHodoCenter3() ) / fHodo->GetScin2XSpacing() ) + 1; - fHitCnt3 = TMath::Max( TMath::Min(fHitCnt3,TMath::Nint(16) ) , 1); // scin_2x_nr = 16 - fHitDist3 = fHitPos3 - ( fHodo->GetScin2XSpacing() * ( fHitCnt3 - 1 ) + fHodo->GetHodoCenter3() ); + fHitCnt3 = TMath::Nint( ( fHitPos3 - fHodo->GetPlaneCenter(2) ) / fHodo->GetPlaneSpacing(2) ) + 1; + fHitCnt3 = TMath::Max( TMath::Min(fHitCnt3,TMath::Nint( fHodo->GetNPaddles(2) ) ) , 1); // scin_2x_nr = 16 + fHitDist3 = fHitPos3 - ( fHodo->GetPlaneSpacing(2) * ( fHitCnt3 - 1 ) + fHodo->GetPlaneCenter(2) ); //---------------------------------------------------------------- if ( fNtracks > 1 ){ // Plane 3 (2X) fZap = 0.; ft = 0; - for ( i = 0; i < 16; i++ ){ + for ( i = 0; i < fHodo->GetNPaddles(2); i++ ){ if ( f2XHits[i] == 0 ) { fX2D[itrack] = TMath::Abs(fHitCnt3-i-1); diff --git a/src/THcHodoscope.cxx b/src/THcHodoscope.cxx index e0e3933900c16fe7a6bd57007b60b4d7e80e6b41..2f3ceabe55d5bb78c5a548ca70a81a0807b09928 100644 --- a/src/THcHodoscope.cxx +++ b/src/THcHodoscope.cxx @@ -391,6 +391,8 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) fNPaddle = new Int_t [fNPlanes]; fFPTime = new Double_t [fNPlanes]; + fPlaneCenter = new Double_t[fNPlanes]; + fPlaneSpacing = new Double_t[fNPlanes]; // fSpacing = new Double_t [fNPlanes]; //fCenter = new Double_t* [fNPlanes]; @@ -444,15 +446,6 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) prefix[1]='\0'; DBRequest list[]={ - // {"scin_2x_zpos", &fScin2XZpos, kDouble, 0, 1}, - // {"scin_2x_dzpos", &fScin2XdZpos, kDouble, 0, 1}, - // {"scin_2y_zpos", &fScin2YZpos, kDouble, 0, 1}, - // {"scin_2y_dzpos", &fScin2YdZpos, kDouble, 0, 1}, - // {"sel_betamin", &fSelBetaMin, kDouble, 0, 1}, - // {"sel_dedx1min", &fSeldEdX1Min, kDouble, 0, 1}, - // {"sel_dedx1max", &fSeldEdX1Max, kDouble, 0, 1}, - // {"sel_using_scin", &fSelUsingScin, kInt, 0, 1}, - // {"sel_ndegreesmin", &fSelNDegreesMin, kDouble, 0, 1}, {"start_time_center", &fStartTimeCenter, kDouble}, {"start_time_slop", &fStartTimeSlop, kDouble}, {"scin_tdc_to_time", &fScinTdcToTime, kDouble}, @@ -479,19 +472,6 @@ Int_t THcHodoscope::ReadDatabase( const TDatime& date ) gHcParms->LoadParmValues((DBRequest*)&list,prefix); - cout << "\n\n\n\n\n\nPaddles1x = " << fNPaddle[0] - << "\nscin_2y_zpos = " << fScin2YZpos - << "\nscin_2y_dzpos = " << fScin2YdZpos - << endl; - // << "\ndedx max = " << fSeldEdX1Max - // << "\nbeta min = " << fSelBetaMin - // << "\nbeta max = " << fSelBetaMax - // << "\net min = " << fSelEtMin - // << "\net max = " << fSelEtMax - - // << endl; - - if (fTofUsingInvAdc) { DBRequest list2[]={ {"hodo_pos_invadc_offset",&fHodoPosInvAdcOffset[0],kDouble,fMaxHodoScin}, @@ -599,6 +579,8 @@ THcHodoscope::~THcHodoscope() delete [] fFPTime; delete [] fBeta; delete [] fBetaChisq; + delete [] fPlaneCenter; + delete [] fPlaneSpacing; if( fIsSetup ) RemoveVariables(); @@ -716,6 +698,8 @@ void THcHodoscope::Clear( Option_t* opt) for(Int_t ip=0;ip<fNPlanes;ip++) { fPlanes[ip]->Clear(opt); fFPTime[ip]=0.; + fPlaneCenter[ip]=0.; + fPlaneSpacing[ip]=0.; } } @@ -734,10 +718,7 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) if(gHaCuts->Result("Pedestal_event")) { Int_t nexthit = 0; for(Int_t ip=0;ip<fNPlanes;ip++) { - - // if ( !fPlanes[ip] ) // Ahmed - // return -1; // Ahmed - + nexthit = fPlanes[ip]->AccumulatePedestals(fRawHitList, nexthit); } fAnalyzePedestals = 1; // Analyze pedestals first normal events @@ -745,9 +726,6 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) } if(fAnalyzePedestals) { for(Int_t ip=0;ip<fNPlanes;ip++) { - - // if ( !fPlanes[ip] ) // Ahmed - // return -1; // Ahmed fPlanes[ip]->CalculatePedestals(); } @@ -761,17 +739,8 @@ Int_t THcHodoscope::Decode( const THaEvData& evdata ) fNfptimes=0; for(Int_t ip=0;ip<fNPlanes;ip++) { - if ( ip == 2 ){ - fHodoCenter3 = fPlanes[ip]->GetPosCenter(0) + fPlanes[ip]->GetPosOffset(); - fScin2XSpacing = fPlanes[ip]->GetSpacing(); - } - if ( ip == 3 ){ - fHodoCenter4 = fPlanes[ip]->GetPosCenter(0) + fPlanes[ip]->GetPosOffset(); - fScin2YSpacing = fPlanes[ip]->GetSpacing(); - } - - // if ( !fPlanes[ip] ) // Ahmed - // return -1; // Ahmed + fPlaneCenter[ip] = fPlanes[ip]->GetPosCenter(0) + fPlanes[ip]->GetPosOffset(); + fPlaneSpacing[ip] = fPlanes[ip]->GetSpacing(); // nexthit = fPlanes[ip]->ProcessHits(fRawHitList, nexthit); // GN: select only events that have reasonable TDC values to start with @@ -915,14 +884,6 @@ Int_t THcHodoscope::FineProcess( TClonesArray& tracks ) for ( ip = 0; ip < fNPlanes; ip++ ){ fNPlaneTime[ip] = 0; fSumPlaneTime[ip] = 0.; - // if ( ip == 2 ){ - // fHodoCenter3 = fPlanes[ip]->GetPosCenter(0) + fPlanes[ip]->GetPosOffset(); - // fScin2XSpacing = fPlanes[ip]->GetSpacing(); - // } - // if ( ip == 3 ){ - // fHodoCenter4 = fPlanes[ip]->GetPosCenter(0) + fPlanes[ip]->GetPosOffset(); - // fScin2YSpacing = fPlanes[ip]->GetSpacing(); - // } } // Loop over scintillator planes. // In ENGINE, its loop over good scintillator hits. diff --git a/src/THcHodoscope.h b/src/THcHodoscope.h index 5ed3f59230ebe7e595a696c17325044cac36910d..a8cf7886c037fd9c6762c4747c9e0b1f52ef2445 100644 --- a/src/THcHodoscope.h +++ b/src/THcHodoscope.h @@ -71,10 +71,10 @@ public: Int_t GetGoodRawPad(Int_t iii){return fGoodRawPad[iii];} Double_t GetNScinHits(Int_t iii){return fNScinHits[iii];} - Double_t GetHodoCenter3() { return fHodoCenter3;} - Double_t GetHodoCenter4() { return fHodoCenter4;} - Double_t GetScin2XSpacing() { return fScin2XSpacing;} - Double_t GetScin2YSpacing() { return fScin2YSpacing;} + + Int_t GetNPaddles(Int_t iii) { return fNPaddle[iii];} + Double_t GetPlaneCenter(Int_t iii) { return fPlaneCenter[iii];} + Double_t GetPlaneSpacing(Int_t iii) { return fPlaneSpacing[iii];} // Double_t GetBeta() const {return fBeta[];} @@ -165,8 +165,8 @@ protected: Double_t fScin2YdZpos; Double_t fChi2Min; - Double_t fHodoCenter4, fHodoCenter3; - Double_t fScin2YSpacing, fScin2XSpacing; + Double_t* fPlaneCenter; + Double_t* fPlaneSpacing; Double_t** fdEdX; // [MAXHODHITS] Array Double_t** fScinHit; // [fNPlanes] Array