18 <<
" Hits: " << hcalHits_
40 edm::LogInfo(
"HitsValidationHcal") <<
"Booking the Histograms";
46 for (
unsigned int i=0;
i<
types.size(); ++
i) {
48 sprintf (name,
"HcalHitEta%s", divisions[i].
first.c_str());
49 sprintf (title,
"Hit energy as a function of eta tower index in %s", divisions[i].
second.c_str());
52 sprintf (name,
"HcalHitTimeAEta%s", divisions[i].
first.c_str());
53 sprintf (title,
"Hit time as a function of eta tower index in %s", divisions[i].
second.c_str());
56 sprintf (name,
"HcalHitE25%s", divisions[i].
first.c_str());
57 sprintf (title,
"Energy in time window 0 to 25 for a tower in %s", divisions[i].
second.c_str());
60 sprintf (name,
"HcalHitE50%s", divisions[i].
first.c_str());
61 sprintf (title,
"Energy in time window 0 to 50 for a tower in %s", divisions[i].
second.c_str());
64 sprintf (name,
"HcalHitE100%s", divisions[i].
first.c_str());
65 sprintf (title,
"Energy in time window 0 to 100 for a tower in %s", divisions[i].
second.c_str());
68 sprintf (name,
"HcalHitE250%s", divisions[i].
first.c_str());
69 sprintf (title,
"Energy in time window 0 to 250 for a tower in %s", divisions[i].
second.c_str());
73 sprintf (name,
"Energy_HB");
75 sprintf (name,
"Energy_HE");
77 sprintf (name,
"Energy_HO");
79 sprintf (name,
"Energy_HF");
82 sprintf (name,
"Time_HB");
84 sprintf (name,
"Time_HE");
86 sprintf (name,
"Time_HO");
88 sprintf (name,
"Time_HF");
91 sprintf (name,
"Time_Enweighted_HB");
93 sprintf (name,
"Time_Enweighted_HE");
95 sprintf (name,
"Time_Enweighted_HO");
97 sprintf (name,
"Time_Enweighted_HF");
109 std::vector<PCaloHit> caloHits;
112 bool getHits =
false;
114 if (hitsHcal.
isValid()) getHits =
true;
116 edm::LogInfo(
"HitsValidationHcal") <<
"HitsValidationHcal.: Input flags Hits "
120 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end());
125 for (
unsigned int i=0;
i<caloHits.size(); ++
i) {
126 unsigned int id_ = caloHits[
i].id();
127 int subdet,
z, depth0, eta0, phi0, lay;
129 int sign = (z==0) ? (-1):(1);
132 <<
"] subdet|z|depth|eta|phi|lay "
133 << subdet <<
"|" << z <<
"|"
134 << depth0 <<
"|" << eta0 <<
"|"
135 << phi0 <<
"|" << lay;
149 caloHits[
i].setID(hid.
rawId());
151 edm::LogInfo(
"HitsValidationHcal") <<
"Hit[" <<
i <<
"] " << hid;
156 edm::LogInfo(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer "
165 int nHit = hits.size();
166 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
167 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
168 int nHB=0, nHE=0, nHO=0, nHF=0;
170 std::map<std::pair<HcalDetId,unsigned int>,
energysum> map_try;
172 std::map<std::pair<HcalDetId,unsigned int>,
energysum>::iterator itr;
174 for (
int i=0;
i<nHit;
i++) {
175 double energy = hits[
i].energy();
176 double time = hits[
i].time();
178 int itime = (int)(time);
179 int subdet =
id.subdet();
180 int depth =
id.depth();
182 unsigned int dep = hits[
i].depth();
184 std::pair<int,int>
types =
histId(subdet, eta, depth, dep);
189 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
193 }
else if (subdet == static_cast<int>(
HcalOuter)) {
197 }
else if (subdet == static_cast<int>(
HcalForward)) {
203 std::pair<HcalDetId,unsigned int> id0(
id,dep);
205 if (map_try.count(id0) != 0) ensum = map_try[id0];
216 map_try[id0] = ensum;
221 <<
id.det() <<
" Sub " << subdet
222 <<
" depth " << depth <<
" depthX "
223 << dep <<
" Eta " << eta <<
" Phi "
224 <<
id.iphi() <<
" E " << energy
225 <<
" time " << time <<
" type "
226 << types.first <<
" " << types.second;
229 double etax = eta - 0.5;
230 if (eta < 0) etax += 1;
231 if (types.first >= 0) {
235 if (types.second >= 0) {
257 for (itr = map_try.begin(); itr != map_try.end(); ++itr) {
260 std::pair<int,int>
types =
histId((
int)(
id.subdet()),
id.ieta(),
id.
depth(), (*itr).first.second);
263 double etax= eta-0.5;
264 double phix= phi-0.5;
265 if (types.first >= 0) {
271 if (types.second >= 0) {
279 edm::LogInfo(
"HitsValidationHcal") <<
" energy of tower =" << (*itr).first.first
280 <<
" in time 25ns is == " << (*itr).second.e25
281 <<
" in time 25-50ns == " << (*itr).second.e50
282 <<
" in time 50-100ns == " << (*itr).second.e100
283 <<
" in time 100-250 ns == " << (*itr).second.e250;
292 std::pair<int,int> range;
302 bins = range.second- range.first;
317 bins = range.second-range.first;
332 << type.
z <<
" range.first:" << range.first
333 <<
" and second:" << range.second;
334 edm::LogInfo(
"HitsValidationHcal") <<
"bins: " << bins <<
" low:" << low
342 int id1(-1), id2(-1);
343 for (
unsigned int k=0;
k<
types.size(); ++
k) {
345 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
346 eta*
types[
k].
z > 0 && dep == (
unsigned int)(
types[
k].depth2)) {
350 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
355 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1) {
361 for (
unsigned int k=0;
k<
types.size(); ++
k) {
367 return std::pair<int,int>(id1,id2);
376 std::vector<std::pair<std::string,std::string> > divisions;
377 std::pair<std::string,std::string>
names;
378 char name1[40], name2[40];
382 snprintf (name1, 40,
"HC%d",
depth);
383 snprintf (name2, 40,
"HCAL depth%d",
depth+1);
386 divisions.push_back(names);
387 types.push_back(type);
391 snprintf (name1, 40,
"HB%d",
depth);
392 snprintf (name2, 40,
"HB depth%d",
depth+1);
395 divisions.push_back(names);
396 types.push_back(type);
400 snprintf (name1, 40,
"HE%d+z",
depth);
401 snprintf (name2, 40,
"HE +z depth%d",
depth+1);
404 divisions.push_back(names);
405 types.push_back(type);
406 snprintf (name1, 40,
"HE%d-z",
depth);
407 snprintf (name2, 40,
"HE -z depth%d",
depth+1);
410 divisions.push_back(names);
411 types.push_back(type);
416 snprintf (name1, 40,
"HO%d", depth);
417 snprintf (name2, 40,
"HO depth%d", depth);
420 divisions.push_back(names);
421 types.push_back(type);
425 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
426 int dept0[4] = {0, 1, 2, 3};
427 for (
int k=0;
k<4; ++
k) {
429 snprintf (name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
430 snprintf (name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth+1);
433 divisions.push_back(names);
434 types.push_back(type);
435 snprintf (name1, 40,
"HF%s%d-z", hfty1[k].c_str(),
depth);
436 snprintf (name2, 40,
"HF (%s) -z depth%d", hfty2[k].c_str(),
depth+1);
439 divisions.push_back(names);
440 types.push_back(type);
SimHitsValidationHcal(const edm::ParameterSet &ps)
MonitorElement * meEnergy_HF
std::vector< MonitorElement * > meHcalHitEta_
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) 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
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
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
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 > &)