diff --git a/NPLib/Detectors/PISTA/CMakeLists.txt b/NPLib/Detectors/PISTA/CMakeLists.txt index d4edf2bbb788f01b8bb9f96628c6eb89abf50ebd..41848764389a46d338eae0aa8d60b5e782d863c2 100644 --- a/NPLib/Detectors/PISTA/CMakeLists.txt +++ b/NPLib/Detectors/PISTA/CMakeLists.txt @@ -12,8 +12,14 @@ add_custom_command(OUTPUT TICPhysicsDict.cxx COMMAND ../../scripts/build_dict.sh add_custom_command(OUTPUT TVamosReconstructionDict.cxx COMMAND ../../scripts/build_dict.sh TVamosReconstruction.h TVamosReconstructionDict.cxx TVamosReconstruction.rootmap libNPPISTA.dylib DEPENDS TVamosReconstruction.h) -add_library(NPPISTA SHARED TPISTASpectra.cxx TPISTAData.cxx TPISTAPhysics.cxx TPISTADataDict.cxx TPISTAPhysicsDict.cxx TFPMWData.cxx TFPMWDataDict.cxx TFPMWPhysics.cxx TFPMWPhysicsDict.cxx TICData.cxx TICDataDict.cxx TICPhysics.cxx TICPhysicsDict.cxx TVamosReconstruction.cxx TVamosReconstructionDict.cxx) +add_custom_command(OUTPUT TTimeDataDict.cxx COMMAND ../../scripts/build_dict.sh TTimeData.h TTimeDataDict.cxx TTimeData.rootmap libNPPISTA.dylib DEPENDS TTimeData.h) + +add_library(NPPISTA SHARED TPISTASpectra.cxx TPISTAData.cxx TPISTAPhysics.cxx + TPISTADataDict.cxx TPISTAPhysicsDict.cxx TFPMWData.cxx TFPMWDataDict.cxx + TFPMWPhysics.cxx TFPMWPhysicsDict.cxx TICData.cxx TICDataDict.cxx + TICPhysics.cxx TICPhysicsDict.cxx TVamosReconstruction.cxx TVamosReconstructionDict.cxx TTimeData.cxx TTimeDataDict.cxx) target_link_libraries(NPPISTA ${ROOT_LIBRARIES} NPCore) -install(FILES TPISTAData.h TPISTAPhysics.h TPISTASpectra.h TFPMWData.h TFPMWPhysics.h TICData.h TICPhysics.h TVamosReconstruction.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) + +install(FILES TPISTAData.h TPISTAPhysics.h TPISTASpectra.h TFPMWData.h TFPMWPhysics.h TICData.h TICPhysics.h TVamosReconstruction.h TTimeData.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) diff --git a/NPLib/Detectors/PISTA/TICData.cxx b/NPLib/Detectors/PISTA/TICData.cxx index 52a8670d53b6128f1c59ac84a6f83cabb8d7bba3..6d34fa00d3f52d2ca45472b05195c267cced7abe 100644 --- a/NPLib/Detectors/PISTA/TICData.cxx +++ b/NPLib/Detectors/PISTA/TICData.cxx @@ -46,6 +46,7 @@ TICData::~TICData() { void TICData::Clear() { fIC_Section.clear(); fIC_Charge.clear(); + fIC_TS.clear(); } diff --git a/NPLib/Detectors/PISTA/TICData.h b/NPLib/Detectors/PISTA/TICData.h index 542d76a8b17316d2e902eba40a252ae0f2fe2e73..5073e68d46c84402def36158b831bad65dc59ee0 100644 --- a/NPLib/Detectors/PISTA/TICData.h +++ b/NPLib/Detectors/PISTA/TICData.h @@ -36,6 +36,7 @@ class TICData : public TObject { private: vector<int> fIC_Section; vector<double> fIC_Charge; + vector<long> fIC_TS; @@ -64,6 +65,7 @@ class TICData : public TObject { // X setters inline void SetIC_Charge(double Charge){fIC_Charge.push_back(Charge);};//! inline void SetIC_Section(int sec){fIC_Section.push_back(sec);};//! + inline void SetIC_TS(long TS){fIC_TS.push_back(TS);};//! ////////////////////// GETTERS //////////////////////// @@ -73,7 +75,9 @@ class TICData : public TObject { {return fIC_Section[i];}//! inline Double_t GetIC_Charge(const unsigned int &i) const {return fIC_Charge[i];}//! - + inline long GetIC_TS(const unsigned int &i) const + {return fIC_TS[i];}//! + ////////////////////////////////////////////////////////////// // Required for ROOT dictionnary ClassDef(TICData,1) // ICData structure diff --git a/NPLib/Detectors/PISTA/TICPhysics.cxx b/NPLib/Detectors/PISTA/TICPhysics.cxx index a4097a504c20469497aeb45bd921963ec5a7c612..c905cf16a25a1716af8a7b21396c65017eebfacb 100644 --- a/NPLib/Detectors/PISTA/TICPhysics.cxx +++ b/NPLib/Detectors/PISTA/TICPhysics.cxx @@ -96,7 +96,7 @@ void TICPhysics::BuildPhysicalEvent() { fIC_raw[i] = m_PreTreatedData->GetIC_Charge(i); fIC[i] = gain*m_PreTreatedData->GetIC_Charge(i); fIC_Init[i] = GainInit * m_PreTreatedData->GetIC_Charge(i); - + fIC_TS.push_back(m_PreTreatedData->GetIC_TS(i)); } @@ -168,9 +168,11 @@ void TICPhysics::PreTreat() { //cout << section << " " << gain << endl; //double charge = gain*m_EventData->GetIC_Charge(i); double charge = m_EventData->GetIC_Charge(i); + long TS = m_EventData->GetIC_TS(i); m_PreTreatedData->SetIC_Charge(charge); m_PreTreatedData->SetIC_Section(segment); + m_PreTreatedData->SetIC_TS(TS); } } @@ -319,6 +321,8 @@ void TICPhysics::Clear() { fIC_raw[i] = 0; fIC_Init[i] = 0; } + + fIC_TS.clear(); } diff --git a/NPLib/Detectors/PISTA/TICPhysics.h b/NPLib/Detectors/PISTA/TICPhysics.h index 5866e24a46b10c703802b025643742b7c4fbba1a..c02c89ab1ccfbd4a6c7ef8fee2935fb7f8f7405b 100644 --- a/NPLib/Detectors/PISTA/TICPhysics.h +++ b/NPLib/Detectors/PISTA/TICPhysics.h @@ -66,6 +66,9 @@ class TICPhysics : public TObject, public NPL::VDetector { double Etot; double EtotInit; double Chio_Z; + + vector<long> fIC_TS; + double fIC[11]; double fIC_raw[11]; double fIC_Init[11];//! diff --git a/NPLib/Detectors/PISTA/TTimeData.cxx b/NPLib/Detectors/PISTA/TTimeData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0ceb7608ec545e1859a83bdfe4d90b062644b272 --- /dev/null +++ b/NPLib/Detectors/PISTA/TTimeData.cxx @@ -0,0 +1,73 @@ +/***************************************************************************** + * Copyright (C) 2009-2020 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Théodore Efremov contact address: theodore.efremov@cea.fr* + * * + * Creation Date : Nov 2024 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Time Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ +#include "TTimeData.h" + +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +using namespace std; + +ClassImp(TTimeData) + + +////////////////////////////////////////////////////////////////////// +TTimeData::TTimeData() { +} + + + +////////////////////////////////////////////////////////////////////// +TTimeData::~TTimeData() { +} + + + +////////////////////////////////////////////////////////////////////// +void TTimeData::Clear() { + fTS_MWPC13.clear(); + fTS_MWPC14.clear(); + fTS_MWPC23.clear(); + fTS_MWPC24.clear(); + + fTime_MWPC13.clear(); + fTime_MWPC14.clear(); + fTime_MWPC23.clear(); + fTime_MWPC24.clear(); +} + + + +////////////////////////////////////////////////////////////////////// +void TTimeData::Dump() const { + // This method is very useful for debuging and worth the dev. + cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event [TTimeData::Dump()] XXXXXXXXXXXXXXXXX" << endl; + + size_t mysize = fTime_MWPC13.size(); + cout << "MWPC_Mult: " << mysize << endl; + for(unsigned int i=0; i<mysize; i++){ + cout << "Time 13 mult " << i+1 << " / T= " << fTime_MWPC13[i] << endl; + cout << "Time 14 mult " << i+1 << " / T= " << fTime_MWPC14[i] << endl; + cout << "Time 23 mult " << i+1 << " / T= " << fTime_MWPC23[i] << endl; + cout << "Time 24 mult " << i+1 << " / T= " << fTime_MWPC24[i] << endl; + } +} diff --git a/NPLib/Detectors/PISTA/TTimeData.h b/NPLib/Detectors/PISTA/TTimeData.h new file mode 100644 index 0000000000000000000000000000000000000000..2d036067cba9fca09e7d971c3933f5f42d82ddb9 --- /dev/null +++ b/NPLib/Detectors/PISTA/TTimeData.h @@ -0,0 +1,118 @@ +#ifndef __TIMEDATA__ +#define __TIMEDATA__ +/***************************************************************************** + * Copyright (C) 2009-2020 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: Théodore Efremov contact address: theodore.efremov@cea.fr * + * * + * Creation Date : Oct 2023 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: * + * This class hold Time Raw data * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ + +// STL +#include <vector> +using namespace std; + +// ROOT +#include "TObject.h" + +class TTimeData : public TObject { + ////////////////////////////////////////////////////////////// + // data members are hold into vectors in order + // to allow multiplicity treatment + private: + vector<long> fTS_MWPC13; + vector<long> fTS_MWPC14; + vector<long> fTS_MWPC23; + vector<long> fTS_MWPC24; + + vector<float> fTime_MWPC13; + vector<float> fTime_MWPC14; + vector<float> fTime_MWPC23; + vector<float> fTime_MWPC24; + + + + + ////////////////////////////////////////////////////////////// + // Constructor and destructor + public: + TTimeData(); + ~TTimeData(); + + + ////////////////////////////////////////////////////////////// + // Inherited from TObject and overriden to avoid warnings + public: + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; + + + ////////////////////////////////////////////////////////////// + // Getters and Setters + // Prefer inline declaration to avoid unnecessary called of + // frequently used methods + // add //! to avoid ROOT creating dictionnary for the methods + public: + ////////////////////// SETTERS //////////////////////// + // X setters + inline void SetTS_MWPC13(long time ){fTS_MWPC13.push_back(time);};//! + inline void SetTS_MWPC14(long time ){fTS_MWPC14.push_back(time);};//! + inline void SetTS_MWPC23(long time ){fTS_MWPC23.push_back(time);};//! + inline void SetTS_MWPC24(long time ){fTS_MWPC24.push_back(time);};//! + + inline void SetTime_MWPC13(float time ){fTime_MWPC13.push_back(time);};//! + inline void SetTime_MWPC14(float time ){fTime_MWPC14.push_back(time);};//! + inline void SetTime_MWPC23(float time ){fTime_MWPC23.push_back(time);};//! + inline void SetTime_MWPC24(float time ){fTime_MWPC24.push_back(time);};//! + + + + ////////////////////// GETTERS //////////////////////// + inline long GetTS_MWPC13(const unsigned int &i) const + {return fTS_MWPC13.at(i) ;}//! + inline long GetTS_MWPC14(const unsigned int &i) const + {return fTS_MWPC14.at(i) ;}//! + inline long GetTS_MWPC23(const unsigned int &i) const + {return fTS_MWPC23.at(i) ;}//! + inline long GetTS_MWPC24(const unsigned int &i) const + {return fTS_MWPC24.at(i) ;}//! + + inline float GetTime_MWPC13(const unsigned int &i) const + {return fTime_MWPC13.at(i) ;}//! + inline float GetTime_MWPC14(const unsigned int &i) const + {return fTime_MWPC14.at(i) ;}//! + inline float GetTime_MWPC23(const unsigned int &i) const + {return fTime_MWPC23.at(i) ;}//! + inline float GetTime_MWPC24(const unsigned int &i) const + {return fTime_MWPC24.at(i) ;}//! + + inline Int_t GetMWPC13Mult() const + {return static_cast<int>(fTime_MWPC13.size());} + inline Int_t GetMWPC14Mult() const + {return static_cast<int>(fTime_MWPC14.size());} + inline Int_t GetMWPC23Mult() const + {return static_cast<int>(fTime_MWPC23.size());} + inline Int_t GetMWPC24Mult() const + {return static_cast<int>(fTime_MWPC24.size());} + + ////////////////////////////////////////////////////////////// + // Required for ROOT dictionnary + ClassDef(TTimeData,1) // TimeData structure +}; + +#endif diff --git a/Projects/AlPhaPha/2024/Analysis.cxx b/Projects/AlPhaPha/2024/Analysis.cxx index 25794b9444ff71f85c921f2e367beb1cc3117448..f9927ec6b0394f8d2004217309603481f8e6115b 100644 --- a/Projects/AlPhaPha/2024/Analysis.cxx +++ b/Projects/AlPhaPha/2024/Analysis.cxx @@ -1,4 +1,4 @@ -/***************************************************************************** +/**************************************************************************** * Copyright (C) 2009-2016 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * @@ -406,416 +406,477 @@ void Analysis::TwoAlphaAnalysis(){ ///////////////////////////////////////////////////////////////////////////////// void Analysis::VamosAnalysis(){ - if(abs(FPMW->XtLin)<5 && abs(FPMW->YtLin)<5){ - //XTarget = FPMW->Xt*cos(20*deg+FPMW->Theta_in)/cos(FPMW->Theta_in); - XTarget = FPMW->Xt*(cos(FPMW->Theta_in)/cos(20*deg+FPMW->Theta_in)); - YTarget = FPMW->Yt; + if(abs(FPMW->XtLin)<5 && abs(FPMW->YtLin)<5){ + //XTarget = FPMW->Xt*cos(20*deg+FPMW->Theta_in)/cos(FPMW->Theta_in); + XTarget = FPMW->Xt*(cos(FPMW->Theta_in)/cos(20*deg+FPMW->Theta_in)); + YTarget = FPMW->Yt; + + XTargetLin = FPMW->XtLin*(cos(FPMW->Theta_in_Lin)/cos(20*deg+FPMW->Theta_in_Lin)); + YTargetLin = FPMW->YtLin; + ZTarget = 0; + + FF_Theta = FPMW->Theta_in+m_Vamos_Angle*deg; + FF_Phi = FPMW->Phi_in; + + Xmean_iter += XTarget; + Ymean_iter += YTarget; + Xmean_iterLin += XTargetLin; + Ymean_iterLin += YTargetLin; + + iteration++; + if(iteration%100==0){ + Xmean = Xmean_iter/iteration; + Ymean = Ymean_iter/iteration; + + XmeanLin = Xmean_iterLin/iteration; + YmeanLin = Ymean_iterLin/iteration; + + iteration = 0; + Xmean_iter = 0; + Ymean_iter = 0; + + + Xmean_iterLin = 0; + Ymean_iterLin = 0; + } + } //If some linearisation is done + else{ + XTargetLin = XmeanLin; + YTargetLin = YmeanLin; + XTarget = Xmean; + YTarget = Ymean; + ZTarget = 0; + } - XTargetLin = FPMW->XtLin*(cos(FPMW->Theta_in_Lin)/cos(20*deg+FPMW->Theta_in_Lin)); - YTargetLin = FPMW->YtLin; - ZTarget = 0; + XTarget += m_XTarget_offset; + YTarget += m_YTarget_offset; + ZTarget += m_ZTarget_offset; - FF_Theta = FPMW->Theta_in+m_Vamos_Angle*deg; - FF_Phi = FPMW->Phi_in; + XTargetLin += m_XTarget_offset; + YTargetLin += m_YTarget_offset +0.2; - Xmean_iter += XTarget; - Ymean_iter += YTarget; - Xmean_iterLin += XTargetLin; - Ymean_iterLin += YTargetLin; + //cout << XTarget << endl; - iteration++; - if(iteration%100==0){ - Xmean = Xmean_iter/iteration; - Ymean = Ymean_iter/iteration; - XmeanLin = Xmean_iterLin/iteration; - YmeanLin = Ymean_iterLin/iteration; + PositionOnTarget = TVector3(XTarget,YTarget,ZTarget); + PositionOnTargetLin = TVector3(XTargetLin,YTargetLin,ZTarget); - iteration = 0; - Xmean_iter = 0; - Ymean_iter = 0; + if( MTOF_FP0_T0VM == 1 && MTOF_FP0_T1VM ==1 ){ - Xmean_iterLin = 0; - Ymean_iterLin = 0; - } - } //If some linearisation is done - else{ - XTargetLin = XmeanLin; - YTargetLin = YmeanLin; - XTarget = Xmean; - YTarget = Ymean; - ZTarget = 0; - } + UShort_t FPMWPat = MTOF_FP0_T0VN[0]; //20 section + FPMW_Section = FPMWPat; + IC->SetFPMWSection(FPMW_Section); + IC->BuildSimplePhysicalEvent(); + double Theta = -1000; - XTarget += m_XTarget_offset; - YTarget += m_YTarget_offset; - ZTarget += m_ZTarget_offset; - XTargetLin += m_XTarget_offset; - YTargetLin += m_YTarget_offset +0.2; + if(FPMW->Xf!=-1000){ - //cout << XTarget << endl; + FF_DE = IC->DE; + FF_Eres = IC->Eres; + Tracking->CalculateReconstruction(FPMW->Xf, 1000*FPMW->Thetaf, m_Brho_ref, FF_Brho, Theta, FF_Path); + // FF_Path is in cm ! + // + FF_Y1 = FPMW->PositionY[0]; + FF_Y3 = FPMW->PositionY[2]; - PositionOnTarget = TVector3(XTarget,YTarget,ZTarget); - PositionOnTargetLin = TVector3(XTargetLin,YTargetLin,ZTarget); + FF_IC_Y = FPMW->Yf + (1442.6+6774.4-7600)*tan(FPMW->Phif/1000); + FF_IC_X = FPMW->Xf + (1442.6+6774.4-7600)*tan(FPMW->Thetaf/1000); - if( MTOF_FP0_T0VM == 1 ){ + // T13 // + double path1 = FPMW->GetDetectorPositionZ(0)/10./cos(FPMW->Theta_in)/cos(FPMW->Phi_in); + double path2 = (FPMW->GetDetectorPositionZ(2)-7600)/10./cos(FPMW->Thetaf); + //Toff + vector<double> Toff13 , Toff14, Toff23, Toff24; + const char* Path13 = "macro/mwpc/Toff/output/Toff13.txt"; + const char* Path14 = "macro/mwpc/Toff/output/Toff14.txt"; + const char* Path23 = "macro/mwpc/Toff/output/Toff23.txt"; + const char* Path24 = "macro/mwpc/Toff/output/Toff24.txt"; - UShort_t FPMWPat = MTOF_FP0_T0VN[0]; //20 section - FPMW_Section = FPMWPat; - IC->SetFPMWSection(FPMW_Section); - IC->BuildSimplePhysicalEvent(); - double Theta = -1000; - if(FPMW->Xf!=-1000){ + Toff13 = TxtToVector(Path13); + Toff14 = TxtToVector(Path14); + Toff23 = TxtToVector(Path23); + Toff24 = TxtToVector(Path24); - FF_DE = IC->DE; - FF_Eres = IC->Eres; + double Toff[20] = {0, 588.0, 588.5, 587.95, 588.04, 587.72, 587.92, 587.9, 587.9, 588.66, 588.80, 588.67, 588.64, 588.75, 588.47, 588.65, 588.65, 588.67, 589.05, 590.3}; + // To know time of electron drift in a section of the chio + for (int seg = 0 ; seg < IC->fIC_TS.size() ; seg++){ + if (FPMW_Section != 0){ + FF_DriftTime.push_back(10* (IC->fIC_TS.at(seg) - Time->GetTS_MWPC13(0) - ((Time->GetTime_MWPC14(0)-Toff14.at(FPMW_Section-1)) - (Time->GetTime_MWPC13(0)- Toff13.at(FPMW_Section-1))))); + } + else { + FF_DriftTime.push_back(10* (IC->fIC_TS.at(seg) - Time->GetTS_MWPC13(0) - ((Time->GetTime_MWPC14(0)) - (Time->GetTime_MWPC13(0))))); + } + } - Tracking->CalculateReconstruction(FPMW->Xf, 1000*FPMW->Thetaf, m_Brho_ref, FF_Brho, Theta, FF_Path); - // FF_Path is in cm ! - FF_Y1 = FPMW->PositionY[0]; - FF_Y3 = FPMW->PositionY[2]; - FF_IC_Y = FPMW->Yf + (1442.6+6774.4-7600)*tan(FPMW->Phif/1000); - FF_IC_X = FPMW->Xf + (1442.6+6774.4-7600)*tan(FPMW->Thetaf/1000); - // T13 // - double path1 = FPMW->GetDetectorPositionZ(0)/10./cos(FPMW->Theta_in)/cos(FPMW->Phi_in); - double path2 = (FPMW->GetDetectorPositionZ(2)-7600)/10./cos(FPMW->Thetaf); - - //Online + FF_T13 = - MTOF_FP0_T0V[0] + Toff[FPMWPat]; + FF_D13 = FF_Path - path1 + path2; + FF_V13 = FF_D13/FF_T13; + FF_Beta13 = FF_V13/29.9792458; + FF_Gamma13 = 1./sqrt(1.0-FF_Beta13*FF_Beta13); - double Toff[20] = {0, 588.0, 588.5, 587.95, 588.04, 587.72, 587.92, 587.9, 587.9, 588.66, 588.80, 588.67, 588.64, 588.75, 588.47, 588.65, 588.65, 588.67, 589.05, 590.3}; + FF_AoQ13 = (FF_Brho/(3.107*FF_Beta13*FF_Gamma13)); + FF_M13 = IC->EtotInit/(931.5016*(FF_Gamma13-1.)); + FF_Q13 = FF_M13/FF_AoQ13; - FF_T13 = - MTOF_FP0_T0V[0] + Toff[FPMWPat]; - FF_D13 = FF_Path - path1 + path2; - FF_V13 = FF_D13/FF_T13; - FF_Beta13 = FF_V13/29.9792458; - FF_Gamma13 = 1./sqrt(1.0-FF_Beta13*FF_Beta13); - + FF_Mass13 = int(FF_Q13+0.5)*FF_AoQ13; - FF_AoQ13 = (FF_Brho/(3.107*FF_Beta13*FF_Gamma13)); - FF_M13 = IC->EtotInit/(931.5016*(FF_Gamma13-1.)); - FF_Q13 = FF_M13/FF_AoQ13; + //FF_DriftTime[FPMW_Section] = 10*(fVAMOS_TS_sec[FPMW_Section]- MT) + } + } + else{ + FPMW_Section = -1; + } - FF_Mass13 = int(FF_Q13+0.5)*FF_AoQ13; +} - //FF_DriftTime[FPMW_Section] = 10*(fVAMOS_TS_sec[FPMW_Section]- MT) +vector<double> Analysis::TxtToVector(const char *Path){ + string line; + vector<double> values; + ifstream file(Path); + + if (file.is_open()) { + while (std::getline(file, line)) { + try { + values.push_back(std::stod(line)); + } catch (const std::invalid_argument& e) { + std::cerr << "Invalid number in line: " << line << '\n'; + } + } + file.close(); + } else { + std::cerr << "Error opening file.\n"; } - } - else{ - FPMW_Section = -1; - } -} + return values; +} //////////////////////////////////////////////////////////////////////////////// void Analysis::InitOutputBranch(){ - RootOutput::getInstance()->GetTree()->Branch("BeamEnergy",&BeamEnergy,"BeamEnergy/D"); - - RootOutput::getInstance()->GetTree()->Branch("XTarget",&XTarget,"XTarget/D"); - RootOutput::getInstance()->GetTree()->Branch("XTargetLin",&XTargetLin,"XTargetLin/D"); - RootOutput::getInstance()->GetTree()->Branch("YTarget",&YTarget,"YTarget/D"); - RootOutput::getInstance()->GetTree()->Branch("YTargetLin",&YTargetLin,"YTargetLin/D"); - RootOutput::getInstance()->GetTree()->Branch("ZTarget",&ZTarget,"ZTarget/D"); - - RootOutput::getInstance()->GetTree()->Branch("Ex242Pu",&Ex242Pu,"Ex242Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("Ex240Pu",&Ex240Pu,"Ex240Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("Ex240PuLin",&Ex240PuLin,"Ex240PuLin/D"); - RootOutput::getInstance()->GetTree()->Branch("Ex236U",&Ex236U,"Ex236U/D"); - RootOutput::getInstance()->GetTree()->Branch("Ex238U",&Ex238U,"Ex238U/D"); - - RootOutput::getInstance()->GetTree()->Branch("DeltaE",&DeltaE,"DeltaE/D"); - RootOutput::getInstance()->GetTree()->Branch("DeltaEcorr",&DeltaEcorr,"DeltaEcorr/D"); - RootOutput::getInstance()->GetTree()->Branch("Eres",&Eres,"Eres/D"); - - RootOutput::getInstance()->GetTree()->Branch("Telescope",&Telescope,"Telescope/I"); - RootOutput::getInstance()->GetTree()->Branch("PID",&PID,"PID/D"); - - RootOutput::getInstance()->GetTree()->Branch("Elab",&Elab,"Elab/D"); - RootOutput::getInstance()->GetTree()->Branch("ThetaLab",&ThetaLab,"ThetaLab/D"); - - RootOutput::getInstance()->GetTree()->Branch("Beta_pista",&Beta_pista,"Beta_pista/D"); - RootOutput::getInstance()->GetTree()->Branch("ThetaLabLin",&ThetaLabLin,"ThetaLabLin/D"); - RootOutput::getInstance()->GetTree()->Branch("ThetaDetectorSurface",&ThetaDetectorSurface,"ThetaDetectorSurface/D"); - RootOutput::getInstance()->GetTree()->Branch("PhiLab",&PhiLab,"PhiLab/D"); - RootOutput::getInstance()->GetTree()->Branch("ThetaCM",&ThetaCM,"ThetaCM/D"); - - RootOutput::getInstance()->GetTree()->Branch("Xcalc",&Xcalc,"Xcalc/D"); - RootOutput::getInstance()->GetTree()->Branch("Ycalc",&Ycalc,"Ycalc/D"); - RootOutput::getInstance()->GetTree()->Branch("Zcalc",&Zcalc,"Zcalc/D"); - - RootOutput::getInstance()->GetTree()->Branch("strip_DE",&strip_DE,"strip_DE/I"); - RootOutput::getInstance()->GetTree()->Branch("strip_E",&strip_E,"strip_E/I"); - RootOutput::getInstance()->GetTree()->Branch("Time_E",&Time_E,"Time_E/D"); - - RootOutput::getInstance()->GetTree()->Branch("Pista_Time_Target",&Pista_Time_Target,"Pista_Time_Target/D"); - RootOutput::getInstance()->GetTree()->Branch("Vamos_Time_Target",&Vamos_Time_Target,"Vamos_Time_Target/D"); - - RootOutput::getInstance()->GetTree()->Branch("FF_DE",&FF_DE,"FF_DE/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Eres",&FF_Eres,"FF_Eres/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Z",&FF_Z,"FF_Z/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Theta",&FF_Theta,"FF_Theta/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Phi",&FF_Phi,"FF_Phi/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Brho",&FF_Brho,"FF_Brho/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Path",&FF_Path,"FF_Path/D"); - - RootOutput::getInstance()->GetTree()->Branch("FF_Y1",&FF_Y1,"FF_Y1/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Y3",&FF_Y3,"FF_Y3/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_IC_Y",&FF_IC_Y,"FF_IC_Y/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_IC_X",&FF_IC_X,"FF_IC_X/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_D13",&FF_D13,"FF_D13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_T13",&FF_T13,"FF_T13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_V13",&FF_V13,"FF_V13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_AoQ13",&FF_AoQ13,"FF_AoQ13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Beta13",&FF_Beta13,"FF_Beta13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Gamma13",&FF_Gamma13,"FF_Gamma13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Q13",&FF_Q13,"FF_Q13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_M13",&FF_M13,"FF_M13/D"); - RootOutput::getInstance()->GetTree()->Branch("FF_Mass13",&FF_Mass13,"FF_Mass13/D"); - - RootOutput::getInstance()->GetTree()->Branch("FPMW_Section",&FPMW_Section,"FPMW_Section/I"); - - RootOutput::getInstance()->GetTree()->Branch("theta_lab_fission",&theta_lab_fission,"theta_lab_fission/D"); - RootOutput::getInstance()->GetTree()->Branch("theta_cm_fission",&theta_cm_fission,"theta_cm_fission/D"); - RootOutput::getInstance()->GetTree()->Branch("theta_240Pu",&theta_240Pu,"theta_240Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("phi_240Pu",&phi_240Pu,"phi_240Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("beta_240Pu",&beta_240Pu,"beta_240Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("gamma_240Pu",&gamma_240Pu,"gamma_240Pu/D"); - RootOutput::getInstance()->GetTree()->Branch("gamma_lab_ff",&gamma_lab_ff,"gamma_lab_ff/D"); - RootOutput::getInstance()->GetTree()->Branch("gamma_cm_ff",&gamma_cm_ff,"gamma_cm_ff/D"); - RootOutput::getInstance()->GetTree()->Branch("beta_lab_ff",&beta_lab_ff,"beta_lab_ff/D"); - RootOutput::getInstance()->GetTree()->Branch("beta_cm_ff",&beta_cm_ff,"beta_cm_ff/D"); - - RootOutput::getInstance()->GetTree()->Branch("Elab1",&Elab1); - RootOutput::getInstance()->GetTree()->Branch("Elab2",&Elab2); - RootOutput::getInstance()->GetTree()->Branch("m_2alpha",&m_2alpha,"m_2alpha/I"); - - RootOutput::getInstance()->GetTree()->Branch("Exo_cosa",&Exo_cosa,"Exo_cosa/D"); - RootOutput::getInstance()->GetTree()->Branch("Exo_E",&Exo_E,"Exo_E/D"); - RootOutput::getInstance()->GetTree()->Branch("Exo_EDC_vamos",&Exo_EDC_vamos,"Exo_EDC_vamos/D"); - RootOutput::getInstance()->GetTree()->Branch("Exo_EDC_pista",&Exo_EDC_pista,"Exo_EDC_pista/D"); - RootOutput::getInstance()->GetTree()->Branch("Exo_Theta",&Exo_Theta,"Exo_Theta/D"); - RootOutput::getInstance()->GetTree()->Branch("Exo_Phi",&Exo_Phi,"Exo_Phi/D"); - - RootOutput::getInstance()->GetTree()->Branch("VAMOS_TS_hour",&VAMOS_TS_hour,"VAMOS_TS_hour/D"); - RootOutput::getInstance()->GetTree()->Branch("PISTA_TS_hour",&PISTA_TS_hour,"PISTA_TS_hour/D"); + RootOutput::getInstance()->GetTree()->Branch("Time",&Time); + + RootOutput::getInstance()->GetTree()->Branch("BeamEnergy",&BeamEnergy,"BeamEnergy/D"); + + RootOutput::getInstance()->GetTree()->Branch("XTarget",&XTarget,"XTarget/D"); + RootOutput::getInstance()->GetTree()->Branch("XTargetLin",&XTargetLin,"XTargetLin/D"); + RootOutput::getInstance()->GetTree()->Branch("YTarget",&YTarget,"YTarget/D"); + RootOutput::getInstance()->GetTree()->Branch("YTargetLin",&YTargetLin,"YTargetLin/D"); + RootOutput::getInstance()->GetTree()->Branch("ZTarget",&ZTarget,"ZTarget/D"); + + RootOutput::getInstance()->GetTree()->Branch("Ex242Pu",&Ex242Pu,"Ex242Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("Ex240Pu",&Ex240Pu,"Ex240Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("Ex240PuLin",&Ex240PuLin,"Ex240PuLin/D"); + RootOutput::getInstance()->GetTree()->Branch("Ex236U",&Ex236U,"Ex236U/D"); + RootOutput::getInstance()->GetTree()->Branch("Ex238U",&Ex238U,"Ex238U/D"); + + RootOutput::getInstance()->GetTree()->Branch("DeltaE",&DeltaE,"DeltaE/D"); + RootOutput::getInstance()->GetTree()->Branch("DeltaEcorr",&DeltaEcorr,"DeltaEcorr/D"); + RootOutput::getInstance()->GetTree()->Branch("Eres",&Eres,"Eres/D"); + + RootOutput::getInstance()->GetTree()->Branch("Telescope",&Telescope,"Telescope/I"); + RootOutput::getInstance()->GetTree()->Branch("PID",&PID,"PID/D"); + + RootOutput::getInstance()->GetTree()->Branch("Elab",&Elab,"Elab/D"); + RootOutput::getInstance()->GetTree()->Branch("ThetaLab",&ThetaLab,"ThetaLab/D"); + + RootOutput::getInstance()->GetTree()->Branch("Beta_pista",&Beta_pista,"Beta_pista/D"); + RootOutput::getInstance()->GetTree()->Branch("ThetaLabLin",&ThetaLabLin,"ThetaLabLin/D"); + RootOutput::getInstance()->GetTree()->Branch("ThetaDetectorSurface",&ThetaDetectorSurface,"ThetaDetectorSurface/D"); + RootOutput::getInstance()->GetTree()->Branch("PhiLab",&PhiLab,"PhiLab/D"); + RootOutput::getInstance()->GetTree()->Branch("ThetaCM",&ThetaCM,"ThetaCM/D"); + + RootOutput::getInstance()->GetTree()->Branch("Xcalc",&Xcalc,"Xcalc/D"); + RootOutput::getInstance()->GetTree()->Branch("Ycalc",&Ycalc,"Ycalc/D"); + RootOutput::getInstance()->GetTree()->Branch("Zcalc",&Zcalc,"Zcalc/D"); + + RootOutput::getInstance()->GetTree()->Branch("strip_DE",&strip_DE,"strip_DE/I"); + RootOutput::getInstance()->GetTree()->Branch("strip_E",&strip_E,"strip_E/I"); + RootOutput::getInstance()->GetTree()->Branch("Time_E",&Time_E,"Time_E/D"); + + RootOutput::getInstance()->GetTree()->Branch("Pista_Time_Target",&Pista_Time_Target,"Pista_Time_Target/D"); + RootOutput::getInstance()->GetTree()->Branch("Vamos_Time_Target",&Vamos_Time_Target,"Vamos_Time_Target/D"); + + RootOutput::getInstance()->GetTree()->Branch("FF_DE",&FF_DE,"FF_DE/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Eres",&FF_Eres,"FF_Eres/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Z",&FF_Z,"FF_Z/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Theta",&FF_Theta,"FF_Theta/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Phi",&FF_Phi,"FF_Phi/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Brho",&FF_Brho,"FF_Brho/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Path",&FF_Path,"FF_Path/D"); + + RootOutput::getInstance()->GetTree()->Branch("FF_DriftTime",&FF_DriftTime); + RootOutput::getInstance()->GetTree()->Branch("FF_Y1",&FF_Y1,"FF_Y1/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Y3",&FF_Y3,"FF_Y3/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_IC_Y",&FF_IC_Y,"FF_IC_Y/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_IC_X",&FF_IC_X,"FF_IC_X/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_D13",&FF_D13,"FF_D13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_T13",&FF_T13,"FF_T13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_V13",&FF_V13,"FF_V13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_AoQ13",&FF_AoQ13,"FF_AoQ13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Beta13",&FF_Beta13,"FF_Beta13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Gamma13",&FF_Gamma13,"FF_Gamma13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Q13",&FF_Q13,"FF_Q13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_M13",&FF_M13,"FF_M13/D"); + RootOutput::getInstance()->GetTree()->Branch("FF_Mass13",&FF_Mass13,"FF_Mass13/D"); + + RootOutput::getInstance()->GetTree()->Branch("FPMW_Section",&FPMW_Section,"FPMW_Section/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP0_T0VM",&MTOF_FP0_T0VM,"MTOF_FP0_T0VM/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP0_T1VM",&MTOF_FP0_T1VM,"MTOF_FP0_T1VM/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP1_T0VM",&MTOF_FP1_T0VM,"MTOF_FP1_T0VM/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP1_T1VM",&MTOF_FP1_T1VM,"MTOF_FP1_T1VM/I"); + + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP0_T0VN",&MTOF_FP0_T0VN,"MTOF_FP0_T0VN/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP0_T1VN",&MTOF_FP0_T1VN,"MTOF_FP0_T1VN/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP1_T0VN",&MTOF_FP1_T0VN,"MTOF_FP1_T0VN/I"); + RootOutput::getInstance()->GetTree()->Branch("MTOF_FP1_T1VN",&MTOF_FP1_T1VN,"MTOF_FP1_T1VN/I"); + + RootOutput::getInstance()->GetTree()->Branch("theta_lab_fission",&theta_lab_fission,"theta_lab_fission/D"); + RootOutput::getInstance()->GetTree()->Branch("theta_cm_fission",&theta_cm_fission,"theta_cm_fission/D"); + RootOutput::getInstance()->GetTree()->Branch("theta_240Pu",&theta_240Pu,"theta_240Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("phi_240Pu",&phi_240Pu,"phi_240Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("beta_240Pu",&beta_240Pu,"beta_240Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("gamma_240Pu",&gamma_240Pu,"gamma_240Pu/D"); + RootOutput::getInstance()->GetTree()->Branch("gamma_lab_ff",&gamma_lab_ff,"gamma_lab_ff/D"); + RootOutput::getInstance()->GetTree()->Branch("gamma_cm_ff",&gamma_cm_ff,"gamma_cm_ff/D"); + RootOutput::getInstance()->GetTree()->Branch("beta_lab_ff",&beta_lab_ff,"beta_lab_ff/D"); + RootOutput::getInstance()->GetTree()->Branch("beta_cm_ff",&beta_cm_ff,"beta_cm_ff/D"); + + RootOutput::getInstance()->GetTree()->Branch("Elab1",&Elab1); + RootOutput::getInstance()->GetTree()->Branch("Elab2",&Elab2); + RootOutput::getInstance()->GetTree()->Branch("m_2alpha",&m_2alpha,"m_2alpha/I"); + + RootOutput::getInstance()->GetTree()->Branch("Exo_cosa",&Exo_cosa,"Exo_cosa/D"); + RootOutput::getInstance()->GetTree()->Branch("Exo_E",&Exo_E,"Exo_E/D"); + RootOutput::getInstance()->GetTree()->Branch("Exo_EDC_vamos",&Exo_EDC_vamos,"Exo_EDC_vamos/D"); + RootOutput::getInstance()->GetTree()->Branch("Exo_EDC_pista",&Exo_EDC_pista,"Exo_EDC_pista/D"); + RootOutput::getInstance()->GetTree()->Branch("Exo_Theta",&Exo_Theta,"Exo_Theta/D"); + RootOutput::getInstance()->GetTree()->Branch("Exo_Phi",&Exo_Phi,"Exo_Phi/D"); + + RootOutput::getInstance()->GetTree()->Branch("VAMOS_TS_hour",&VAMOS_TS_hour,"VAMOS_TS_hour/D"); + RootOutput::getInstance()->GetTree()->Branch("PISTA_TS_hour",&PISTA_TS_hour,"PISTA_TS_hour/D"); + } //////////////////////////////////////////////////////////////////////////////// void Analysis::InitInputBranch(){ - RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW0_FPMW0",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW0_FPMW0",&T13); - - RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW0_FPMW1",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW0_FPMW1",&T14); - - RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW1_FPMW0",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW1_FPMW0",&T23); - - RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW1_FPMW1",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW1_FPMW1",&T24); - - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0VN",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0VN",&MTOF_FP0_T0VN); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1VN",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1VN",&MTOF_FP0_T1VN); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0VN",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0VN",&MTOF_FP1_T0VN); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1VN",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1VN",&MTOF_FP1_T1VN); - - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0V",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0V",&MTOF_FP0_T0V); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1V",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1V",&MTOF_FP0_T1V); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0V",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0V",&MTOF_FP1_T0V); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1V",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1V",&MTOF_FP1_T1V); - - - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0VM",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0VM",&MTOF_FP0_T0VM); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1VM",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1VM",&MTOF_FP0_T1VM); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0VM",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0VM",&MTOF_FP1_T0VM); - RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1VM",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1VM",&MTOF_FP1_T1VM); - - RootInput::getInstance()->GetChain()->SetBranchStatus("fVAMOS_TS_sec",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("fVAMOS_TS_sec",&fVAMOS_TS_sec); - RootInput::getInstance()->GetChain()->SetBranchStatus("fPISTA_TS_sec",true); - RootInput::getInstance()->GetChain()->SetBranchAddress("fPISTA_TS_sec",&fPISTA_TS_sec); + RootInput::getInstance()->GetChain()->SetBranchStatus("Time",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("Time",&Time); + + RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW0_FPMW0",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW0_FPMW0",&T13); + + RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW0_FPMW1",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW0_FPMW1",&T14); + + RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW1_FPMW0",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW1_FPMW0",&T23); + + RootInput::getInstance()->GetChain()->SetBranchStatus("T_TMW1_FPMW1",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("T_TMW1_FPMW1",&T24); + + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0VN",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0VN",&MTOF_FP0_T0VN); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1VN",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1VN",&MTOF_FP0_T1VN); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0VN",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0VN",&MTOF_FP1_T0VN); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1VN",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1VN",&MTOF_FP1_T1VN); + + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0V",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0V",&MTOF_FP0_T0V); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1V",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1V",&MTOF_FP0_T1V); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0V",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0V",&MTOF_FP1_T0V); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1V",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1V",&MTOF_FP1_T1V); + + + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T0VM",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T0VM",&MTOF_FP0_T0VM); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP0_T1VM",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP0_T1VM",&MTOF_FP0_T1VM); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T0VM",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T0VM",&MTOF_FP1_T0VM); + RootInput::getInstance()->GetChain()->SetBranchStatus("MTOF_FP1_T1VM",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("MTOF_FP1_T1VM",&MTOF_FP1_T1VM); + + RootInput::getInstance()->GetChain()->SetBranchStatus("fVAMOS_TS_sec",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("fVAMOS_TS_sec",&fVAMOS_TS_sec); + RootInput::getInstance()->GetChain()->SetBranchStatus("fPISTA_TS_sec",true); + RootInput::getInstance()->GetChain()->SetBranchAddress("fPISTA_TS_sec",&fPISTA_TS_sec); } //////////////////////////////////////////////////////////////////////////////// void Analysis::ReInitValue(){ - BeamEnergy = -1000; - Ex242Pu = -1000; - Ex240Pu = -1000; - Ex240PuLin = -1000; - Ex236U = -1000; - Ex238U = -1000; - DeltaE = -1000; - DeltaEcorr = -1000; - Eres = -1000; - Elab = -1000; - ThetaLab = -1000; - Beta_pista = -1; - ThetaDetectorSurface = -1000; - PhiLab = -1000; - ThetaCM = -1000; - XTarget = -1000; - XTargetLin = -1000; - YTarget = -1000; - YTargetLin = -1000; - ZTarget = -1000; - Xcalc = -1000; - Ycalc = -1000; - Zcalc = -1000; - PID = -1000; - Telescope = -1; - strip_DE = -1; - strip_E = -1; - Time_E = -1000; - Pista_Time_Target = -1000; - Vamos_Time_Target = -1000; - - Exo_cosa = -100; - Exo_E = -100; - Exo_EDC_vamos = -100; - Exo_EDC_pista = -100; - Exo_Theta = -100; - Exo_Phi = -100; - - FF_Theta = -100; - FF_Phi = -100; - FF_Brho = -1; - FF_Path = -1; - FF_Y1 = -1000; - FF_Y3 = -1000; - FF_IC_X = -1000; - FF_IC_Y = -1000; - FF_D13 = -1; - FF_T13 = -1; - FF_V13 = -1; - FF_AoQ13 = -1; - FF_Beta13 = -1; - FF_Gamma13 = -1; - FF_Q13 = -1; - FF_M13 = -1; - FF_Mass13 = -1; - FPMW_Section = -1; - - theta_lab_fission = -100; - theta_cm_fission = -100; - theta_240Pu = -100; - phi_240Pu = -100; - beta_240Pu = -100; - gamma_240Pu = -100; - gamma_lab_ff = -100; - gamma_cm_ff = -100; - beta_lab_ff = -100; - beta_cm_ff = -100; - - - m_2alpha = 0; - Elab1.clear(); - Elab2.clear(); + BeamEnergy = -1000; + Ex242Pu = -1000; + Ex240Pu = -1000; + Ex240PuLin = -1000; + Ex236U = -1000; + Ex238U = -1000; + DeltaE = -1000; + DeltaEcorr = -1000; + Eres = -1000; + Elab = -1000; + ThetaLab = -1000; + Beta_pista = -1; + ThetaDetectorSurface = -1000; + PhiLab = -1000; + ThetaCM = -1000; + XTarget = -1000; + XTargetLin = -1000; + YTarget = -1000; + YTargetLin = -1000; + ZTarget = -1000; + Xcalc = -1000; + Ycalc = -1000; + Zcalc = -1000; + PID = -1000; + Telescope = -1; + strip_DE = -1; + strip_E = -1; + Time_E = -1000; + Pista_Time_Target = -1000; + Vamos_Time_Target = -1000; + + Exo_cosa = -100; + Exo_E = -100; + Exo_EDC_vamos = -100; + Exo_EDC_pista = -100; + Exo_Theta = -100; + Exo_Phi = -100; + + FF_Theta = -100; + FF_Phi = -100; + FF_Brho = -1; + FF_Path = -1; + FF_Y1 = -1000; + FF_Y3 = -1000; + FF_IC_X = -1000; + FF_IC_Y = -1000; + FF_D13 = -1; + FF_T13 = -1; + FF_V13 = -1; + FF_AoQ13 = -1; + FF_Beta13 = -1; + FF_Gamma13 = -1; + FF_Q13 = -1; + FF_M13 = -1; + FF_Mass13 = -1; + FPMW_Section = -1; + FF_DriftTime.clear(); + + theta_lab_fission = -100; + theta_cm_fission = -100; + theta_240Pu = -100; + phi_240Pu = -100; + beta_240Pu = -100; + gamma_240Pu = -100; + gamma_lab_ff = -100; + gamma_cm_ff = -100; + beta_lab_ff = -100; + beta_cm_ff = -100; + + + m_2alpha = 0; + Elab1.clear(); + Elab2.clear(); } //////////////////////////////////////////////////////////////////////////////// void Analysis::ReadAnalysisConfig(){ - bool ReadingStatus = false; + bool ReadingStatus = false; - string filename = "AnalysisConfig.dat"; + string filename = "AnalysisConfig.dat"; - // open analysis config file - ifstream AnalysisConfigFile; - AnalysisConfigFile.open(filename.c_str()); + // open analysis config file + ifstream AnalysisConfigFile; + AnalysisConfigFile.open(filename.c_str()); - if (!AnalysisConfigFile.is_open()) { - cout << " No AnalysisConfig.dat found: Default parameter loaded for Analayis " << filename << endl; - return; - } - cout << "**** Loading user parameter for Analysis from AnalysisConfig.dat " << endl; - - // Save it in a TAsciiFile - TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); - asciiConfig->AppendLine("%%% AnalysisConfig.dat %%%"); - asciiConfig->Append(filename.c_str()); - asciiConfig->AppendLine(""); - // read analysis config file - string LineBuffer,DataBuffer,whatToDo; - while (!AnalysisConfigFile.eof()) { - // Pick-up next line - getline(AnalysisConfigFile, LineBuffer); - - // search for "header" - string name = "AnalysisConfig"; - if (LineBuffer.compare(0, name.length(), name) == 0) - ReadingStatus = true; - - // loop on tokens and data - while (ReadingStatus ) { - whatToDo=""; - AnalysisConfigFile >> whatToDo; - - // Search for comment symbol (%) - if (whatToDo.compare(0, 1, "%") == 0) { - AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); - } - - else if (whatToDo=="XTARGET_OFFSET") { - AnalysisConfigFile >> DataBuffer; - m_XTarget_offset = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_XTarget_offset << endl; - } - else if (whatToDo=="YTARGET_OFFSET") { - AnalysisConfigFile >> DataBuffer; - m_YTarget_offset = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_YTarget_offset << endl; - } - else if (whatToDo=="ZTARGET_OFFSET") { - AnalysisConfigFile >> DataBuffer; - m_ZTarget_offset = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_ZTarget_offset << endl; - } - else if (whatToDo=="BEAM_THETAX") { - AnalysisConfigFile >> DataBuffer; - m_Beam_ThetaX = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_Beam_ThetaX << endl; - } - else if (whatToDo=="BEAM_THETAY") { - AnalysisConfigFile >> DataBuffer; - m_Beam_ThetaY = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_Beam_ThetaY << endl; - } - else if (whatToDo=="BRHO_REF") { - AnalysisConfigFile >> DataBuffer; - m_Brho_ref = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_Brho_ref << endl; - } - else if (whatToDo=="VAMOS_ANGLE") { - AnalysisConfigFile >> DataBuffer; - m_Vamos_Angle = atof(DataBuffer.c_str()); - cout << "**** " << whatToDo << " " << m_Vamos_Angle << endl; - } - - else { - ReadingStatus = false; - } + if (!AnalysisConfigFile.is_open()) { + cout << " No AnalysisConfig.dat found: Default parameter loaded for Analayis " << filename << endl; + return; + } + cout << "**** Loading user parameter for Analysis from AnalysisConfig.dat " << endl; + + // Save it in a TAsciiFile + TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); + asciiConfig->AppendLine("%%% AnalysisConfig.dat %%%"); + asciiConfig->Append(filename.c_str()); + asciiConfig->AppendLine(""); + // read analysis config file + string LineBuffer,DataBuffer,whatToDo; + while (!AnalysisConfigFile.eof()) { + // Pick-up next line + getline(AnalysisConfigFile, LineBuffer); + + // search for "header" + string name = "AnalysisConfig"; + if (LineBuffer.compare(0, name.length(), name) == 0) + ReadingStatus = true; + + // loop on tokens and data + while (ReadingStatus ) { + whatToDo=""; + AnalysisConfigFile >> whatToDo; + + // Search for comment symbol (%) + if (whatToDo.compare(0, 1, "%") == 0) { + AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); + } + + else if (whatToDo=="XTARGET_OFFSET") { + AnalysisConfigFile >> DataBuffer; + m_XTarget_offset = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_XTarget_offset << endl; + } + else if (whatToDo=="YTARGET_OFFSET") { + AnalysisConfigFile >> DataBuffer; + m_YTarget_offset = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_YTarget_offset << endl; + } + else if (whatToDo=="ZTARGET_OFFSET") { + AnalysisConfigFile >> DataBuffer; + m_ZTarget_offset = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_ZTarget_offset << endl; + } + else if (whatToDo=="BEAM_THETAX") { + AnalysisConfigFile >> DataBuffer; + m_Beam_ThetaX = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_Beam_ThetaX << endl; + } + else if (whatToDo=="BEAM_THETAY") { + AnalysisConfigFile >> DataBuffer; + m_Beam_ThetaY = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_Beam_ThetaY << endl; + } + else if (whatToDo=="BRHO_REF") { + AnalysisConfigFile >> DataBuffer; + m_Brho_ref = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_Brho_ref << endl; + } + else if (whatToDo=="VAMOS_ANGLE") { + AnalysisConfigFile >> DataBuffer; + m_Vamos_Angle = atof(DataBuffer.c_str()); + cout << "**** " << whatToDo << " " << m_Vamos_Angle << endl; + } + + else { + ReadingStatus = false; + } + } } - } } //////////////////////////////////////////////////////////////////////////////// @@ -827,20 +888,20 @@ void Analysis::End(){ // Construct Method to be pass to the DetectorFactory // //////////////////////////////////////////////////////////////////////////////// NPL::VAnalysis* Analysis::Construct(){ - return (NPL::VAnalysis*) new Analysis(); + return (NPL::VAnalysis*) new Analysis(); } //////////////////////////////////////////////////////////////////////////////// // Registering the construct method to the factory // //////////////////////////////////////////////////////////////////////////////// extern "C"{ - class proxy{ - public: - proxy(){ - NPL::AnalysisFactory::getInstance()->SetConstructor(Analysis::Construct); - } - }; - - proxy p; + class proxy{ + public: + proxy(){ + NPL::AnalysisFactory::getInstance()->SetConstructor(Analysis::Construct); + } + }; + + proxy p; } diff --git a/Projects/AlPhaPha/2024/Analysis.h b/Projects/AlPhaPha/2024/Analysis.h index 125f5ec99c6625ad6df2b2fc5dcb14374315da86..7a4bbb2823f7c0d31cb6734c7d5bfae2c74fa979 100644 --- a/Projects/AlPhaPha/2024/Analysis.h +++ b/Projects/AlPhaPha/2024/Analysis.h @@ -36,6 +36,8 @@ #include "TRandom3.h" #include "TSpline.h" #include "TChain.h" +#include "TTimeData.h" +#include <vector> class Analysis: public NPL::VAnalysis{ public: @@ -140,7 +142,7 @@ class Analysis: public NPL::VAnalysis{ double FF_M13; double FF_Mass13; double FF_Etot13; - Float_t FF_DriftTime[20]; + vector<double> FF_DriftTime; double Exo_cosa; double Exo_E; @@ -222,7 +224,9 @@ class Analysis: public NPL::VAnalysis{ Float_t MTOF_FP1_T0V[92]; Float_t MTOF_FP1_T1V[92]; + vector<double> TxtToVector(const char* Path); private: + TTimeData* Time ; TPISTAPhysics* PISTA; TFPMWPhysics* FPMW; TICPhysics* IC; diff --git a/Projects/AlPhaPha/2024/SnakeFileGeneric b/Projects/AlPhaPha/2024/Snakefile similarity index 86% rename from Projects/AlPhaPha/2024/SnakeFileGeneric rename to Projects/AlPhaPha/2024/Snakefile index 9aa13a1addd4a8a37c982733dfafa63f266eb347..c2b42c1666d746178afc26f844ea7121daa18566 100644 --- a/Projects/AlPhaPha/2024/SnakeFileGeneric +++ b/Projects/AlPhaPha/2024/Snakefile @@ -3,7 +3,7 @@ import subprocess # Lire le répertoire d'entrée depuis les arguments de configuration #input_directory = config["folder"] -input_directory = os.getcwd() + "/../DataMacro/output/run_241" +input_directory = os.getcwd() + "/../DataMacro/output/run_247" origin = [] # Iterate over files in input_directory for filename in os.listdir(input_directory): @@ -12,14 +12,14 @@ for filename in os.listdir(input_directory): origin.append(filename) # Définir le répertoire de sortie pour les fichiers convertis -phy_directory = os.getcwd() + "/../DataMacro/output/analysis" +phy_directory = os.getcwd() + "/../DataMacro/output/analysis/run_247" #phy_directory = "./" # define target files directory analysedfile = [] for inputfile in origin: #analysedfile.append("/home/morfouacep/Physics/NPTool/nptool/Projects/ana_e850/root/analysis/"+inputfile.replace("_raw_","_")) - analysedfile.append( os.getcwd() + "/../DataMacro/output/analysis/"+inputfile) + analysedfile.append( os.getcwd() + "/../DataMacro/output/analysis/run_247/"+inputfile) ## batch rules rule all: diff --git a/Projects/AlPhaPha/2024/convert_snakemake_generic.sh b/Projects/AlPhaPha/2024/convert_snakemake_generic.sh index 10a5f3daf85d317225f3078bab83ae442d3a1a48..7ead632c0d8a841894512a0d7f58ade995a08f5e 100755 --- a/Projects/AlPhaPha/2024/convert_snakemake_generic.sh +++ b/Projects/AlPhaPha/2024/convert_snakemake_generic.sh @@ -3,4 +3,4 @@ echo "- executing snakemake file for npanalysis..." snakemake --cores 30 --forceall --keep-incomplete --keep-going --rerun-incomplete echo "- snakemake executed successfully!" echo "- Merging file..." -root -q '../DataMacro/Merger.C(16,"root/analysis","VamosCalib241","../DataMacro/output/analysis/run_raw_241_")' +root -q '../DataMacro/Merger.C(30,"root/analysis","VamosCalib247","../DataMacro/output/analysis/run_247/run_raw_247_")' diff --git a/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Cut/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Cut/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..71d0df6fef1491bc83cb666eab4a766060bc0577 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Cut/ReadMe.md @@ -0,0 +1,3 @@ +# Fill your cut here + +Fill this directory with your cut diff --git a/Projects/AlPhaPha/2024/macro/chio/FillCharge.cxx b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FillCharge.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/FillCharge.cxx rename to Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FillCharge.cxx diff --git a/Projects/AlPhaPha/2024/macro/chio/FillSelectTree.C b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FillSelectTree.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/FillSelectTree.C rename to Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FillSelectTree.C diff --git a/Projects/AlPhaPha/2024/macro/chio/FitCharge.C b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FitCharge.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/FitCharge.C rename to Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/FitCharge.C diff --git a/Projects/AlPhaPha/2024/macro/chio/Minimization.C b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Minimization.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/Minimization.C rename to Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Minimization.C diff --git a/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Output/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Output/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..53145de146838959247a7d2b25df28daea120c04 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/Output/ReadMe.md @@ -0,0 +1,3 @@ +# Output + +This directory is crucial for pathing of the macro diff --git a/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..3e6f98ff227ed13a32aec8477ee7090fd282e46a --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/ReadMe.md @@ -0,0 +1,7 @@ +# Requirement + +You need to fill Cut folder with the cut of each charge + +You can do this simply by using the DECorr.C macro in the YCalibration folder + +The name of the cut should be Z1->ZN and you should space them a little diff --git a/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/SplineChio.C b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/SplineChio.C new file mode 100644 index 0000000000000000000000000000000000000000..eb7c1011f258abdd4000e661ba873e344470ab96 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/SplineChio.C @@ -0,0 +1,776 @@ +#include "TICPhysics.h" +#include <TChain.h> +#include <TCutG.h> +#include <TF1.h> +#include <TFile.h> +#include <TH2.h> +#include <TSpline.h> +#include <fstream> + +using namespace std; + +const int Ncuts=28; +const int NSegment=11; +const int Nrun=1; +int RunNumber[Nrun]={241}; + +void MakeSpline(); +void ApplySpline_perTCutG(); +void ApplySpline(); +vector<vector<TSpline3*>> LoadSpline(const char* PathToSpline); + +/////////////////////////////////////////////////////////////////////////// +void SplineChio() +{ + //=========================================================================================================== + // Loading Var + //=========================================================================================================== + + //**********************Cut************************************** + TFile *fcut=new TFile("Cut/Cut_Z.root","open"); + TCutG *cutZ[Ncuts]; + for(int i=0;i<Ncuts;i++) cutZ[i]=(TCutG*)fcut->Get(Form("Z%i",i+1)); + + // ****************** Spline Y ********************************** + TFile *fSplineIC = new TFile("../YCalibration/Output/spline_P2P_2024.root","open"); + + + vector<vector<TSpline3*>> Spline = LoadSpline("../YCalibration/Output/spline_P2P_2024.root"); + vector<TSpline3*> spline_X(11), spline_Y(11); + spline_X = Spline.at(0) ; spline_Y = Spline.at(1); + + //**********************DE_E**************************************************** + TChain *chain=new TChain("PhysicsTree"); + + chain->Add("../../../root/analysis/VamosCalib241.root"); + + TICPhysics* IC = new TICPhysics() ; + double FF_IC_X, FF_IC_Y, FF_V13; + double FF_DE, FF_Eres; + + chain->SetBranchStatus("IC", true); + chain->SetBranchAddress("IC", &IC); + chain->SetBranchStatus("FF_IC_Y", true); + chain->SetBranchAddress("FF_IC_Y", &FF_IC_Y); + + + TH2F *hChioDE_E_all = new TH2F("hChioDE_E","hChioDE_E",1000,1000,20000,500,1000,26000); + TH2F *hChioDE_E[Ncuts]; + for(int i=0;i<Ncuts;i++) hChioDE_E[i]=new TH2F(Form("hChioDE_E_%d",i+1),Form("hChioDE_E_%d",i+1),2000,1000,20000,1250,1000,26000); + + auto start = std::chrono::high_resolution_clock::now(); + int Nentries=chain->GetEntries(); + for(int e=0;e<Nentries;++e) + { + if (e % 100000 == 0 && e > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / e; + double timeLeft = avgTimePerIteration * (Nentries - e); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } + + chain->GetEntry(e); + + vector<double> ICcorr_Y(NSegment), ICcorr_X(NSegment); // the [0] element of spline is the + vector<double> Temp_X(NSegment) , Temp_Y(NSegment); // correction on the first + // segment of ic + for (int seg = 1; seg < NSegment+1 ; seg++) { + + if (seg == NSegment) seg = 0; //from 1to NSeg finishing with 0 + + if (spline_Y.at(seg)==0){ + ICcorr_Y.at(seg) = IC->fIC_raw[seg]; + } + + else { + if (seg == 0) { + Temp_Y.at(seg) = ICcorr_Y.at(1) / IC->fIC_raw[seg] * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(1) / Temp_Y.at(seg); + } + + else if (seg == 1){ + ICcorr_Y.at(seg) = IC->fIC_raw[1]*spline_Y.at(1)->Eval(0)/spline_Y.at(1)->Eval(FF_IC_Y); + } + + else if (seg > 1) { + Temp_Y.at(seg) = IC->fIC_raw[seg]/ICcorr_Y.at(seg-1) * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(seg-1) * Temp_Y.at(seg); + } + + if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0; + } //end if non empty + if (seg == 0) break; + }//endloop seg + + + FF_DE = 0.5*( ICcorr_Y[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + FF_Eres = 0 ; + + for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){ + if (seg >4){ + FF_Eres += IC->fIC_raw[seg] ; + //Ecorr += ICcorr_Y.at(seg) ; + } + } + + + hChioDE_E_all->Fill(FF_Eres,FF_DE); + + //for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(Chio_E,FF_DE)) {hChioDE_E[i]->Fill(Chio_E,FF_DE); break;} + for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(FF_Eres,FF_DE)) {hChioDE_E[i]->Fill(FF_Eres,FF_DE); break;} + } + + + //**********************************Out*************************** + TFile *outFile=new TFile("histo/SingleZ_ChioDE_E.root","recreate"); + for(int i=0;i<Ncuts;i++) hChioDE_E[i]->Write(); + outFile->Close(); + + TCanvas * can = new TCanvas(Form("ChioEbis_vs_ChioDE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + Form("ChioEbis_vs_ChiodE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + 0,0,2000,1000); + can->cd(); gPad-> SetLogz(); + hChioDE_E_all->Draw("colz"); + for(int i = 0 ; i < Ncuts ; i++) cutZ[i]->Draw("same"); +} + +/////////////////////////////////////////////////////////////////////////// +void MakeSpline() +{ + TFile *inFile=new TFile("histo/SingleZ_ChioDE_E.root"); + + TSpline3 *gspline[Ncuts]; + + TH2F* h2 [Ncuts]; + TH1F* hProfile[Ncuts]; + TH1F* pfx[Ncuts]; // extended hProfile + TFile *fspline=new TFile("Output/spline_Chio_2024.root","recreate"); + + TCanvas * canfit = new TCanvas("canfit","canfit",0,0,2000,1500); + + for(int i=0;i<Ncuts;i++) + { + // Get the 2D plot in TCutG + h2[i]=(TH2F*)inFile->Get(Form("hChioDE_E_%d",i+1)); + + // Create the TProfile + hProfile[i]=(TH1F*)h2[i]->ProfileX(); + hProfile[i]->SetLineWidth(2); + hProfile[i]->SetDirectory(0); + canfit->cd(); + if (i==0) { + hProfile[i]->GetYaxis()->SetRangeUser(5000,26000); + hProfile[i]->Draw(); + } + else hProfile[i]->Draw("same"); + + // Get the range of the TProfile + int FirstBin, LastBin; + double parpol3[4]; + for(int bin=1; bin<hProfile[i]->GetNbinsX(); bin++){ + FirstBin = bin; + if (hProfile[i]->GetBinContent(bin)>6000) break; + } + double parpol1[2]; + for(int bin=hProfile[i]->GetNbinsX(); bin>1 ; bin--){ + LastBin = bin; + if (hProfile[i]->GetBinContent(bin)>6000) break; + } + + // Create the extended TProfile + pfx[i] = new TH1F(Form("pfx_%02d",i+1),Form("pfx_%02d",i+1),hProfile[i]->GetNbinsX(),hProfile[i]->GetBinLowEdge(1), + hProfile[i]->GetBinLowEdge(hProfile[i]->GetNbinsX())+hProfile[i]->GetBinWidth(hProfile[i]->GetNbinsX())); + pfx[i]->SetLineColor(8); + pfx[i]->SetDirectory(0); + + // find the function to extend the TProfile on the lower range + TF1 * fitpol3 = new TF1(Form("FitPol3_pfx_%02d",i+1),"pol3",hProfile[i]->GetBinLowEdge(FirstBin),hProfile[i]->GetBinLowEdge(FirstBin)+10000); + hProfile[i]->Fit(fitpol3,"R"); + fitpol3->GetParameters(parpol3); + + // find the function to extend the TProfile on the higher range + TF1 * fitpol1 = new TF1(Form("FitPol1_pfx_%02d",i+1),"pol1",hProfile[i]->GetBinLowEdge(LastBin)-10000,hProfile[i]->GetBinLowEdge(LastBin)); + hProfile[i]->Fit(fitpol1,"R"); + fitpol1->GetParameters(parpol1); + + // fill the extended TProfile + float newval,lastval,lasterr; + for(int bin=1; bin<=FirstBin; bin++){ + newval=0; + if(i < (Ncuts-4) && i!=0 && i!=1) + for(int par=0; par<4; par++) newval += parpol3[par]*pow(hProfile[i]->GetBinCenter(bin),par); + else if (i >= (Ncuts-4)) + newval = hProfile[i]->GetBinContent(FirstBin); + else{ + newval=0; + for(int par=0; par<2; par++) newval += parpol1[par]*pow(hProfile[i]->GetBinCenter(bin),par); + pfx[i]->SetBinContent(bin,newval); + } + pfx[i]->SetBinContent(bin,newval); + } + for(int bin=FirstBin; bin<=LastBin; bin++){ + newval = hProfile[i]->GetBinContent(bin); + if (newval!=0){ + pfx[i]->SetBinContent(bin,newval); + pfx[i]->SetBinError(bin,hProfile[i]->GetBinError(bin)); + lastval = newval; + lasterr = hProfile[i]->GetBinError(bin); + } + else{ + pfx[i]->SetBinContent(bin,lastval); + pfx[i]->SetBinError(bin,lasterr); + } + } + for(int bin=LastBin; bin<=hProfile[i]->GetNbinsX(); bin++){ + newval=0; + for(int par=0; par<2; par++) newval += parpol1[par]*pow(hProfile[i]->GetBinCenter(bin),par); + pfx[i]->SetBinContent(bin,newval); + } + pfx[i]->Draw("same"); + + gspline[i]=new TSpline3(pfx[i]); + gspline[i]->SetName(Form("fspline_%d",i+1)); + fspline->cd(); + gspline[i]->Write(); + + } + + fspline->Close(); + + TGraph * gr = new TGraph(); + gr->SetName("DEvsZ"); + + TCanvas * can = new TCanvas("ChioEcorr_vs_Ebis_for_TSplines","ChioEcorr_vs_Ebis_for_TSplines",0,0,2500,2000); + can->cd(); + ofstream ofile_par; + string filename_par = "Output/mean_spline_par.dat"; + ofile_par.open(filename_par.c_str()); + cout << "Float_t FF_DEcorr[" << Ncuts << "] = { " << endl; + ofile_par << "Float_t FF_DEcorr[" << Ncuts << "] = { " << endl; + for(int i=0;i<Ncuts;i++){ + can->cd(); + if(i==0) h2[i]->Draw("col"); + else h2[i]->Draw("col,same"); + cout << h2[i]->GetMean(2) << ", " << endl; + ofile_par << h2[i]->GetMean(2) << ", " << endl; + //gr->SetPoint(i,sqrt(h2[i]->GetMean(2)),i+31); + gr->SetPoint(i,gspline[i]->Eval(8500),i+31); + //hProfile[i]->Draw("same"); + pfx[i]->Draw("same"); + gspline[i]->SetLineColor(kBlue); + gspline[i]->SetLineWidth(3); + gspline[i]->Draw("lsame"); + } + + TCanvas * cangr = new TCanvas("ToGetRoughCal","ToGetRoughCal",200,0,1200,1000); + cangr->cd(); + gr->SetMarkerStyle(20); + gr->Draw("AP"); + gr->Fit("pol2"); +} + + +/////////////////////////////////////////////////////////////////////////// +void ApplySpline_perTCutG() +{ + + // *************************Cut*************************** + TFile *fcut=new TFile("Cut/Cut_Z.root"); + TCutG *cutZ[Ncuts]; + + // ******************* TSpline DE************************* + TFile *fspline=new TFile("Output/spline_Chio_2024.root","read"); + TSpline3 *gspline[Ncuts]; + + for(int i=0;i<Ncuts;i++){ + cutZ[i]=(TCutG*)fcut->Get(Form("Z%i",i+1)); + gspline[i] = (TSpline3*)fspline->FindObjectAny(Form("fspline_%d",i+1)); + } + + // ****************** Spline Y ********************************** + TFile *fSplineIC = new TFile("../YCalibration/Output/spline_P2P_2024.root","open"); + + + vector<vector<TSpline3*>> Spline = LoadSpline("../YCalibration/Output/spline_P2P_2024.root"); + vector<TSpline3*> spline_X(11), spline_Y(11); + spline_X = Spline.at(0) ; spline_Y = Spline.at(1); + + //**********************DE_E**************************************************** + TChain *chain=new TChain("PhysicsTree"); + + chain->Add("../../../root/analysis/VamosCalib241.root"); + + TICPhysics* IC = new TICPhysics() ; + double FF_IC_X, FF_IC_Y, FF_V13; + double FF_DE, FF_Eres; + + chain->SetBranchStatus("IC", true); + chain->SetBranchAddress("IC", &IC); + chain->SetBranchStatus("FF_IC_Y", true); + chain->SetBranchAddress("FF_IC_Y", &FF_IC_Y); + + // variable after applying TSpline + double FF_DEcorr; + double FF_DEcorr0[Ncuts] = { + 7375.73, + 7982.83, + 8419.21, + 8801.52, + 9227.89, + 9667.77, + 10163.1, + 10680.5, + 11222.2, + 11758.3, + 12287.6, + 12802.2, + 13324.2, + 13828.4, + 14325.2, + 14773.7, + 15207.3, + 15674.6, + 16098.9, + 16548.5, + 16926.9, + 17384.1, + 17778.3, + 18196.6, + 18597.6, + 19043.9, + 19437.8, + 19889.4,}; + // 20301.1, + //20709.7, + //21112.6, + //21544, + //21953.4, + //22361.8}; + + + TH2F *hChioDE_E_all = new TH2F("hChioDE_E_all","hChioDE_E_all",1000,1000,41000,500,1000,26000); + TH2F *hChioDE_E = new TH2F("hChioDE_E","hChioDE_E",1000,1000,41000,500,1000,26000); + TH2F *hChioDE_E_corr = new TH2F("hChioDE_E_corr","hChioDE_E_corr",1000,1000,41000,500,1000,26000); + + int Nentries=chain->GetEntries(); + auto start = std::chrono::high_resolution_clock::now(); + + for(int e=0;e<Nentries;++e){ + if (e % 100000 == 0 && e > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / e; + double timeLeft = avgTimePerIteration * (Nentries - e); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } + + chain->GetEntry(e); + + + + vector<double> ICcorr_Y(NSegment), ICcorr_X(NSegment); // the [0] element of spline is the + vector<double> Temp_X(NSegment) , Temp_Y(NSegment); // correction on the first + // segment of ic + for (int seg = 1; seg < NSegment+1 ; seg++) { + + if (seg == NSegment) seg = 0; //from 1to NSeg finishing with 0 + + if (spline_Y.at(seg)==0){ + ICcorr_Y.at(seg) = IC->fIC_raw[seg]; + } + + else { + if (seg == 0) { + Temp_Y.at(seg) = ICcorr_Y.at(1) / IC->fIC_raw[seg] * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(1) / Temp_Y.at(seg); + } + + else if (seg == 1){ + ICcorr_Y.at(seg) = IC->fIC_raw[1]*spline_Y.at(1)->Eval(0)/spline_Y.at(1)->Eval(FF_IC_Y); + } + + else if (seg > 1) { + Temp_Y.at(seg) = IC->fIC_raw[seg]/ICcorr_Y.at(seg-1) * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(seg-1) * Temp_Y.at(seg); + } + + if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0; + } //end if non empty + if (seg == 0) break; + }//endloop seg + + + FF_DE = 0.5*( ICcorr_Y[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + FF_Eres = 0 ; + + for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){ + if (seg >4){ + FF_Eres += IC->fIC_raw[seg] ; + //Ecorr += ICcorr_Y.at(seg) ; + } + } + + hChioDE_E_all->Fill(FF_Eres,FF_DE); + for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(FF_Eres,FF_DE)) { + hChioDE_E->Fill(FF_Eres,FF_DE); + FF_DEcorr = FF_DEcorr0[i] * FF_DE / gspline[i]->Eval(FF_Eres); + hChioDE_E_corr->Fill(FF_Eres,FF_DEcorr); + break; + } + } + +TCanvas * can = new TCanvas(Form("ChioEbis_vs_ChioDE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + Form("ChioEbis_vs_ChiodE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + 0,0,2000,1000); +can->Divide(1,3); +can->cd(1); gPad-> SetLogz(); hChioDE_E_all->Draw("colz"); +can->cd(2); gPad-> SetLogz(); hChioDE_E->Draw("colz"); +can->cd(3); gPad-> SetLogz(); hChioDE_E_corr->Draw("colz"); + +} + +/////////////////////////////////////////////////////////////////////////// +void ApplySpline() +{ + // *************************Cut*************************** + TFile *fcut=new TFile("Cut/Cut_Z.root"); + TCutG *cutZ[Ncuts]; + + // ******************* TSpline DE************************* + TFile *fspline=new TFile("Output/spline_Chio_2024.root","read"); + TSpline3 *gspline[Ncuts]; + + for(int i=0;i<Ncuts;i++){ + cutZ[i]=(TCutG*)fcut->Get(Form("Z%i",i+1)); + gspline[i] = (TSpline3*)fspline->FindObjectAny(Form("fspline_%d",i+1)); + } + + // ****************** Spline Y ********************************** + TFile *fSplineIC = new TFile("../YCalibration/Output/spline_P2P_2024.root","open"); + + + vector<vector<TSpline3*>> Spline = LoadSpline("../YCalibration/Output/spline_P2P_2024.root"); + vector<TSpline3*> spline_X(11), spline_Y(11); + spline_X = Spline.at(0) ; spline_Y = Spline.at(1); + + //**********************DE_E**************************************************** + TChain *chain=new TChain("PhysicsTree"); + + chain->Add("../../../root/analysis/VamosCalib241.root"); + + TICPhysics* IC = new TICPhysics() ; + double FF_IC_X, FF_IC_Y, FF_V13; + double FF_DE, FF_Eres; + + chain->SetBranchStatus("IC", true); + chain->SetBranchAddress("IC", &IC); + chain->SetBranchStatus("FF_IC_Y", true); + chain->SetBranchAddress("FF_IC_Y", &FF_IC_Y); + + + // variable after applying TSpline + double FF_DEcorr=0; + double Zrough=0; + double Zabitbetter=0; + + double FF_DEcorr0[Ncuts]; + for(int index=0; index<Ncuts; index++){ + FF_DEcorr0[index] = gspline[index]->Eval(8500); + } + /*double FF_DEcorr0[Ncuts] = { + 7375.73, + 7982.83, + 8419.21, + 8801.52, + 9227.89, + 9667.77, + 10163.1, + 10680.5, + 11222.2, + 11758.3, + 12287.6, + 12802.2, + 13324.2, + 13828.4, + 14325.2, + 14773.7, + 15207.3, + 15674.6, + 16098.9, + 16548.5, + 16926.9, + 17384.1, + 17778.3, + 18196.6, + 18597.6, + 19043.9, + 19437.8, + 19889.4, + 20301.1, + 20709.7, + 21112.6, + 21544, + 21953.4, + 22361.8};*/ + + // histos + TH2F *hChioDE_E_all = new TH2F("hChioDE_E_all","hChioDE_E_all",1000,1000,41000,500,1000,26000); + TH2F *hChioDE_E_corr = new TH2F("hChioDE_E_corr","hChioDE_E_corr",1000,1000,41000,500,1000,26000); + TH1F *hChioDE_corr = new TH1F("hChioDE_corr","hChioDE_corr",2500,1000,26000); + TH2F *hChioZ_E_rough = new TH2F("hChioZ_E_rough","hChioZ_E_rough",1000,1000,41000,500,25,65); + TH1F *hChioZ_rough = new TH1F("hChioZ_rough","hChioZ_rough",2500,25,65); + TH1F *hChioZ_abitbetter = new TH1F("hChioZ_abitbetter","hChioZ_abitbetter",2500,25,65); + + int Nentries=1e6;//chain->GetEntries(); + auto start = std::chrono::high_resolution_clock::now(); + + double FF_Eres_prev = 0; + for(int e=0;e<Nentries;e++) + { + if (e % 100000 == 0 && e > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / e; + double timeLeft = avgTimePerIteration * (Nentries - e); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } + + FF_DEcorr = -100; + chain->GetEntry(e); + + //=========================================================================================================== + // Splined Y + //=========================================================================================================== + vector<double> ICcorr_Y(NSegment), ICcorr_X(NSegment); // the [0] element of spline is the + vector<double> Temp_X(NSegment) , Temp_Y(NSegment); // correction on the first + // segment of ic + for (int seg = 1; seg < NSegment+1 ; seg++) { + + if (seg == NSegment) seg = 0; //from 1to NSeg finishing with 0 + + if (spline_Y.at(seg)==0){ + ICcorr_Y.at(seg) = IC->fIC_raw[seg]; + } + + else { + if (seg == 0) { + Temp_Y.at(seg) = ICcorr_Y.at(1) / IC->fIC_raw[seg] * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(1) / Temp_Y.at(seg); + } + + else if (seg == 1){ + ICcorr_Y.at(seg) = IC->fIC_raw[1]*spline_Y.at(1)->Eval(0)/spline_Y.at(1)->Eval(FF_IC_Y); + } + + else if (seg > 1) { + Temp_Y.at(seg) = IC->fIC_raw[seg]/ICcorr_Y.at(seg-1) * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y); + ICcorr_Y.at(seg) = ICcorr_Y.at(seg-1) * Temp_Y.at(seg); + } + + if (!(ICcorr_Y.at(seg)==ICcorr_Y.at(seg))) ICcorr_Y.at(seg) = 0; + } //end if non empty + if (seg == 0) break; + }//endloop seg + + + FF_DE = 0.5*( ICcorr_Y[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + FF_Eres = 0 ; + + for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){ + if (seg >4){ + FF_Eres += IC->fIC_raw[seg] ; + //Ecorr += ICcorr_Y.at(seg) ; + } + } + + //=========================================================================================================== + // Spline DE + //===========================================================================================================& + + + if (FF_DE<3000) continue; + if(FF_Eres==FF_Eres_prev) continue; + FF_Eres_prev = FF_Eres; + + hChioDE_E_all->Fill(FF_Eres,FF_DE); + + float Eval_DEspline, DEspline0; + int index=0; + for(int i=0; i<Ncuts; i++){ + Eval_DEspline = gspline[i]->Eval(FF_Eres); + if(FF_DE<Eval_DEspline) break; + index = i; + } + + Eval_DEspline = gspline[index]->Eval(FF_Eres); + DEspline0 = FF_DEcorr0[index]; + float dmin, dsup; + if( index < (Ncuts-1) && FF_DE > gspline[0]->Eval(FF_Eres)){ + dmin = FF_DE-gspline[index]->Eval(FF_Eres); + dsup = gspline[index+1]->Eval(FF_Eres)-FF_DE; + if(dmin<0) cout << "negative value of dmin = " << dmin << ", for index = " << index << endl; + if(dsup<0) cout << "negative value of dsup = " << dsup << ", for index = " << index << endl; + //if(dsup<dmin) { + // Eval_DEspline = gspline[index+1]->Eval(FF_Eres) ; + // DEspline0 = FF_DEcorr0[index] ; + //} + Eval_DEspline = dsup*gspline[index]->Eval(FF_Eres)/(dmin+dsup) + dmin*gspline[index+1]->Eval(FF_Eres)/(dmin+dsup) ; + DEspline0 = dsup*FF_DEcorr0[index]/(dmin+dsup) + dmin*FF_DEcorr0[index+1]/(dmin+dsup) ; + + FF_DEcorr = DEspline0 * FF_DE / Eval_DEspline ; + hChioDE_E_corr->Fill(FF_Eres,FF_DEcorr); + //if(FF_DEcorr>15120 && FF_DEcorr<15130) { + // cout << e << " " << index << " " << FF_Eres << " " << FF_DEcorr << endl; + //} + } + + // should be pol2 !!! + //Zrough = -110.165 + 3.34475*sqrt(FF_DEcorr) - 0.0271123*FF_DEcorr + 8.60752e-05 * pow(sqrt(FF_DEcorr),3); + Zrough = 16.8521 + 0.0017328*FF_DEcorr + 1.70774e-8*pow(FF_DEcorr,2); + Zabitbetter = -127.117 + 3.83463*sqrt(FF_DEcorr) - 0.0317448 *FF_DEcorr + 0.000100428 * pow(sqrt(FF_DEcorr),3); + hChioZ_E_rough->Fill(FF_Eres,Zrough); + + if(3000<FF_Eres && FF_Eres<25000){ + hChioDE_corr->Fill(FF_DEcorr); + hChioZ_rough->Fill(Zrough); + hChioZ_abitbetter->Fill(Zabitbetter); + } + } + + TCanvas * can = new TCanvas(Form("ChioEbis_vs_ChioDE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + Form("ChioEbis_vs_ChiodE_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + 0,0,2000,2000); + can->Divide(1,3); + can->cd(1); gPad-> SetLogz(); hChioDE_E_all->Draw("colz"); + for(int i = 0 ; i < Ncuts ; i++) cutZ[i]->Draw("same"); + can->cd(2); gPad-> SetLogz(); hChioDE_E_corr->Draw("colz"); + can->cd(3); gPad-> SetLogz(); hChioZ_E_rough->Draw("colz"); + + TCanvas * can1D = new TCanvas(Form("DE_and_Z_ifE_8000to25000_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + Form("DE_and_Z_ifE_8000to25000_run%04d_%04d",RunNumber[0],RunNumber[Nrun-1]), + 0, 0, 2000,2000); + can1D->Divide(1,3); + can1D->cd(1); hChioDE_corr->Draw(); + can1D->cd(2); hChioZ_rough->Draw(); + can1D->cd(3); hChioZ_abitbetter->Draw(); + + TFile * fsave = new TFile(Form("Output/DEvsE_corr_run%04d_%04d.root",RunNumber[0],RunNumber[Nrun-1]),"recreate"); + can->Write(); + hChioDE_E_all->Write(); + hChioDE_E_corr->Write(); + hChioZ_E_rough->Write(); + can1D->Write(); + hChioDE_corr->Write(); + hChioZ_rough->Write(); + hChioZ_abitbetter->Write(); + fsave->Close(); +} + +/////////////////////////////////////////////////////////////////////////// +void Fit_DE_E_corr() +{ + + TFile * f = new TFile(Form("Output/DEvsE_corr_run%04d_%04d.root",RunNumber[0],RunNumber[Nrun-1]),"read"); + f->ls(); + TH1F * h1DEcorr = (TH1F*)f->Get("hChioDE_corr"); + h1DEcorr->SetDirectory(0); + f->Close(); + + TCanvas * canfit = new TCanvas("DEcorrforfit","Decorrforfit",0,0,3000,1000); + canfit->Divide(2,1); + canfit->cd(1); h1DEcorr->Draw(); + + float InitMean[34] = { + 7.55521e+03, 7.82392e+03, 8.04283e+03, 8.36164e+03, + 8.68128e+03, 9.06218e+03, 9.44613e+03, 9.82352e+03, + 1.02433e+04, 1.06666e+04, 1.11215e+04, 1.15371e+04, + 1.20246e+04, 1.24492e+04, 1.29190e+04, 1.34056e+04, + 1.38367e+04, 1.42968e+04, 1.46816e+04, 1.51614e+04, + 1.55115e+04, 1.58873e+04, 1.63049e+04, 1.66187e+04, + 1.69730e+04, 1.73969e+04, 1.76965e+04, 1.80730e+04, + 1.85234e+04, 1.88849e+04, 1.92127e+04, 1.96378e+04, + 1.99820e+04, 2.02914e+04 + }; + + float InitSigma[34] = { + 6.97215e+01, 7.76394e+01, 7.84506e+01, 8.23239e+01, + 9.25943e+01, 1.06154e+02, 1.03566e+02, 1.02429e+02, + 1.10066e+02, 1.15032e+02, 1.20449e+02, 1.15397e+02, + 1.30322e+02, 1.29513e+02, 1.45757e+02, 1.53552e+02, + 1.48061e+02, 1.49866e+02, 1.60311e+02, 1.56691e+02, + 1.55461e+02, 1.78093e+02, 1.66829e+02, 1.67863e+02, + 1.75509e+02, 1.75189e+02, 1.70589e+02, 1.76178e+02, + 1.65192e+02, 1.87470e+02, 1.78153e+02, 1.58322e+02, + 1.53678e+02, 1.97134e+02 + }; + + char name[1000]; + TString totname; + for(int i=0; i<34;i++){ + sprintf(name,"%i",i*3); + totname += "gaus(" + TString(name) + ")+"; + } + totname.Remove(totname.Last('+')); + TF1 * gtot = new TF1("MultiGaussianFit",totname,InitMean[0]-2*InitSigma[0],InitMean[33]+2*InitSigma[33]); + + for(int i=0; i<34;i++){ + gtot->SetParameter(i*3+1,InitMean[i]); + gtot->SetParameter(i*3+2,InitSigma[i]); + } + h1DEcorr->Fit(gtot,"R+"); + + TGraph * gr = new TGraph(); + gr->SetName("DEfit_vs_Z"); + gr->SetMarkerStyle(20); + for(int i=0; i<33; i++){ + gr->SetPoint(i,sqrt(gtot->GetParameter(i*3+1)),i+32); + } + + canfit->cd(2); gr->Draw("AP"); + +} + + +vector<vector<TSpline3*>> LoadSpline(const char* PathToSpline){ + TFile *fSplineIC = new TFile(PathToSpline,"open"); + // Get number of spline + int SplineCount = 0 ; + TIter next(fSplineIC->GetListOfKeys()); + TKey* key; + + while ((key=(TKey*)next())){ + if (std::string(key->GetClassName()) == "TSpline3"){ + SplineCount ++; + } + } + + vector<vector<TSpline3*>> Spline; + vector<TSpline3*> spline_X(11), spline_Y(11); + for (int i = 0; i < SplineCount ; i++) { + int seg = int((i-2)/2 +1 ); + if (i < 2){ + spline_X.at(0) = (TSpline3 *)fSplineIC->Get("fspline_IC0_X"); + spline_Y.at(0) = (TSpline3 *)fSplineIC->Get("fspline_IC0_Y"); + } + + else if ( i>=2 && i<4){ + spline_X.at(1) = (TSpline3 *)fSplineIC->Get("fspline_IC1_X"); + spline_Y.at(1) = (TSpline3 *)fSplineIC->Get("fspline_IC1_Y"); + } + else if (seg >=2 && (i%2 == 0) ) { + spline_X.at(seg) = (TSpline3 *)fSplineIC->Get(Form("fspline_IC%d_X",seg)); + } + else if (seg >=2 && !(i%2 == 0) ) { + spline_Y.at(seg) = (TSpline3 *)fSplineIC->Get(Form("fspline_IC%d_Y",seg)); + } + } //End loop on histogram + + Spline.push_back(spline_X); + Spline.push_back(spline_Y); + + return Spline; +} diff --git a/Projects/AlPhaPha/2024/macro/chio/charge.cal b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/charge.cal similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/charge.cal rename to Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/charge.cal diff --git a/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/histo/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/histo/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..ad679641bc5f7248cfd099b9876816d918264951 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/DE_E_Spline/histo/ReadMe.md @@ -0,0 +1,4 @@ +# Histo Holder + +this directory exist to hold some histogram generated by the macro + diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/DECorr.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/DECorr.C similarity index 80% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/DECorr.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/DECorr.C index 2301a6381237fb698ade20aa6efe03de5be8d22a..5e6eb7d3eea92eeefe6356653819a83dc8bea771 100644 --- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/DECorr.C +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/DECorr.C @@ -21,7 +21,7 @@ void DECorr(bool cut = false, bool spline = false) { // Loading var //=========================================================================================================== TChain* chain = new TChain("PhysicsTree"); - chain->Add("../../../root/analysis/VamosCalib241.root"); + chain->Add("../../../root/analysis/VamosCalib247.root"); TICPhysics* IC = new TICPhysics() ; double FF_IC_X, FF_IC_Y, FF_V13; @@ -109,16 +109,28 @@ void DECorr(bool cut = false, bool spline = false) { //Defining output histo TH2F* hDE_E = new TH2F("DE_E","DE_E",1000,0,22000,1000,0,28000); + TH2F* hDE_E_splined = new TH2F("DE_E_splined","DE_E_splined",1000,0,22000,1000,0,28000); TH2F* hDE_Ebis = new TH2F("DE_Ebis","DE_Ebis",1000,0,22000,1000,0,24000); + + TH2F* hDE_Y = new TH2F("DE_Y","DE_Y",1000,-100,100,1000,0,22000); TH2F* hDE_Y_splined = new TH2F("DE_Ysplined","DE_Ysplined",1000,-100,100,1000,0,22000); + TH2F* hDE_Y_splined_nocut = new TH2F("DE_Ysplined_nocut","DE_Ysplined_nocut",1000,-100,100,1000,0,22000); + TH2F* hIC_Y = new TH2F("IC_Y","IC_Y",1000,-100,100,1000,0,22000); + TH2F* hIC_Y_splined = new TH2F("IC_Ysplined","IC_Ysplined",1000,-100,100,1000,0,22000); + + TH2F* hDE_Y_corr = new TH2F("DE_Ycorr","DE_Ycorr",1000,-100,100,1000,0,22000); + TH2F* hDE_Y_corr_nocut = new TH2F("DE_Ycorr_nocut","DE_Ycorr_nocut",1000,-100,100,1000,0,22000); + TH2F* hDE_Y_bis = new TH2F("DE_Ybis","DE_Ybis",1000,-100,100,1000,0,22000); TH2F* hDEbis_Y_corr = new TH2F("DE_Ybiscorr","DE_Ybiscorr",1000,-100,100,1000,0,22000); + TH2F* hDE_E_corr = new TH2F("DE_Ecorr","DE_Ecorr",1000,0,22000,1000,0,28000); TH2F* hDE_Ebis_corr = new TH2F("DE_Ebiscorr","DE_Ebiscorr",1000,0,22000,1000,0,24000); TH2F* hDE_E_Recur = new TH2F("DE_E_Recur","DE_E_Recur",1000,0,22000,1000,0,28000); + TH2F* hDE_V = new TH2F("DE_V","DE_V",1000,0,5,1000,0,28000); // Def Lim spline double Ymin = -100 , Ymax =100; @@ -174,8 +186,8 @@ void DECorr(bool cut = false, bool spline = false) { }//endloop seg - double DE = 0 , DE_splined=0,E =0, Ecorr ,DE_Ycorr=0, DE_Ybis=0, DE_Y_Recur=0; - + double DE = 0 , DE_splined=0 ,DE_corr=0, DE_Ybis=0, DE_Y_Recur=0; + double E =0, Ecorr=0; for (int seg = 0 ; seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){ if (seg >4){ E += IC->fIC_raw[seg] ; @@ -183,23 +195,39 @@ void DECorr(bool cut = false, bool spline = false) { } } + + + // ********************* DE setter ********************* double IC1corr = (IC->fIC_raw[1]*(1-0.000686068*FF_IC_Y))*(1-4.88238e-05*FF_IC_Y+7.40395e-06*FF_IC_Y*FF_IC_Y); double DE_Bis = 0.5*(IC1corr+IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; - DE = 0.5*(IC->fIC_raw[0]+ IC->fIC_raw[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; - //DE_splined = 0.5*(ICcorr_Y[0]+ ICcorr_Y[1] +ICcorr_Y[2]+ICcorr_Y[3])+ICcorr_Y[4]; - DE_splined = 0.5*( ICcorr_Y[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + DE = 0.5*(ICcorr_Y.at(0)+ IC->fIC_raw[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + DE_splined = 0.5*(ICcorr_Y[0]+ ICcorr_Y[1] +ICcorr_Y[2]+ICcorr_Y[3])+ICcorr_Y[4]; + //DE_splined = 0.5*( ICcorr_Y[1] +IC->fIC_raw[2]+IC->fIC_raw[3])+IC->fIC_raw[4]; + + + //************* Cut ****************** + bool CutV = abs( FF_V13-3.94)<0.01; + bool CutVbis = abs( FF_V13-3.94)<0.01; + + //bool CutV = true; + //bool CutVbis = true; + + //***********Fill histo************* - //bool CutV = FF_V13 > 4.2 && FF_V13 <=4.3; - //bool CutV = true; //nocut if (FF_IC_Y >Ymin && FF_IC_Y <Ymax ){ - //hDE_E->Fill(E,DE); - hDE_E->Fill(E,DE_splined); + + //*************Init DE_E***************** + hDE_E->Fill(E,DE); + hDE_E_splined->Fill(E,DE_splined); hDE_Ebis->Fill(E,DE_Bis); - if (spline== true && FF_IC_Y >Ymin && FF_IC_Y<Ymax ){ - DE_Ycorr = DE_splined * splineDEcorr->Eval(0) / splineDEcorr->Eval(FF_IC_Y); - hDE_E_corr->Fill(E,DE_Ycorr); + hDE_V->Fill(FF_V13,DE_splined); + + //******* Coor DE ************ + if (spline== true ){ + DE_corr = DE_splined * splineDEcorr->Eval(0) / splineDEcorr->Eval(FF_IC_Y); + hDE_E_corr->Fill(E,DE_corr); DE_Ybis = DE_Bis * splineDEbis->Eval(0) / splineDEbis->Eval(FF_IC_Y); hDE_Ebis_corr->Fill(E,DE_Ybis); @@ -207,26 +235,34 @@ void DECorr(bool cut = false, bool spline = false) { DE_Y_Recur = DE_splined; for (int i=0; i<vsplineDE.size() ; i++){ - DE_Y_Recur = DE_Y_Recur * vsplineDE.at(i)->Eval(0) / vsplineDE.at(i)->Eval(FF_IC_Y); + DE_Y_Recur = DE_Y_Recur * vsplineDE.at(i)->Eval(0) / vsplineDE.at(i)->Eval(FF_IC_Y); } - hDE_E_Recur->Fill(E,DE_Y_Recur); - } + hDE_E_Recur->Fill(E,DE_Y_Recur); + } + else { - DE_Ycorr = DE_splined; - hDE_E_corr->Fill(E,DE_Ycorr); + DE_corr = DE_splined; + hDE_E_corr->Fill(E,DE_corr); DE_Ybis = DE_Bis ; hDE_Ebis_corr->Fill(E,DE_Ybis); } - //bool CutV = CutZ->IsInside(E,DE_splined); - bool CutV = CutZ->IsInside(E,DE_Y_Recur); - bool CutVbis = CutZbis->IsInside(E,DE_Bis); - - if (cut == true && CutV) { - hDE_Y->Fill(FF_IC_Y,DE_splined); - //hDE_Y_corr->Fill(FF_IC_Y,DE_splined); - hDE_Y_corr->Fill(FF_IC_Y,DE_Y_Recur); + bool CutCharge = CutZ->IsInside(FF_V13,DE_splined); + //bool CutChargeBis = CutZ->IsInside(E,DE_Y_Recur); + //bool CutVbis = CutZbis->IsInside(E,DE_Bis); + // DE_Y in a cut + + hDE_Y_corr_nocut->Fill(FF_IC_Y,DE); + hDE_Y_splined_nocut->Fill(FF_IC_Y,DE_splined); + if (cut == true && CutV && CutCharge) { + + hDE_Y->Fill(FF_IC_Y,DE); + hDE_Y_splined->Fill(FF_IC_Y,DE_splined); + hDE_Y_corr->Fill(FF_IC_Y,DE_corr); + + hIC_Y->Fill(FF_IC_Y,IC->fIC_raw[1]); + hIC_Y_splined->Fill(FF_IC_Y,ICcorr_Y.at(1)); }//end cut else {;} @@ -243,9 +279,9 @@ void DECorr(bool cut = false, bool spline = false) { TSpline3 *splineDE, *osplineDEbis; if (spline == true){ - splineDE = MakeSpline(hDE_Y_corr,0,Ymin,Ymax,0,23000); + splineDE = MakeSpline(hDE_Y_splined,0,Ymin,Ymax,0,23000); osplineDEbis = MakeSpline(hDE_Y_bis,1,Ymin,Ymax,0,23000); - TFile *fSpline = new TFile("Output/splineDE.root","update"); + TFile *fSpline = new TFile("Output/splineDE.root","recreate"); splineDE->SetName("SplineDe_0"); splineDE->Write(); osplineDEbis->SetName("SplineDebis"); @@ -260,17 +296,28 @@ void DECorr(bool cut = false, bool spline = false) { c->Divide(2,2); c->cd(1); gPad->SetLogz(); - hDE_Y_corr->ProfileX()->Draw(); + hDE_Y->ProfileX()->Draw(); c->cd(2); gPad->SetLogz(); - hDE_Y->ProfileX()->Draw(); + hDE_Y_splined->ProfileX()->Draw(); c->cd(3); gPad->SetLogz(); - hDEbis_Y_corr->ProfileX()->Draw(); + hIC_Y->ProfileX()->Draw(); c->cd(4); gPad->SetLogz(); - hDE_Y_bis->ProfileX()->Draw(); + hIC_Y_splined->ProfileX()->Draw(); + + TCanvas *c4 = new TCanvas("c4","c4",1500,1000); + c4->Divide(2); + c4->cd(1); + hDE_Y_splined_nocut->ProfileX()->Draw(); + c4->cd(2); + hDE_Y_corr_nocut->ProfileX()->Draw(); + + + TCanvas *c1 = new TCanvas("c1","c1",1500,1000); + hDE_V->Draw(); TCanvas* c2 = new TCanvas("c2","c2",1500,1000); c2->Divide(2 + 3*spline); @@ -283,10 +330,10 @@ void DECorr(bool cut = false, bool spline = false) { if (spline){ c2->cd(3); gPad->SetLogz(); - hDE_E_corr->Draw(); + hDE_E_splined->Draw(); c2->cd(4); gPad->SetLogz(); - hDE_E_Recur->Draw(); + hDE_E_corr->Draw(); c2->cd(5); gPad->SetLogz(); hDE_Ebis_corr->Draw(); diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/ICCorr.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/ICCorr.C diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/IC_Dampen_Recombination.cxx b/Projects/AlPhaPha/2024/macro/chio/YCalibration/IC_Dampen_Recombination.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/IC_Dampen_Recombination.cxx rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/IC_Dampen_Recombination.cxx diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/IC_Dampen_Recombination.h b/Projects/AlPhaPha/2024/macro/chio/YCalibration/IC_Dampen_Recombination.h similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/IC_Dampen_Recombination.h rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/IC_Dampen_Recombination.h diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/CutZ.cxx b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/CutZ.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/CutZ.cxx rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/CutZ.cxx diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/DECorrParra.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/DECorrParra.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/DECorrParra.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/DECorrParra.C diff --git a/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotChio.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotChio.C new file mode 100644 index 0000000000000000000000000000000000000000..c3b8424dea658e413d07e00a2c918643bc954627 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotChio.C @@ -0,0 +1,21 @@ +#include <TCanvas.h> +#include <TFile.h> +#include <TGraph.h> +#include <TH2.h> +#include <TTree.h> + +void PlotChio(){ + + TFile *f = new TFile("../../../root/analysis/VamosCalib241.root"); + TTree *tree = (TTree*) f->Get("PhysicsTree"); + + + TCanvas *c1 = new TCanvas("c1","c1",1200,600); + + TH2F *h = new TH2F("h","h",1000,-800,800,1000,-160,160); + tree->Draw("FF_IC_Y:FF_IC_X>>h","","colz"); + h->GetXaxis()->SetTitle("X"); + h->GetYaxis()->SetTitle("Y"); + + +} diff --git a/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotOnline.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotOnline.C new file mode 100644 index 0000000000000000000000000000000000000000..113fa6f5223d4488fc2ea7a43620e05bc4844b4a --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Legacy/PlotOnline.C @@ -0,0 +1,15 @@ + +#include <TF1.h> +#include <TFile.h> +#include <TSpline.h> + +void PlotOnline(){ + + TF1 *f1 = new TF1("Fonction Online", "(1-0.000686068*x)*(1-4.88238e-05*x+7.40395e-06*x*x)", -100, 100); + + + TFile *fSplineIC = new TFile("Output/spline_P2P_2024.root","open"); + TSpline3 *spline_X = (TSpline3 *)fSplineIC->Get("fspline_IC1_Y"); + + f1->Draw(); +} diff --git a/Projects/AlPhaPha/2024/macro/chio/YCalibration/Output/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Output/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..612bb5848913890a39168d1cdf4e806b3cf355fc --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/Output/ReadMe.md @@ -0,0 +1,3 @@ +# Output + +Directory essential for pathing diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ReadMe.md b/Projects/AlPhaPha/2024/macro/chio/YCalibration/ReadMe.md similarity index 66% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ReadMe.md rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/ReadMe.md index 1541c4dd52def5128368bc7f8696bc783bf7030e..10a6324c37f70ab764edc66abd7e7821b75eab84 100644 --- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ReadMe.md +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/ReadMe.md @@ -13,9 +13,13 @@ of the electron by the grid. ## The code -SplineXY.C serve the purpose of creating this spline and storing int a .root +SplineChioXY.C serve the purpose of creating this spline and storing int a .root file. -## Devel +SplineChioAllXY.C make the spline for all section of the chio -Apparently the main correction must come from the correction of the DE +SplineChioP2P scale the i section from the i-1 one + +DECorr.C plot the DE_E with several correction compared + +IC_Dampen_recombi try a expo fit diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioAllXY.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioAllXY.C similarity index 99% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioAllXY.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioAllXY.C index a1e253b60b7cd695d910b2caa1411d2bd359576a..c1e4e3769710416d68149f4d6df5bdbe346e6379 100644 --- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioAllXY.C +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioAllXY.C @@ -93,7 +93,7 @@ void HistoFiller(bool cut) { // Input and setters TChain* chain = new TChain("PhysicsTree"); - chain->Add("../../../root/analysis/VamosCalib241.root"); + chain->Add("../../../root/analysis/VamosCalib247.root"); TICPhysics* IC = new TICPhysics() ; double FF_IC_X, FF_IC_Y; diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioP2P.C similarity index 99% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioP2P.C index 65e11afa92e9540cfd74e5eb27117674c166deb3..b7f9f49fdc086db467ce4415e16816398b183b20 100644 --- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C +++ b/Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioP2P.C @@ -53,7 +53,8 @@ void SplineChioP2P() { NCallSpline+=1; SplineAllIC.at(1)= (SplineICurrent); // - //SplineAllIC.erase(SplineAllIC.begin() + 1); //activate this to not make the + SplineAllIC.erase(SplineAllIC.begin() + 1); + ///activate this to not make the //spline of IC1 diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioXY.C b/Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioXY.C similarity index 100% rename from Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioXY.C rename to Projects/AlPhaPha/2024/macro/chio/YCalibration/SplineChioXY.C diff --git a/Projects/AlPhaPha/2024/macro/mwpc/HistoPosFiller.cxx b/Projects/AlPhaPha/2024/macro/mwpc/Linearisation/HistoPosFiller.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/mwpc/HistoPosFiller.cxx rename to Projects/AlPhaPha/2024/macro/mwpc/Linearisation/HistoPosFiller.cxx diff --git a/Projects/AlPhaPha/2024/macro/mwpc/LinearisationTransfo.cxx b/Projects/AlPhaPha/2024/macro/mwpc/Linearisation/LinearisationTransfo.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/mwpc/LinearisationTransfo.cxx rename to Projects/AlPhaPha/2024/macro/mwpc/Linearisation/LinearisationTransfo.cxx diff --git a/Projects/AlPhaPha/2024/macro/mwpc/LinearisationTxt.cxx b/Projects/AlPhaPha/2024/macro/mwpc/Linearisation/LinearisationTxt.cxx similarity index 100% rename from Projects/AlPhaPha/2024/macro/mwpc/LinearisationTxt.cxx rename to Projects/AlPhaPha/2024/macro/mwpc/Linearisation/LinearisationTxt.cxx diff --git a/Projects/AlPhaPha/2024/macro/mwpc/ReadMe.md b/Projects/AlPhaPha/2024/macro/mwpc/Linearisation/ReadMe.md similarity index 100% rename from Projects/AlPhaPha/2024/macro/mwpc/ReadMe.md rename to Projects/AlPhaPha/2024/macro/mwpc/Linearisation/ReadMe.md diff --git a/Projects/AlPhaPha/2024/macro/mwpc/Toff/ToffGenerator.cxx b/Projects/AlPhaPha/2024/macro/mwpc/Toff/ToffGenerator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4d01c7cb3ae2c3efe91f126dd353c4580712d7d0 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/mwpc/Toff/ToffGenerator.cxx @@ -0,0 +1,487 @@ +#include "TTimeData.h" +#include <TCanvas.h> +#include <TChain.h> +#include <TF1.h> +#include <TFile.h> +#include <TH2.h> +#include <TLatex.h> +#include <iostream> +using namespace std; + +vector<int> SortSection(UShort_t STargFocal[2]); +vector<double> ToffCalc(vector<double> ToffP2P); + +void ToffGenerator(bool Create = true ){ + + //=========================================================================================================== + // Setters + //=========================================================================================================== + + TChain* chain = new TChain("PhysicsTree"); + chain->Add("../../../root/analysis/VamosCalib247.root"); + + + Int_t M13 , M14, M23, M24 ;// we will fetch multiplicity during + // the getentry + + UShort_t S13[20] , S14[20] , S23[20] , S24[20]; + + TTimeData *Time = new TTimeData(); + + + chain->SetBranchStatus("MTOF_FP0_T0VN", true); + chain->SetBranchAddress("MTOF_FP0_T0VN", &S13); + + chain->SetBranchStatus("MTOF_FP0_T1VN", true); + chain->SetBranchAddress("MTOF_FP0_T1VN", &S14); + + chain->SetBranchStatus("MTOF_FP1_T0VN", true); + chain->SetBranchAddress("MTOF_FP1_T0VN", &S23); + + chain->SetBranchStatus("MTOF_FP1_T1VN", true); + chain->SetBranchAddress("MTOF_FP1_T1VN", &S24); + + chain->SetBranchStatus("Time", true); + chain->SetBranchAddress("Time", &Time); + + //=========================================================================================================== + // Histograms + //=========================================================================================================== + + TH2F *hToff13; + TH2F *hToff14; + TH2F *hToff23; + TH2F *hToff24; + + double xmin[4], xmax[4]; + double ymin[4], ymax[4]; + int binx = 20 , biny = 400; + + xmin[0] = 0 ; xmax[0] = 20 ; ymin[0] = -10 ; ymax[0] = 10 ; + xmin[1] = 0 ; xmax[1] = 20 ; ymin[1] = -10 ; ymax[1] = 10 ; + xmin[2] = 0 ; xmax[2] = 20 ; ymin[2] = -10 ; ymax[2] = 10 ; + xmin[3] = 0 ; xmax[3] = 20 ; ymin[3] = -10 ; ymax[3] = 10 ; + + if (Create == true){ + + hToff13 = new TH2F("Toff13","Toff13",binx ,xmin[0] , xmax[0], biny, ymin[0], ymax[0]); + hToff14 = new TH2F("Toff14","Toff14",binx ,xmin[1] , xmax[1], biny, ymin[1], ymax[1]); + hToff23 = new TH2F("Toff23","Toff23",binx ,xmin[2] , xmax[2], biny, ymin[2], ymax[2]); + hToff24 = new TH2F("Toff24","Toff24",binx ,xmin[3] , xmax[3], biny, ymin[3], ymax[3]); + + //=========================================================================================================== + // Loop on entries + //=========================================================================================================== + int Nentries = chain->GetEntries(); + //int Nentries = 1000000; + auto start = std::chrono::high_resolution_clock::now(); + + for (int e = 0; e < Nentries; e++) { + + chain->GetEntry(e); + + if (e % 100000 == 0 && e > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / e; + double timeLeft = avgTimePerIteration * (Nentries - e); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } + + // Get Multiplicity + M13 = Time->GetMWPC13Mult(); + M14 = Time->GetMWPC14Mult(); + M23 = Time->GetMWPC23Mult(); + M24 = Time->GetMWPC24Mult(); + + + + if (M13 == 2 && (abs(S13[0]-S13[1]) == 1)){ + vector<int> Pos = SortSection(S13); + hToff13->Fill(S13[0],Time->GetTime_MWPC13(Pos[0]) - Time->GetTime_MWPC13(Pos[1])); + } + if (M23 == 2 && (abs(S23[0]-S23[1]) == 1)){ + vector<int> Pos = SortSection(S23); + hToff23->Fill(S23[0],Time->GetTime_MWPC23(Pos[0]) - Time->GetTime_MWPC23(Pos[1])); + } + + if (M14 == 2 && (abs(S14[0]-S14[1]) == 1)){ + vector<int> Pos = SortSection(S14); + hToff14->Fill(S14[0],Time->GetTime_MWPC14(Pos[0]) - Time->GetTime_MWPC14(Pos[1])); + } + + if (M24 == 2 && (abs(S24[0]-S24[1]) == 1)){ + vector<int> Pos = SortSection(S24); + hToff24->Fill(S24[0],Time->GetTime_MWPC24(Pos[0]) - Time->GetTime_MWPC24(Pos[1])); + } + } // End loop event + + TFile *out = new TFile("output/ToffHisto.root","recreate"); + hToff13->Write(); + hToff14->Write(); + hToff23->Write(); + hToff24->Write(); + }// end if create + + else { + + TFile *in = new TFile("output/ToffHisto.root","open"); + hToff13 = (TH2F*)in->Get("Toff13"); + hToff14 = (TH2F*)in->Get("Toff14"); + hToff23 = (TH2F*)in->Get("Toff23"); + hToff24 = (TH2F*)in->Get("Toff24"); + } + + int MinX = 2; + hToff13->SetMinimum(MinX); + hToff14->SetMinimum(MinX); + hToff23->SetMinimum(MinX); + hToff24->SetMinimum(MinX); + //=========================================================================================================== + // Proj fit + //=========================================================================================================== + TCanvas* c13 = new TCanvas("c13", "Toff13", 1800, 1600); + c13->Divide(5, 4); // Adjust rows/columns to fit the number of bins (e.g., 20 bins here) + + TCanvas* c14 = new TCanvas("c14", "Toff14", 1800, 1600); + c14->Divide(5, 4); // Adjust rows/columns to fit the number of bins (e.g., 20 bins here) + + TCanvas* c23 = new TCanvas("c23", "Toff23", 1800, 1600); + c23->Divide(5, 4); // Adjust rows/columns to fit the number of bins (e.g., 20 bins here) + + TCanvas* c24 = new TCanvas("c24", "Toff24", 1800, 1600); + c24->Divide(5, 4); // Adjust rows/columns to fit the number of bins (e.g., 20 bins here) + + vector<double> P2PToff13(19), P2PToff14(19) , P2PToff23(19), P2PToff24(19); + + // Loop through bins and draw each fit + for (int binX = 1; binX <= hToff13->GetNbinsX()-1; ++binX) { + + c13->cd(binX); + + // Create a projection along the Y-axis for the current X-bin + TH1F* proj = (TH1F*)hToff13->ProjectionY(Form("proj_bin13%d", binX), binX, binX); + proj->SetMinimum(MinX); + + // Fit the projection with a Gaussian + TF1* fit = new TF1(Form("fit_bin%d", binX), "gaus",-5,5); + + // Select subpad and draw + proj->Fit(fit,"R"); // Suppress output with "Q" + proj->Draw(); + fit->SetLineColor(kRed); // Optional: Differentiate fit line + fit->Draw("SAME"); + + // Retrieve fit parameters + double mean = fit->GetParameter(1); + double sigma = fit->GetParameter(2); + P2PToff13.at(binX-1) = mean; + + // Add fit results to the subpad using TLatex + TLatex text; + text.SetNDC(); + text.SetTextSize(0.05); + text.SetTextAlign(13); // Align at top-left corner + text.DrawLatex(0.15, 0.85, Form("#mu = %.2f", mean)); + text.DrawLatex(0.15, 0.75, Form("#sigma = %.2f", sigma)); + + + // Save the mean to the text file + + } + // Display the canvas + c13->Update(); + + // Loop through bins and draw each fit + for (int binX = 1; binX <= hToff14->GetNbinsX()-1; ++binX) { + + c14->cd(binX); + + // Create a projection along the Y-axis for the current X-bin + TH1F* proj = (TH1F*)hToff14->ProjectionY(Form("proj_bin14%d", binX), binX, binX); + proj->SetMinimum(MinX); + + // Fit the projection with a Gaussian + TF1* fit = new TF1(Form("fit_bin%d", binX), "gaus"); + + // Select subpad and draw + proj->Fit(fit); // Suppress output with "Q" + proj->Draw(); + fit->SetLineColor(kRed); // Optional: Differentiate fit line + fit->Draw("SAME"); + + // Retrieve fit parameters + double mean = fit->GetParameter(1); + double sigma = fit->GetParameter(2); + P2PToff14.at(binX-1) = mean; + + + + // Add fit results to the subpad using TLatex + TLatex text; + text.SetNDC(); + text.SetTextSize(0.05); + text.SetTextAlign(13); // Align at top-left corner + text.DrawLatex(0.15, 0.85, Form("#mu = %.2f", mean)); + text.DrawLatex(0.15, 0.75, Form("#sigma = %.2f", sigma)); + + + // Save the mean to the text file + + } + // Display the canvas + c14->Update(); + + + // Loop through bins and draw each fit + for (int binX = 1; binX <= hToff23->GetNbinsX()-1; ++binX) { + + c23->cd(binX); + + // Create a projection along the Y-axis for the current X-bin + TH1F* proj = (TH1F*)hToff23->ProjectionY(Form("proj_bin23%d", binX), binX, binX); + proj->SetMinimum(MinX); + + // Fit the projection with a Gaussian + TF1* fit = new TF1(Form("fit_bin%d", binX), "gaus"); + + // Select subpad and draw + proj->Fit(fit); // Suppress output with "Q" + proj->Draw(); + fit->SetLineColor(kRed); // Optional: Differentiate fit line + fit->Draw("SAME"); + + // Retrieve fit parameters + double mean = fit->GetParameter(1); + double sigma = fit->GetParameter(2); + P2PToff23.at(binX-1) = mean; + + // Add fit results to the subpad using TLatex + TLatex text; + text.SetNDC(); + text.SetTextSize(0.05); + text.SetTextAlign(13); // Align at top-left corner + text.DrawLatex(0.15, 0.85, Form("#mu = %.2f", mean)); + text.DrawLatex(0.15, 0.75, Form("#sigma = %.2f", sigma)); + + + // Save the mean to the text file + + } + // Display the canvas + c23->Update(); + + // Loop through bins and draw each fit + for (int binX = 1; binX <= hToff24->GetNbinsX()-1; ++binX) { + + c24->cd(binX); + + // Create a projection along the Y-axis for the current X-bin + TH1F* proj = (TH1F*)hToff24->ProjectionY(Form("proj_bin24%d", binX), binX, binX); + proj->SetMinimum(MinX); + + // Fit the projection with a Gaussian + TF1* fit = new TF1(Form("fit_bin%d", binX), "gaus"); + + // Select subpad and draw + proj->Fit(fit,"Q"); // Suppress output with "Q" + proj->Draw(); + fit->SetLineColor(kRed); // Optional: Differentiate fit line + fit->Draw("SAME"); + + // Retrieve fit parameters + double mean = fit->GetParameter(1); + double sigma = fit->GetParameter(2); + P2PToff24.at(binX-1) = mean; + + // Add fit results to the subpad using TLatex + TLatex text; + text.SetNDC(); + text.SetTextSize(0.05); + text.SetTextAlign(13); // Align at top-left corner + text.DrawLatex(0.15, 0.85, Form("#mu = %.2f", mean)); + text.DrawLatex(0.15, 0.75, Form("#sigma = %.2f", sigma)); + + + // Save the mean to the text file + + } + // Display the canvas + c24->Update(); + + //=========================================================================================================== + // Saving correction + //=========================================================================================================== + + + //First we get the absolute correction to use on each section + vector<double> Toff13, Toff14, Toff23, Toff24; + Toff13 = ToffCalc(P2PToff13); + Toff23 = ToffCalc(P2PToff23); + Toff14 = ToffCalc(P2PToff14); + Toff24 = ToffCalc(P2PToff24); + + //Save it in a txt file + ofstream o13("output/Toff13.txt"); + ofstream o23("output/Toff23.txt"); + ofstream o14("output/Toff14.txt"); + ofstream o24("output/Toff24.txt"); + + for (auto &elem : Toff13) o13 << elem << endl; + for (auto &elem : Toff14) o14 << elem << endl; + for (auto &elem : Toff23) o23 << elem << endl; + for (auto &elem : Toff24) o24 << elem << endl; + + + //=========================================================================================================== + // Testing correction + //=========================================================================================================== + + + TH2F* hCorrToff13 = new TH2F("CorrToff13","CorrToff13",binx ,xmin[0] , xmax[0], biny, ymin[0], ymax[0]); + TH2F* hCorrToff14 = new TH2F("CorrToff14","CorrToff14",binx ,xmin[1] , xmax[1], biny, ymin[1], ymax[1]); + TH2F* hCorrToff23 = new TH2F("CorrToff23","CorrToff23",binx ,xmin[2] , xmax[2], biny, ymin[2], ymax[2]); + TH2F* hCorrToff24 = new TH2F("CorrToff24","CorrToff24",binx ,xmin[3] , xmax[3], biny, ymin[3], ymax[3]); + + + int Nentries = chain->GetEntries(); + //int Nentries = 1000000; + auto start = std::chrono::high_resolution_clock::now(); + + for (int e = 0; e < Nentries; e++) { + + chain->GetEntry(e); + + if (e % 100000 == 0 && e > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / e; + double timeLeft = avgTimePerIteration * (Nentries - e); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } + + // Get Multiplicity + M13 = Time->GetMWPC13Mult(); + M14 = Time->GetMWPC14Mult(); + M23 = Time->GetMWPC23Mult(); + M24 = Time->GetMWPC24Mult(); + + + + if (M13 == 2 && (abs(S13[0]-S13[1]) == 1)){ + vector<int> Pos = SortSection(S13); + + if (S13[0] == 0) hCorrToff13->Fill(S13[0],Time->GetTime_MWPC13(Pos[0]) - (Time->GetTime_MWPC13(Pos[1]) + Toff13.at(0) )); + + else{ + hCorrToff13->Fill(S13[0],(Time->GetTime_MWPC13(Pos[0]) + Toff13.at(S13[0]-1)) - (Time->GetTime_MWPC13(Pos[1]) + Toff13.at(S13[1]-1))); + } + + } + + + if (M23 == 2 && (abs(S23[0]-S23[1]) == 1)){ + vector<int> Pos = SortSection(S23); + if (S23[0] == 0) hCorrToff23->Fill(S23[0],Time->GetTime_MWPC23(Pos[0]) - (Time->GetTime_MWPC23(Pos[1]) + Toff23.at(0) )); + + else{ + hCorrToff23->Fill(S23[0],(Time->GetTime_MWPC23(Pos[0]) + Toff23.at(S23[0]-1)) - (Time->GetTime_MWPC23(Pos[1]) + Toff23.at(S23[1]-1))); + } + } + + + if (M14 == 2 && (abs(S14[0]-S14[1]) == 1)){ + vector<int> Pos = SortSection(S14); + if (S14[0] == 0) hCorrToff14->Fill(S14[0],Time->GetTime_MWPC14(Pos[0]) - (Time->GetTime_MWPC14(Pos[1]) + Toff14.at(0) )); + + else{ + hCorrToff14->Fill(S14[0],(Time->GetTime_MWPC14(Pos[0]) + Toff14.at(S14[0]-1)) - (Time->GetTime_MWPC14(Pos[1]) + Toff14.at(S14[1]-1))); + } + } + + + if (M24 == 2 && (abs(S24[0]-S24[1]) == 1)){ + vector<int> Pos = SortSection(S24); + if (S24[0] == 0) hCorrToff24->Fill(S24[0],Time->GetTime_MWPC24(Pos[0]) - (Time->GetTime_MWPC24(Pos[1]) + Toff24.at(0) )); + + else{ + hCorrToff24->Fill(S24[0],(Time->GetTime_MWPC24(Pos[0]) + Toff24.at(S24[0]-1)) - (Time->GetTime_MWPC24(Pos[1]) + Toff24.at(S24[1]-1))); + } + } + + + } // End loop event + + //=========================================================================================================== + // Drawing canvas + //=========================================================================================================== + + TCanvas *c1 = new TCanvas("c1","c1"); + c1->Divide(2); + + c1->cd(1); + hToff13->Draw("colz"); + c1->cd(2); + hCorrToff13->Draw("colz"); + + TCanvas *c2 = new TCanvas("c2","c2"); + c2->Divide(2); + + c2->cd(1); + hToff23->Draw("colz"); + c2->cd(2); + hCorrToff23->Draw("colz"); + + + + TCanvas *c3 = new TCanvas("c3","c3"); + c3->Divide(2); + + c3->cd(1); + hToff14->Draw("colz"); + c3->cd(2); + hCorrToff14->Draw("colz"); + + + TCanvas *c4 = new TCanvas("c4","c4"); + c4->Divide(2); + + c4->cd(1); + hToff24->Draw("colz"); + c4->cd(2); + hCorrToff24->Draw("colz"); +} + +vector<int> SortSection(UShort_t STargFocal[2]){ + UShort_t FSection ,LSection ; + vector<int> Pos(2) ; + if (STargFocal[0]<STargFocal[1]){ + Pos[0] = 0 ; + Pos[1] = 1 ; + FSection = STargFocal[0]; + LSection = STargFocal[1]; + } + else { + Pos[0] = 1 ; + Pos[1] = 0 ; + FSection = STargFocal[1]; + LSection = STargFocal[0]; + } + + STargFocal[0] = FSection; + STargFocal[1] = LSection; + return Pos; +} + +vector<double> ToffCalc(vector<double> ToffP2P){ + + vector<double> res; + double Sum = 0; + for (int i=0; i<ToffP2P.size() ; i++){ + Sum += ToffP2P.at(i); + res.push_back(Sum); + } + return res; +} diff --git a/Projects/AlPhaPha/2024/macro/mwpc/Toff/output/ReadMe.md b/Projects/AlPhaPha/2024/macro/mwpc/Toff/output/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..b9c3d0261a8238e58145e56b1b1804a454f11bf7 --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/mwpc/Toff/output/ReadMe.md @@ -0,0 +1 @@ +# Output here diff --git a/Projects/AlPhaPha/2024/project.config b/Projects/AlPhaPha/2024/project.config index 685928aff9996c09fcd64ff7131a6f187082589e..b3a6c3e89cba9bba28d7917e6bbcaa0ca72c6549 100644 --- a/Projects/AlPhaPha/2024/project.config +++ b/Projects/AlPhaPha/2024/project.config @@ -1,6 +1,6 @@ Project e850 - %AnalysisOutput= ../../../../../../../../../ - AnalysisOutput= ./root/analysis + AnalysisOutput= ../../../../../../../../../ + %AnalysisOutput= ./root/analysis SimulationOutput= ./root/simulation EnergyLoss= ./EnergyLossTable diff --git a/Projects/AlPhaPha/DataMacro/Merger.C b/Projects/AlPhaPha/DataMacro/Merger.C index aea1e96403ffeb705ed143b8440f7f0de18f75c5..66c65707a18abfc391fc2071159fa1789e034faf 100644 --- a/Projects/AlPhaPha/DataMacro/Merger.C +++ b/Projects/AlPhaPha/DataMacro/Merger.C @@ -11,7 +11,7 @@ void Merger(int N, const char* outputDir, const char* outputFileName, const char continue; } merger.AddFile(fileName); // Add file to the merger - + cout << "Added file " << fileName << endl; // Display progress int progress = ((i + 1) * 100) / N; std::cout << "\rMerging files: " << progress << "% complete." << std::flush; diff --git a/Projects/AlPhaPha/DataMacro/output/ReadMe.md b/Projects/AlPhaPha/DataMacro/output/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..7f7cf92728778dc17d27c4bab8a9c12808786473 --- /dev/null +++ b/Projects/AlPhaPha/DataMacro/output/ReadMe.md @@ -0,0 +1,9 @@ +# How it works + +Please create a directory holding the data cut by Secator.C + +``` +mkdir run_RUNUMBER + +``` +and use secator to cut the data in the directory diff --git a/Projects/AlPhaPha/DataMacro/output/analysis/ReadMe.md b/Projects/AlPhaPha/DataMacro/output/analysis/ReadMe.md new file mode 100644 index 0000000000000000000000000000000000000000..91298cc8030a794f4558a4d27001a2a1aa29e82f --- /dev/null +++ b/Projects/AlPhaPha/DataMacro/output/analysis/ReadMe.md @@ -0,0 +1,9 @@ +# How it works + +Please create a directory holding the data analysed by the snakemake before +merger + +``` +mkdir run_RUNUMBER + +``` diff --git a/Projects/AlPhaPha/conversion/2024/ChainConvert.sh b/Projects/AlPhaPha/conversion/2024/ChainConvert.sh index fdffedb5e2d53aa3cd91e650c69db8c3483fec90..a3933aa0fc4702e222e307e792c020850e0808ac 100644 --- a/Projects/AlPhaPha/conversion/2024/ChainConvert.sh +++ b/Projects/AlPhaPha/conversion/2024/ChainConvert.sh @@ -3,11 +3,15 @@ max_jobs=20 # Set the maximum number of parallel jobs (cores) for run in {201..260}; do - while [ $(jobs | wc -l) -ge $max_jobs ]; do + while [ $(jobs -r | wc -l) -ge $max_jobs ]; do wait -n # Wait for at least one job to finish + echo "A job has finished. $(jobs -r | wc -l) jobs remaining." done - root "convert.C($run)" & + root -b -q "convert.C($run)" & + echo "Started job for run $run. $(jobs -r | wc -l) jobs currently running." done -wait # Wait for all jobs to finish +# Ensure all remaining jobs are completed +wait +echo "All jobs are complete." diff --git a/Projects/AlPhaPha/conversion/2024/convert.C b/Projects/AlPhaPha/conversion/2024/convert.C index 51574c3217b63cd54c6c330b563d0faac551ba9f..7346962e63dcb52699e88557745e089312eea49b 100644 --- a/Projects/AlPhaPha/conversion/2024/convert.C +++ b/Projects/AlPhaPha/conversion/2024/convert.C @@ -4,6 +4,7 @@ void convert(int run=204){ m_pista = new TPISTAData(); m_fpmw = new TFPMWData(); m_ic = new TICData(); + m_time = new TTimeData(); m_exogam = new TExogamCalData(); int Year = 2024; @@ -23,6 +24,7 @@ void convert(int run=204){ output_tree->Branch("PISTA","TPISTAData",&m_pista); output_tree->Branch("FPMW","TFPMWData",&m_fpmw); output_tree->Branch("IC","TICData",&m_ic); + output_tree->Branch("Time","TTimeData",&m_time); output_tree->Branch("Exogam","TExogamCalData",&m_exogam); output_tree->Branch("T_TMW0_FPMW0",&T_TMW0_FPMW0,"T_TMW0_FPMW0/F"); @@ -53,98 +55,132 @@ void convert(int run=204){ + auto start = std::chrono::high_resolution_clock::now(); int nentries = input_tree->GetEntries(); for(int i=0; i<nentries; i++){ Clear(); input_tree->GetEntry(i); - if(i%10000==0) cout << "\033[34m\rProcessing tree... " <<(double)i/nentries*100 << "\% done" << flush; + + + if (i % 100000 == 0 && i > 0 ) { + auto now = std::chrono::high_resolution_clock::now(); + std::chrono::duration<double> elapsed = now - start; + double avgTimePerIteration = elapsed.count() / i; + double timeLeft = avgTimePerIteration * (nentries - i); + + std::cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush; + } fVAMOS_TS_sec = TMWPat_0TS*1e-8; fPISTA_TS_sec = PISTA_TS*1e-8; // IC // - for(int i=0; i<11; i++){ + for (int i=0; i<ICRawM; i++){ + m_ic->SetIC_TS(ICRawTS[i]); m_ic->SetIC_Section(i+1); m_ic->SetIC_Charge(IC[i]); } + // Time // + + for (int i=0; i<MTOF_FP0_T0VM;i++){ + m_time->SetTS_MWPC13(MTOF_FP0_T0VTS[i]); + m_time->SetTime_MWPC13(MTOF_FP0_T0V[i]); + } + for (int i=0; i<MTOF_FP0_T1VM;i++){ + m_time->SetTS_MWPC14(MTOF_FP0_T1VTS[i]); + m_time->SetTime_MWPC14(MTOF_FP0_T1V[i]); + } + + for (int i=0; i<MTOF_FP1_T0VM;i++){ + m_time->SetTS_MWPC23(MTOF_FP1_T0VTS[i]); + m_time->SetTime_MWPC23(MTOF_FP1_T0V[i]); + } + + for (int i=0; i<MTOF_FP1_T1VM;i++){ + m_time->SetTS_MWPC24(MTOF_FP1_T1VTS[i]); + m_time->SetTime_MWPC24(MTOF_FP1_T1V[i]); + } + + + // -TMW1- // for(int p=0;p<TMW1_XRawM; p++){ - int strip = TMW1_XRawNr[p]; - double charge = TMW1_XRaw[p]; - m_fpmw->SetFPMW_X(1,strip,charge); + int strip = TMW1_XRawNr[p]; + double charge = TMW1_XRaw[p]; + m_fpmw->SetFPMW_X(1,strip,charge); } for(int p=0;p<TMW1_YRawM; p++){ - int strip = TMW1_YRawNr[p]; - double charge = TMW1_YRaw[p]; - m_fpmw->SetFPMW_Y(1,strip,charge); + int strip = TMW1_YRawNr[p]; + double charge = TMW1_YRaw[p]; + m_fpmw->SetFPMW_Y(1,strip,charge); } // -TMW2- // for(int p=0;p<TMW2_XRawM; p++){ - int strip = TMW2_XRawNr[p]; - double charge = TMW2_XRaw[p]; - m_fpmw->SetFPMW_X(2,strip,charge); + int strip = TMW2_XRawNr[p]; + double charge = TMW2_XRaw[p]; + m_fpmw->SetFPMW_X(2,strip,charge); } for(int p=0;p<TMW2_YRawM; p++){ - int strip = TMW2_YRawNr[p]; - double charge = TMW2_YRaw[p]; - m_fpmw->SetFPMW_Y(2,strip,charge); + int strip = TMW2_YRawNr[p]; + double charge = TMW2_YRaw[p]; + m_fpmw->SetFPMW_Y(2,strip,charge); } // -FPMW0- // for(int p=0;p<FPMW0_XRawM; p++){ - int strip = FPMW0_XRawNr[p]; - double charge = FPMW0_XRaw[p]; - m_fpmw->SetFPMW_X(3,strip,charge); + int strip = FPMW0_XRawNr[p]; + double charge = FPMW0_XRaw[p]; + m_fpmw->SetFPMW_X(3,strip,charge); } for(int p=0;p<FPMW0_YRawM; p++){ - int strip = FPMW0_YRawNr[p]; - double charge = FPMW0_YRaw[p]; - m_fpmw->SetFPMW_Y(3,strip,charge); + int strip = FPMW0_YRawNr[p]; + double charge = FPMW0_YRaw[p]; + m_fpmw->SetFPMW_Y(3,strip,charge); } // -FPMW1- // for(int p=0;p<FPMW1_XRawM; p++){ - int strip = FPMW1_XRawNr[p]; - double charge = FPMW1_XRaw[p]; - m_fpmw->SetFPMW_X(4,strip,charge); + int strip = FPMW1_XRawNr[p]; + double charge = FPMW1_XRaw[p]; + m_fpmw->SetFPMW_X(4,strip,charge); } for(int p=0;p<FPMW1_YRawM; p++){ - int strip = FPMW1_YRawNr[p]; - double charge = FPMW1_YRaw[p]; - m_fpmw->SetFPMW_Y(4,strip,charge); + int strip = FPMW1_YRawNr[p]; + double charge = FPMW1_YRaw[p]; + m_fpmw->SetFPMW_Y(4,strip,charge); } if(fVAMOS_TS_sec>0 || fPISTA_TS_sec>0){ - if(OutersVM<25){ - for(int p=0; p<Inner6MVM; p++){ - //if(Inner6MVM==2) cout << "********p= " << p << endl; - int crystal = Inner6MVN[p]; - double E = Inner6MV[p]; - double EHG = Inner20MV[p]; - double TDC = DeltaTV[p]; // Existe pas en 2024 - unsigned long long TS = Inner6MVTS[p]; - int seg = -1; - double outers1 = -1000; - double outers2 = -1000; - double outers3 = -1000; - double outers4 = -1000; - - //cout << "*****************mult= " << OutersVM << endl; - for(int i=0; i<OutersVM; i++){ - seg = OutersVN[i] - 4*crystal; - // cout << i << " " << OutersVN[i] << " " << crystal << " " << seg << endl; - if(seg==0) outers1 = OutersV[i]; - else if(seg==1) outers2 = OutersV[i]; - else if(seg==2) outers3 = OutersV[i]; - else if(seg==3) outers4 = OutersV[i]; - } - m_exogam->SetExo(crystal,E,EHG,TS,TDC,0,0,outers1,outers2,outers3,outers4); - //cout << outers1 << " " << outers2 << " " << outers3 << " " << outers4 << endl; - //if(Inner6MVM==2){ - // cout << "setting p= " << p << " " << outers1 << " " << outers2 << " " << outers3 << " " << outers4 << endl; - //} + if(OutersVM<25){ + for(int p=0; p<Inner6MVM; p++){ + //if(Inner6MVM==2) cout << "********p= " << p << endl; + int crystal = Inner6MVN[p]; + double E = Inner6MV[p]; + double EHG = Inner20MV[p]; + double TDC = DeltaTV[p]; // Existe pas en 2024 + unsigned long long TS = Inner6MVTS[p]; + int seg = -1; + double outers1 = -1000; + double outers2 = -1000; + double outers3 = -1000; + double outers4 = -1000; + + //cout << "*****************mult= " << OutersVM << endl; + for(int i=0; i<OutersVM; i++){ + seg = OutersVN[i] - 4*crystal; + // cout << i << " " << OutersVN[i] << " " << crystal << " " << seg << endl; + if(seg==0) outers1 = OutersV[i]; + else if(seg==1) outers2 = OutersV[i]; + else if(seg==2) outers3 = OutersV[i]; + else if(seg==3) outers4 = OutersV[i]; + } + m_exogam->SetExo(crystal,E,EHG,TS,TDC,0,0,outers1,outers2,outers3,outers4); + //cout << outers1 << " " << outers2 << " " << outers3 << " " << outers4 << endl; + //if(Inner6MVM==2){ + // cout << "setting p= " << p << " " << outers1 << " " << outers2 << " " << outers3 << " " << outers4 << endl; + //} + } } - } } if(fPISTA_TS_sec>0 || fVAMOS_TS_sec>0) @@ -159,145 +195,159 @@ void convert(int run=204){ /////////////////////////////////////////////////// void Clear(){ - m_fpmw->Clear(); - m_ic->Clear(); - m_pista->Clear(); - m_exogam->Clear(); + m_fpmw->Clear(); + m_ic->Clear(); + m_time->Clear(); + m_pista->Clear(); + m_exogam->Clear(); } /////////////////////////////////////////////////// void InitInputTree(){ - input_tree->SetBranchAddress("PISTA",&m_pista); - - // TAC - input_tree->SetBranchStatus("T_TMW1_FPMW0_C","true"); - input_tree->SetBranchAddress("T_TMW1_FPMW0_C",&T_TMW0_FPMW0); - input_tree->SetBranchStatus("T_TMW1_FPMW1_C","true"); - input_tree->SetBranchAddress("T_TMW1_FPMW1_C",&T_TMW0_FPMW1); - input_tree->SetBranchStatus("T_TMW2_FPMW0_C","true"); - input_tree->SetBranchAddress("T_TMW2_FPMW0_C",&T_TMW1_FPMW0); - input_tree->SetBranchStatus("T_TMW2_FPMW1_C","true"); - input_tree->SetBranchAddress("T_TMW2_FPMW1_C",&T_TMW1_FPMW1); - - // Pat - //input_tree->SetBranchStatus("MTOF_FP0_T0VN","true"); - //input_tree->SetBranchAddress("MTOF_FP0_T0VN",&fFPMWPat_0RawNr); - input_tree->SetBranchStatus("TMWPat_00TS","true"); - input_tree->SetBranchAddress("TMWPat_00TS",&TMWPat_0TS); - input_tree->SetBranchStatus("PISTA_TS","true"); - input_tree->SetBranchAddress("PISTA_TS",&PISTA_TS); - - //MTOF - - input_tree->SetBranchStatus("MTOF_FP0_T0VN","true"); - input_tree->SetBranchAddress("MTOF_FP0_T0VN",&MTOF_FP0_T0VN); - input_tree->SetBranchStatus("MTOF_FP1_T0VN","true"); - input_tree->SetBranchAddress("MTOF_FP1_T0VN",&MTOF_FP1_T0VN); - input_tree->SetBranchStatus("MTOF_FP0_T1VN","true"); - input_tree->SetBranchAddress("MTOF_FP0_T1VN",&MTOF_FP0_T1VN); - input_tree->SetBranchStatus("MTOF_FP1_T1VN","true"); - input_tree->SetBranchAddress("MTOF_FP1_T1VN",&MTOF_FP1_T1VN); - - input_tree->SetBranchStatus("MTOF_FP0_T0VM","true"); - input_tree->SetBranchAddress("MTOF_FP0_T0VM",&MTOF_FP0_T0VM); - input_tree->SetBranchStatus("MTOF_FP1_T0VM","true"); - input_tree->SetBranchAddress("MTOF_FP1_T0VM",&MTOF_FP1_T0VM); - input_tree->SetBranchStatus("MTOF_FP0_T1VM","true"); - input_tree->SetBranchAddress("MTOF_FP0_T1VM",&MTOF_FP0_T1VM); - input_tree->SetBranchStatus("MTOF_FP1_T1VM","true"); - input_tree->SetBranchAddress("MTOF_FP1_T1VM",&MTOF_FP1_T1VM); - - input_tree->SetBranchStatus("MTOF_FP0_T0V","true"); - input_tree->SetBranchAddress("MTOF_FP0_T0V",&MTOF_FP0_T0V); - input_tree->SetBranchStatus("MTOF_FP1_T0V","true"); - input_tree->SetBranchAddress("MTOF_FP1_T0V",&MTOF_FP1_T0V); - input_tree->SetBranchStatus("MTOF_FP0_T1V","true"); - input_tree->SetBranchAddress("MTOF_FP0_T1V",&MTOF_FP0_T1V); - input_tree->SetBranchStatus("MTOF_FP1_T1V","true"); - input_tree->SetBranchAddress("MTOF_FP1_T1V",&MTOF_FP1_T1V); - - - - // IC - input_tree->SetBranchStatus("IC","true"); - input_tree->SetBranchAddress("IC",&IC); - - // FPMW0-X - input_tree->SetBranchStatus("FPMW0_XRawM","true"); - input_tree->SetBranchAddress("FPMW0_XRawM",&FPMW0_XRawM); - input_tree->SetBranchStatus("FPMW0_XRaw","true"); - input_tree->SetBranchAddress("FPMW0_XRaw",FPMW0_XRaw); - input_tree->SetBranchStatus("FPMW0_XRawNr","true"); - input_tree->SetBranchAddress("FPMW0_XRawNr",FPMW0_XRawNr); - // FPMW0-Y - input_tree->SetBranchStatus("FPMW0_YRawM","true"); - input_tree->SetBranchAddress("FPMW0_YRawM",&FPMW0_YRawM); - input_tree->SetBranchStatus("FPMW0_YRaw","true"); - input_tree->SetBranchAddress("FPMW0_YRaw",FPMW0_YRaw); - input_tree->SetBranchStatus("FPMW0_YRawNr","true"); - input_tree->SetBranchAddress("FPMW0_YRawNr",FPMW0_YRawNr); - // FPMW1-X - input_tree->SetBranchStatus("FPMW1_XRawM","true"); - input_tree->SetBranchAddress("FPMW1_XRawM",&FPMW1_XRawM); - input_tree->SetBranchStatus("FPMW1_XRaw","true"); - input_tree->SetBranchAddress("FPMW1_XRaw",FPMW1_XRaw); - input_tree->SetBranchStatus("FPMW1_XRawNr","true"); - input_tree->SetBranchAddress("FPMW1_XRawNr",FPMW1_XRawNr); - // FPMW0-Y - input_tree->SetBranchStatus("FPMW1_YRawM","true"); - input_tree->SetBranchAddress("FPMW1_YRawM",&FPMW1_YRawM); - input_tree->SetBranchStatus("FPMW1_YRaw","true"); - input_tree->SetBranchAddress("FPMW1_YRaw",FPMW1_YRaw); - input_tree->SetBranchStatus("FPMW1_YRawNr","true"); - input_tree->SetBranchAddress("FPMW1_YRawNr",FPMW1_YRawNr); - // TMW1-X - input_tree->SetBranchStatus("TMW1_XRawM","true"); - input_tree->SetBranchAddress("TMW1_XRawM",&TMW1_XRawM); - input_tree->SetBranchStatus("TMW1_XRaw","true"); - input_tree->SetBranchAddress("TMW1_XRaw",TMW1_XRaw); - input_tree->SetBranchStatus("TMW1_XRawNr","true"); - input_tree->SetBranchAddress("TMW1_XRawNr",TMW1_XRawNr); - // TMW1-Y - input_tree->SetBranchStatus("TMW1_YRawM","true"); - input_tree->SetBranchAddress("TMW1_YRawM",&TMW1_YRawM); - input_tree->SetBranchStatus("TMW1_YRaw","true"); - input_tree->SetBranchAddress("TMW1_YRaw",TMW1_YRaw); - input_tree->SetBranchStatus("TMW1_YRawNr","true"); - input_tree->SetBranchAddress("TMW1_YRawNr",TMW1_YRawNr); - // TMW2-X - input_tree->SetBranchStatus("TMW2_XRawM","true"); - input_tree->SetBranchAddress("TMW2_XRawM",&TMW2_XRawM); - input_tree->SetBranchStatus("TMW2_XRaw","true"); - input_tree->SetBranchAddress("TMW2_XRaw",TMW2_XRaw); - input_tree->SetBranchStatus("TMW2_XRawNr","true"); - input_tree->SetBranchAddress("TMW2_XRawNr",TMW2_XRawNr); - // TMW2-Y - input_tree->SetBranchStatus("TMW2_YRawM","true"); - input_tree->SetBranchAddress("TMW2_YRawM",&TMW2_YRawM); - input_tree->SetBranchStatus("TMW2_YRaw","true"); - input_tree->SetBranchAddress("TMW2_YRaw",TMW2_YRaw); - input_tree->SetBranchStatus("TMW2_YRawNr","true"); - input_tree->SetBranchAddress("TMW2_YRawNr",TMW2_YRawNr); - // Exogam - input_tree->SetBranchStatus("Inner6MVM","true"); - input_tree->SetBranchAddress("Inner6MVM",&Inner6MVM); - input_tree->SetBranchStatus("Inner6MV","true"); - input_tree->SetBranchAddress("Inner6MV",Inner6MV); - input_tree->SetBranchStatus("Inner6MVN","true"); - input_tree->SetBranchAddress("Inner6MVN",Inner6MVN); - input_tree->SetBranchStatus("Inner6MVTS","true"); - input_tree->SetBranchAddress("Inner6MVTS",Inner6MVTS); - - input_tree->SetBranchStatus("OutersVM","true"); - input_tree->SetBranchAddress("OutersVM",&OutersVM); - input_tree->SetBranchStatus("OutersV","true"); - input_tree->SetBranchAddress("OutersV",OutersV); - input_tree->SetBranchStatus("OutersVN","true"); - input_tree->SetBranchAddress("OutersVN",OutersVN); - - input_tree->SetBranchStatus("Inner20MV","true"); - input_tree->SetBranchAddress("Inner20MV",Inner20MV); + input_tree->SetBranchAddress("PISTA",&m_pista); + + // TAC + input_tree->SetBranchStatus("T_TMW1_FPMW0_C","true"); + input_tree->SetBranchAddress("T_TMW1_FPMW0_C",&T_TMW0_FPMW0); + input_tree->SetBranchStatus("T_TMW1_FPMW1_C","true"); + input_tree->SetBranchAddress("T_TMW1_FPMW1_C",&T_TMW0_FPMW1); + input_tree->SetBranchStatus("T_TMW2_FPMW0_C","true"); + input_tree->SetBranchAddress("T_TMW2_FPMW0_C",&T_TMW1_FPMW0); + input_tree->SetBranchStatus("T_TMW2_FPMW1_C","true"); + input_tree->SetBranchAddress("T_TMW2_FPMW1_C",&T_TMW1_FPMW1); + + // Pat + //input_tree->SetBranchStatus("MTOF_FP0_T0VN","true"); + //input_tree->SetBranchAddress("MTOF_FP0_T0VN",&fFPMWPat_0RawNr); + input_tree->SetBranchStatus("TMWPat_00TS","true"); + input_tree->SetBranchAddress("TMWPat_00TS",&TMWPat_0TS); + input_tree->SetBranchStatus("PISTA_TS","true"); + input_tree->SetBranchAddress("PISTA_TS",&PISTA_TS); + + //MTOF + + input_tree->SetBranchStatus("MTOF_FP0_T0VN","true"); + input_tree->SetBranchAddress("MTOF_FP0_T0VN",&MTOF_FP0_T0VN); + input_tree->SetBranchStatus("MTOF_FP1_T0VN","true"); + input_tree->SetBranchAddress("MTOF_FP1_T0VN",&MTOF_FP1_T0VN); + input_tree->SetBranchStatus("MTOF_FP0_T1VN","true"); + input_tree->SetBranchAddress("MTOF_FP0_T1VN",&MTOF_FP0_T1VN); + input_tree->SetBranchStatus("MTOF_FP1_T1VN","true"); + input_tree->SetBranchAddress("MTOF_FP1_T1VN",&MTOF_FP1_T1VN); + + input_tree->SetBranchStatus("MTOF_FP0_T0VM","true"); + input_tree->SetBranchAddress("MTOF_FP0_T0VM",&MTOF_FP0_T0VM); + input_tree->SetBranchStatus("MTOF_FP1_T0VM","true"); + input_tree->SetBranchAddress("MTOF_FP1_T0VM",&MTOF_FP1_T0VM); + input_tree->SetBranchStatus("MTOF_FP0_T1VM","true"); + input_tree->SetBranchAddress("MTOF_FP0_T1VM",&MTOF_FP0_T1VM); + input_tree->SetBranchStatus("MTOF_FP1_T1VM","true"); + input_tree->SetBranchAddress("MTOF_FP1_T1VM",&MTOF_FP1_T1VM); + + input_tree->SetBranchStatus("MTOF_FP0_T0V","true"); + input_tree->SetBranchAddress("MTOF_FP0_T0V",&MTOF_FP0_T0V); + input_tree->SetBranchStatus("MTOF_FP1_T0V","true"); + input_tree->SetBranchAddress("MTOF_FP1_T0V",&MTOF_FP1_T0V); + input_tree->SetBranchStatus("MTOF_FP0_T1V","true"); + input_tree->SetBranchAddress("MTOF_FP0_T1V",&MTOF_FP0_T1V); + input_tree->SetBranchStatus("MTOF_FP1_T1V","true"); + input_tree->SetBranchAddress("MTOF_FP1_T1V",&MTOF_FP1_T1V); + + + input_tree->SetBranchStatus("MTOF_FP0_T0VTS","true"); + input_tree->SetBranchAddress("MTOF_FP0_T0VTS",&MTOF_FP0_T0VTS); + input_tree->SetBranchStatus("MTOF_FP1_T0VTS","true"); + input_tree->SetBranchAddress("MTOF_FP1_T0VTS",&MTOF_FP1_T0VTS); + input_tree->SetBranchStatus("MTOF_FP0_T1VTS","true"); + input_tree->SetBranchAddress("MTOF_FP0_T1VTS",&MTOF_FP0_T1VTS); + input_tree->SetBranchStatus("MTOF_FP1_T1VTS","true"); + input_tree->SetBranchAddress("MTOF_FP1_T1VTS",&MTOF_FP1_T1VTS); + + // IC + input_tree->SetBranchStatus("IC","true"); + input_tree->SetBranchAddress("IC",&IC); + + input_tree->SetBranchStatus("ICRawTS","true"); + input_tree->SetBranchAddress("ICRawTS",&ICRawTS); + + input_tree->SetBranchStatus("ICRawM","true"); + input_tree->SetBranchAddress("ICRawM",&ICRawM); + // FPMW0-X + input_tree->SetBranchStatus("FPMW0_XRawM","true"); + input_tree->SetBranchAddress("FPMW0_XRawM",&FPMW0_XRawM); + input_tree->SetBranchStatus("FPMW0_XRaw","true"); + input_tree->SetBranchAddress("FPMW0_XRaw",FPMW0_XRaw); + input_tree->SetBranchStatus("FPMW0_XRawNr","true"); + input_tree->SetBranchAddress("FPMW0_XRawNr",FPMW0_XRawNr); + // FPMW0-Y + input_tree->SetBranchStatus("FPMW0_YRawM","true"); + input_tree->SetBranchAddress("FPMW0_YRawM",&FPMW0_YRawM); + input_tree->SetBranchStatus("FPMW0_YRaw","true"); + input_tree->SetBranchAddress("FPMW0_YRaw",FPMW0_YRaw); + input_tree->SetBranchStatus("FPMW0_YRawNr","true"); + input_tree->SetBranchAddress("FPMW0_YRawNr",FPMW0_YRawNr); + // FPMW1-X + input_tree->SetBranchStatus("FPMW1_XRawM","true"); + input_tree->SetBranchAddress("FPMW1_XRawM",&FPMW1_XRawM); + input_tree->SetBranchStatus("FPMW1_XRaw","true"); + input_tree->SetBranchAddress("FPMW1_XRaw",FPMW1_XRaw); + input_tree->SetBranchStatus("FPMW1_XRawNr","true"); + input_tree->SetBranchAddress("FPMW1_XRawNr",FPMW1_XRawNr); + // FPMW0-Y + input_tree->SetBranchStatus("FPMW1_YRawM","true"); + input_tree->SetBranchAddress("FPMW1_YRawM",&FPMW1_YRawM); + input_tree->SetBranchStatus("FPMW1_YRaw","true"); + input_tree->SetBranchAddress("FPMW1_YRaw",FPMW1_YRaw); + input_tree->SetBranchStatus("FPMW1_YRawNr","true"); + input_tree->SetBranchAddress("FPMW1_YRawNr",FPMW1_YRawNr); + // TMW1-X + input_tree->SetBranchStatus("TMW1_XRawM","true"); + input_tree->SetBranchAddress("TMW1_XRawM",&TMW1_XRawM); + input_tree->SetBranchStatus("TMW1_XRaw","true"); + input_tree->SetBranchAddress("TMW1_XRaw",TMW1_XRaw); + input_tree->SetBranchStatus("TMW1_XRawNr","true"); + input_tree->SetBranchAddress("TMW1_XRawNr",TMW1_XRawNr); + // TMW1-Y + input_tree->SetBranchStatus("TMW1_YRawM","true"); + input_tree->SetBranchAddress("TMW1_YRawM",&TMW1_YRawM); + input_tree->SetBranchStatus("TMW1_YRaw","true"); + input_tree->SetBranchAddress("TMW1_YRaw",TMW1_YRaw); + input_tree->SetBranchStatus("TMW1_YRawNr","true"); + input_tree->SetBranchAddress("TMW1_YRawNr",TMW1_YRawNr); + // TMW2-X + input_tree->SetBranchStatus("TMW2_XRawM","true"); + input_tree->SetBranchAddress("TMW2_XRawM",&TMW2_XRawM); + input_tree->SetBranchStatus("TMW2_XRaw","true"); + input_tree->SetBranchAddress("TMW2_XRaw",TMW2_XRaw); + input_tree->SetBranchStatus("TMW2_XRawNr","true"); + input_tree->SetBranchAddress("TMW2_XRawNr",TMW2_XRawNr); + // TMW2-Y + input_tree->SetBranchStatus("TMW2_YRawM","true"); + input_tree->SetBranchAddress("TMW2_YRawM",&TMW2_YRawM); + input_tree->SetBranchStatus("TMW2_YRaw","true"); + input_tree->SetBranchAddress("TMW2_YRaw",TMW2_YRaw); + input_tree->SetBranchStatus("TMW2_YRawNr","true"); + input_tree->SetBranchAddress("TMW2_YRawNr",TMW2_YRawNr); + // Exogam + input_tree->SetBranchStatus("Inner6MVM","true"); + input_tree->SetBranchAddress("Inner6MVM",&Inner6MVM); + input_tree->SetBranchStatus("Inner6MV","true"); + input_tree->SetBranchAddress("Inner6MV",Inner6MV); + input_tree->SetBranchStatus("Inner6MVN","true"); + input_tree->SetBranchAddress("Inner6MVN",Inner6MVN); + input_tree->SetBranchStatus("Inner6MVTS","true"); + input_tree->SetBranchAddress("Inner6MVTS",Inner6MVTS); + + input_tree->SetBranchStatus("OutersVM","true"); + input_tree->SetBranchAddress("OutersVM",&OutersVM); + input_tree->SetBranchStatus("OutersV","true"); + input_tree->SetBranchAddress("OutersV",OutersV); + input_tree->SetBranchStatus("OutersVN","true"); + input_tree->SetBranchAddress("OutersVN",OutersVN); + + input_tree->SetBranchStatus("Inner20MV","true"); + input_tree->SetBranchAddress("Inner20MV",Inner20MV); } diff --git a/Projects/AlPhaPha/conversion/2024/convert.h b/Projects/AlPhaPha/conversion/2024/convert.h index 8b7a4face728fb452516e33db43042a18e32d5a7..5a0411fd19594b54c7cf5a43614ab62e29d6e715 100644 --- a/Projects/AlPhaPha/conversion/2024/convert.h +++ b/Projects/AlPhaPha/conversion/2024/convert.h @@ -1,6 +1,7 @@ TPISTAData* m_pista; TFPMWData* m_fpmw; TICData* m_ic; +TTimeData* m_time; TExogamCalData* m_exogam; //TFile* ofile; TChain* input_tree; @@ -24,6 +25,11 @@ Int_t MTOF_FP1_T0VN[20]; Int_t MTOF_FP0_T1VN[20]; Int_t MTOF_FP1_T1VN[20]; +long MTOF_FP0_T0VTS[20]; +long MTOF_FP0_T1VTS[20]; +long MTOF_FP1_T0VTS[20]; +long MTOF_FP1_T1VTS[20]; + Int_t MTOF_FP0_T0VM; Int_t MTOF_FP1_T0VM; Int_t MTOF_FP0_T1VM; @@ -44,6 +50,8 @@ ULong64_t PISTA_TS; // IC // float IC[11]; +long ICRawTS[11]; +int ICRawM; // TW1 // Int_t TMW1_XRawM;