Skip to content
Snippets Groups Projects
Commit bf86d9b8 authored by Pierre Morfouace's avatar Pierre Morfouace
Browse files

updating TICPhysics.cxx

parent eef51f28
No related branches found
No related tags found
No related merge requests found
...@@ -100,20 +100,23 @@ void TICPhysics::BuildPhysicalEvent() { ...@@ -100,20 +100,23 @@ void TICPhysics::BuildPhysicalEvent() {
if(i < 4){ if(i < 4){
fIC_PID[i] = 0.5* m_PreTreatedData->GetIC_Charge(i); fIC_PID[i] = 0.5* m_PreTreatedData->GetIC_Charge(i);
} }
else if(i >= 6){ else if(i >= 6 && m_Data_Year==2024){
fIC_PID[i] = 2* m_PreTreatedData->GetIC_Charge(i); 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); 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_Init[i] = GainInit * m_PreTreatedData->GetIC_Charge(i);
fIC_TS.push_back(m_PreTreatedData->GetIC_TS(i)); fIC_TS.push_back(m_PreTreatedData->GetIC_TS(i));
} }
if(m_Y_SPLINE_CORRECTION && m_XY0_SPLINE_CORRECTION){ if(m_Y_SPLINE_CORRECTION && m_XY0_SPLINE_CORRECTION){
ApplyXYCorrections(); ApplyXYCorrections();
} }
if (fIC_Init[1]>0 && fIC_Init[5]>0) { if (fIC_Init[1]>0 && fIC_Init[5]>0) {
EtotInit = 0 ; EtotInit = 0 ;
...@@ -136,24 +139,25 @@ void TICPhysics::BuildPhysicalEvent() { ...@@ -136,24 +139,25 @@ void TICPhysics::BuildPhysicalEvent() {
EtotInit = -100 ; EtotInit = -100 ;
} }
DE = (fIC_PID[0] + fIC_PID[1] + fIC_PID[2] + fIC_PID[3]) + fIC_PID[4]; 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]); //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 if (m_DE_SPLINE_CORRECTION && m_Y_SPLINE_CORRECTION){
UShort_t FPMW_Section = m_FPMW_Section; if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8 ){ //only mult 1 event
double TempY; UShort_t FPMW_Section = m_FPMW_Section;
double TempY;
//Data year sensitive loading
if (m_Data_Year == 2024){ //Data year sensitive loading
TempY = 10* (fIC_TS.at(0) - m_TimeData->GetTS_MWPC13(0)) - ((m_TimeData->GetTime_MWPC13(0)+m_TimeData->GetToff_DT13(FPMW_Section))) ; 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 ; 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 DE = DE * m_DEspline.at(0)->Eval(0) / m_DEspline.at(0)->Eval(TempY) ;
} // end DE correction } // end if mult 1
} // end DE correction
if(fIC[1]>0 && fIC[5]>0){ if(fIC[1]>0 && fIC[5]>0){
double scalor = Cal->GetValue("IC/ETOT_SCALING_SEC"+NPL::itoa(m_FPMW_Section),0); double scalor = Cal->GetValue("IC/ETOT_SCALING_SEC"+NPL::itoa(m_FPMW_Section),0);
...@@ -276,15 +280,14 @@ void TICPhysics::ReadAnalysisConfig() { ...@@ -276,15 +280,14 @@ void TICPhysics::ReadAnalysisConfig() {
TString PathTemp = m_XY0_PROFILE_PATH; TString PathTemp = m_XY0_PROFILE_PATH;
TFile* ifile = new TFile(PathTemp,"read"); TFile* ifile = new TFile(PathTemp,"read");
if(ifile->IsOpen() && !ifile->IsZombie()){ if(ifile->IsOpen() && !ifile->IsZombie()){
m_XY0_SPLINE_CORRECTION = true; m_XY0_SPLINE_CORRECTION = true;
m_IC0_Profile.LoadProfile(PathTemp,"ICOneZeroProfile"); m_IC0_Profile.LoadProfile(PathTemp,"ICOneZeroProfile");
} }
else { else {
m_XY0_SPLINE_CORRECTION = false ; m_XY0_SPLINE_CORRECTION = false ;
} }
ifile->Close(); ifile->Close();
} }
else if (whatToDo=="LOAD_DE_SPLINE") { else if (whatToDo=="LOAD_DE_SPLINE") {
AnalysisConfigFile >> DataBuffer; AnalysisConfigFile >> DataBuffer;
m_DE_SPLINE_PATH = DataBuffer; m_DE_SPLINE_PATH = DataBuffer;
...@@ -317,9 +320,9 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa ...@@ -317,9 +320,9 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa
NSpline = 0 ; NSpline = 0 ;
while ((key=(TKey*)next())){ while ((key=(TKey*)next())){
if (std::string(key->GetClassName()) == "TSpline3"){ if (std::string(key->GetClassName()) == "TSpline3"){
NSpline ++; NSpline ++;
} }
} }
cout << "This file contains " << NSpline << " splines " << endl; cout << "This file contains " << NSpline << " splines " << endl;
// Load Spline // Load Spline
...@@ -329,13 +332,13 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa ...@@ -329,13 +332,13 @@ bool TICPhysics::LoadSpline(vector<TSpline3*> &iSpline, int &NSpline , string Pa
cout << iSpline.at(i)->GetName() << " is loaded!" << endl; cout << iSpline.at(i)->GetName() << " is loaded!" << endl;
} }
ifile->Close(); ifile->Close();
return true; return true;
} }
else{ else{
cout << "File " << filename << " not found!" << endl; cout << "File " << filename << " not found!" << endl;
ifile->Close(); ifile->Close();
return false; return false;
} }
} }
...@@ -379,63 +382,63 @@ double TICPhysics::ApplyZSpline(){ ...@@ -379,63 +382,63 @@ double TICPhysics::ApplyZSpline(){
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void TICPhysics::ApplyXYCorrections(){ void TICPhysics::ApplyXYCorrections(){
vector<double> ICcorr_Y(11), ICcorr_X(11); vector<double> ICcorr_Y(11), ICcorr_X(11);
double FF_DriftTime ; double FF_DriftTime ;
if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8){ //only mult 1 event if (m_TimeData->GetMWPC13Mult() ==1 && fIC_TS.size()>=8){ //only mult 1 event
UShort_t FPMW_Section = m_FPMW_Section; UShort_t FPMW_Section = m_FPMW_Section;
// ***************************Different def of correction depending on year********************************** // ***************************Different def of correction depending on year**********************************
if (m_Data_Year == 2024){ 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))) ; 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){ else if (m_Data_Year == 2023){
FF_DriftTime = m_Y; FF_DriftTime = m_Y;
} }
else { else {
return ; return ;
} }
//************************** Correction of section 1 to 4 *************************************************** //************************** Correction of section 1 to 4 ***************************************************
for (int seg = 2; seg < fIC_TS.size() ; seg++) { // loop on multiplicity of event for (int seg = 2; seg < fIC_TS.size() ; seg++) { // loop on multiplicity of event
if (m_Yspline.at(seg-2)==0){ if (m_Yspline.at(seg-2)==0){
ICcorr_Y.at(seg) = fIC_PID[seg]; ICcorr_Y.at(seg) = fIC_PID[seg];
} }
else { else {
ICcorr_Y.at(seg) = fIC_PID[seg] * m_Yspline.at(seg-2)->Eval(0)/ m_Yspline.at(seg-2)->Eval(FF_DriftTime); 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; if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0;
} //end if non empty } //end if non empty
if (seg == 0) break; if (seg == 0) break;
}//endloop seg }//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 ICRatio = fIC_PID[1]/fIC_PID[0];
Double_t ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); 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 ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false);
if ( ICRatioCorr<1.4 || ICRatioCorr >1.5){ if ( ICRatioCorr<1.4 || ICRatioCorr >1.5){
ICRatioCorr = ICRatio * PolX / m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false); 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); ICcorr_Y0 = fIC_PID[0] / PolX * m_IC0_Profile.Evaluate(m_X,FF_DriftTime,false);
if (ICRatioCorr >100) { if (ICRatioCorr >100) {
ICcorr_Y0 = fIC_PID[0]; 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;
} }
//************************** 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;
}
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment