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)),
82 descriptions.
add(
"hcalSimHitAnalysis", desc);
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);
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;
138 for (
auto hit : hits) {
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
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
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
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
const std::string hcalHits_
#define DEFINE_FWK_MODULE(type)
~HcalSimHitAnalysis() override=default
T * make(const Args &...args) const
make new ROOT object
bool getData(T &iHolder) const
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
void beginRun(edm::Run const &, edm::EventSetup const &) override
Abs< T >::type abs(const T &t)
const std::string g4Label_
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
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)
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
DetId relabel(const uint32_t testId) const
tok_geom_(esConsumes< CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun >())