32 edm::LogInfo(
"HitsValidationHcal") <<
"Histograms booked";
37 std::string divisions[
nType]={
"HB0",
"HB1",
"HE0+z",
"HE1+z",
"HE2+z",
"HE0-z",
"HE1-z",
38 "HE2-z",
"HO0",
"HFL0+z",
"HFS0+z",
"HFL1+z",
"HFS1+z",
39 "HFL2+z",
"HFS2+z",
"HFL3+z",
"HFS3+z",
"HFL0-z",
"HFS0-z",
40 "HFL1-z",
"HFS1-z",
"HFL2-z",
"HFS2-z",
"HFL3-z",
"HFS3-z"};
42 std::string divisions1[
nType]={
"HB depth1",
"HB depth2 ",
"HE+z depth1",
"HE+z depth2",
"HE+z depth3",
"HE-z depth1",
"HE-z depth2",
43 "HE-z depth3",
"HO depth1",
"HFL+z depth1",
"HFS+z depth1",
"HFL+z depth2",
"HFS+z depth2",
44 "HFL+z depth3",
"HFS+z depth3",
"HFL+z depth4",
"HFS+z depth4",
"HFL-z depth1",
"HFS-z depth1",
45 "HFL-z depth2",
"HFS-z depth2",
"HFL-z depth3",
"HFS-z depth3 ",
"HFL-z depth4",
"HFS-z depth4"};
47 double etaLow[
nType]={-16,-16,16,16,16,-30,-30,-30,-15,29,29,29,29,29,29,29,29,
48 -41,-41,-41,-41,-41,-41,-41,-41};
49 double etaHigh[
nType]={16,16,30,30,30,-16,-16,-16,15,41,41,41,41,41,41,41,41,
50 -29,-29,-29,-29,-29,-29,-29,-29};
51 int etaBins[
nType]={32,32,14,14,14,14,14,14,30,12,12,12,12,12,12,12,12,
52 12,12,12,12,12,12,12,12};
56 sprintf (name,
"HcalHitEta%s", divisions[
i].c_str());
57 sprintf (title,
"Hit energy as a function of eta tower index in %s", divisions1[
i].c_str());
60 sprintf (name,
"HcalHitTimeAEta%s", divisions[i].c_str());
61 sprintf (title,
"Hit time as a function of eta tower index in %s", divisions1[i].c_str());
64 sprintf (name,
"HcalHitE25%s", divisions[i].c_str());
65 sprintf (title,
"Energy in time window 0 to 25 for a tower in %s", divisions1[i].c_str());
68 sprintf (name,
"HcalHitE50%s", divisions[i].c_str());
69 sprintf (title,
"Energy in time window 0 to 50 for a tower in %s", divisions1[i].c_str());
72 sprintf (name,
"HalHitE100%s", divisions[i].c_str());
73 sprintf (title,
"Energy in time window 0 to 100 for a tower in %s", divisions1[i].c_str());
76 sprintf (name,
"HcalHitE250%s", divisions[i].c_str());
77 sprintf (title,
"Energy in time window 0 to 250 for a tower in %s", divisions1[i].c_str());
81 sprintf (name,
"Energy_HB");
83 sprintf (name,
"Energy_HE");
85 sprintf (name,
"Energy_HO");
87 sprintf (name,
"Energy_HF");
90 sprintf (name,
"Time_HB");
92 sprintf (name,
"Time_HE");
94 sprintf (name,
"Time_HO");
96 sprintf (name,
"Time_HF");
99 sprintf (name,
"Time_Enweighted_HB");
101 sprintf (name,
"Time_Enweighted_HE");
103 sprintf (name,
"Time_Enweighted_HO");
105 sprintf (name,
"Time_Enweighted_HF");
115 LogDebug(
"SimHitsValidationHcal") <<
"Run = " << e.
id().
run() <<
" Event = "
118 std::vector<PCaloHit> caloHits;
121 bool getHits =
false;
123 if (hitsHcal.
isValid()) getHits =
true;
125 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal.: Input flags Hits " << getHits;
128 caloHits.insert(caloHits.end(),hitsHcal->begin(),hitsHcal->end());
129 LogDebug(
"SimHitsValidationHcal") <<
"SimHitsValidationHcal: Hit buffer "
137 int nHit = hits.size();
138 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
139 double timetotHB = 0, timetotHE = 0, timetotHF = 0, timetotHO = 0;
140 int nHB=0, nHE=0, nHO=0, nHF=0;
142 std::map<std::pair<HcalDetId,int>,
energysum> map_try;
145 std::map<std::pair<HcalDetId,int>,
energysum>::iterator itr;
147 for (
int i=0;
i<nHit;
i++) {
148 double energy = hits[
i].energy();
149 double time = hits[
i].time();
150 unsigned int id_ = hits[
i].id();
152 int itime = (int)(time);
154 int subdet =
id.subdet();
155 int depth =
id.depth();
158 unsigned int dep = hits[
i].depth();
166 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
171 if (eta < 0) type += 3;
172 }
else if (subdet == static_cast<int>(
HcalOuter)) {
177 }
else if (subdet == static_cast<int>(
HcalForward)) {
181 type = depth+8+2*dep;
182 if (eta < 0) type += 8;
185 std::pair<HcalDetId,int> id0(
id,type);
188 if (map_try.count(id0) != 0) ensum = map_try[id0];
199 map_try[id0] = ensum;
201 LogDebug(
"SimHitsValidationHcal") <<
"Hit[" <<
i <<
"] ID " << std::hex << id_
202 << std::dec <<
" " <<
id << std::dec<<
" Det " << det <<
" Sub "
203 << subdet <<
" depth " << depth <<
" depthX "
204 << dep <<
" Eta " << eta <<
" Phi " << phi
205 <<
" E " << energy <<
" time " << time
210 double etax = eta - 0.5;
211 if (eta < 0) etax += 1;
212 if (
dbe_ && type >= 0) {
235 for ( itr = map_try.begin() ; itr != map_try.end(); ++itr) {
236 if (
dbe_ && (*itr).first.second >= 0) {
241 double etax= eta-0.5;
242 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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#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)
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)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
void analyzeHits(std::vector< PCaloHit > &)