From efec815add24c28d29abaf915eaa502faf751b6f Mon Sep 17 00:00:00 2001 From: "theodore.efremov" <theodore.efremov@cea.fr> Date: Fri, 29 Nov 2024 16:44:07 +0100 Subject: [PATCH] Started working on toff --- .../2024/macro/mwpc/Toff/ToffGenerator.cxx | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Projects/AlPhaPha/2024/macro/mwpc/Toff/ToffGenerator.cxx 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 000000000..3a6429a1a --- /dev/null +++ b/Projects/AlPhaPha/2024/macro/mwpc/Toff/ToffGenerator.cxx @@ -0,0 +1,70 @@ +#include "TTimeData.h" +#include <TChain.h> +#include <TH2.h> +using namespace std; + +void ToffGenerator( ){ + + //=========================================================================================================== + // Setters + //=========================================================================================================== + + TChain* chain = new TChain("PhysicsTree"); + chain->Add("../../../root/analysis/VamosCalib247.root"); + + + Int_t FPMW_Section , M13 , M14, M23, M24 ;// we will fetch multiplicity during + // the getentry + + TTimeData *Time; + + + chain->SetBranchStatus("FPMW_Section", true); + chain->SetBranchAddress("FPMW_Section", &FPMW_Section); + + chain->SetBranchStatus("Time", true); + chain->SetBranchAddress("Time", &Time); + + //=========================================================================================================== + // Histograms + //=========================================================================================================== + + TH2F *hToff13 = new TH2F("Toff13","Toff13", 20, 0, 20, 100, -50, 50); + TH2F *hToff14 = new TH2F("Toff14","Toff14", 20, 0, 20, 100, -50, 50); + TH2F *hToff23 = new TH2F("Toff23","Toff23", 20, 0, 20, 100, -50, 50); + TH2F *hToff24 = new TH2F("Toff24","Toff24", 20, 0, 20, 100, -50, 50); + + //=========================================================================================================== + // Loop on entries + //=========================================================================================================== + + int Nentries = chain->GetEntries(); + //int Nentries = 10000000; + 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; + } + + + M13 = Time->GetMWPC13Mult(); + M14 = Time->GetMWPC14Mult(); + M23 = Time->GetMWPC23Mult(); + M24 = Time->GetMWPC24Mult(); + + + if (M13 == 2 && (FPMW_Section)){ + //hToff13->Fill() + + } + + + + } +} -- GitLab