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);
53 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
54 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
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;
103 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
105 name =
"HcalHitE50" + divisions[
i].first;
106 title =
"Energy in time window 0 to 50 for a tower in " + divisions[
i].second;
108 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
110 name =
"HcalHitE100" + divisions[
i].first;
111 title =
"Energy in time window 0 to 100 for a tower in " + divisions[
i].second;
113 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
115 name =
"HcalHitE250" + divisions[
i].first;
116 title =
"Energy in time window 0 to 250 for a tower in " + divisions[
i].second;
118 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
139 name =
"Time_Enweighted_HB";
141 name =
"Time_Enweighted_HE";
143 name =
"Time_Enweighted_HO";
145 name =
"Time_Enweighted_HF";
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++) {
196 double energy = hits[
i].energy();
197 double time = hits[
i].time();
199 int itime = (int)(time);
200 int subdet =
id.subdet();
201 int depth =
id.depth();
203 unsigned int dep = hits[
i].depth();
205 std::pair<int, int>
types =
histId(subdet, eta, depth, dep);
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;
318 bins = range.second - range.first;
333 bins = range.second - range.first;
348 <<
" range.first:" << range.first <<
" and second:" << range.second;
349 edm::LogVerbatim(
"HitsValidationHcal") <<
"bins: " << bins <<
" low:" << low <<
" high:" << high;
355 int id1(-1), id2(-1);
356 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
358 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 && eta *
types[
k].
z > 0 &&
359 dep == (
unsigned int)(
types[
k].depth2)) {
364 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 && eta *
types[
k].
z > 0) {
369 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1) {
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);
404 types.push_back(type);
408 snprintf(name1, 40,
"HB%d",
depth);
409 snprintf(name2, 40,
"HB depth%d",
depth + 1);
412 divisions.push_back(names);
413 types.push_back(type);
417 snprintf(name1, 40,
"HE%d+z",
depth);
418 snprintf(name2, 40,
"HE +z depth%d",
depth + 1);
421 divisions.push_back(names);
422 types.push_back(type);
423 snprintf(name1, 40,
"HE%d-z",
depth);
424 snprintf(name2, 40,
"HE -z depth%d",
depth + 1);
427 divisions.push_back(names);
428 types.push_back(type);
433 snprintf(name1, 40,
"HO%d", depth);
434 snprintf(name2, 40,
"HO depth%d", depth);
437 divisions.push_back(names);
438 types.push_back(type);
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);
451 types.push_back(type);
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);
457 types.push_back(type);
468 desc.
add<
bool>(
"Verbose",
false);
469 desc.
add<
bool>(
"TestNumber",
false);
SimHitsValidationHcal(const edm::ParameterSet &ps)
Log< level::Info, true > LogVerbatim
MonitorElement * meEnergy_HF
EventNumber_t event() const
const HcalDDDRecConstants * hcons
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
MonitorElement * metime_enweighted_HO
constexpr uint32_t rawId() const
get the raw id
MonitorElement * metime_HE
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const std::string names[nVars_]
const uint16_t range(const Frame &aFrame)
MonitorElement * metime_enweighted_HB
std::vector< MonitorElement * > meHcalEnergyl25_
bool getData(T &iHolder) const
MonitorElement * meEnergy_HB
MonitorElement * metime_HO
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< MonitorElement * > meHcalEnergyl100_
MonitorElement * metime_enweighted_HF
ParameterDescriptionBase * add(U const &iLabel, T const &value)
MonitorElement * metime_enweighted_HE
std::vector< MonitorElement * > meHcalEnergyl250_
std::vector< MonitorElement * > meHcalHitEta_
int getMaxDepth(const int &type) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
MonitorElement * meEnergy_HE
std::vector< MonitorElement * > meHcalEnergyl50_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
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)
DetId relabel(const uint32_t testId) const
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * metime_HB
MonitorElement * meEnergy_HO
etaRange getLimits(idType)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
~SimHitsValidationHcal() override
int getNPhi(const int &type) const
std::vector< std::pair< std::string, std::string > > getHistogramTypes()
MonitorElement * metime_HF
void analyzeHits(std::vector< PCaloHit > &)