diff --git a/src/THcCoinTime.cxx b/src/THcCoinTime.cxx index 6f35ec2e3e39c635aa2835f599e485688b1cae27..6d4958ed37b7b8c924093ee11008209ef11e8ec9 100644 --- a/src/THcCoinTime.cxx +++ b/src/THcCoinTime.cxx @@ -236,10 +236,10 @@ Int_t THcCoinTime::Process( const THaEvData& evdata ) Double_t HMS_FPtime = theHMSTrack->GetFPTime(); //Get raw TDC Times for HMS/SHMS (3/4 trigger) - pTRIG1_rawTdcTime_ROC1 = fCoinDet->Get_pTRG1_ROC1_rawTdctime(); //TDC Channels (0.1 ns/Ch) - pTRIG4_rawTdcTime_ROC1 = fCoinDet->Get_pTRG4_ROC1_rawTdctime(); - pTRIG1_rawTdcTime_ROC2 = fCoinDet->Get_pTRG1_ROC2_rawTdctime(); - pTRIG4_rawTdcTime_ROC2 = fCoinDet->Get_pTRG4_ROC2_rawTdctime(); + pTRIG1_TdcTime_ROC1 = fCoinDet->Get_CT_Trigtime(0); //SHMS + pTRIG4_TdcTime_ROC1 = fCoinDet->Get_CT_Trigtime(1); //HMS + pTRIG1_TdcTime_ROC2 = fCoinDet->Get_CT_Trigtime(2);//SHMS + pTRIG4_TdcTime_ROC2 = fCoinDet->Get_CT_Trigtime(3);//HMS DeltaSHMSpathLength = -0.11*atan2(shms_xptar,1)*1000 - 0.057*shms_dP; DeltaHMSpathLength = 12.462*hms_xpfp + 0.1138*hms_xpfp*hms_xfp - 0.0154*hms_xfp - 72.292*hms_xpfp*hms_xpfp - 0.0000544*hms_xfp*had_xfp - 116.52*hms_ypfp*hms_ypfp; @@ -273,8 +273,8 @@ Int_t THcCoinTime::Process( const THaEvData& evdata ) had_coinCorr_Positron = (HadPathLength) / (lightSpeed * hadArm_BetaCalc_Positron ); //Raw, Uncorrected Coincidence Time - fROC1_RAW_CoinTime = (pTRIG1_rawTdcTime_ROC1*0.1 + SHMS_FPtime) - (pTRIG4_rawTdcTime_ROC1*0.1 + HMS_FPtime); - fROC2_RAW_CoinTime = (pTRIG1_rawTdcTime_ROC2*0.1 + SHMS_FPtime) - (pTRIG4_rawTdcTime_ROC2*0.1 + HMS_FPtime); + fROC1_RAW_CoinTime = (pTRIG1_TdcTime_ROC1 + SHMS_FPtime) - (pTRIG4_TdcTime_ROC1 + HMS_FPtime); + fROC2_RAW_CoinTime = (pTRIG1_TdcTime_ROC2 + SHMS_FPtime) - (pTRIG4_TdcTime_ROC2 + HMS_FPtime); //Corrected Coincidence Time for ROC1/ROC2 (ROC1 Should be identical to ROC2) diff --git a/src/THcCoinTime.h b/src/THcCoinTime.h index ed1cb187f82578da609485d8504f4bf77c9836f4..91d3ba27ffa462e71d28f32985665b9fa40486a8 100644 --- a/src/THcCoinTime.h +++ b/src/THcCoinTime.h @@ -125,11 +125,11 @@ public: Double_t had_ypfp; //hadron yp focal plane Double_t had_FPtime; //hadron focal plane time - //Raw trigger times pTrig1 (SHMS 3/4 trig) and pTrig4 (HMS 3/4 trig) - Int_t pTRIG1_rawTdcTime_ROC1; - Int_t pTRIG4_rawTdcTime_ROC1; - Int_t pTRIG1_rawTdcTime_ROC2; - Int_t pTRIG4_rawTdcTime_ROC2; + // trigger times pTrig1 (SHMS 3/4 trig) and pTrig4 (HMS 3/4 trig) + Int_t pTRIG1_TdcTime_ROC1; + Int_t pTRIG4_TdcTime_ROC1; + Int_t pTRIG1_TdcTime_ROC2; + Int_t pTRIG4_TdcTime_ROC2; //-------------------------------------------------------------------- diff --git a/src/THcTrigDet.cxx b/src/THcTrigDet.cxx index 0d690f56dddf66926a09051d00b1be289443f2a6..d60aa010c7a5eb9dd222b29b9097bbf5173296cc 100644 --- a/src/THcTrigDet.cxx +++ b/src/THcTrigDet.cxx @@ -221,16 +221,6 @@ void THcTrigDet::Clear(Option_t* opt) { }; } -//Added function to SET coincidence trigger times -void THcTrigDet::SetCoinTrigTimes() -{ - pTrig1_ROC1 = fTdcTimeRaw[fidx0]; - pTrig4_ROC1 = fTdcTimeRaw[fidx1]; - pTrig1_ROC2 = fTdcTimeRaw[fidx2]; - pTrig4_ROC2 = fTdcTimeRaw[fidx3]; - -} - Int_t THcTrigDet::Decode(const THaEvData& evData) { @@ -300,9 +290,6 @@ Int_t THcTrigDet::Decode(const THaEvData& evData) { ++iHit; } - //Set raw Tdc coin. trigger times for pTRIG1/4 - SetCoinTrigTimes(); - return 0; } @@ -319,11 +306,13 @@ void THcTrigDet::Setup(const char* name, const char* description) { Int_t THcTrigDet::ReadDatabase(const TDatime& date) { std::string adcNames, tdcNames; + std::string trigNames="pTRIG1_ROC1 pTRIG4_ROC1 pTRIG1_ROC2 pTRIG4_ROC2"; DBRequest list[] = { {"_numAdc", &fNumAdc, kInt}, // Number of ADC channels. {"_numTdc", &fNumTdc, kInt}, // Number of TDC channels. {"_adcNames", &adcNames, kString}, // Names of ADC channels. {"_tdcNames", &tdcNames, kString}, // Names of TDC channels. + {"_trigNames", &trigNames, kString,0,1}, // Names of Triggers for coincidence time. {"_tdcoffset", &fTdcOffset, kDouble,0,1}, // Offset of tdc channels {"_adc_tdc_offset", &fAdcTdcOffset, kDouble,0,1}, // Offset of Adc Pulse time (ns) {"_tdcchanperns", &fTdcChanperNS, kDouble,0,1}, // Convert channesl to ns @@ -331,7 +320,7 @@ Int_t THcTrigDet::ReadDatabase(const TDatime& date) { {"_trig_adcrefcut", &fADC_RefTimeCut, kInt, 0, 1}, {0} }; - fTdcChanperNS=0.1; + fTdcChanperNS=0.09766; fTdcOffset=300.; fAdcTdcOffset=200.; fTDC_RefTimeCut=-1000.; @@ -363,36 +352,24 @@ Int_t THcTrigDet::ReadDatabase(const TDatime& date) { // Split the names to std::vector<std::string>. fAdcNames = vsplit(adcNames); fTdcNames = vsplit(tdcNames); + fTrigNames = vsplit(trigNames); //default index values - fidx0 = 27; - fidx1 = 30; - fidx2 = 58; - fidx3 = 61; - + //Assign an index to coincidence trigger times strings - for (int i = 0; i <fNumTdc; i++) - { - - if(fTdcNames.at(i)=="pTRIG1_ROC1") - { - fidx0 = i; - } - else if(fTdcNames.at(i)=="pTRIG4_ROC1") - { - fidx1 = i; - } - else if(fTdcNames.at(i)=="pTRIG1_ROC2") - { - fidx2 = i; - } - else if(fTdcNames.at(i)=="pTRIG4_ROC2") - { - fidx3 = i; - } - - } - + for (UInt_t j = 0; j <fTrigNames.size(); j++) { + fTrigId[j]=-1; + } + for (int i = 0; i <fNumTdc; i++) { + for (UInt_t j = 0; j <fTrigNames.size(); j++) { + if(fTdcNames.at(i)==fTrigNames[j]) fTrigId[j]=i; + } + } + + cout << " Trgi = " << fTrigNames.size() << endl; + for (UInt_t j = 0; j <fTrigNames.size(); j++) { + cout << fTrigNames[j] << " " << fTrigId[j] << endl; + } return kOK; diff --git a/src/THcTrigDet.h b/src/THcTrigDet.h index fd8cd5364eed6e9d3d9af336b85d6eb044ddc254..20b4838cd537a28a25d256182533020490f31904 100644 --- a/src/THcTrigDet.h +++ b/src/THcTrigDet.h @@ -32,37 +32,21 @@ class THcTrigDet : public THaDetector, public THcHitList { virtual Bool_t IsIgnoreType(Int_t evtype) const; virtual Bool_t HaveIgnoreList() const; Int_t End(THaRunBase* run); - - //Funtions to get raw TdcTimes - Int_t Get_pTRG1_ROC1_rawTdctime() {return pTrig1_ROC1;} - Int_t Get_pTRG4_ROC1_rawTdctime() {return pTrig4_ROC1;} - Int_t Get_pTRG1_ROC2_rawTdctime() {return pTrig1_ROC2;} - Int_t Get_pTRG4_ROC2_rawTdctime() {return pTrig4_ROC2;} + //Funtions to get TDCtime for cointime module + Double_t Get_CT_Trigtime(Int_t ii) { return (fTrigId[ii]==-1 ? 0. : fTdcTime[fTrigId[ii]]) ;} protected: void Setup(const char* name, const char* description); virtual Int_t ReadDatabase(const TDatime& date); virtual Int_t DefineVariables(EMode mode=kDefine); - //Added for coin. time calculation - void SetCoinTrigTimes(); - - //indices to store pTrig string locations - Int_t fidx0; - Int_t fidx1; - Int_t fidx2; - Int_t fidx3; - - Int_t pTrig1_ROC1; - Int_t pTrig4_ROC1; - Int_t pTrig1_ROC2; - Int_t pTrig4_ROC2; std::string fKwPrefix; Int_t fNumAdc; Int_t fNumTdc; + Int_t fTrigId[4]; Double_t fAdcTdcOffset; Double_t fTdcOffset; @@ -70,6 +54,7 @@ class THcTrigDet : public THaDetector, public THcHitList { std::vector<std::string> fAdcNames; std::vector<std::string> fTdcNames; + std::vector<std::string> fTrigNames; static const int fMaxAdcChannels = 200; static const int fMaxTdcChannels = 200;