30 edm::LogInfo(
"HitsValidationHcal") <<
"Histograms booked";
35 std::string divisions[
nType]={
"HB0",
"HB1",
"HE0+z",
"HE1+z",
"HE2+z",
"HE0-z",
"HE1-z",
36 "HE2-z",
"HO0",
"HFL0+z",
"HFS0+z",
"HFL1+z",
"HFS1+z",
37 "HFL2+z",
"HFS2+z",
"HFL3+z",
"HFS3+z",
"HFL0-z",
"HFS0-z",
38 "HFL1-z",
"HFS1-z",
"HFL2-z",
"HFS2-z",
"HFL3-z",
"HFS3-z"};
40 std::string divisions1[
nType]={
"HB depth1",
"HB depth2 ",
"HE+z depth1",
"HE+z depth2",
"HE+z depth3",
"HE-z depth1",
"HE-z depth2",
41 "HE-z depth3",
"HO depth1",
"HFL+z depth1",
"HFS+z depth1",
"HFL+z depth2",
"HFS+z depth2",
42 "HFL+z depth3",
"HFS+z depth3",
"HFL+z depth4",
"HFS+z depth4",
"HFL-z depth1",
"HFS-z depth1",
43 "HFL-z depth2",
"HFS-z depth2",
"HFL-z depth3",
"HFS-z depth3 ",
"HFL-z depth4",
"HFS-z depth4"};
45 double etaLow[
nType]={-16,-16,16,16,16,-30,-30,-30,-15,29,29,29,29,29,29,29,29,
46 -41,-41,-41,-41,-41,-41,-41,-41};
47 double etaHigh[
nType]={16,16,30,30,30,-16,-16,-16,15,41,41,41,41,41,41,41,41,
48 -29,-29,-29,-29,-29,-29,-29,-29};
49 int etaBins[
nType]={32,32,14,14,14,14,14,14,30,12,12,12,12,12,12,12,12,
50 12,12,12,12,12,12,12,12};
54 sprintf (name,
"HcalHitEta%s", divisions[
i].c_str());
55 sprintf (title,
"Hit energy as a function of eta tower index in %s", divisions1[
i].c_str());
58 sprintf (name,
"HcalHitTimeAEta%s", divisions[i].c_str());
59 sprintf (title,
"Hit time as a function of eta tower index in %s", divisions1[i].c_str());
62 sprintf (name,
"HcalHitE25%s", divisions[i].c_str());
63 sprintf (title,
"Energy in time window 0 to 25 for a tower in %s", divisions1[i].c_str());
66 sprintf (name,
"HcalHitE50%s", divisions[i].c_str());
67 sprintf (title,
"Energy in time window 0 to 50 for a tower in %s", divisions1[i].c_str());
70 sprintf (name,
"HalHitE100%s", divisions[i].c_str());
71 sprintf (title,
"Energy in time window 0 to 100 for a tower in %s", divisions1[i].c_str());
74 sprintf (name,
"HcalHitE250%s", divisions[i].c_str());
75 sprintf (title,
"Energy in time window 0 to 250 for a tower in %s", divisions1[i].c_str());
79 sprintf (name,
"Energy_HB");
81 sprintf (name,
"Energy_HE");
83 sprintf (name,
"Energy_HO");
85 sprintf (name,
"Energy_HF");
88 sprintf (name,
"Time_HB");
90 sprintf (name,
"Time_HE");
92 sprintf (name,
"Time_HO");
94 sprintf (name,
"Time_HF");
97 sprintf (name,
"Time_Enweighted_HB");
99 sprintf (name,
"Time_Enweighted_HE");
101 sprintf (name,
"Time_Enweighted_HO");
103 sprintf (name,
"Time_Enweighted_HF");
113 LogDebug(
"SimHitsValidationHcal") <<
"Run = " << e.
id().
run() <<
" Event = "
116 std::vector<PCaloHit> caloHits;
119 bool getHits =
false;
121 if (hitsHcal.
isValid()) getHits =
true;
123 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal.: Input flags Hits " << getHits;
126 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end());
127 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal: Hit buffer "
135 int nHit = hits.size();
136 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
137 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
138 int nHB=0, nHE=0, nHO=0, nHF=0;
140 std::map<std::pair<HcalDetId,int>,
energysum> map_try;
143 std::map<std::pair<HcalDetId,int>,
energysum>::iterator itr;
145 for (
int i=0;
i<nHit;
i++) {
146 double energy = hits[
i].energy();
147 double time = hits[
i].time();
148 unsigned int id_ = hits[
i].id();
150 int itime = (int)(time);
152 int subdet =
id.subdet();
153 int depth =
id.depth();
156 unsigned int dep = hits[
i].depth();
164 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
169 if (eta < 0) type += 3;
170 }
else if (subdet == static_cast<int>(
HcalOuter)) {
175 }
else if (subdet == static_cast<int>(
HcalForward)) {
179 type = depth+8+2*dep;
180 if (eta < 0) type += 8;
183 std::pair<HcalDetId,int> id0(
id,type);
186 if (map_try.count(id0) != 0) ensum = map_try[id0];
197 map_try[id0] = ensum;
199 LogDebug(
"SimHitsValidationHcal") <<
"Hit[" <<
i <<
"] ID " << std::hex << id_
200 << std::dec <<
" " <<
id << std::dec<<
" Det " << det <<
" Sub "
201 << subdet <<
" depth " << depth <<
" depthX "
202 << dep <<
" Eta " << eta <<
" Phi " << phi
203 <<
" E " << energy <<
" time " << time
208 double etax = eta - 0.5;
209 if (eta < 0) etax += 1;
210 if (
dbe_ && type >= 0) {
233 for ( itr = map_try.begin() ; itr != map_try.end(); ++itr) {
234 if (
dbe_ && (*itr).first.second >= 0) {
239 double etax= eta-0.5;
240 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 * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * metime_enweighted_HB
#define DEFINE_FWK_MODULE(type)
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
void setVerbose(unsigned level)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * meEnergy_HE
MonitorElement * metime_HO
MonitorElement * meHcalEnergyl100_[nType]
void showDirStructure(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
MonitorElement * metime_enweighted_HE
MonitorElement * metime_enweighted_HO
MonitorElement * meEnergy_HO
void setCurrentFolder(const std::string &fullpath)
void analyzeHits(std::vector< PCaloHit > &)