42 float iphi_max = NphiMax + 0.5;
43 int iphi_bins = (
int)(iphi_max - iphi_min);
53 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
86 ib.setCurrentFolder(
"HcalHitsV/SimHitsValidationHcal");
91 for (
unsigned int i = 0;
i <
types.size(); ++
i) {
93 name =
"HcalHitEta" + divisions[
i].first;
94 title =
"Hit energy as a function of eta tower index in " + divisions[
i].second;
97 name =
"HcalHitTimeAEta" + divisions[
i].first;
98 title =
"Hit time as a function of eta tower index in" + divisions[
i].second;
101 name =
"HcalHitE25" + divisions[
i].first;
102 title =
"Energy in time window 0 to 25 for a tower in " + divisions[
i].second;
106 name =
"HcalHitE50" + divisions[
i].first;
107 title =
"Energy in time window 0 to 50 for a tower in " + divisions[
i].second;
111 name =
"HcalHitE100" + divisions[
i].first;
112 title =
"Energy in time window 0 to 100 for a tower in " + divisions[
i].second;
116 name =
"HcalHitE250" + divisions[
i].first;
117 title =
"Energy in time window 0 to 250 for a tower in " + divisions[
i].second;
140 name =
"Time_Enweighted_HB";
142 name =
"Time_Enweighted_HE";
144 name =
"Time_Enweighted_HO";
146 name =
"Time_Enweighted_HF";
152 edm::LogVerbatim(
"HitsValidationHcal") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
154 std::vector<PCaloHit> caloHits;
157 bool getHits =
false;
162 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal.: Input flags Hits " << getHits;
165 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
170 for (
unsigned int i = 0;
i < caloHits.size(); ++
i) {
171 unsigned int id_ = caloHits[
i].id();
173 caloHits[
i].setID(hid.
rawId());
180 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer " << caloHits.size();
187 int nHit =
hits.size();
188 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
189 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
190 int nHB = 0, nHE = 0, nHO = 0, nHF = 0;
192 std::map<std::pair<HcalDetId, unsigned int>,
energysum> map_try;
194 std::map<std::pair<HcalDetId, unsigned int>,
energysum>::iterator
itr;
196 for (
int i = 0;
i < nHit;
i++) {
201 int subdet =
id.subdet();
202 int depth =
id.depth();
204 unsigned int dep =
hits[
i].depth();
211 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
215 }
else if (subdet == static_cast<int>(
HcalOuter)) {
219 }
else if (subdet == static_cast<int>(
HcalForward)) {
225 std::pair<HcalDetId, unsigned int> id0(
id, dep);
227 if (map_try.count(id0) != 0)
228 ensum = map_try[id0];
240 map_try[id0] = ensum;
244 <<
"Hit[" <<
i <<
"] ID " <<
std::dec <<
" " <<
id <<
std::dec <<
" Det " <<
id.det() <<
" Sub " << subdet
245 <<
" depth " <<
depth <<
" depthX " << dep <<
" Eta " <<
eta <<
" Phi " <<
id.iphi() <<
" E " <<
energy
246 <<
" time " <<
time <<
" type " <<
types.first <<
" " <<
types.second;
249 double etax =
eta - 0.5;
252 if (
types.first >= 0) {
256 if (
types.second >= 0) {
277 for (
itr = map_try.begin();
itr != map_try.end(); ++
itr) {
280 std::pair<int, int>
types =
histId((
int)(
id.subdet()),
id.
ieta(),
id.
depth(), (*itr).first.second);
283 double etax =
eta - 0.5;
284 double phix =
phi - 0.5;
285 if (
types.first >= 0) {
291 if (
types.second >= 0) {
300 <<
" energy of tower =" << (*itr).first.first <<
" in time 25ns is == " << (*itr).second.e25
301 <<
" in time 25-50ns == " << (*itr).second.e50 <<
" in time 50-100ns == " << (*itr).second.e100
302 <<
" in time 100-250 ns == " << (*itr).second.e250;
309 std::pair<int, int>
range;
349 <<
" range.first:" <<
range.first <<
" and second:" <<
range.second;
357 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
360 dep == (
unsigned int)(
types[
k].depth2)) {
378 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
384 return std::pair<int, int>(
id1,
id2);
392 std::vector<std::pair<std::string, std::string>> divisions;
395 std::pair<std::string, std::string>
names;
396 char name1[40],
name2[40];
400 snprintf(name1, 40,
"HC%d",
depth);
401 snprintf(
name2, 40,
"HCAL depth%d",
depth + 1);
404 divisions.push_back(
names);
409 snprintf(name1, 40,
"HB%d",
depth);
413 divisions.push_back(
names);
418 snprintf(name1, 40,
"HE%d+z",
depth);
419 snprintf(
name2, 40,
"HE +z depth%d",
depth + 1);
422 divisions.push_back(
names);
424 snprintf(name1, 40,
"HE%d-z",
depth);
425 snprintf(
name2, 40,
"HE -z depth%d",
depth + 1);
428 divisions.push_back(
names);
434 snprintf(name1, 40,
"HO%d",
depth);
438 divisions.push_back(
names);
443 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
444 int dept0[4] = {0, 1, 2, 3};
445 for (
int k = 0;
k < 4; ++
k) {
447 snprintf(name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
448 snprintf(
name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth + 1);
451 divisions.push_back(
names);
453 snprintf(name1, 40,
"HF%s%d-z", hfty1[
k].c_str(),
depth);
454 snprintf(
name2, 40,
"HF (%s) -z depth%d", hfty2[
k].c_str(),
depth + 1);
457 divisions.push_back(
names);
469 desc.
add<
bool>(
"Verbose",
false);
470 desc.
add<
bool>(
"TestNumber",
false);