101 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
112 desc.
add<
int>(
"Verbose", 0);
113 desc.
add<
bool>(
"TestNumber",
true);
114 desc.
add<
bool>(
"hep17",
false);
115 descriptions.
add(
"hcalSimHitCheck", desc);
150 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
151 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
152 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
184 meAllNHit_ = fs->
make<TH1D>(
"Hit01",
"Number of Hits in HCal", 20000, 0., 20000.);
185 meBadDetHit_ = fs->
make<TH1D>(
"Hit02",
"Hits with wrong Det", 100, 0., 100.);
186 meBadSubHit_ = fs->
make<TH1D>(
"Hit03",
"Hits with wrong Subdet", 100, 0., 100.);
187 meBadIdHit_ = fs->
make<TH1D>(
"Hit04",
"Hits with wrong ID", 100, 0., 100.);
188 meHBNHit_ = fs->
make<TH1D>(
"Hit05",
"Number of Hits in HB", 20000, 0., 20000.);
189 meHENHit_ = fs->
make<TH1D>(
"Hit06",
"Number of Hits in HE", 10000, 0., 10000.);
190 meHONHit_ = fs->
make<TH1D>(
"Hit07",
"Number of Hits in HO", 10000, 0., 10000.);
191 meHFNHit_ = fs->
make<TH1D>(
"Hit08",
"Number of Hits in HF", 10000, 0., 10000.);
197 meSubdetHit_ = fs->
make<TH1D>(
"Hit10",
"Subdetectors in HCal", 50, 0., 50.);
203 sprintf(hname,
"Hit12bd%d",
depth);
204 sprintf(htitle,
"Eta-phi in HCal d%d",
depth);
206 fs->
make<TH2D>(hname, htitle, ieta_bins_HF, ieta_min_HF, ieta_max_HF, iphi_bins, iphi_min,
iphi_max));
213 meTimeHit_ = fs->
make<TH1D>(
"Hit15",
"Time in HCal", 528, 0., 528.);
214 meTimeWHit_ = fs->
make<TH1D>(
"Hit16",
"Time in HCal (E wtd)", 528, 0., 528.);
223 meHFDepHitw_ = fs->
make<TH1D>(
"Hit20b",
"Depths in HF (p.e. weighted)", 20, 0., 20.);
229 meHEEtaHit_->Sumw2();
230 meHOEtaHit_->Sumw2();
231 meHFEtaHit_->Sumw2();
237 meHEPhiHit_->Sumw2();
238 meHOPhiHit_->Sumw2();
239 meHFPhiHit_->Sumw2();
244 meHFEneHit_ = fs->
make<TH1D>(
"Hit32",
"Energy in HF", 1001, -0.5, 1000.5);
265 meHFEneSum_ = fs->
make<TH1D>(
"HFEneSum",
"HFEneSum", 1001, -0.5, 1000.5);
266 meHBEneSum_->Sumw2();
294 meHBL10Ene_ = fs->
make<TH1D>(
"Hit41",
"Log10Energy in HB", 140, -10., 4.);
295 meHEL10Ene_ = fs->
make<TH1D>(
"Hit42",
"Log10Energy in HE", 140, -10., 4.);
296 meHFL10Ene_ = fs->
make<TH1D>(
"Hit43",
"Log10Energy in HF", 50, -1., 4.);
297 meHOL10Ene_ = fs->
make<TH1D>(
"Hit44",
"Log10Energy in HO", 140, -10., 4.);
298 meHBL10EneP_ = fs->
make<TProfile>(
"Hit45",
"Log10Energy in HB vs Hit contribution", 140, -10., 4., 0., 1.);
299 meHEL10EneP_ = fs->
make<TProfile>(
"Hit46",
"Log10Energy in HE vs Hit contribution", 140, -10., 4., 0., 1.);
300 meHFL10EneP_ = fs->
make<TProfile>(
"Hit47",
"Log10Energy in HF vs Hit contribution", 140, -10., 4., 0., 1.);
301 meHOL10EneP_ = fs->
make<TProfile>(
"Hit48",
"Log10Energy in HO vs Hit contribution", 140, -10., 4., 0., 1.);
309 std::vector<PCaloHit> caloHits;
312 bool getHits =
false;
319 edm::LogVerbatim(
"HcalSim") <<
"HcalValidation: Input flags Hits " << getHits;
322 caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
324 edm::LogVerbatim(
"HcalSim") <<
"HcalValidation: Hit buffer " << caloHits.size();
330 int nHit = hits.size();
331 int nHB = 0, nHE = 0, nHO = 0, nHF = 0, nBad1 = 0, nBad2 = 0, nBad = 0;
332 std::vector<double> encontHB(140, 0.);
333 std::vector<double> encontHE(140, 0.);
334 std::vector<double> encontHF(140, 0.);
335 std::vector<double> encontHO(140, 0.);
336 double entotHB = 0, entotHE = 0, entotHF = 0, entotHO = 0;
373 for (
int i = 0;
i < nHit;
i++) {
374 double energy = hits[
i].energy();
375 double log10en = log10(energy);
376 int log10i = int((log10en + 10.) * 10.);
377 double time = hits[
i].time();
378 unsigned int id = hits[
i].id();
393 << subdet <<
" depth " << depth <<
" Eta " << eta <<
" Phi " << phi <<
" E " << energy
398 else if (subdet == static_cast<int>(
HcalEndcap))
400 else if (subdet == static_cast<int>(
HcalOuter))
425 else if (subdet == static_cast<int>(
HcalEndcap))
427 else if (subdet == static_cast<int>(
HcalOuter))
451 if (log10i >= 0 && log10i < 140)
452 encontHB[log10i] +=
energy;
455 HBEneMap[eta + eta_offset_HB][phi - 1] +=
energy;
457 }
else if (subdet == static_cast<int>(
HcalEndcap)) {
462 bool isHEP17 = (phi >= 63) && (phi <= 66) && (eta > 0);
478 if (log10i >= 0 && log10i < 140)
479 encontHE[log10i] +=
energy;
482 HEEneMap[eta + eta_offset_HE][phi - 1] +=
energy;
484 }
else if (subdet == static_cast<int>(
HcalOuter)) {
492 if (log10i >= 0 && log10i < 140)
493 encontHO[log10i] +=
energy;
496 HOEneMap[eta + eta_offset_HO][phi - 1] +=
energy;
498 }
else if (subdet == static_cast<int>(
HcalForward)) {
507 if (log10i >= 0 && log10i < 140)
508 encontHF[log10i] +=
energy;
511 HFEneMap[eta + eta_offset_HF][phi - 1] +=
energy;
516 for (
int i = 0;
i < 140;
i++)
517 meHBL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHB[
i] / entotHB);
519 for (
int i = 0;
i < 140;
i++)
520 meHEL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHE[
i] / entotHE);
522 for (
int i = 0;
i < 140;
i++)
523 meHFL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHF[
i] / entotHF);
525 for (
int i = 0;
i < 140;
i++)
526 meHOL10EneP_->Fill(-10. + (
float(
i) + 0.5) / 10., encontHO[
i] / entotHO);
539 if (HBEneMap[
i][
j] != 0) {
542 meHBEneMap_->Fill((
i - eta_offset_HB), j + 1, HBEneMap[
i][j]);
549 if (HEEneMap[
i][
j] != 0) {
552 meHEEneMap_->Fill((
i - eta_offset_HE), j + 1, HEEneMap[
i][j]);
559 if (HOEneMap[
i][
j] != 0) {
562 meHOEneMap_->Fill((
i - eta_offset_HO), j + 1, HOEneMap[
i][j]);
569 if (HFEneMap[
i][
j] != 0) {
572 meHFEneMap_->Fill((
i - eta_offset_HF), j + 1, HFEneMap[
i][j]);
578 edm::LogVerbatim(
"HcalSim") <<
"HcalSimHitCheck::analyzeHits: HB " << nHB <<
" HE " << nHE <<
" HO " << nHO
579 <<
" HF " << nHF <<
" Bad " << nBad <<
" All " << nHit;
TProfile * meHFEneSum_vs_ieta_
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
const HcalDDDRecConstants * hcons_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
TProfile * meHBEneSum_vs_ieta_
TProfile * meHOEneSum_vs_ieta_
std::vector< TH2D * > meEtaPhiHitDepth_
T * make(const Args &...args) const
make new ROOT object
void analyzeHits(std::vector< PCaloHit > &)
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
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
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
HcalSimHitCheck(const edm::ParameterSet &ps)
DetId relabel(const uint32_t testId) const
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