Skip to content

Commit 1b89ee1

Browse files
authored
Merge pull request #45044 from bsunanda/Run3-alca247Z
Run3-alca247Z Add a new defintion of truncated DetID and a new scaling script for HCAL IsoTrack calibration
2 parents 5d0c0d5 + f1b31a2 commit 1b89ee1

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

Calibration/HcalCalibAlgos/macros/CalibCorr.C

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
// void CalibCorrScale(infile, oufile, scale)
5252
// Scales all contents of correction factors by "scale" from "infile"
5353
// to "outfile"
54+
// void CalibCorrScale2(infile, oufile, scaleB, scaleT, scaleE)
55+
// Scales all contents of correction factors in the barrel, transition and
56+
// endcap regions by "scaleB", "scaleT", "scaleE" from "infile" and writes
57+
// them to "outfile"
5458
//////////////////////////////////////////////////////////////////////////////
5559
#ifndef CalibrationHcalCalibAlgosCalibCorr_h
5660
#define CalibrationHcalCalibAlgosCalibCorr_h
@@ -144,6 +148,13 @@ unsigned int truncateId(unsigned int detId, int truncateFlag, bool debug = false
144148
//Ignore depth index for depth > 1 in HB and HE
145149
if (depth > 1)
146150
depth = 2;
151+
} else if (truncate0 == 6) {
152+
//Ignore depth index for depth > 2 in HB and HE and
153+
// depthe 1, 2 are considered as depth 1
154+
if (depth <= 2)
155+
depth = 1;
156+
else
157+
depth = 2;
147158
}
148159
id = (subdet << 25) | (0x1000000) | ((depth & 0xF) << 20) | ((zside > 0) ? (0x80000 | (ieta << 10)) : (ieta << 10));
149160
if (debug) {
@@ -1353,4 +1364,58 @@ void CalibCorrScale(const char* infile, const char* outfile, double scale) {
13531364
myfile.close();
13541365
}
13551366
}
1367+
1368+
void CalibCorrScale2(const char* infile, const char* outfile, double scaleB, double scaleT, double scaleE) {
1369+
int ietasL[3] = {0, 13, 17};
1370+
int ietasH[3] = {14, 18, 29};
1371+
double scale[3] = {scaleB, scaleT, scaleE};
1372+
std::ofstream myfile;
1373+
myfile.open(outfile);
1374+
if (!myfile.is_open()) {
1375+
std::cout << "** ERROR: Can't open '" << outfile << std::endl;
1376+
} else {
1377+
if (std::string(infile) != "") {
1378+
std::ifstream fInput(infile);
1379+
if (!fInput.good()) {
1380+
std::cout << "Cannot open file " << infile << std::endl;
1381+
} else {
1382+
char buffer[1024];
1383+
unsigned int all(0), good(0), comment(0);
1384+
while (fInput.getline(buffer, 1024)) {
1385+
++all;
1386+
if (buffer[0] == '#') {
1387+
myfile << buffer << std::endl;
1388+
++comment;
1389+
continue; //ignore comment
1390+
}
1391+
std::vector<std::string> items = splitString(std::string(buffer));
1392+
if (items.size() != 5) {
1393+
std::cout << "Ignore line: " << buffer << std::endl;
1394+
} else {
1395+
++good;
1396+
int ieta = std::atoi(items[1].c_str());
1397+
int depth = std::atoi(items[2].c_str());
1398+
int jp(-1);
1399+
for (int j = 0; j < 3; ++j) {
1400+
if (std::abs(ieta) > ietasL[j] && std::abs(ieta) <= ietasH[j]) {
1401+
if (jp < 0)
1402+
jp = j;
1403+
}
1404+
}
1405+
if (jp < 0)
1406+
jp = 2;
1407+
float corrf = scale[jp] * std::atof(items[3].c_str());
1408+
float dcorr = scale[jp] * std::atof(items[4].c_str());
1409+
myfile << std::setw(10) << items[0] << std::setw(10) << std::dec << ieta << std::setw(10) << depth
1410+
<< std::setw(10) << corrf << " " << std::setw(10) << dcorr << std::endl;
1411+
}
1412+
}
1413+
fInput.close();
1414+
std::cout << "Reads total of " << all << ", " << comment << " and " << good << " good records from " << infile
1415+
<< " and copied to " << outfile << std::endl;
1416+
}
1417+
}
1418+
myfile.close();
1419+
}
1420+
}
13561421
#endif

Calibration/HcalCalibAlgos/macros/CalibMonitor.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
// depths in HE with values > 1 as depth 2; (4)
8080
// all depths in HB with values > 1 as depth 2;
8181
// (5) all depths in HB and HE with values > 1
82-
// as depth 2.
82+
// as depth 2; (6) for depth = 1 and 2, depth =
83+
// 1, else depth = 2.
8384
// The digit *d* is used if zside is to be
8485
// ignored (1) or not (0)
8586
// (Default 0)

Calibration/HcalCalibAlgos/macros/CalibPlotProperties.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@
7474
// all depths as depth 1 (2), all depths in HE
7575
// with values > 1 as depth 2 (3), all depths in
7676
// HB with values > 1 as depth 2 (4), all depths
77-
// in HB and HE with values > 1 as depth 2 (5)
78-
// (Default 0)
77+
// in HB and HE with values > 1 as depth 2 (5),
78+
// for depth = 1 and 2, depth = 1, else depth
79+
// = 2 (6). (Default 0)
7980
// useGen (bool) = true/false to use generator level momentum
8081
// or reconstruction level momentum (def false)
8182
// scale (double) = energy scale if correction factor to be used

Calibration/HcalCalibAlgos/macros/CalibTree.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
// depths in HE with values > 1 as depth 2; (4)
5959
// all depths in HB with values > 1 as depth 2;
6060
// (5) all depths in HB and HE with values > 1
61-
// as depth 2.
61+
// as depth 2; (6) for depth = 1 and 2, depth =
62+
// 1, else depth = 2.
6263
// The digit *d* is used if zside is to be
6364
// ignored (1) or not (0)
6465
// (Default 0)

0 commit comments

Comments
 (0)