92 : g4Label(ps.getParameter<
std::
string>(
"moduleLabel")),
93 hcalHits(ps.getParameter<
std::
string>(
"HitCollection")),
94 outFile_(ps.getParameter<
std::
string>(
"outputFile")),
95 verbose_(ps.getParameter<
int>(
"Verbose")),
97 testNumber_(ps.getParameter<
bool>(
"TestNumber")),
98 hep17_(ps.getParameter<
bool>(
"hep17")),
110 desc.add<
int>(
"Verbose", 0);
111 desc.add<
bool>(
"TestNumber",
true);
112 desc.add<
bool>(
"hep17",
false);
113 descriptions.
add(
"hcalSimHitCheck",
desc);
148 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
182 meAllNHit_ =
fs->make<TH1D>(
"Hit01",
"Number of Hits in HCal", 20000, 0., 20000.);
183 meBadDetHit_ =
fs->make<TH1D>(
"Hit02",
"Hits with wrong Det", 100, 0., 100.);
184 meBadSubHit_ =
fs->make<TH1D>(
"Hit03",
"Hits with wrong Subdet", 100, 0., 100.);
185 meBadIdHit_ =
fs->make<TH1D>(
"Hit04",
"Hits with wrong ID", 100, 0., 100.);
186 meHBNHit_ =
fs->make<TH1D>(
"Hit05",
"Number of Hits in HB", 20000, 0., 20000.);
187 meHENHit_ =
fs->make<TH1D>(
"Hit06",
"Number of Hits in HE", 10000, 0., 10000.);
188 meHONHit_ =
fs->make<TH1D>(
"Hit07",
"Number of Hits in HO", 10000, 0., 10000.);
189 meHFNHit_ =
fs->make<TH1D>(
"Hit08",
"Number of Hits in HF", 10000, 0., 10000.);
194 meDetectHit_ =
fs->make<TH1D>(
"Hit09",
"Detector ID", 50, 0., 50.);
195 meSubdetHit_ =
fs->make<TH1D>(
"Hit10",
"Subdetectors in HCal", 50, 0., 50.);
196 meDepthHit_ =
fs->make<TH1D>(
"Hit11",
"Depths in HCal", 20, 0., 20.);
201 sprintf(hname,
"Hit12bd%d",
depth);
202 sprintf(htitle,
"Eta-phi in HCal d%d",
depth);
210 meEnergyHit_ =
fs->make<TH1D>(
"Hit14",
"Energy in HCal", 2000, 0., 20.);
211 meTimeHit_ =
fs->make<TH1D>(
"Hit15",
"Time in HCal", 528, 0., 528.);
212 meTimeWHit_ =
fs->make<TH1D>(
"Hit16",
"Time in HCal (E wtd)", 528, 0., 528.);
213 meHBDepHit_ =
fs->make<TH1D>(
"Hit17",
"Depths in HB", 20, 0., 20.);
214 meHEDepHit_ =
fs->make<TH1D>(
"Hit18",
"Depths in HE", 20, 0., 20.);
215 meHODepHit_ =
fs->make<TH1D>(
"Hit19",
"Depths in HO", 20, 0., 20.);
216 meHFDepHit_ =
fs->make<TH1D>(
"Hit20",
"Depths in HF", 20, 0., 20.);
221 meHFDepHitw_ =
fs->make<TH1D>(
"Hit20b",
"Depths in HF (p.e. weighted)", 20, 0., 20.);
238 meHBEneHit_ =
fs->make<TH1D>(
"Hit29",
"Energy in HB", 2000, 0., 20.);
239 meHEEneHit_ =
fs->make<TH1D>(
"Hit30",
"Energy in HE", 500, 0., 5.);
241 meHOEneHit_ =
fs->make<TH1D>(
"Hit31",
"Energy in HO", 500, 0., 5.);
242 meHFEneHit_ =
fs->make<TH1D>(
"Hit32",
"Energy in HF", 1001, -0.5, 1000.5);
260 meHBEneSum_ =
fs->make<TH1D>(
"HBEneSum",
"HBEneSum", 2000, 0., 20.);
261 meHEEneSum_ =
fs->make<TH1D>(
"HEEneSum",
"HEEneSum", 500, 0., 5.);
262 meHOEneSum_ =
fs->make<TH1D>(
"HOEneSum",
"HOEneSum", 500, 0., 5.);
263 meHFEneSum_ =
fs->make<TH1D>(
"HFEneSum",
"HFEneSum", 1001, -0.5, 1000.5);
278 meHBTimHit_ =
fs->make<TH1D>(
"Hit33",
"Time in HB", 528, 0., 528.);
279 meHETimHit_ =
fs->make<TH1D>(
"Hit34",
"Time in HE", 528, 0., 528.);
280 meHOTimHit_ =
fs->make<TH1D>(
"Hit35",
"Time in HO", 528, 0., 528.);
281 meHFTimHit_ =
fs->make<TH1D>(
"Hit36",
"Time in HF", 528, 0., 528.);
287 meHBEneHit2_ =
fs->make<TH1D>(
"Hit37",
"Energy in HB 2", 100, 0., 0.0001);
288 meHEEneHit2_ =
fs->make<TH1D>(
"Hit38",
"Energy in HE 2", 100, 0., 0.0001);
289 meHEP17EneHit2_ =
fs->make<TH1D>(
"Hit38b",
"Energy in HEP17 2", 100, 0., 0.0001);
290 meHOEneHit2_ =
fs->make<TH1D>(
"Hit39",
"Energy in HO 2", 100, 0., 0.0001);
291 meHFEneHit2_ =
fs->make<TH1D>(
"Hit40",
"Energy in HF 2", 100, 0.5, 100.5);
292 meHBL10Ene_ =
fs->make<TH1D>(
"Hit41",
"Log10Energy in HB", 140, -10., 4.);
293 meHEL10Ene_ =
fs->make<TH1D>(
"Hit42",
"Log10Energy in HE", 140, -10., 4.);
294 meHFL10Ene_ =
fs->make<TH1D>(
"Hit43",
"Log10Energy in HF", 50, -1., 4.);
295 meHOL10Ene_ =
fs->make<TH1D>(
"Hit44",
"Log10Energy in HO", 140, -10., 4.);
296 meHBL10EneP_ =
fs->make<TProfile>(
"Hit45",
"Log10Energy in HB vs Hit contribution", 140, -10., 4., 0., 1.);
297 meHEL10EneP_ =
fs->make<TProfile>(
"Hit46",
"Log10Energy in HE vs Hit contribution", 140, -10., 4., 0., 1.);
298 meHFL10EneP_ =
fs->make<TProfile>(
"Hit47",
"Log10Energy in HF vs Hit contribution", 140, -10., 4., 0., 1.);
299 meHOL10EneP_ =
fs->make<TProfile>(
"Hit48",
"Log10Energy in HO vs Hit contribution", 140, -10., 4., 0., 1.);
305 edm::LogVerbatim(
"HcalSim") <<
"Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
307 bool getHits =
false;
313 edm::LogVerbatim(
"HcalSim") <<
"HcalValidation: Input flags Hits " << getHits;
314 std::vector<PCaloHit> caloHits;
315 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
317 edm::LogVerbatim(
"HcalSim") <<
"HcalValidation: Hit buffer " << caloHits.size();
321 edm::LogVerbatim(
"HcalSim") <<
"HcalValidation: Input flags Hits " << getHits;
327 int nHit =
hits.size();
328 int nHB = 0, nHE = 0, nHO = 0, nHF = 0, nBad1 = 0, nBad2 = 0, nBad = 0;
329 std::vector<double> encontHB(140, 0.);
330 std::vector<double> encontHE(140, 0.);
331 std::vector<double> encontHF(140, 0.);
332 std::vector<double> encontHO(140, 0.);
333 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
370 for (
int i = 0;
i < nHit;
i++) {
372 double log10en = log10(
energy);
373 int log10i =
int((log10en + 10.) * 10.);
375 unsigned int id =
hits[
i].id();
390 << subdet <<
" depth " <<
depth <<
" Eta " <<
eta <<
" Phi " <<
phi <<
" E " <<
energy 395 else if (subdet == static_cast<int>(
HcalEndcap))
397 else if (subdet == static_cast<int>(
HcalOuter))
422 else if (subdet == static_cast<int>(
HcalEndcap))
424 else if (subdet == static_cast<int>(
HcalOuter))
448 if (log10i >= 0 && log10i < 140)
449 encontHB[log10i] +=
energy;
454 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
459 bool isHEP17 = (
phi >= 63) && (
phi <= 66) && (
eta > 0);
475 if (log10i >= 0 && log10i < 140)
476 encontHE[log10i] +=
energy;
481 }
else if (subdet == static_cast<int>(
HcalOuter)) {
489 if (log10i >= 0 && log10i < 140)
490 encontHO[log10i] +=
energy;
495 }
else if (subdet == static_cast<int>(
HcalForward)) {
504 if (log10i >= 0 && log10i < 140)
505 encontHF[log10i] +=
energy;
513 for (
int i = 0;
i < 140;
i++)
514 meHBL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHB[
i] / entotHB);
516 for (
int i = 0;
i < 140;
i++)
517 meHEL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHE[
i] / entotHE);
519 for (
int i = 0;
i < 140;
i++)
520 meHFL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHF[
i] / entotHF);
522 for (
int i = 0;
i < 140;
i++)
523 meHOL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHO[
i] / entotHO);
536 if (HBEneMap[
i][
j] != 0) {
546 if (HEEneMap[
i][
j] != 0) {
556 if (HOEneMap[
i][
j] != 0) {
566 if (HFEneMap[
i][
j] != 0) {
575 edm::LogVerbatim(
"HcalSim") <<
"HcalSimHitCheck::analyzeHits: HB " << nHB <<
" HE " << nHE <<
" HO " << nHO
576 <<
" HF " << nHF <<
" Bad " << nBad <<
" All " << nHit;
TProfile * meHFEneSum_vs_ieta_
Log< level::Info, true > LogVerbatim
std::pair< int, int > getEtaRange(const int &i) const
std::vector< PCaloHit > PCaloHitContainer
const HcalDDDRecConstants * hcons_
int getNPhi(const int &type) const
TProfile * meHBEneSum_vs_ieta_
TProfile * meHOEneSum_vs_ieta_
std::vector< TH2D * > meEtaPhiHitDepth_
const std::string hcalHits
void analyzeHits(std::vector< PCaloHit > &)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
constexpr Detector det() const
get the detector field from this detid
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr int ieta() const
get the cell ieta
void analyze(edm::Event const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
bool getData(T &iHolder) const
DetId relabel(const uint32_t testId) const
int getMaxDepth(const int &type) const
void beginRun(edm::Run const &, edm::EventSetup const &) override
TProfile * meHEEneSum_vs_ieta_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void endRun(edm::Run const &, edm::EventSetup const &) override
HcalSimHitCheck(const edm::ParameterSet &ps)
const std::string outFile_
const std::string g4Label
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
constexpr int iphi() const
get the cell iphi
constexpr int depth() const
get the tower depth