14 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
41 float iphi_max = NphiMax + 0.5;
42 int iphi_bins = (
int)(iphi_max - iphi_min);
52 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
85 ib.setCurrentFolder(
"HcalHitsV/SimHitsValidationHcal");
90 for (
unsigned int i = 0;
i <
types.size(); ++
i) {
92 name =
"HcalHitEta" + divisions[
i].first;
93 title =
"Hit energy as a function of eta tower index in " + divisions[
i].second;
96 name =
"HcalHitTimeAEta" + divisions[
i].first;
97 title =
"Hit time as a function of eta tower index in" + divisions[
i].second;
100 name =
"HcalHitE25" + divisions[
i].first;
101 title =
"Energy in time window 0 to 25 for a tower in " + divisions[
i].second;
105 name =
"HcalHitE50" + divisions[
i].first;
106 title =
"Energy in time window 0 to 50 for a tower in " + divisions[
i].second;
110 name =
"HcalHitE100" + divisions[
i].first;
111 title =
"Energy in time window 0 to 100 for a tower in " + divisions[
i].second;
115 name =
"HcalHitE250" + divisions[
i].first;
116 title =
"Energy in time window 0 to 250 for a tower in " + divisions[
i].second;
139 name =
"Time_Enweighted_HB";
141 name =
"Time_Enweighted_HE";
143 name =
"Time_Enweighted_HO";
145 name =
"Time_Enweighted_HF";
151 edm::LogVerbatim(
"HitsValidationHcal") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
153 std::vector<PCaloHit> caloHits;
156 bool getHits =
false;
161 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal.: Input flags Hits " << getHits;
164 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
169 for (
unsigned int i = 0;
i < caloHits.size(); ++
i) {
170 unsigned int id_ = caloHits[
i].id();
172 caloHits[
i].setID(hid.
rawId());
179 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer " << caloHits.size();
186 int nHit =
hits.size();
187 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
188 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
189 int nHB = 0, nHE = 0, nHO = 0, nHF = 0;
191 std::map<std::pair<HcalDetId, unsigned int>,
energysum> map_try;
193 std::map<std::pair<HcalDetId, unsigned int>,
energysum>::iterator itr;
195 for (
int i = 0;
i < nHit;
i++) {
200 int subdet =
id.subdet();
201 int depth =
id.depth();
203 unsigned int dep =
hits[
i].depth();
210 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
214 }
else if (subdet == static_cast<int>(
HcalOuter)) {
218 }
else if (subdet == static_cast<int>(
HcalForward)) {
224 std::pair<HcalDetId, unsigned int> id0(
id, dep);
226 if (map_try.count(id0) != 0)
227 ensum = map_try[id0];
239 map_try[id0] = ensum;
243 <<
"Hit[" <<
i <<
"] ID " <<
std::dec <<
" " <<
id <<
std::dec <<
" Det " <<
id.det() <<
" Sub " << subdet
244 <<
" depth " <<
depth <<
" depthX " << dep <<
" Eta " <<
eta <<
" Phi " <<
id.iphi() <<
" E " <<
energy
245 <<
" time " <<
time <<
" type " <<
types.first <<
" " <<
types.second;
248 double etax =
eta - 0.5;
251 if (
types.first >= 0) {
255 if (
types.second >= 0) {
276 for (itr = map_try.begin(); itr != map_try.end(); ++itr) {
279 std::pair<int, int>
types =
histId((
int)(
id.subdet()),
id.
ieta(),
id.
depth(), (*itr).first.second);
282 double etax =
eta - 0.5;
283 double phix =
phi - 0.5;
284 if (
types.first >= 0) {
290 if (
types.second >= 0) {
299 <<
" energy of tower =" << (*itr).first.first <<
" in time 25ns is == " << (*itr).second.e25
300 <<
" in time 25-50ns == " << (*itr).second.e50 <<
" in time 50-100ns == " << (*itr).second.e100
301 <<
" in time 100-250 ns == " << (*itr).second.e250;
308 std::pair<int, int>
range;
348 <<
" range.first:" <<
range.first <<
" and second:" <<
range.second;
356 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
359 dep == (
unsigned int)(
types[
k].depth2)) {
377 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
383 return std::pair<int, int>(
id1,
id2);
391 std::vector<std::pair<std::string, std::string>> divisions;
394 std::pair<std::string, std::string>
names;
395 char name1[40],
name2[40];
399 snprintf(name1, 40,
"HC%d",
depth);
400 snprintf(
name2, 40,
"HCAL depth%d",
depth + 1);
403 divisions.push_back(
names);
408 snprintf(name1, 40,
"HB%d",
depth);
412 divisions.push_back(
names);
417 snprintf(name1, 40,
"HE%d+z",
depth);
418 snprintf(
name2, 40,
"HE +z depth%d",
depth + 1);
421 divisions.push_back(
names);
423 snprintf(name1, 40,
"HE%d-z",
depth);
424 snprintf(
name2, 40,
"HE -z depth%d",
depth + 1);
427 divisions.push_back(
names);
433 snprintf(name1, 40,
"HO%d",
depth);
437 divisions.push_back(
names);
442 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
443 int dept0[4] = {0, 1, 2, 3};
444 for (
int k = 0;
k < 4; ++
k) {
446 snprintf(name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
447 snprintf(
name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth + 1);
450 divisions.push_back(
names);
452 snprintf(name1, 40,
"HF%s%d-z", hfty1[
k].c_str(),
depth);
453 snprintf(
name2, 40,
"HF (%s) -z depth%d", hfty2[
k].c_str(),
depth + 1);
456 divisions.push_back(
names);
468 desc.add<
bool>(
"Verbose",
false);
469 desc.add<
bool>(
"TestNumber",
false);