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);
49 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
50 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
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;
99 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
101 name =
"HcalHitE50" + divisions[
i].first;
102 title =
"Energy in time window 0 to 50 for a tower in " + divisions[
i].second;
104 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
106 name =
"HcalHitE100" + divisions[
i].first;
107 title =
"Energy in time window 0 to 100 for a tower in " + divisions[
i].second;
109 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
111 name =
"HcalHitE250" + divisions[
i].first;
112 title =
"Energy in time window 0 to 250 for a tower in " + divisions[
i].second;
114 ib.
book2D(name, title, limit.
bins, limit.
low, limit.
high, iphi_bins, iphi_min, iphi_max));
135 name =
"Time_Enweighted_HB";
137 name =
"Time_Enweighted_HE";
139 name =
"Time_Enweighted_HO";
141 name =
"Time_Enweighted_HF";
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++) {
191 double energy = hits[
i].energy();
192 double time = hits[
i].time();
194 int itime = (int)(time);
195 int subdet =
id.subdet();
196 int depth =
id.depth();
198 unsigned int dep = hits[
i].depth();
200 std::pair<int, int>
types =
histId(subdet, eta, depth, dep);
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;
313 bins = range.second - range.first;
328 bins = range.second - range.first;
343 <<
" range.first:" << range.first <<
" and second:" << range.second;
344 edm::LogVerbatim(
"HitsValidationHcal") <<
"bins: " << bins <<
" low:" << low <<
" high:" << high;
350 int id1(-1), id2(-1);
351 for (
unsigned int k = 0;
k <
types.size(); ++
k) {
353 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 && eta *
types[
k].
z > 0 &&
354 dep == (
unsigned int)(
types[
k].depth2)) {
359 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 && eta *
types[
k].
z > 0) {
364 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1) {
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);
399 types.push_back(type);
403 snprintf(name1, 40,
"HB%d",
depth);
404 snprintf(name2, 40,
"HB depth%d",
depth + 1);
407 divisions.push_back(names);
408 types.push_back(type);
412 snprintf(name1, 40,
"HE%d+z",
depth);
413 snprintf(name2, 40,
"HE +z depth%d",
depth + 1);
416 divisions.push_back(names);
417 types.push_back(type);
418 snprintf(name1, 40,
"HE%d-z",
depth);
419 snprintf(name2, 40,
"HE -z depth%d",
depth + 1);
422 divisions.push_back(names);
423 types.push_back(type);
428 snprintf(name1, 40,
"HO%d", depth);
429 snprintf(name2, 40,
"HO depth%d", depth);
432 divisions.push_back(names);
433 types.push_back(type);
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);
446 types.push_back(type);
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);
452 types.push_back(type);
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
EventNumber_t event() const
const HcalDDDRecConstants * hcons
std::vector< PCaloHit > PCaloHitContainer
virtual void setCurrentFolder(std::string const &fullpath)
#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
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
MonitorElement * metime_HO
void addDefault(ParameterSetDescription const &psetDescription)
const std::string hcalHits_
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())
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)
DetId relabel(const uint32_t testId) const
std::pair< int, int > getEtaRange(const int &i) const
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * metime_HB
const std::string g4Label_
MonitorElement * meEnergy_HO
etaRange getLimits(idType)
int getNPhi(const int &type) const
std::vector< std::pair< std::string, std::string > > getHistogramTypes()
MonitorElement * metime_HF
void analyzeHits(std::vector< PCaloHit > &)