diff --git a/NPLib/Detectors/PISTA/TICPhysics.cxx b/NPLib/Detectors/PISTA/TICPhysics.cxx index 45a2a22eccf667d5a76117b816c51f51a7518e03..e7cfae25b44f46a923fd9e5b7f19cce3b7cdea83 100644 --- a/NPLib/Detectors/PISTA/TICPhysics.cxx +++ b/NPLib/Detectors/PISTA/TICPhysics.cxx @@ -100,20 +100,23 @@ void TICPhysics::BuildPhysicalEvent() { if(i < 4){ fIC_PID[i] = 0.5* m_PreTreatedData->GetIC_Charge(i); } - else if(i >= 6){ - fIC_PID[i] = 2* m_PreTreatedData->GetIC_Charge(i); + else if(i >= 6 && m_Data_Year==2024){ + fIC_PID[i] = 2*m_PreTreatedData->GetIC_Charge(i); } - else { + else if((i==4 || i==5) && m_Data_Year==2024){ fIC_PID[i] = m_PreTreatedData->GetIC_Charge(i); } - + else if(i >= 4 && m_Data_Year==2023){ + fIC_PID[i] = m_PreTreatedData->GetIC_Charge(i); + } + fIC_Init[i] = GainInit * m_PreTreatedData->GetIC_Charge(i); fIC_TS.push_back(m_PreTreatedData->GetIC_TS(i)); } if(m_Y_SPLINE_CORRECTION && m_XY0_SPLINE_CORRECTION){ - ApplyXYCorrections(); - } + ApplyXYCorrections(); + } if (fIC_Init[1]>0 && fIC_Init[5]>0) { EtotInit = 0 ; @@ -136,24 +139,25 @@ void TICPhysics::BuildPhysicalEvent() { EtotInit = -100 ; } - DE = (fIC_PID[0] + fIC_PID[1] + fIC_PID[2] + fIC_PID[3]) + fIC_PID[4]; - Eres = fIC_PID[5] + (fIC_PID[6] + fIC_PID[7] + fIC_PID[8] + fIC_PID[9]); - - if (m_DE_SPLINE_CORRECTION && m_Y_SPLINE_CORRECTION){ - if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8 ){ //only mult 1 event - UShort_t FPMW_Section = m_FPMW_Section; - double TempY; - - //Data year sensitive loading - if (m_Data_Year == 2024){ - TempY = 10* (fIC_TS.at(0) - m_TimeData->GetTS_MWPC13(0)) - ((m_TimeData->GetTime_MWPC13(0)+m_TimeData->GetToff_DT13(FPMW_Section))) ; - } - else if (m_Data_Year == 2023){ - TempY = m_Y ; - } - DE = DE * m_DEspline.at(0)->Eval(0) / m_DEspline.at(0)->Eval(TempY) ; - } // end if mult 1 - } // end DE correction + DE = fIC_PID[0] + fIC_PID[1] + fIC_PID[2] + fIC_PID[3] + fIC_PID[4]; + //DE = 0.5*(fIC_raw[0] + fIC_raw[1] + fIC_raw[2] + fIC_raw[3]) + fIC_raw[4]; + Eres = fIC_PID[5] + fIC_PID[6] + fIC_PID[7] + fIC_PID[8] + fIC_PID[9]; + + if (m_DE_SPLINE_CORRECTION && m_Y_SPLINE_CORRECTION){ + if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8 ){ //only mult 1 event + UShort_t FPMW_Section = m_FPMW_Section; + double TempY; + + //Data year sensitive loading + if (m_Data_Year == 2024){ + TempY = 10* (fIC_TS.at(0) - m_TimeData->GetTS_MWPC13(0)) - ((m_TimeData->GetTime_MWPC13(0)+m_TimeData->GetToff_DT13(FPMW_Section))) ; + } + else if (m_Data_Year == 2023){ + TempY = m_Y ; + } + DE = DE * m_DEspline.at(0)->Eval(0) / m_DEspline.at(0)->Eval(TempY) ; + } // end if mult 1 + } // end DE correction if(fIC[1]>0 && fIC[5]>0){ double scalor = Cal->GetValue("IC/ETOT_SCALING_SEC"+NPL::itoa(m_FPMW_Section),0); @@ -276,15 +280,14 @@ void TICPhysics::ReadAnalysisConfig() { TString PathTemp = m_XY0_PROFILE_PATH; TFile* ifile = new TFile(PathTemp,"read"); if(ifile->IsOpen() && !ifile->IsZombie()){ - m_XY0_SPLINE_CORRECTION = true; - m_IC0_Profile.LoadProfile(PathTemp,"ICOneZeroProfile"); + m_XY0_SPLINE_CORRECTION = true; + m_IC0_Profile.LoadProfile(PathTemp,"ICOneZeroProfile"); } else { - m_XY0_SPLINE_CORRECTION = false ; + m_XY0_SPLINE_CORRECTION = false ; } ifile->Close(); } - else if (whatToDo=="LOAD_DE_SPLINE") { AnalysisConfigFile >> DataBuffer; m_DE_SPLINE_PATH = DataBuffer; @@ -317,9 +320,9 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa NSpline = 0 ; while ((key=(TKey*)next())){ - if (std::string(key->GetClassName()) == "TSpline3"){ - NSpline ++; - } + if (std::string(key->GetClassName()) == "TSpline3"){ + NSpline ++; + } } cout << "This file contains " << NSpline << " splines " << endl; // Load Spline @@ -329,13 +332,13 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa cout << iSpline.at(i)->GetName() << " is loaded!" << endl; } - ifile->Close(); - return true; + ifile->Close(); + return true; } else{ - cout << "File " << filename << " not found!" << endl; - ifile->Close(); - return false; + cout << "File " << filename << " not found!" << endl; + ifile->Close(); + return false; } } @@ -379,63 +382,63 @@ double TICPhysics::ApplyZSpline(){ } /////////////////////////////////////////////////////////////////////////// void TICPhysics::ApplyXYCorrections(){ - vector<double> ICcorr_Y(11), ICcorr_X(11); - double FF_DriftTime ; - if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8){ //only mult 1 event - UShort_t FPMW_Section = m_FPMW_Section; - - // ***************************Different def of correction depending on year********************************** - if (m_Data_Year == 2024){ - FF_DriftTime = 10* (fIC_TS.at(0) - m_TimeData->GetTS_MWPC13(0)) - ((m_TimeData->GetTime_MWPC13(0)+m_TimeData->GetToff_DT13(FPMW_Section))) ; - } - else if (m_Data_Year == 2023){ - FF_DriftTime = m_Y; - } - else { - return ; - } + vector<double> ICcorr_Y(11), ICcorr_X(11); + double FF_DriftTime ; + if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8){ //only mult 1 event + UShort_t FPMW_Section = m_FPMW_Section; + + // ***************************Different def of correction depending on year********************************** + if (m_Data_Year == 2024){ + FF_DriftTime = 10* (fIC_TS.at(0) - m_TimeData->GetTS_MWPC13(0)) - ((m_TimeData->GetTime_MWPC13(0)+m_TimeData->GetToff_DT13(FPMW_Section))) ; + } + else if (m_Data_Year == 2023){ + FF_DriftTime = m_Y; + } + else { + return ; + } - //************************** Correction of section 1 to 4 *************************************************** - for (int seg = 2; seg < fIC_TS.size() ; seg++) { // loop on multiplicity of event + //************************** Correction of section 1 to 4 *************************************************** + for (int seg = 2; seg < fIC_TS.size() ; seg++) { // loop on multiplicity of event - if (m_Yspline.at(seg-2)==0){ - ICcorr_Y.at(seg) = fIC_PID[seg]; - } + if (m_Yspline.at(seg-2)==0){ + ICcorr_Y.at(seg) = fIC_PID[seg]; + } - else { - ICcorr_Y.at(seg) = fIC_PID[seg] * m_Yspline.at(seg-2)->Eval(0)/ m_Yspline.at(seg-2)->Eval(FF_DriftTime); - if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0; - } //end if non empty - if (seg == 0) break; - }//endloop seg + else { + ICcorr_Y.at(seg) = fIC_PID[seg] * m_Yspline.at(seg-2)->Eval(0)/ m_Yspline.at(seg-2)->Eval(FF_DriftTime); + if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0; + } //end if non empty + if (seg == 0) break; + }//endloop seg - //************************** Correction of section 0 *************************************************** + //************************** Correction of section 0 *************************************************** - Double_t PolX = 1.37622; + Double_t PolX = 1.37622; - Double_t ICRatio = fIC_PID[1]/fIC_PID[0]; - Double_t ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); - Double_t ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); + Double_t ICRatio = fIC_PID[1]/fIC_PID[0]; + Double_t ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); + Double_t ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); - if ( ICRatioCorr<1.4 || ICRatioCorr >1.5){ - ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); - ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); - if (ICRatioCorr >100) { - ICcorr_Y0 = fIC_PID[0]; - } - } - - - //************************** Overwrite ICRAW *************************************************** - //Overwrite ic_raw - for (int i = 1 ; i<fIC_TS.size() ;i++){ - if (ICcorr_Y.at(i) != 0 ){ - fIC_PID[i] = ICcorr_Y.at(i); - } - } - fIC_PID[0] = ICcorr_Y0; + if ( ICRatioCorr<1.4 || ICRatioCorr >1.5){ + ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); + ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); + if (ICRatioCorr >100) { + ICcorr_Y0 = fIC_PID[0]; + } } + + + //************************** Overwrite ICRAW *************************************************** + //Overwrite ic_raw + for (int i = 1 ; i<fIC_TS.size() ;i++){ + if (ICcorr_Y.at(i) != 0 ){ + fIC_PID[i] = ICcorr_Y.at(i); + } + } + fIC_PID[0] = ICcorr_Y0; + } } ///////////////////////////////////////////////////////////////////////////