|
40 | 40 | // factor from phi symmetry studies |
41 | 41 | // *infile* is the name of the input file |
42 | 42 | // *flag* can have a value between 0:5 specifying the type of correction |
43 | | -// 5 for run-dependent correctons using results from several phi |
44 | | -// symmetry studies; 4 for using results from one phi-symmetry |
| 43 | +// 5 for run-dependent correctons using results from several phi |
| 44 | +// symmetry studies; 4 for using results from one phi-symmetry |
45 | 45 | // study; 3 for pileup correction using machine learning method; |
46 | | -// 2 for overall response corrections; 1 for depth dependence |
| 46 | +// 2 for overall response corrections; 1 for depth dependence |
47 | 47 | // corrections; 0 for raddam corrections) |
48 | 48 | // CalibSelectRBX(rbxFile, debug) |
49 | 49 | // A class for selecting a given set of Read Out Box's and provides |
@@ -877,13 +877,15 @@ double CalibCorr::getPhiCorrs(int run, unsigned int idx) { |
877 | 877 | if (good_ == 0) |
878 | 878 | return cfac; |
879 | 879 | unsigned int runid = runId(run); |
880 | | - std::map<std::pair<unsigned int, unsigned int>, double>::iterator itr = corrPhiSyms_.find(std::pair<unsigned int, unsigned int>(runid, idx)); |
| 880 | + std::map<std::pair<unsigned int, unsigned int>, double>::iterator itr = |
| 881 | + corrPhiSyms_.find(std::pair<unsigned int, unsigned int>(runid, idx)); |
881 | 882 | if (itr != corrPhiSyms_.end()) |
882 | 883 | cfac = itr->second; |
883 | 884 | if (debug_) { |
884 | 885 | int subdet, zside, ieta, iphi, depth; |
885 | 886 | unpackDetId(idx, subdet, zside, ieta, iphi, depth); |
886 | | - std::cout << "Run " << run << " ID " << runid << ":" << std::hex << idx << std::dec << " (Sub " << subdet << " eta " << zside * ieta << " phi " << iphi << " depth " << depth << ") Factor " << cfac << std::endl; |
| 887 | + std::cout << "Run " << run << " ID " << runid << ":" << std::hex << idx << std::dec << " (Sub " << subdet << " eta " |
| 888 | + << zside * ieta << " phi " << iphi << " depth " << depth << ") Factor " << cfac << std::endl; |
887 | 889 | } |
888 | 890 | return cfac; |
889 | 891 | } |
@@ -1117,50 +1119,53 @@ unsigned int CalibCorr::readCorrPhis(const char* infile0) { |
1117 | 1119 | continue; //ignore other comments |
1118 | 1120 | } else { |
1119 | 1121 | std::vector<std::string> item = splitString(bufferString0); |
1120 | | - if (item.size() > 2) { |
1121 | | - int run1 = std::atoi(item[0].c_str()); |
1122 | | - int run2 = std::atoi(item[1].c_str()); |
1123 | | - std::string infile(item[2]); |
1124 | | - unsigned int runid = runs_.size(); |
1125 | | - runs_.push_back(std::pair<int, int>(run1, run2)); |
1126 | | - std::ifstream fInput(infile.c_str()); |
1127 | | - if (!fInput.good()) { |
1128 | | - std::cout << "Cannot open file " << infile << std::endl; |
1129 | | - } else { |
1130 | | - char buffer[1024]; |
1131 | | - while (fInput.getline(buffer, 1024)) { |
1132 | | - ++all; |
1133 | | - std::string bufferString(buffer); |
1134 | | - if (bufferString.substr(0, 1) == "#") { |
1135 | | - continue; //ignore other comments |
1136 | | - } else { |
1137 | | - std::vector<std::string> items = splitString(bufferString); |
1138 | | - if (items.size() < 5) { |
1139 | | - std::cout << "Ignore line: " << buffer << " Size " << items.size(); |
1140 | | - for (unsigned int k = 0; k < items.size(); ++k) |
1141 | | - std::cout << " [" << k << "] : " << items[k]; |
1142 | | - std::cout << std::endl; |
1143 | | - } else { |
1144 | | - ++good; |
1145 | | - int subdet = std::atoi(items[0].c_str()); |
1146 | | - int ieta = std::atoi(items[1].c_str()); |
1147 | | - int iphi = std::atoi(items[2].c_str()); |
1148 | | - int depth = std::atoi(items[3].c_str()); |
1149 | | - double corrf = std::atof(items[4].c_str()); |
1150 | | - unsigned int id = packDetId(subdet, ieta, iphi, depth); |
1151 | | - corrPhiSyms_[std::pair<int, int>(runid, id)] = corrf; |
1152 | | - if (debug_) |
1153 | | - std::cout << "ID " << runid << ":" << std::hex << id << std::dec << ":" << id << " (subdet " << subdet << " eta " << ieta << " phi " << iphi << " depth " << depth << ") " << corrPhiSym_[id] << std::endl; |
1154 | | - } |
1155 | | - } |
1156 | | - } |
1157 | | - fInput.close(); |
1158 | | - } |
1159 | | - } |
| 1122 | + if (item.size() > 2) { |
| 1123 | + int run1 = std::atoi(item[0].c_str()); |
| 1124 | + int run2 = std::atoi(item[1].c_str()); |
| 1125 | + std::string infile(item[2]); |
| 1126 | + unsigned int runid = runs_.size(); |
| 1127 | + runs_.push_back(std::pair<int, int>(run1, run2)); |
| 1128 | + std::ifstream fInput(infile.c_str()); |
| 1129 | + if (!fInput.good()) { |
| 1130 | + std::cout << "Cannot open file " << infile << std::endl; |
| 1131 | + } else { |
| 1132 | + char buffer[1024]; |
| 1133 | + while (fInput.getline(buffer, 1024)) { |
| 1134 | + ++all; |
| 1135 | + std::string bufferString(buffer); |
| 1136 | + if (bufferString.substr(0, 1) == "#") { |
| 1137 | + continue; //ignore other comments |
| 1138 | + } else { |
| 1139 | + std::vector<std::string> items = splitString(bufferString); |
| 1140 | + if (items.size() < 5) { |
| 1141 | + std::cout << "Ignore line: " << buffer << " Size " << items.size(); |
| 1142 | + for (unsigned int k = 0; k < items.size(); ++k) |
| 1143 | + std::cout << " [" << k << "] : " << items[k]; |
| 1144 | + std::cout << std::endl; |
| 1145 | + } else { |
| 1146 | + ++good; |
| 1147 | + int subdet = std::atoi(items[0].c_str()); |
| 1148 | + int ieta = std::atoi(items[1].c_str()); |
| 1149 | + int iphi = std::atoi(items[2].c_str()); |
| 1150 | + int depth = std::atoi(items[3].c_str()); |
| 1151 | + double corrf = std::atof(items[4].c_str()); |
| 1152 | + unsigned int id = packDetId(subdet, ieta, iphi, depth); |
| 1153 | + corrPhiSyms_[std::pair<int, int>(runid, id)] = corrf; |
| 1154 | + if (debug_) |
| 1155 | + std::cout << "ID " << runid << ":" << std::hex << id << std::dec << ":" << id << " (subdet " |
| 1156 | + << subdet << " eta " << ieta << " phi " << iphi << " depth " << depth << ") " |
| 1157 | + << corrPhiSym_[id] << std::endl; |
| 1158 | + } |
| 1159 | + } |
| 1160 | + } |
| 1161 | + fInput.close(); |
| 1162 | + } |
| 1163 | + } |
1160 | 1164 | } |
1161 | 1165 | } |
1162 | 1166 | fIn.close(); |
1163 | | - std::cout << "Reads total of " << all << " and " << good << " good records of phi-symmetry factors from " << runs_.size() << " files as given in " << infile0 << std::endl; |
| 1167 | + std::cout << "Reads total of " << all << " and " << good << " good records of phi-symmetry factors from " |
| 1168 | + << runs_.size() << " files as given in " << infile0 << std::endl; |
1164 | 1169 | } |
1165 | 1170 | return good; |
1166 | 1171 | } |
@@ -1452,7 +1457,8 @@ bool CalibDuplicate::select(int ieta, int iphi) { |
1452 | 1457 | } |
1453 | 1458 |
|
1454 | 1459 | double CalibDuplicate::getCorr(int run, int ieta, int depth) { |
1455 | | - std::map<std::pair<int, int>, std::vector<double> >::const_iterator itr = corrs_.find(std::pair<int, int>(ieta, depth)); |
| 1460 | + std::map<std::pair<int, int>, std::vector<double> >::const_iterator itr = |
| 1461 | + corrs_.find(std::pair<int, int>(ieta, depth)); |
1456 | 1462 | double corr(1.0); |
1457 | 1463 | if (itr != corrs_.end()) { |
1458 | 1464 | unsigned int irun = runId(run); |
@@ -1480,23 +1486,24 @@ bool CalibDuplicate::readCorrFactor(const char* infile) { |
1480 | 1486 | fInput >> eta >> depth; |
1481 | 1487 | std::vector<double> corrs; |
1482 | 1488 | for (int i = 0; i < nrun; ++i) { |
1483 | | - fInput >> corr; |
1484 | | - corrs.push_back(corr); |
| 1489 | + fInput >> corr; |
| 1490 | + corrs.push_back(corr); |
1485 | 1491 | } |
1486 | 1492 | corrs_[std::pair<int, int>(eta, depth)] = corrs; |
1487 | 1493 | } |
1488 | 1494 | fInput.close(); |
1489 | | - std::cout << "CalibDuplicate::readCorrFactor:Reads information of " << runs_.size() << " runs and " << corrs_.size() << " channels from " << infile << std::endl; |
| 1495 | + std::cout << "CalibDuplicate::readCorrFactor:Reads information of " << runs_.size() << " runs and " << corrs_.size() |
| 1496 | + << " channels from " << infile << std::endl; |
1490 | 1497 | flag = true; |
1491 | 1498 | if (debug_) { |
1492 | 1499 | for (unsigned int k = 0; k < runs_.size(); ++k) |
1493 | | - std::cout << "Run range[" << k << "] " << runs_[k].first << ":" << runs_[k].second << std::endl; |
| 1500 | + std::cout << "Run range[" << k << "] " << runs_[k].first << ":" << runs_[k].second << std::endl; |
1494 | 1501 | std::map<std::pair<int, int>, std::vector<double> >::const_iterator itr; |
1495 | 1502 | for (itr = corrs_.begin(); itr != corrs_.end(); ++itr) { |
1496 | | - std::cout << "eta:depth [" << (itr->first).first << ":" << (itr->first).second << "]"; |
1497 | | - for (unsigned int i = 0; i < (itr->second).size(); ++i) |
1498 | | - std::cout << " " << (itr->second)[i]; |
1499 | | - std::cout << std::endl; |
| 1503 | + std::cout << "eta:depth [" << (itr->first).first << ":" << (itr->first).second << "]"; |
| 1504 | + for (unsigned int i = 0; i < (itr->second).size(); ++i) |
| 1505 | + std::cout << " " << (itr->second)[i]; |
| 1506 | + std::cout << std::endl; |
1500 | 1507 | } |
1501 | 1508 | } |
1502 | 1509 | } |
@@ -1531,7 +1538,6 @@ void CalibCorrTest(const char* infile, int flag) { |
1531 | 1538 | CalibDuplicate* c1 = new CalibDuplicate(infile, -flag, true); |
1532 | 1539 | delete c1; |
1533 | 1540 | } |
1534 | | - |
1535 | 1541 | } |
1536 | 1542 |
|
1537 | 1543 | unsigned int stringTest(const std::string& str) { |
|
0 commit comments