Skip to content

Commit

Permalink
Merge pull request #35831 from bsunanda/Run3-alca207
Browse files Browse the repository at this point in the history
Run3-alca207 Update the macros used in IsoTrack calibration of HCAL
  • Loading branch information
cmsbuild authored Oct 29, 2021
2 parents 90aad40 + 36c7e6b commit cd4913a
Show file tree
Hide file tree
Showing 5 changed files with 460 additions and 373 deletions.
36 changes: 35 additions & 1 deletion Calibration/HcalCalibAlgos/macros/CalibCorr.C
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,41 @@ double puFactor(int type, int ieta, double pmom, double eHcal, double ediff, boo
if (debug)
std::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF[icor] << ":"
<< LINEAR_COR_COEF[icor] << ":" << SQUARE_COR_COEF[icor] << " Fac " << fac;
} else if (type == 99) { // dlphin
} else if (type == 97) { // dlphin Try 3
const double CONST_COR_COEF[6] = {0.987617, 0.983421, 0.938622, 0.806662, 0.738354, 0.574195};
const double LINEAR_COR_COEF[6] = {-0.07018610, -0.2494880, -0.1997290, -0.1769320, -0.2427950, -0.1230480};
const double SQUARE_COR_COEF[6] = {0, 0, 0.0263541, 0.0257008, 0.0426584, 0.0200361};
const int PU_IETA_1 = 7;
const int PU_IETA_2 = 16;
const int PU_IETA_3 = 25;
const int PU_IETA_4 = 26;
const int PU_IETA_5 = 27;
unsigned icor = (unsigned(jeta >= PU_IETA_1) + unsigned(jeta >= PU_IETA_2) + unsigned(jeta >= PU_IETA_3) +
unsigned(jeta >= PU_IETA_4) + unsigned(jeta >= PU_IETA_5));
double deltaCut = (icor > 2) ? 1.0 : DELTA_CUT;
if (d2p > deltaCut)
fac = (CONST_COR_COEF[icor] + LINEAR_COR_COEF[icor] * d2p + SQUARE_COR_COEF[icor] * d2p * d2p);
if (debug)
std::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF[icor] << ":"
<< LINEAR_COR_COEF[icor] << ":" << SQUARE_COR_COEF[icor] << " Fac " << fac;
} else if (type == 98) { // dlphin Try 2
const double CONST_COR_COEF[6] = {0.987665, 0.983468, 0.938628, 0.807241, 0.739132, 0.529059};
const double LINEAR_COR_COEF[6] = {-0.0708906, -0.249995, -0.199683, -0.177692, -0.243436, -0.0668783};
const double SQUARE_COR_COEF[6] = {0, 0, 0.0263163, 0.0260158, 0.0426864, 0.00398778};
const int PU_IETA_1 = 7;
const int PU_IETA_2 = 16;
const int PU_IETA_3 = 25;
const int PU_IETA_4 = 26;
const int PU_IETA_5 = 27;
unsigned icor = (unsigned(jeta >= PU_IETA_1) + unsigned(jeta >= PU_IETA_2) + unsigned(jeta >= PU_IETA_3) +
unsigned(jeta >= PU_IETA_4) + unsigned(jeta >= PU_IETA_5));
double deltaCut = (icor > 2) ? 1.0 : DELTA_CUT;
if (d2p > deltaCut)
fac = (CONST_COR_COEF[icor] + LINEAR_COR_COEF[icor] * d2p + SQUARE_COR_COEF[icor] * d2p * d2p);
if (debug)
std::cout << " d2p " << d2p << ":" << DELTA_CUT << " coeff " << icor << ":" << CONST_COR_COEF[icor] << ":"
<< LINEAR_COR_COEF[icor] << ":" << SQUARE_COR_COEF[icor] << " Fac " << fac;
} else if (type == 99) { // dlphin Try 1
const double CONST_COR_COEF[6] = {0.98312, 0.978532, 0.972211, 0.756004, 0.638075, 0.547192};
const double LINEAR_COR_COEF[6] = {-0.0472436, -0.186206, -0.247339, -0.166062, -0.159781, -0.118747};
const double SQUARE_COR_COEF[6] = {0, 0, 0.0356827, 0.0202461, 0.01785078, 0.0123003};
Expand Down
7 changes: 4 additions & 3 deletions Calibration/HcalCalibAlgos/macros/CalibFitPlots.C
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ void FitHistExtended(const char* infile,
TH1D* hist2 = (TH1D*)hist1->Clone(name);
fitOneGauss(hist2, true, debug);
hists.push_back(hist2);
results meaner = fitTwoGauss(hist, debug);
results meaner = fitOneGauss(hist, true, debug);
value = meaner.mean;
error = meaner.errmean;
width = meaner.width;
Expand Down Expand Up @@ -872,7 +872,8 @@ void FitHistExtended(const char* infile,
fitLanGau(hist3, debug);
hists.push_back(hist3);
}
results meaner0 = fitTwoGauss(hist, debug);
// results meaner0 = fitTwoGauss(hist, debug);
results meaner0 = fitOneGauss(hist, true, debug);
value = meaner0.mean;
error = meaner0.errmean;
double rms;
Expand Down Expand Up @@ -2197,7 +2198,7 @@ void PlotHistCorrFactors(char* infile1,
}
}

if (nfile > 1) {
if (nfile > 0) {
gStyle->SetCanvasBorderMode(0);
gStyle->SetCanvasColor(kWhite);
gStyle->SetPadColor(kWhite);
Expand Down
26 changes: 14 additions & 12 deletions Calibration/HcalCalibAlgos/macros/CalibMonitor.C
Original file line number Diff line number Diff line change
Expand Up @@ -1634,19 +1634,21 @@ void GetEntries::Init(TTree *tree, const char *dupFileName) {
fChain->SetBranchAddress("t_trackType", &t_trackType, &b_t_trackType);
Notify();

ifstream infile(dupFileName);
if (!infile.is_open()) {
std::cout << "Cannot open " << dupFileName << std::endl;
} else {
while (1) {
Long64_t jentry;
infile >> jentry;
if (!infile.good())
break;
entries_.push_back(jentry);
if (std::string(dupFileName) != "") {
ifstream infile(dupFileName);
if (!infile.is_open()) {
std::cout << "Cannot open " << dupFileName << std::endl;
} else {
while (1) {
Long64_t jentry;
infile >> jentry;
if (!infile.good())
break;
entries_.push_back(jentry);
}
infile.close();
std::cout << "Reads a list of " << entries_.size() << " events from " << dupFileName << std::endl;
}
infile.close();
std::cout << "Reads a list of " << entries_.size() << " events from " << dupFileName << std::endl;
}

h_tk[0] = new TH1I("Track0", "# of tracks produced", 2000, 0, 2000);
Expand Down
26 changes: 14 additions & 12 deletions Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C
Original file line number Diff line number Diff line change
Expand Up @@ -487,19 +487,21 @@ void CalibPlotProperties::Init(TChain *tree, const char *dupFileName) {
fChain->SetBranchAddress("t_HitEnergies3", &t_HitEnergies3, &b_t_HitEnergies3);
Notify();

ifstream infil1(dupFileName);
if (!infil1.is_open()) {
std::cout << "Cannot open duplicate file " << dupFileName << std::endl;
} else {
while (1) {
Long64_t jentry;
infil1 >> jentry;
if (!infil1.good())
break;
entries_.push_back(jentry);
if (std::string(dupFileName) != "") {
ifstream infil1(dupFileName);
if (!infil1.is_open()) {
std::cout << "Cannot open duplicate file " << dupFileName << std::endl;
} else {
while (1) {
Long64_t jentry;
infil1 >> jentry;
if (!infil1.good())
break;
entries_.push_back(jentry);
}
infil1.close();
std::cout << "Reads a list of " << entries_.size() << " events from " << dupFileName << std::endl;
}
infil1.close();
std::cout << "Reads a list of " << entries_.size() << " events from " << dupFileName << std::endl;
}

char name[20], title[200];
Expand Down
Loading

0 comments on commit cd4913a

Please sign in to comment.