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);
149 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
150 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
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.);
195 meSubdetHit_ = fs->
make<TH1D>(
"Hit10",
"Subdetectors in HCal", 50, 0., 50.);
201 sprintf(hname,
"Hit12bd%d",
depth);
202 sprintf(htitle,
"Eta-phi in HCal d%d",
depth);
204 fs->
make<TH2D>(hname, htitle, ieta_bins_HF, ieta_min_HF, ieta_max_HF, iphi_bins, iphi_min,
iphi_max));
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.);
221 meHFDepHitw_ = fs->
make<TH1D>(
"Hit20b",
"Depths in HF (p.e. weighted)", 20, 0., 20.);
227 meHEEtaHit_->Sumw2();
228 meHOEtaHit_->Sumw2();
229 meHFEtaHit_->Sumw2();
235 meHEPhiHit_->Sumw2();
236 meHOPhiHit_->Sumw2();
237 meHFPhiHit_->Sumw2();
242 meHFEneHit_ = fs->
make<TH1D>(
"Hit32",
"Energy in HF", 1001, -0.5, 1000.5);
263 meHFEneSum_ = fs->
make<TH1D>(
"HFEneSum",
"HFEneSum", 1001, -0.5, 1000.5);
264 meHBEneSum_->Sumw2();
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.);
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++) {
371 double energy = hits[
i].energy();
372 double log10en = log10(energy);
373 int log10i = int((log10en + 10.) * 10.);
374 double time = hits[
i].time();
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;
452 HBEneMap[eta + eta_offset_HB][phi - 1] +=
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;
479 HEEneMap[eta + eta_offset_HE][phi - 1] +=
energy;
481 }
else if (subdet == static_cast<int>(
HcalOuter)) {
489 if (log10i >= 0 && log10i < 140)
490 encontHO[log10i] +=
energy;
493 HOEneMap[eta + eta_offset_HO][phi - 1] +=
energy;
495 }
else if (subdet == static_cast<int>(
HcalForward)) {
504 if (log10i >= 0 && log10i < 140)
505 encontHF[log10i] +=
energy;
508 HFEneMap[eta + eta_offset_HF][phi - 1] +=
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) {
539 meHBEneMap_->Fill((
i - eta_offset_HB), j + 1, HBEneMap[
i][j]);
546 if (HEEneMap[
i][
j] != 0) {
549 meHEEneMap_->Fill((
i - eta_offset_HE), j + 1, HEEneMap[
i][j]);
556 if (HOEneMap[
i][
j] != 0) {
559 meHOEneMap_->Fill((
i - eta_offset_HO), j + 1, HOEneMap[
i][j]);
566 if (HFEneMap[
i][
j] != 0) {
569 meHFEneMap_->Fill((
i - eta_offset_HF), j + 1, HFEneMap[
i][j]);
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
EventNumber_t event() const
std::vector< PCaloHit > PCaloHitContainer
const HcalDDDRecConstants * hcons_
#define DEFINE_FWK_MODULE(type)
TProfile * meHBEneSum_vs_ieta_
TProfile * meHOEneSum_vs_ieta_
std::vector< TH2D * > meEtaPhiHitDepth_
T * make(const Args &...args) const
make new ROOT object
const std::string hcalHits
void analyzeHits(std::vector< PCaloHit > &)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
constexpr int iphi() const
get the cell iphi
void analyze(edm::Event const &, edm::EventSetup const &) override
constexpr int ieta() const
get the cell ieta
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void beginRun(edm::Run const &, edm::EventSetup const &) override
TProfile * meHEEneSum_vs_ieta_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int getMaxDepth(const int &type) const
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
DetId relabel(const uint32_t testId) const
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
constexpr int depth() const
get the tower depth
std::pair< int, int > getEtaRange(const int &i) const
int getNPhi(const int &type) const
constexpr Detector det() const
get the detector field from this detid