63 : g4Label_(ps.getUntrackedParameter<
std::
string>(
"moduleLabel",
"g4SimHits")),
64 hcalHits_(ps.getUntrackedParameter<
std::
string>(
"HitCollection",
"HcalHits")),
65 verbose_(ps.getUntrackedParameter<
bool>(
"Verbose",
false)),
66 testNumber_(ps.getUntrackedParameter<
bool>(
"TestNumber",
true)),
80 desc.addUntracked<
bool>(
"Verbose",
false);
81 desc.addUntracked<
bool>(
"TestNumber",
true);
82 descriptions.
add(
"hcalSimHitAnalysis",
desc);
87 if (!
tfile.isAvailable())
89 <<
"please add it to config file";
92 int nx[
ndets_] = {100, 100, 350, 160};
93 double xlo[
ndets_] = {0, -300, 0, -160};
94 double xhi[
ndets_] = {500, 300, 3500, 160};
95 int ny[
ndets_] = {100, 100, 50, 160};
96 double ylo[
ndets_] = {170, -300, 375, -160};
97 double yhi[
ndets_] = {370, 300, 425, 160};
101 sprintf(
name,
"poszp%d",
i);
102 sprintf(
title,
"%s+", dets[
i].c_str());
104 poszp_[
i]->GetXaxis()->SetTitle(xttl[
i].c_str());
105 poszp_[
i]->GetYaxis()->SetTitle(yttl[
i].c_str());
106 sprintf(
title,
"%s-", dets[
i].c_str());
107 poszp_[
i]->GetYaxis()->SetTitleOffset(1.2);
109 sprintf(
name,
"poszn%d",
i);
111 poszn_[
i]->GetXaxis()->SetTitle(xttl[
i].c_str());
112 poszn_[
i]->GetYaxis()->SetTitle(yttl[
i].c_str());
113 poszn_[
i]->GetYaxis()->SetTitleOffset(1.2);
120 edm::LogVerbatim(
"HitStudy") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
129 bool getHits = (hitsCalo.
isValid());
130 uint32_t
nhits = (getHits) ? hitsCalo->size() : 0;
132 edm::LogVerbatim(
"HitStudy") <<
"HcalSimHitAnalysis: Input flags Hits " << getHits <<
" with " <<
nhits <<
" hits";
134 std::vector<PCaloHit>
hits;
135 hits.insert(
hits.end(), hitsCalo->begin(), hitsCalo->end());
137 std::map<HcalDetId, double> hitMap;
139 double edep =
hit.energy();
140 uint32_t
id =
hit.
id();
142 auto it = hitMap.find(hid);
143 if (it == hitMap.end()) {
146 (it->second) += edep;
150 for (
auto it : hitMap) {
159 edm::LogVerbatim(
"HitStudy") <<
"HcalSimHitAnalysis: " <<
id <<
":" << it.second <<
" at " << gpos
160 <<
" subdet " << subdet <<
":" << indx;
162 double x = ((indx == 0) || (indx == 2)) ?
std::abs(gpos.
z()) : gpos.
x();
163 double y = ((indx == 0) || (indx == 2)) ? (gpos.
perp()) : gpos.
y();
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
std::vector< PCaloHit > PCaloHitContainer
HcalSimHitAnalysis(const edm::ParameterSet &ps)
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
void endRun(edm::Run const &, edm::EventSetup const &) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const std::string hcalHits_
~HcalSimHitAnalysis() override=default
void beginRun(edm::Run const &, edm::EventSetup const &) override
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
DetId relabel(const uint32_t testId) const
const std::string g4Label_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(edm::Event const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
GlobalPoint getPosition(const DetId &id) const
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly