71 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
72 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
82 desc.addUntracked<
bool>(
"Verbose",
false);
83 desc.addUntracked<
bool>(
"TestNumber",
true);
84 descriptions.
add(
"hcalSimHitAnalysis",
desc);
89 if (!
tfile.isAvailable())
91 <<
"please add it to config file";
94 int nx[
ndets_] = {100, 100, 350, 160};
95 double xlo[
ndets_] = {0, -300, 0, -160};
96 double xhi[
ndets_] = {500, 300, 3500, 160};
97 int ny[
ndets_] = {100, 100, 50, 160};
98 double ylo[
ndets_] = {170, -300, 375, -160};
99 double yhi[
ndets_] = {370, 300, 425, 160};
103 sprintf(
name,
"poszp%d",
i);
104 sprintf(
title,
"%s+", dets[
i].c_str());
106 poszp_[
i]->GetXaxis()->SetTitle(xttl[
i].c_str());
107 poszp_[
i]->GetYaxis()->SetTitle(yttl[
i].c_str());
108 sprintf(
title,
"%s-", dets[
i].c_str());
109 poszp_[
i]->GetYaxis()->SetTitleOffset(1.2);
111 sprintf(
name,
"poszn%d",
i);
113 poszn_[
i]->GetXaxis()->SetTitle(xttl[
i].c_str());
114 poszn_[
i]->GetYaxis()->SetTitle(yttl[
i].c_str());
115 poszn_[
i]->GetYaxis()->SetTitleOffset(1.2);
122 edm::LogVerbatim(
"HitStudy") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
132 bool getHits = (hitsCalo.
isValid());
133 uint32_t
nhits = (getHits) ? hitsCalo->size() : 0;
135 edm::LogVerbatim(
"HitStudy") <<
"HcalSimHitAnalysis: Input flags Hits " << getHits <<
" with " <<
nhits <<
" hits";
137 std::vector<PCaloHit>
hits;
138 hits.insert(
hits.end(), hitsCalo->begin(), hitsCalo->end());
140 std::map<HcalDetId, double> hitMap;
142 double edep =
hit.energy();
143 uint32_t
id =
hit.
id();
145 auto it = hitMap.find(hid);
146 if (it == hitMap.end()) {
149 (it->second) += edep;
153 for (
auto it : hitMap) {
162 edm::LogVerbatim(
"HitStudy") <<
"HcalSimHitAnalysis: " <<
id <<
":" << it.second <<
" at " << gpos
163 <<
" subdet " << subdet <<
":" << indx;
165 double x = ((indx == 0) || (indx == 2)) ?
std::abs(gpos.
z()) : gpos.
x();
166 double y = ((indx == 0) || (indx == 2)) ? (gpos.
perp()) : gpos.
y();