21 edm::LogInfo(
"HitsValidationHcal") <<
"Histograms booked";
26 std::string divisions[
nType]={
"HB0",
"HB1",
"HE0+z",
"HE1+z",
"HE2+z",
"HE0-z",
"HE1-z",
27 "HE2-z",
"HO0",
"HFL0+z",
"HFS0+z",
"HFL1+z",
"HFS1+z",
28 "HFL2+z",
"HFS2+z",
"HFL3+z",
"HFS3+z",
"HFL0-z",
"HFS0-z",
29 "HFL1-z",
"HFS1-z",
"HFL2-z",
"HFS2-z",
"HFL3-z",
"HFS3-z"};
31 std::string divisions1[
nType]={
"HB depth1",
"HB depth2 ",
"HE+z depth1",
"HE+z depth2",
"HE+z depth3",
"HE-z depth1",
"HE-z depth2",
32 "HE-z depth3",
"HO depth1",
"HFL+z depth1",
"HFS+z depth1",
"HFL+z depth2",
"HFS+z depth2",
33 "HFL+z depth3",
"HFS+z depth3",
"HFL+z depth4",
"HFS+z depth4",
"HFL-z depth1",
"HFS-z depth1",
34 "HFL-z depth2",
"HFS-z depth2",
"HFL-z depth3",
"HFS-z depth3 ",
"HFL-z depth4",
"HFS-z depth4"};
36 double etaLow[
nType]={-16,-16,16,16,16,-30,-30,-30,-15,29,29,29,29,29,29,29,29,
37 -41,-41,-41,-41,-41,-41,-41,-41};
38 double etaHigh[
nType]={16,16,30,30,30,-16,-16,-16,15,41,41,41,41,41,41,41,41,
39 -29,-29,-29,-29,-29,-29,-29,-29};
40 int etaBins[
nType]={32,32,14,14,14,14,14,14,30,12,12,12,12,12,12,12,12,
41 12,12,12,12,12,12,12,12};
45 sprintf (name,
"HcalHitEta%s", divisions[
i].c_str());
46 sprintf (title,
"Hit energy as a function of eta tower index in %s", divisions1[
i].c_str());
49 sprintf (name,
"HcalHitTimeAEta%s", divisions[i].c_str());
50 sprintf (title,
"Hit time as a function of eta tower index in %s", divisions1[i].c_str());
53 sprintf (name,
"HcalHitE25%s", divisions[i].c_str());
54 sprintf (title,
"Energy in time window 0 to 25 for a tower in %s", divisions1[i].c_str());
57 sprintf (name,
"HcalHitE50%s", divisions[i].c_str());
58 sprintf (title,
"Energy in time window 0 to 50 for a tower in %s", divisions1[i].c_str());
61 sprintf (name,
"HalHitE100%s", divisions[i].c_str());
62 sprintf (title,
"Energy in time window 0 to 100 for a tower in %s", divisions1[i].c_str());
65 sprintf (name,
"HcalHitE250%s", divisions[i].c_str());
66 sprintf (title,
"Energy in time window 0 to 250 for a tower in %s", divisions1[i].c_str());
70 sprintf (name,
"Energy_HB");
72 sprintf (name,
"Energy_HE");
74 sprintf (name,
"Energy_HO");
76 sprintf (name,
"Energy_HF");
79 sprintf (name,
"Time_HB");
81 sprintf (name,
"Time_HE");
83 sprintf (name,
"Time_HO");
85 sprintf (name,
"Time_HF");
88 sprintf (name,
"Time_Enweighted_HB");
90 sprintf (name,
"Time_Enweighted_HE");
92 sprintf (name,
"Time_Enweighted_HO");
94 sprintf (name,
"Time_Enweighted_HF");
101 LogDebug(
"SimHitsValidationHcal") <<
"Run = " << e.
id().
run() <<
" Event = "
104 std::vector<PCaloHit> caloHits;
107 bool getHits =
false;
109 if (hitsHcal.
isValid()) getHits =
true;
111 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal.: Input flags Hits " << getHits;
114 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end());
115 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal: Hit buffer "
123 int nHit = hits.size();
124 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
125 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
126 int nHB=0, nHE=0, nHO=0, nHF=0;
128 std::map<std::pair<HcalDetId,int>,
energysum> map_try;
131 std::map<std::pair<HcalDetId,int>,
energysum>::iterator itr;
133 for (
int i=0;
i<nHit;
i++) {
134 double energy = hits[
i].energy();
135 double time = hits[
i].time();
136 unsigned int id_ = hits[
i].id();
138 int itime = (int)(time);
140 int subdet =
id.subdet();
141 int depth =
id.depth();
144 unsigned int dep = hits[
i].depth();
152 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
157 if (eta < 0) type += 3;
158 }
else if (subdet == static_cast<int>(
HcalOuter)) {
163 }
else if (subdet == static_cast<int>(
HcalForward)) {
167 type = depth+8+2*dep;
168 if (eta < 0) type += 8;
171 std::pair<HcalDetId,int> id0(
id,type);
174 if (map_try.count(id0) != 0) ensum = map_try[id0];
185 map_try[id0] = ensum;
187 LogDebug(
"SimHitsValidationHcal") <<
"Hit[" <<
i <<
"] ID " << std::hex << id_
189 << subdet <<
" depth " << depth <<
" depthX "
190 << dep <<
" Eta " << eta <<
" Phi " << phi
191 <<
" E " << energy <<
" time " << time
196 double etax = eta - 0.5;
197 if (eta < 0) etax += 1;
220 for ( itr = map_try.begin() ; itr != map_try.end(); ++itr) {
221 if ( (*itr).first.second >= 0) {
226 double etax= eta-0.5;
227 double phix= phi-0.5;
SimHitsValidationHcal(const edm::ParameterSet &ps)
MonitorElement * meEnergy_HF
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meHcalHitEta_[nType]
MonitorElement * meHcalEnergyl50_[nType]
MonitorElement * metime_enweighted_HB
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * metime_HE
MonitorElement * meHcalHitTimeEta_[nType]
MonitorElement * meEnergy_HB
MonitorElement * meHcalEnergyl250_[nType]
MonitorElement * metime_HB
MonitorElement * metime_enweighted_HF
MonitorElement * meHcalEnergyl25_[nType]
MonitorElement * metime_HF
MonitorElement * book1D(Args &&...args)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
MonitorElement * meEnergy_HE
MonitorElement * metime_HO
MonitorElement * meHcalEnergyl100_[nType]
MonitorElement * metime_enweighted_HE
MonitorElement * metime_enweighted_HO
MonitorElement * meEnergy_HO
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
void analyzeHits(std::vector< PCaloHit > &)