8 : g4Label_(ps.getParameter<
std::
string>(
"ModuleLabel")),
9 hcalHits_(ps.getParameter<
std::
string>(
"HitCollection")),
10 verbose_(ps.getParameter<
bool>(
"Verbose")),
11 testNumber_(ps.getParameter<
bool>(
"TestNumber")),
37 float iphi_max = NphiMax + 0.5;
38 int iphi_bins = (
int)(iphi_max - iphi_min);
48 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
81 ib.setCurrentFolder(
"HcalHitsV/SimHitsValidationHcal");
86 for (
unsigned int i = 0;
i <
types.size(); ++
i) {
88 name =
"HcalHitEta" + divisions[
i].first;
89 title =
"Hit energy as a function of eta tower index in " + divisions[
i].second;
92 name =
"HcalHitTimeAEta" + divisions[
i].first;
93 title =
"Hit time as a function of eta tower index in" + divisions[
i].second;
96 name =
"HcalHitE25" + divisions[
i].first;
97 title =
"Energy in time window 0 to 25 for a tower in " + divisions[
i].second;
101 name =
"HcalHitE50" + divisions[
i].first;
102 title =
"Energy in time window 0 to 50 for a tower in " + divisions[
i].second;
106 name =
"HcalHitE100" + divisions[
i].first;
107 title =
"Energy in time window 0 to 100 for a tower in " + divisions[
i].second;
111 name =
"HcalHitE250" + divisions[
i].first;
112 title =
"Energy in time window 0 to 250 for a tower in " + divisions[
i].second;
135 name =
"Time_Enweighted_HB";
137 name =
"Time_Enweighted_HE";
139 name =
"Time_Enweighted_HO";
141 name =
"Time_Enweighted_HF";
147 edm::LogVerbatim(
"HitsValidationHcal") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
150 bool getHits =
false;
155 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal.: Input flags Hits " << getHits;
158 std::vector<PCaloHit> caloHits;
159 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
164 for (
unsigned int i = 0;
i < caloHits.size(); ++
i) {
165 unsigned int id_ = caloHits[
i].id();
167 caloHits[
i].setID(hid.
rawId());
174 edm::LogVerbatim(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer " << caloHits.size();
181 int nHit =
hits.size();
182 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
183 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
184 int nHB = 0, nHE = 0, nHO = 0, nHF = 0;
186 std::map<std::pair<HcalDetId, unsigned int>,
energysum> map_try;
188 std::map<std::pair<HcalDetId, unsigned int>,
energysum>::iterator itr;
190 for (
int i = 0;
i < nHit;
i++) {
195 int subdet =
id.subdet();
196 int depth =
id.depth();
198 unsigned int dep =
hits[
i].depth();
205 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
209 }
else if (subdet == static_cast<int>(
HcalOuter)) {
213 }
else if (subdet == static_cast<int>(
HcalForward)) {
219 std::pair<HcalDetId, unsigned int> id0(
id, dep);
221 if (map_try.count(id0) != 0)
222 ensum = map_try[id0];
234 map_try[id0] = ensum;
238 <<
"Hit[" <<
i <<
"] ID " <<
std::dec <<
" " <<
id <<
std::dec <<
" Det " <<
id.det() <<
" Sub " << subdet
239 <<
" depth " <<
depth <<
" depthX " << dep <<
" Eta " <<
eta <<
" Phi " <<
id.iphi() <<
" E " <<
energy 240 <<
" time " <<
time <<
" type " <<
types.first <<
" " <<
types.second;
243 double etax =
eta - 0.5;
246 if (
types.first >= 0) {
250 if (
types.second >= 0) {
271 for (itr = map_try.begin(); itr != map_try.end(); ++itr) {
274 std::pair<int, int>
types =
histId((
int)(
id.subdet()),
id.
ieta(),
id.
depth(), (*itr).first.second);
277 double etax =
eta - 0.5;
278 double phix =
phi - 0.5;
279 if (
types.first >= 0) {
285 if (
types.second >= 0) {
294 <<
" energy of tower =" << (*itr).first.first <<
" in time 25ns is == " << (*itr).second.e25
295 <<
" in time 25-50ns == " << (*itr).second.e50 <<
" in time 50-100ns == " << (*itr).second.e100
296 <<
" in time 100-250 ns == " << (*itr).second.e250;
303 std::pair<int, int>
range;
343 <<
" range.first:" <<
range.first <<
" and second:" <<
range.second;
351 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
354 dep == (
unsigned int)(
types[
k].depth2)) {
372 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
378 return std::pair<int, int>(
id1,
id2);
386 std::vector<std::pair<std::string, std::string>> divisions;
389 std::pair<std::string, std::string>
names;
390 char name1[40],
name2[40];
394 snprintf(name1, 40,
"HC%d",
depth);
395 snprintf(
name2, 40,
"HCAL depth%d",
depth + 1);
398 divisions.push_back(
names);
403 snprintf(name1, 40,
"HB%d",
depth);
407 divisions.push_back(
names);
412 snprintf(name1, 40,
"HE%d+z",
depth);
413 snprintf(
name2, 40,
"HE +z depth%d",
depth + 1);
416 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);
428 snprintf(name1, 40,
"HO%d",
depth);
432 divisions.push_back(
names);
437 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
438 int dept0[4] = {0, 1, 2, 3};
439 for (
int k = 0;
k < 4; ++
k) {
441 snprintf(name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
442 snprintf(
name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth + 1);
445 divisions.push_back(
names);
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);
463 desc.add<
bool>(
"Verbose",
false);
464 desc.add<
bool>(
"TestNumber",
false);
SimHitsValidationHcal(const edm::ParameterSet &ps)
Log< level::Info, true > LogVerbatim
MonitorElement * meEnergy_HF
std::pair< int, int > getEtaRange(const int &i) const
const HcalDDDRecConstants * hcons
std::vector< PCaloHit > PCaloHitContainer
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
int getNPhi(const int &type) const
MonitorElement * metime_enweighted_HO
MonitorElement * metime_HE
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const std::string names[nVars_]
MonitorElement * metime_enweighted_HB
std::vector< MonitorElement * > meHcalEnergyl25_
MonitorElement * meEnergy_HB
MonitorElement * metime_HO
void addDefault(ParameterSetDescription const &psetDescription)
const std::string hcalHits_
std::vector< MonitorElement * > meHcalEnergyl100_
#define DEFINE_FWK_MODULE(type)
std::vector< idType > types
MonitorElement * metime_enweighted_HF
DetId relabel(const uint32_t testId) const
int getMaxDepth(const int &type) const
MonitorElement * metime_enweighted_HE
std::vector< MonitorElement * > meHcalEnergyl250_
std::vector< MonitorElement * > meHcalHitEta_
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meEnergy_HE
std::vector< MonitorElement * > meHcalEnergyl50_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > meHcalHitTimeEta_
std::pair< int, int > histId(int subdet, int eta, int depth, unsigned int dep)
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
MonitorElement * metime_HB
const std::string g4Label_
MonitorElement * meEnergy_HO
etaRange getLimits(idType)
std::vector< std::pair< std::string, std::string > > getHistogramTypes()
MonitorElement * metime_HF
void analyzeHits(std::vector< PCaloHit > &)