2222// pLow and pHigh and save the canvases
2323//
2424// .L CalibPlotProperties.C+g
25- // CalibSplit c1(fname, dirname, outFileName, pmin, pmax, debug);
25+ // CalibSplit c1(fname, dirname, outFileName, pmin, pmax, runMin, runMax, debug);
2626// c1.Loop(nentries);
2727//
2828// This will split the tree and keep for tacks with momenta between
138138// outFileName (std::string)= name of the file containing saved tree
139139// pmin (double) = minimum track momentum (40.0)
140140// pmax (double) = maximum track momentum (60.0)
141+ // runMin (int) = minimum run number (-1) | if -1, no check on
142+ // runMax (int) = maximum run number (-1) | run number not done
141143// debug (bool) = debug flag (false)
142144//////////////////////////////////////////////////////////////////////////////
143145#include <TROOT.h>
@@ -1812,6 +1814,8 @@ public:
18121814 const std ::string & outFileName ,
18131815 double pmin = 40.0 ,
18141816 double pmax = 60.0 ,
1817+ int runMin = -1 ,
1818+ int runMax = -1 ,
18151819 bool debug = false);
18161820 virtual ~CalibSplit ();
18171821 virtual Int_t Cut (Long64_t entry );
@@ -1827,23 +1831,27 @@ public:
18271831private :
18281832 const std ::string fname_ , dirnm_ , outFileName_ ;
18291833 const double pmin_ , pmax_ ;
1834+ const int runMin_ , runMax_ ;
18301835 const bool debug_ ;
1836+ bool checkRun_ ;
18311837 TFile * outputFile_ ;
18321838 TDirectoryFile * outputDir_ ;
18331839 TTree * outputTree_ ;
18341840};
18351841
1836- CalibSplit ::CalibSplit (
1837- const char * fname , const std ::string & dirnm , const std ::string & outFileName , double pmin , double pmax , bool debug )
1842+ CalibSplit ::CalibSplit (const char * fname , const std ::string & dirnm , const std ::string & outFileName , double pmin , double pmax , int runMin , int runMax , bool debug )
18381843 : fname_ (fname ),
18391844 dirnm_ (dirnm ),
18401845 outFileName_ (outFileName ),
18411846 pmin_ (pmin ),
18421847 pmax_ (pmax ),
1848+ runMin_ (runMin ),
1849+ runMax_ (runMax ),
18431850 debug_ (debug ),
18441851 outputFile_ (nullptr ),
18451852 outputDir_ (nullptr ),
18461853 outputTree_ (nullptr ) {
1854+ checkRun_ = ((runMin_ < 0 ) || (runMax_ < 0 )) ? false : true;
18471855 char treeName [400 ];
18481856 sprintf (treeName , "%s/CalibTree" , dirnm .c_str ());
18491857 TChain * chain = new TChain (treeName );
@@ -2075,6 +2083,10 @@ void CalibSplit::Loop(Long64_t nentries) {
20752083 std ::cout << "Entry " << jentry << " Run " << t_Run << " Event " << t_Event << std ::endl ;
20762084 ++ kount ;
20772085 bool select = ((t_p >= pmin_ ) && (t_p < pmax_ ));
2086+ if (select && checkRun_ ) {
2087+ if ((t_Run < runMin_ ) || (t_Run > runMax_ ))
2088+ select = false;
2089+ }
20782090 if (!select ) {
20792091 ++ reject ;
20802092 if (debug_ )
0 commit comments