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();
176 caloHits[
i].setID(hid.
rawId());
178 edm::LogInfo(
"HitsValidationHcal") <<
"Hit[" <<
i <<
"] " << hid;
183 edm::LogInfo(
"HitsValidationHcal") <<
"HitsValidationHcal: Hit buffer " 192 int nHit = hits.size();
193 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
194 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
195 int nHB=0, nHE=0, nHO=0, nHF=0;
197 std::map<std::pair<HcalDetId,unsigned int>,
energysum> map_try;
199 std::map<std::pair<HcalDetId,unsigned int>,
energysum>::iterator itr;
201 for (
int i=0;
i<nHit;
i++) {
202 double energy = hits[
i].energy();
203 double time = hits[
i].time();
205 int itime = (
int)(time);
206 int subdet =
id.subdet();
207 int depth =
id.depth();
209 unsigned int dep = hits[
i].depth();
211 std::pair<int,int>
types =
histId(subdet, eta, depth, dep);
216 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
220 }
else if (subdet == static_cast<int>(
HcalOuter)) {
224 }
else if (subdet == static_cast<int>(
HcalForward)) {
230 std::pair<HcalDetId,unsigned int> id0(
id,dep);
232 if (map_try.count(id0) != 0) ensum = map_try[id0];
234 ensum.
e250 += energy;
236 ensum.
e100 += energy;
239 if (itime<25) ensum.
e25 += energy;
243 map_try[id0] = ensum;
248 <<
id.det() <<
" Sub " << subdet
249 <<
" depth " << depth <<
" depthX " 250 << dep <<
" Eta " << eta <<
" Phi " 251 <<
id.iphi() <<
" E " << energy
252 <<
" time " << time <<
" type " 253 << types.first <<
" " << types.second;
256 double etax = eta - 0.5;
257 if (eta < 0) etax += 1;
258 if (types.first >= 0) {
262 if (types.second >= 0) {
284 for (itr = map_try.begin(); itr != map_try.end(); ++itr) {
287 std::pair<int,int>
types =
histId((
int)(
id.subdet()),
id.ieta(),
id.
depth(), (*itr).first.second);
290 double etax= eta-0.5;
291 double phix= phi-0.5;
292 if (types.first >= 0) {
298 if (types.second >= 0) {
306 edm::LogInfo(
"HitsValidationHcal") <<
" energy of tower =" << (*itr).first.first
307 <<
" in time 25ns is == " << (*itr).second.e25
308 <<
" in time 25-50ns == " << (*itr).second.e50
309 <<
" in time 50-100ns == " << (*itr).second.e100
310 <<
" in time 100-250 ns == " << (*itr).second.e250;
319 std::pair<int,int> range;
329 bins = range.second- range.first;
344 bins = range.second-range.first;
359 << type.
z <<
" range.first:" << range.first
360 <<
" and second:" << range.second;
361 edm::LogInfo(
"HitsValidationHcal") <<
"bins: " << bins <<
" low:" << low
370 for (
unsigned int k=0;
k<
types.size(); ++
k) {
372 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
373 eta*
types[
k].
z > 0 && dep == (
unsigned int)(
types[
k].depth2)) {
377 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1 &&
382 if (subdet == (
int)(
types[
k].subdet) && depth ==
types[
k].depth1) {
388 for (
unsigned int k=0;
k<
types.size(); ++
k) {
394 return std::pair<int,int>(
id1,
id2);
403 std::vector<std::pair<std::string,std::string> > divisions;
404 std::pair<std::string,std::string>
names;
405 char name1[40], name2[40];
409 snprintf (name1, 40,
"HC%d",
depth);
410 snprintf (name2, 40,
"HCAL depth%d",
depth+1);
413 divisions.push_back(names);
414 types.push_back(type);
418 snprintf (name1, 40,
"HB%d",
depth);
419 snprintf (name2, 40,
"HB depth%d",
depth+1);
422 divisions.push_back(names);
423 types.push_back(type);
427 snprintf (name1, 40,
"HE%d+z",
depth);
428 snprintf (name2, 40,
"HE +z depth%d",
depth+1);
431 divisions.push_back(names);
432 types.push_back(type);
433 snprintf (name1, 40,
"HE%d-z",
depth);
434 snprintf (name2, 40,
"HE -z depth%d",
depth+1);
437 divisions.push_back(names);
438 types.push_back(type);
443 snprintf (name1, 40,
"HO%d", depth);
444 snprintf (name2, 40,
"HO depth%d", depth);
447 divisions.push_back(names);
448 types.push_back(type);
452 std::string hfty2[4] = {
"Absorber",
"Window",
"Bundle",
"Jungle"};
453 int dept0[4] = {0, 1, 2, 3};
454 for (
int k=0;
k<4; ++
k) {
456 snprintf (name1, 40,
"HF%s%d+z", hfty1[
k].c_str(),
depth);
457 snprintf (name2, 40,
"HF (%s) +z depth%d", hfty2[
k].c_str(),
depth+1);
460 divisions.push_back(names);
461 types.push_back(type);
462 snprintf (name1, 40,
"HF%s%d-z", hfty1[k].c_str(),
depth);
463 snprintf (name2, 40,
"HF (%s) -z depth%d", hfty2[k].c_str(),
depth+1);
466 divisions.push_back(names);
467 types.push_back(type);
478 desc.
add<
bool>(
"Verbose",
false);
479 desc.
add<
bool>(
"TestNumber",
false);
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)
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * metime_enweighted_HB
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
MonitorElement * meEnergy_HB
MonitorElement * metime_HO
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< MonitorElement * > meHcalEnergyl250_
MonitorElement * book1D(Args &&...args)
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)
int getMaxDepth(const int &type) const
MonitorElement * meEnergy_HE
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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
MonitorElement * metime_HB
MonitorElement * meEnergy_HO
etaRange getLimits(idType)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
int getNPhi(const int &type) const
std::vector< std::pair< std::string, std::string > > getHistogramTypes()
MonitorElement * metime_HF
void analyzeHits(std::vector< PCaloHit > &)