Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-alca249 Modify calibration macros to use the current IsoTrack calibration #46410

Merged
merged 4 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Calibration/HcalCalibAlgos/macros/CalibCorr.C
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,9 @@ unsigned int truncateId(unsigned int detId, int truncateFlag, bool debug = false
depth = 1;
}
} else if (truncate0 == 9) {
//Depths 1 and 2 in HB considered as depth = 1; rest of the depths in HB as depth = 2
if (subdet == 1) {
if (depth > 1)
depth = 2;
else
depth = 1;
}
//Depths 1 and 2 considered as depth = 2; rest of the depths are kept as it is
if (depth <= 2)
depth = 2;
}
id = (subdet << 25) | (0x1000000) | ((depth & 0xF) << 20) | ((zside > 0) ? (0x80000 | (ieta << 10)) : (ieta << 10));
if (debug) {
Expand Down
46 changes: 23 additions & 23 deletions Calibration/HcalCalibAlgos/macros/CalibFitPlots.C
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@
// infile4, text4, infile5, text5, prefixF, ratio,
// drawStatBox, nmin, isRealData, year, iformat, save)
// Defaults: ratio=false, drawStatBox=true, nmin=100, isRealData=false,
// year=2018, iformat=0, save=0
// year="2024", iformat=0, save=0
//
// PlotHistCorr2Factors(infile1, text1, infile2, text2, depth, prefixF, ratio,
// drawStatBox, nmin, isRealData, year, iformat, save)
// Defaults: ratio=true, drawStatBox=false, nmin=100, isRealData=true,
// year=2023, iformat=0, save=0
// year="2024", iformat=0, save=0
//
// PlotHistCorrDFactors(infile1, text1, infile2, text2, infile3, text3,
// infile4, text4, infile5, text5, depth, prefixF, ratio,
// drawStatBox, nmin, isRealData, year, iformat, save)
// Defaults: ratio=true, drawStatBox=false, nmin=100, isRealData=true,
// year=2024, iformat=0, save=0
// year="2024", iformat=0, save=0
//
// For plotting correction factors including systematics
// PlotHistCorrSys(infilec, conds, text, save)
Expand Down Expand Up @@ -166,7 +166,7 @@
// text0, etaMin, etaMax, doFit, isRealData, year, iformat,
// save)
// Defaults etaMin = -1, etaMax = -1, doFit = true, isRealData = true,
// year = 2022, iformat = 0, save = 0
// year = "2024", iformat = 0, save = 0
// text0 is a general description common to both sets of corr factors
// etaMin < 0 and etaMax > 0 will take ieta range from -etaMax to +etaMax;
// etaMin > 0 will select ieta's where |ieta| is greater than etaMin
Expand Down Expand Up @@ -219,7 +219,7 @@
// scale (double) = constant scale factor applied to the factors
// ratio (bool) = set to show the ratio plot (false)
// drawStatBox (bool) = set to show the statistical box (true)
// year (int) = Year of data taking (applicable to Data)
// year (char *) = Year of data taking (applicable to Data)
// infilc (string) = prefix of the file names of correction factors
// (assumes file name would be the prefix followed
// by _condX.txt where X=0 for the default version
Expand Down Expand Up @@ -269,13 +269,13 @@ const double fitrangeFactor = 1.5;
struct cfactors {
int ieta, depth;
double corrf, dcorr;
cfactors(int ie = 0, int dp = 0, double cor = 1, double dc = 0) : ieta(ie), depth(dp), corrf(cor), dcorr(dc){};
cfactors(int ie = 0, int dp = 0, double cor = 1, double dc = 0) : ieta(ie), depth(dp), corrf(cor), dcorr(dc) {};
};

struct results {
double mean, errmean, width, errwidth;
results(double v1 = 0, double er1 = 0, double v2 = 0, double er2 = 0)
: mean(v1), errmean(er1), width(v2), errwidth(er2){};
: mean(v1), errmean(er1), width(v2), errwidth(er2) {};
};

std::pair<double, double> GetMean(TH1D* hist, double xmin, double xmax, double& rms) {
Expand Down Expand Up @@ -2583,7 +2583,7 @@ void PlotHistCorrFactors(char* infile1,
bool drawStatBox = true,
int nmin = 100,
bool isRealData = false,
int year = 2018,
const char* year = "2024",
int iformat = 0,
int save = 0) {
std::map<int, cfactors> cfacs[5];
Expand Down Expand Up @@ -2801,9 +2801,9 @@ void PlotHistCorrFactors(char* infile1,
txt0->SetFillColor(0);
char txt[40];
if (isRealData)
sprintf(txt, "CMS Preliminary (%d)", year);
sprintf(txt, "CMS Preliminary (%s)", year);
else
sprintf(txt, "CMS Simulation Preliminary (%d)", year);
sprintf(txt, "CMS Simulation Preliminary (%s)", year);
txt0->AddText(txt);
txt0->Draw("same");
pad->Update();
Expand Down Expand Up @@ -2838,7 +2838,7 @@ void PlotHistCorr2Factors(char* infile1,
bool drawStatBox = false,
int nmin = 100,
bool isRealData = true,
int year = 2023,
const char* year = "2024",
int iformat = 0,
int save = 0) {
std::map<int, cfactors> cfacs[5];
Expand Down Expand Up @@ -2922,7 +2922,7 @@ void PlotHistCorr2Factors(char* infile1,
h->GetYaxis()->SetLabelOffset(0.005);
h->GetYaxis()->SetTitleSize(0.036);
h->GetYaxis()->SetTitleOffset(1.20);
h->GetYaxis()->SetRangeUser(0.50, 1.50);
h->GetYaxis()->SetRangeUser(0.80, 1.20);
hists.push_back(h);
fitr.push_back(fit);
htype.push_back(ih);
Expand Down Expand Up @@ -2967,7 +2967,7 @@ void PlotHistCorr2Factors(char* infile1,
h->GetYaxis()->SetTitle("Correction Factor");
h->GetYaxis()->SetLabelOffset(0.005);
h->GetYaxis()->SetTitleOffset(1.20);
h->GetYaxis()->SetRangeUser(0.5, 1.5);
h->GetYaxis()->SetRangeUser(0.8, 1.2);
hists.push_back(h);
entries.push_back(nent);
if (drawStatBox)
Expand Down Expand Up @@ -3017,9 +3017,9 @@ void PlotHistCorr2Factors(char* infile1,
txt0->SetFillColor(0);
char txt[40];
if (isRealData)
sprintf(txt, "CMS Preliminary (%d)", year);
sprintf(txt, "CMS Preliminary (%s)", year);
else
sprintf(txt, "CMS Simulation Preliminary (%d)", year);
sprintf(txt, "CMS Simulation Preliminary (%s)", year);
txt0->AddText(txt);
txt0->Draw("same");
pad->Update();
Expand Down Expand Up @@ -3060,7 +3060,7 @@ void PlotHistCorrDFactors(char* infile1,
bool drawStatBox = false,
int nmin = 100,
bool isRealData = true,
int year = 2024,
const char* year = "2024",
int iformat = 0,
int save = 0) {
std::map<int, cfactors> cfacs[5];
Expand Down Expand Up @@ -3169,7 +3169,7 @@ void PlotHistCorrDFactors(char* infile1,
h->GetYaxis()->SetLabelOffset(0.005);
h->GetYaxis()->SetTitleSize(0.036);
h->GetYaxis()->SetTitleOffset(1.20);
h->GetYaxis()->SetRangeUser(0.50, 1.50);
h->GetYaxis()->SetRangeUser(0.80, 1.20);
hists.push_back(h);
fitr.push_back(fit);
htype.push_back(ih);
Expand Down Expand Up @@ -3214,7 +3214,7 @@ void PlotHistCorrDFactors(char* infile1,
h->GetYaxis()->SetTitle("Correction Factor");
h->GetYaxis()->SetLabelOffset(0.005);
h->GetYaxis()->SetTitleOffset(1.20);
h->GetYaxis()->SetRangeUser(0.5, 1.5);
h->GetYaxis()->SetRangeUser(0.8, 1.2);
hists.push_back(h);
entries.push_back(nent);
if (drawStatBox)
Expand Down Expand Up @@ -3264,9 +3264,9 @@ void PlotHistCorrDFactors(char* infile1,
txt0->SetFillColor(0);
char txt[40];
if (isRealData)
sprintf(txt, "CMS Preliminary (%d)", year);
sprintf(txt, "CMS Preliminary (%s)", year);
else
sprintf(txt, "CMS Simulation Preliminary (%d)", year);
sprintf(txt, "CMS Simulation Preliminary (%s)", year);
txt0->AddText(txt);
txt0->Draw("same");
pad->Update();
Expand Down Expand Up @@ -4779,7 +4779,7 @@ void PlotHistCorrRatio(char* infile1,
int etaMax = -1,
bool doFit = true,
bool isRealData = true,
int year = 2022,
const char* year = "2024",
int iformat = 0,
int save = 0) {
std::map<int, cfactors> cfacs[2];
Expand Down Expand Up @@ -4920,9 +4920,9 @@ void PlotHistCorrRatio(char* infile1,
txt0->SetFillColor(0);
char txt[40];
if (isRealData)
sprintf(txt, "CMS Preliminary (%d)", year);
sprintf(txt, "CMS Preliminary (%s)", year);
else
sprintf(txt, "CMS Simulation Preliminary (%d)", year);
sprintf(txt, "CMS Simulation Preliminary (%s)", year);
txt0->AddText(txt);
txt0->Draw("same");
TPaveText* txt2 = new TPaveText(0.65, 0.91, 0.90, 0.96, "blNDC");
Expand Down
11 changes: 5 additions & 6 deletions Calibration/HcalCalibAlgos/macros/CalibMonitor.C
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@
// (5) all depths in HB and HE with values > 1
// as depth 2; (6) for depth = 1 and 2, depth =
// 1, else depth = 2; (7) in case of HB, depths
// 1 and 2 are set to 1, else depth =2; for HE
// 1 and 2 are set to 1, else depth = 2; for HE
// ignore depth index; (8) in case of HE, depths
// 1 and 2 are set to 1, else depth =2; for HB
// ignore depth index; (9) Ignore depth index for
// depth > 1 in HB and all depth index for HE.
// The digit *d* is used if zside is to be
// ignored (1) or not (0)
// 1 and 2 are set to 1, else depth = 2; for HB
// ignore depth index; (9) Assign all depth = 1
// as depth = 2. The digit *d* is used if zside
// is to be ignored (1) or not (0)
// (Default 0)
// useGen (bool) = true/false to use generator level momentum
// or reconstruction level momentum
Expand Down
29 changes: 16 additions & 13 deletions Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@
// o =0/1/2 for tight / loose / flexible
// selection). Default = 101111
// isRealData (bool) = true/false for data/MC (default true)
// truncateFlag (int) = Flag to treat different depths differently (0)
// both depths of ieta 15, 16 of HB as depth 1 (1)
// all depths as depth 1 (2), ignore all depth
// index in HE (depth index set 1) (3); ignore
// depth index in HB (depth index set 1) (4); all
// all depths in HB and HE with values > 1 as
// depth 2 (5); for depth = 1 and 2, depth = 1,
// else depth = 2 (6); in case of HB, depths 1
// and 2 are set to 1, else depth = 2; for HE
// ignore depth index (7); in case of HE, depths 1
// and 2 are set to 1, else depth =2; for HB
// ignore depth index (8); ignore depth index for
// depth > 1 in HB and all depth index for HE (9).
// truncateFlag (int) = A two digit flag (dr) with the default value 0.
// The digit *r* is used to treat depth values:
// (0) treat each depth independently; (1) all
// depths of ieta 15, 16 of HB as depth 1; (2)
// all depths in HB and HE as depth 1; (3) ignore
// depth index in HE (depth index set to 1); (4)
// ignore depth index in HB (depth index set 1);
// (5) all depths in HB and HE with values > 1
// as depth 2; (6) for depth = 1 and 2, depth =
// 1, else depth = 2; (7) in case of HB, depths
// 1 and 2 are set to 1, else depth = 2; for HE
// ignore depth index; (8) in case of HE, depths
// 1 and 2 are set to 1, else depth = 2; for HB
// ignore depth index; (9) Assign all depth = 1
// as depth = 2. The digit *d* is used if zside
// is to be ignored (1) or not (0)
// (Default 0)
// useGen (bool) = true/false to use generator level momentum
// or reconstruction level momentum (def false)
Expand Down
11 changes: 5 additions & 6 deletions Calibration/HcalCalibAlgos/macros/CalibTree.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@
// (5) all depths in HB and HE with values > 1
// as depth 2; (6) for depth = 1 and 2, depth =
// 1, else depth = 2; (7) in case of HB, depths
// 1 and 2 are set to 1, else depth =2; for HE
// 1 and 2 are set to 1, else depth = 2; for HE
// ignore depth index; (8) in case of HE, depths
// 1 and 2 are set to 1, else depth =2; for HB
// ignore depth index; (9) Ignore depth index for
// depth > 1 in HB and all depth index for HE.
// The digit *d* is used if zside is to be
// ignored (1) or not (0)
// 1 and 2 are set to 1, else depth = 2; for HB
// ignore depth index; (9) Assign all depth = 1
// as depth = 2. The digit *d* is used if zside
// is to be ignored (1) or not (0)
// (Default 0)
// maxIter (int) = number of iterations (30)
// drForm (int) = type of threshold/dupFileName/rcorFileName (hdr)
Expand Down