46 void analyzeHits(std::vector<PCaloHit> &,
const std::vector<SimTrack> &);
69 : g4Label_(iConfig.getUntrackedParameter<
std::
string>(
"ModuleLabel",
"g4SimHits")),
70 hcalHits_(iConfig.getUntrackedParameter<
std::
string>(
"HitCollection",
"HcalHits")),
83 descriptions.
add(
"HFPMTHitAnalyzer",
desc);
91 if (!
fs.isAvailable())
93 <<
"please add it to config file";
96 h_HFDepHit = HFHitsDir.
make<TH1F>(
"Hit20",
"Depths in HF", 50, 0., 50.);
97 h_HFDepHit->GetXaxis()->SetTitle(
"Depths in HF");
98 for (
int i = 0;
i < 3;
i++) {
100 sprintf(sub,
"(PMT)");
102 sprintf(sub,
"(Bundle)");
104 sprintf(sub,
"(Jungle)");
105 sprintf(
name,
"Eta%d",
i);
106 sprintf(
title,
"Eta Index of hits in %s", sub);
109 sprintf(
name,
"Phi%d",
i);
110 sprintf(
title,
"Phi Index of hits in %s", sub);
115 hHF_MC_e = HFSourcePart.
make<TH1F>(
"MCEnergy",
"Energy of Generated Particle", 1000, 0., 500.);
116 hHF_MC_e->GetXaxis()->SetTitle(
"Energy of Generated Particle");
120 for (
int i = 0;
i < 3;
i++) {
122 sprintf(sub,
"(Absorber)");
124 sprintf(sub,
"(PMT)");
126 sprintf(sub,
"(All)");
127 sprintf(
name,
"Energy1%d",
i);
128 sprintf(
title,
"Energy in depth 1 %s", sub);
131 sprintf(
name,
"Energy2%d",
i);
132 sprintf(
title,
"Energy in depth 2 %s", sub);
135 sprintf(
name,
"Energy12%d",
i);
136 sprintf(
title,
"Energy in depths 1,2 %s", sub);
139 sprintf(
name,
"Em1%d",
i);
140 sprintf(
title,
"EM energy in depth 1 %s", sub);
143 sprintf(
name,
"Em2%d",
i);
144 sprintf(
title,
"EM energy in depth 2 %s", sub);
147 sprintf(
name,
"Em12%d",
i);
148 sprintf(
title,
"EM energy in depths 1,2 %s", sub);
151 sprintf(
name,
"Had1%d",
i);
152 sprintf(
title,
"Had energy in depth 1 %s", sub);
155 sprintf(
name,
"Had2%d",
i);
156 sprintf(
title,
"Had energy in depth 2 %s", sub);
159 sprintf(
name,
"Had12%d",
i);
160 sprintf(
title,
"Had energy in depths 1,2 %s", sub);
167 for (
int i = 0;
i < 3;
i++) {
169 sprintf(sub,
"(Absorber)");
171 sprintf(sub,
"(PMT)");
173 sprintf(sub,
"(All)");
174 sprintf(
name,
"Time1Ewt%d",
i);
175 sprintf(
title,
"Time (energy weighted) in depth 1 %s", sub);
178 sprintf(
name,
"Time2Ewt%d",
i);
179 sprintf(
title,
"Time (energy weighted) in depth 2 %s", sub);
182 sprintf(
name,
"Time12Ewt%d",
i);
183 sprintf(
title,
"Time (energy weighted) in depths 1,2 %s", sub);
186 sprintf(
name,
"Time1%d",
i);
187 sprintf(
title,
"Time in depth 1 %s", sub);
190 sprintf(
name,
"Time2%d",
i);
191 sprintf(
title,
"Time in depth 2 %s", sub);
194 sprintf(
name,
"Time12%d",
i);
195 sprintf(
title,
"Time in depths 1,2 %s", sub);
211 float orig_energy = 0;
212 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
214 orig_energy = (*p)->momentum().e();
218 std::vector<PCaloHit> caloHits;
219 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
224 int nHit =
hits.size();
225 float energy1[3], energy2[3], energy12[3];
226 float em1[3], had1[3], em2[3], had2[3], em12[3], had12[3];
227 for (
int i = 0;
i < 3;
i++) {
228 energy1[
i] = energy2[
i] = energy12[
i] = 0;
229 em1[
i] = em2[
i] = em12[
i] = 0;
230 had1[
i] = had2[
i] = had12[
i] = 0;
233 for (
int i = 0;
i < nHit;
i++) {
235 double em =
hits[
i].energyEM();
236 double had =
hits[
i].energyHad();
238 uint32_t id_ =
hits[
i].id();
239 uint16_t pmtHit =
hits[
i].depth();
240 uint16_t depthX = pmtHit;
242 << pmtHit <<
" E (e|h|t) " << em <<
" " << had <<
" " <<
energy <<
" Time " <<
time;
246 int subdet =
id.subdet();
247 int depth =
id.depth();
255 int ieta =
id.ietaAbs();
256 int iphi =
id.iphi();
267 energy1[pmtHit] +=
energy;
268 energy12[pmtHit] +=
energy;
272 had12[pmtHit] += had;
285 energy2[pmtHit] +=
energy;
286 energy12[pmtHit] +=
energy;
290 had12[pmtHit] += had;
305 for (
int i = 0;
i < 3;
i++) {
315 edm::LogVerbatim(
"HFShower") <<
"HFPMTHitAnalyser:: Type " <<
i <<
" Energy 1|2| " << energy1[
i] <<
" " 316 << energy2[
i] <<
" " << energy12[
i] <<
" EM Energy 1|2| " << em1[
i] <<
" " << em2[
i]
317 <<
" " << em12[
i] <<
" Had Energy 1|2| " << had1[
i] <<
" " << had2[
i] <<
" "
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
std::vector< PCaloHit > PCaloHitContainer
~HFPMTHitAnalyzer() override
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_calo_
T * make(const Args &...args) const
make new ROOT object
void analyze(const edm::Event &, const edm::EventSetup &) override
const std::string hcalHits_
#define DEFINE_FWK_MODULE(type)
HFPMTHitAnalyzer(const edm::ParameterSet &)
const HepMC::GenEvent * GetEvent() const
const edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
const edm::EDGetTokenT< edm::SimTrackContainer > tok_track_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void beginRun(edm::Run const &, edm::EventSetup const &) override
void endRun(edm::Run const &, edm::EventSetup const &) override
std::vector< SimTrack > SimTrackContainer
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void analyzeHits(std::vector< PCaloHit > &, const std::vector< SimTrack > &)
const std::string g4Label_