18 <<
" Hits: " << hcalHits_
44 float iphi_max = NphiMax + 0.5;
45 int iphi_bins = (int) (iphi_max - iphi_min);
55 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
56 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
57 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
88 edm::LogInfo(
"HitsValidationHcal") <<
"Booking the Histograms";
94 for (
unsigned int i=0;
i<
types.size(); ++
i) {
96 sprintf (name,
"HcalHitEta%s", divisions[i].
first.c_str());
97 sprintf (title,
"Hit energy as a function of eta tower index in %s", divisions[i].
second.c_str());
100 sprintf (name,
"HcalHitTimeAEta%s", divisions[i].
first.c_str());
101 sprintf (title,
"Hit time as a function of eta tower index in %s", divisions[i].
second.c_str());
104 sprintf (name,
"HcalHitE25%s", divisions[i].
first.c_str());
105 sprintf (title,
"Energy in time window 0 to 25 for a tower in %s", divisions[i].
second.c_str());
108 sprintf (name,
"HcalHitE50%s", divisions[i].
first.c_str());
109 sprintf (title,
"Energy in time window 0 to 50 for a tower in %s", divisions[i].
second.c_str());
112 sprintf (name,
"HcalHitE100%s", divisions[i].
first.c_str());
113 sprintf (title,
"Energy in time window 0 to 100 for a tower in %s", divisions[i].
second.c_str());
116 sprintf (name,
"HcalHitE250%s", divisions[i].
first.c_str());
117 sprintf (title,
"Energy in time window 0 to 250 for a tower in %s", divisions[i].
second.c_str());
121 sprintf (name,
"Energy_HB");
123 sprintf (name,
"Energy_HE");
125 sprintf (name,
"Energy_HO");
127 sprintf (name,
"Energy_HF");
130 sprintf (name,
"Time_HB");
132 sprintf (name,
"Time_HE");
134 sprintf (name,
"Time_HO");
136 sprintf (name,
"Time_HF");
139 sprintf (name,
"Time_Enweighted_HB");
141 sprintf (name,
"Time_Enweighted_HE");
143 sprintf (name,
"Time_Enweighted_HO");
145 sprintf (name,
"Time_Enweighted_HF");
157 std::vector<PCaloHit> caloHits;
160 bool getHits =
false;
162 if (hitsHcal.
isValid()) getHits =
true;
164 edm::LogInfo(
"HitsValidationHcal") <<
"HitsValidationHcal.: Input flags Hits "
168 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end());
173 for (
unsigned int i=0;
i<caloHits.size(); ++
i) {
174 unsigned int id_ = caloHits[
i].id();
175 int subdet,
z, depth0, eta0, phi0, lay;
177 int sign = (z==0) ? (-1):(1);
180 <<
"] subdet|z|depth|eta|phi|lay "
181 << subdet <<
"|" << z <<
"|"
182 << depth0 <<
"|" << eta0 <<
"|"
183 << phi0 <<
"|" << lay;
197 caloHits[
i].setID(hid.
rawId());
199 edm::LogInfo(
"HitsValidationHcal") <<
"Hit[" <<
i <<
"] " << hid;
204 edm::LogInfo(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer "
213 int nHit = hits.size();
214 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
215 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
216 int nHB=0, nHE=0, nHO=0, nHF=0;
218 std::map<std::pair<HcalDetId,unsigned int>,
energysum> map_try;
220 std::map<std::pair<HcalDetId,unsigned int>,
energysum>::iterator itr;
222 for (
int i=0;
i<nHit;
i++) {
223 double energy = hits[
i].energy();
224 double time = hits[
i].time();
226 int itime = (int)(time);
227 int subdet =
id.subdet();
228 int depth =
id.depth();
230 unsigned int dep = hits[
i].depth();
232 std::pair<int,int>
types =
histId(subdet, eta, depth, dep);
237 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
241 }
else if (subdet == static_cast<int>(
HcalOuter)) {
245 }
else if (subdet == static_cast<int>(
HcalForward)) {
251 std::pair<HcalDetId,unsigned int> id0(
id,dep);
253 if (map_try.count(id0) != 0) ensum = map_try[id0];
264 map_try[id0] = ensum;
269 <<
id.det() <<
" Sub " << subdet
270 <<
" depth " << depth <<
" depthX "
271 << dep <<
" Eta " << eta <<
" Phi "
272 <<
id.iphi() <<
" E " << energy
273 <<
" time " << time <<
" type "
274 << types.first <<
" " << types.second;
277 double etax = eta - 0.5;
278 if (eta < 0) etax += 1;
279 if (types.first >= 0) {
283 if (types.second >= 0) {
305 for (itr = map_try.begin(); itr != map_try.end(); ++itr) {
308 std::pair<int,int>
types =
histId((
int)(
id.subdet()),
id.ieta(),
id.
depth(), (*itr).first.second);
311 double etax= eta-0.5;
312 double phix= phi-0.5;
313 if (types.first >= 0) {
319 if (types.second >= 0) {
327 edm::LogInfo(
"HitsValidationHcal") <<
" energy of tower =" << (*itr).first.first
328 <<
" in time 25ns is == " << (*itr).second.e25
329 <<
" in time 25-50ns == " << (*itr).second.e50
330 <<
" in time 50-100ns == " << (*itr).second.e100
331 <<
" in time 100-250 ns == " << (*itr).second.e250;
340 std::pair<int,int> range;
350 bins = range.second- range.first;
365 bins = range.second-range.first;
380 << type.
z <<
" range.first:" << range.first
381 <<
" and second:" << range.second;
382 edm::LogInfo(
"HitsValidationHcal") <<
"bins: " << bins <<
" low:" << low
390 int id1(-1), id2(-1);
391 for (
unsigned int k=0;
k<
types.size(); ++
k) {
393 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
394 eta*
types[
k].
z > 0 && dep == (
unsigned int)(
types[
k].depth2)) {
398 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
403 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1) {
409 for (
unsigned int k=0;
k<
types.size(); ++
k) {
415 return std::pair<int,int>(id1,id2);
424 std::vector<std::pair<std::string,std::string> > divisions;
425 std::pair<std::string,std::string>
names;
426 char name1[40], name2[40];
430 snprintf (name1, 40,
"HC%d",
depth);
431 snprintf (name2, 40,
"HCAL depth%d",
depth+1);
434 divisions.push_back(names);
435 types.push_back(type);
439 snprintf (name1, 40,
"HB%d",
depth);
440 snprintf (name2, 40,
"HB depth%d",
depth+1);
443 divisions.push_back(names);
444 types.push_back(type);
448 snprintf (name1, 40,
"HE%d+z",
depth);
449 snprintf (name2, 40,
"HE +z depth%d",
depth+1);
452 divisions.push_back(names);
453 types.push_back(type);
454 snprintf (name1, 40,
"HE%d-z",
depth);
455 snprintf (name2, 40,
"HE -z depth%d",
depth+1);
458 divisions.push_back(names);
459 types.push_back(type);
464 snprintf (name1, 40,
"HO%d", depth);
465 snprintf (name2, 40,
"HO depth%d", depth);
468 divisions.push_back(names);
469 types.push_back(type);
473 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
474 int dept0[4] = {0, 1, 2, 3};
475 for (
int k=0;
k<4; ++
k) {
477 snprintf (name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
478 snprintf (name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth+1);
481 divisions.push_back(names);
482 types.push_back(type);
483 snprintf (name1, 40,
"HF%s%d-z", hfty1[k].c_str(),
depth);
484 snprintf (name2, 40,
"HF (%s) -z depth%d", hfty2[k].c_str(),
depth+1);
487 divisions.push_back(names);
488 types.push_back(type);
499 desc.
add<
bool>(
"Verbose",
false);
500 desc.
add<
bool>(
"TestNumber",
false);
int getNPhi(const int type) const
SimHitsValidationHcal(const edm::ParameterSet &ps)
MonitorElement * meEnergy_HF
std::vector< MonitorElement * > meHcalHitEta_
T getParameter(std::string const &) const
EventNumber_t event() const
const HcalDDDRecConstants * hcons
static const HistoName names[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
MonitorElement * metime_enweighted_HO
std::vector< MonitorElement * > meHcalEnergyl25_
MonitorElement * metime_HE
void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * metime_enweighted_HB
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
int getMaxDepth(const int type) const
MonitorElement * meEnergy_HB
MonitorElement * metime_HO
void addDefault(ParameterSetDescription const &psetDescription)
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
std::vector< MonitorElement * > meHcalEnergyl250_
MonitorElement * book1D(Args &&...args)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
std::vector< idType > types
MonitorElement * metime_enweighted_HF
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< MonitorElement * > meHcalEnergyl100_
std::vector< MonitorElement * > meHcalEnergyl50_
MonitorElement * metime_enweighted_HE
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
MonitorElement * meEnergy_HE
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::pair< int, int > getEtaRange(const int i) const
std::vector< MonitorElement * > meHcalHitTimeEta_
std::pair< int, int > histId(int subdet, int eta, int depth, unsigned int dep)
MonitorElement * metime_HB
MonitorElement * meEnergy_HO
etaRange getLimits(idType)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
std::vector< std::pair< std::string, std::string > > getHistogramTypes()
MonitorElement * metime_HF
void analyzeHits(std::vector< PCaloHit > &)