Skip to content

Commit be1c0ac

Browse files
authored
Merge pull request #45641 from bsunanda/Run3-alca248A
Run3-alca248A Modify the macro to accommodate some requirements for obtaining calibration constants of HCAL
2 parents 10ceefa + 5091d02 commit be1c0ac

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

Calibration/HcalCalibAlgos/macros/CalibMain.C

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//
3131
// Other parameters for CalibSplit:
3232
// <InputFile> <HistogramFile> <Flag> <DirectoryName> <Prefix> <PUcorr>
33-
// <Truncate> <Nmax> <pmin> <pmax> <debug>
33+
// <Truncate> <Nmax> <pmin> <pmax> <runMin> <runMax> <debug>
3434
//
3535
//
3636
////////////////////////////////////////////////////////////////////////////////
@@ -371,8 +371,10 @@ int main(Int_t argc, Char_t* argv[]) {
371371
// CalibSplit
372372
double pmin = (argc > 10) ? std::atof(argv[10]) : 40.0;
373373
double pmax = (argc > 11) ? std::atof(argv[11]) : 60.0;
374-
bool debug = (argc > 12) ? (std::atoi(argv[12]) > 0) : false;
375-
CalibSplit c1(infile, dirname, histfile, pmin, pmax, debug);
374+
int runMin = (argc > 12) ? std::atoi(argv[12]) : -1;
375+
int runMax = (argc > 13) ? std::atoi(argv[13]) : -1;
376+
bool debug = (argc > 14) ? (std::atoi(argv[14]) > 0) : false;
377+
CalibSplit c1(infile, dirname, histfile, pmin, pmax, runMin, runMax, debug);
376378
c1.Loop(nmax);
377379
}
378380
return 0;

Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
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
@@ -138,6 +138,8 @@
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,34 @@ public:
18271831
private:
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,
1843+
const std::string &dirnm,
1844+
const std::string &outFileName,
1845+
double pmin,
1846+
double pmax,
1847+
int runMin,
1848+
int runMax,
1849+
bool debug)
18381850
: fname_(fname),
18391851
dirnm_(dirnm),
18401852
outFileName_(outFileName),
18411853
pmin_(pmin),
18421854
pmax_(pmax),
1855+
runMin_(runMin),
1856+
runMax_(runMax),
18431857
debug_(debug),
18441858
outputFile_(nullptr),
18451859
outputDir_(nullptr),
18461860
outputTree_(nullptr) {
1861+
checkRun_ = ((runMin_ < 0) || (runMax_ < 0)) ? false : true;
18471862
char treeName[400];
18481863
sprintf(treeName, "%s/CalibTree", dirnm.c_str());
18491864
TChain *chain = new TChain(treeName);
@@ -2075,6 +2090,10 @@ void CalibSplit::Loop(Long64_t nentries) {
20752090
std::cout << "Entry " << jentry << " Run " << t_Run << " Event " << t_Event << std::endl;
20762091
++kount;
20772092
bool select = ((t_p >= pmin_) && (t_p < pmax_));
2093+
if (select && checkRun_) {
2094+
if ((t_Run < runMin_) || (t_Run > runMax_))
2095+
select = false;
2096+
}
20782097
if (!select) {
20792098
++reject;
20802099
if (debug_)

0 commit comments

Comments
 (0)