File indexing completed on 2025-08-06 08:21:00
0001 #include <calib_emc_pi0/CaloCalibEmc_Pi0.h>
0002
0003 #include <fstream>
0004 #include <string>
0005 #include "TChain.h"
0006 #include "TTree.h"
0007 #include "TString.h"
0008
0009
0010
0011 void runCCPi0Loop(int nevents = -1, const char *ifile="", const char *ofile="")
0012 {
0013 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
0014
0015 CaloCalibEmc_Pi0 calo_obj("CaloCalibEmc_Pi0", ofile);
0016 calo_obj.InitRun(0);
0017 TTree * intree1 = GetTChainMacro(ifile);
0018
0019 calo_obj.Loop(nevents, ifile, intree1);
0020 calo_obj.End(0);
0021 }
0022
0023
0024 TTree* GetTChainMacro(TString ifile="")
0025 {
0026 ifstream inFile;
0027 inFile.open(ifile, ios::in);
0028 if (!inFile)
0029 {
0030 cerr << "Unable to open file:\n ";
0031 exit(1);
0032 }
0033
0034 TChain *pitree = new TChain("_eventTree");
0035 string root_file;
0036 int lines=0;
0037 while (std::getline(inFile, root_file))
0038 {
0039 pitree->Add(root_file.c_str());
0040 lines += 1;
0041 }
0042 printf("total lines: %d\n",lines);
0043 inFile.close();
0044
0045 return (TTree *) pitree;
0046 }