Skip to content

Commit 987080a

Browse files
author
Sunanda
committed
Add a new defintion of truncated DetID and a new scaling script for HCAL IsoTrack calibration
1 parent 1234e95 commit 987080a

File tree

4 files changed

+71
-4
lines changed

4 files changed

+71
-4
lines changed

Calibration/HcalCalibAlgos/macros/CalibCorr.C

Lines changed: 64 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,12 @@ 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 > 1 in HB and HE
153+
if (depth <= 2)
154+
depth = 1;
155+
else
156+
depth = 2;
147157
}
148158
id = (subdet << 25) | (0x1000000) | ((depth & 0xF) << 20) | ((zside > 0) ? (0x80000 | (ieta << 10)) : (ieta << 10));
149159
if (debug) {
@@ -1353,4 +1363,58 @@ void CalibCorrScale(const char* infile, const char* outfile, double scale) {
13531363
myfile.close();
13541364
}
13551365
}
1366+
1367+
void CalibCorrScale2(const char* infile, const char* outfile, double scaleB, double scaleT, double scaleE) {
1368+
int ietasL[3] = {0, 13, 17};
1369+
int ietasH[3] = {14, 18, 29};
1370+
double scale[3] = {scaleB, scaleT, scaleE};
1371+
std::ofstream myfile;
1372+
myfile.open(outfile);
1373+
if (!myfile.is_open()) {
1374+
std::cout << "** ERROR: Can't open '" << outfile << std::endl;
1375+
} else {
1376+
if (std::string(infile) != "") {
1377+
std::ifstream fInput(infile);
1378+
if (!fInput.good()) {
1379+
std::cout << "Cannot open file " << infile << std::endl;
1380+
} else {
1381+
char buffer[1024];
1382+
unsigned int all(0), good(0), comment(0);
1383+
while (fInput.getline(buffer, 1024)) {
1384+
++all;
1385+
if (buffer[0] == '#') {
1386+
myfile << buffer << std::endl;
1387+
++comment;
1388+
continue; //ignore comment
1389+
}
1390+
std::vector<std::string> items = splitString(std::string(buffer));
1391+
if (items.size() != 5) {
1392+
std::cout << "Ignore line: " << buffer << std::endl;
1393+
} else {
1394+
++good;
1395+
int ieta = std::atoi(items[1].c_str());
1396+
int depth = std::atoi(items[2].c_str());
1397+
int jp(-1);
1398+
for (int j = 0; j < 3; ++j) {
1399+
if (std::abs(ieta) > ietasL[j] && std::abs(ieta) <= ietasH[j]) {
1400+
if (jp < 0)
1401+
jp = j;
1402+
}
1403+
}
1404+
if (jp < 0)
1405+
jp = 2;
1406+
float corrf = scale[jp] * std::atof(items[3].c_str());
1407+
float dcorr = scale[jp] * std::atof(items[4].c_str());
1408+
myfile << std::setw(10) << items[0] << std::setw(10) << std::dec << ieta << std::setw(10) << depth
1409+
<< std::setw(10) << corrf << " " << std::setw(10) << dcorr << std::endl;
1410+
}
1411+
}
1412+
fInput.close();
1413+
std::cout << "Reads total of " << all << ", " << comment << " and " << good << " good records from " << infile
1414+
<< " and copied to " << outfile << std::endl;
1415+
}
1416+
}
1417+
myfile.close();
1418+
}
1419+
}
13561420
#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. (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)