71 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
72 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
84 descriptions.
add(
"hcalSimHitAnalysis", desc);
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);
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;
141 for (
auto hit : hits) {
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();
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
HcalSimHitAnalysis(const edm::ParameterSet &ps)
void endRun(edm::Run const &, edm::EventSetup const &) override
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
T * make(const Args &...args) const
make new ROOT object
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
bool getData(T &iHolder) const
void beginRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
Abs< T >::type abs(const T &t)
GlobalPoint getPosition(const DetId &id) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void analyze(edm::Event const &, edm::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
DetId relabel(const uint32_t testId) const
~HcalSimHitAnalysis() override