24 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>();
25 tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
30 edm::LogVerbatim(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
67 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
68 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
69 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
78 float ieta_min_HB = -iEtaHBMax - 1.5;
79 float ieta_max_HB = iEtaHBMax + 1.5;
80 int ieta_bins_HB = (int)(ieta_max_HB - ieta_min_HB);
82 float ieta_min_HE = -iEtaHEMax - 1.5;
83 float ieta_max_HE = iEtaHEMax + 1.5;
84 int ieta_bins_HE = (int)(ieta_max_HE - ieta_min_HE);
86 float ieta_min_HF = -iEtaHFMax - 1.5;
87 float ieta_max_HF = iEtaHFMax + 1.5;
88 int ieta_bins_HF = (int)(ieta_max_HF - ieta_min_HF);
90 float ieta_min_HO = -iEtaHOMax - 1.5;
91 float ieta_max_HO = iEtaHOMax + 1.5;
92 int ieta_bins_HO = (int)(ieta_max_HO - ieta_min_HO);
102 sprintf(histo,
"N_HB");
104 sprintf(histo,
"N_HB%d",
depth);
107 Nhb.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
111 sprintf(histo,
"N_HE");
113 sprintf(histo,
"N_HE%d",
depth);
116 Nhe.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
119 sprintf(histo,
"N_HO");
120 Nho = ib.
book1D(histo, histo, 2200, 0., 2200.);
124 sprintf(histo,
"N_HF");
126 sprintf(histo,
"N_HF%d",
depth);
129 Nhf.push_back(ib.
book1D(histo, histo, 1800, 0., 1800.));
135 sprintf(histo,
"emean_vs_ieta_HB");
137 sprintf(histo,
"emean_vs_ieta_HB%d",
depth);
141 ib.
bookProfile(histo, histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB, -10., 2000.,
" "));
145 sprintf(histo,
"emean_vs_ieta_HE");
147 sprintf(histo,
"emean_vs_ieta_HE%d",
depth);
151 ib.
bookProfile(histo, histo, ieta_bins_HE, ieta_min_HE, ieta_max_HE, -10., 2000.,
" "));
154 sprintf(histo,
"emean_vs_ieta_HO");
159 sprintf(histo,
"emean_vs_ieta_HF");
161 sprintf(histo,
"emean_vs_ieta_HF%d",
depth);
165 ib.
bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 2000.,
" "));
171 sprintf(histo,
"occupancy_vs_ieta_HB");
173 sprintf(histo,
"occupancy_vs_ieta_HB%d",
depth);
180 sprintf(histo,
"occupancy_vs_ieta_HE");
182 sprintf(histo,
"occupancy_vs_ieta_HE%d",
depth);
188 sprintf(histo,
"occupancy_vs_ieta_HO");
193 sprintf(histo,
"occupancy_vs_ieta_HF");
195 sprintf(histo,
"occupancy_vs_ieta_HF%d",
depth);
204 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB");
206 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth);
213 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE");
215 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth);
221 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HO");
226 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF");
228 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth);
237 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
240 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
243 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
292 double phi_MC = -999.;
293 double eta_MC = -999.;
302 double maxPt = -99999.;
306 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
308 double phip = (*p)->momentum().phi();
309 double etap = (*p)->momentum().eta();
310 double pt = (*p)->momentum().perp();
324 const float calib_HB = 120.;
325 const float calib_HE = 190.;
326 const float calib_HF1 =
hf1_;
327 const float calib_HF2 =
hf2_;
331 const auto SimHitResult = hcalHits.
product();
341 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
350 double etaS = cellGeometry->getPosition().eta();
351 double phiS = cellGeometry->getPosition().phi();
352 double en = SimHits->energy();
355 int depth = cell.depth();
356 double ieta = cell.ieta();
359 double r =
dR(eta_MC, phi_MC, etaS, phiS);
363 if (eta_diff < etaMax) {
365 ietaMax = cell.ieta();
369 HcalCone += en * calib_HB;
371 HcalCone += en * calib_HE;
372 else if (sub == 4 && (depth == 1 || depth == 3))
373 HcalCone += en * calib_HF1;
374 else if (sub == 4 && (depth == 2 || depth == 4))
375 HcalCone += en * calib_HF2;
431 const auto SimHitResultEB = ecalEBHits.
product();
433 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin(); SimHits != SimHitResultEB->end();
438 double etaS = cellGeometry->getPosition().eta();
439 double phiS = cellGeometry->getPosition().phi();
440 double en = SimHits->energy();
442 double r =
dR(eta_MC, phi_MC, etaS, phiS);
453 const auto SimHitResultEE = ecalEEHits.
product();
455 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin(); SimHits != SimHitResultEE->end();
460 double etaS = cellGeometry->getPosition().eta();
461 double phiS = cellGeometry->getPosition().phi();
462 double en = SimHits->energy();
464 double r =
dR(eta_MC, phi_MC, etaS, phiS);
481 double PI = 3.1415926535898;
482 double deltaphi = phi1 - phi2;
484 deltaphi = phi2 - phi1;
487 deltaphi = 2. * PI - deltaphi;
489 double deltaeta = eta2 -
eta1;
490 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
498 double PI = 3.1415926535898;
502 if (a1 > 0.5 * PI && a2 < 0.)
504 if (a2 > 0.5 * PI && a1 < 0.)
506 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
517 double PI = 3.1415926535898;
520 double tmp = a2 -
a1;
MonitorElement * meEnConeEtaProfile
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
double dR(double eta1, double phi1, double eta2, double phi2)
std::vector< MonitorElement * > emean_vs_ieta_HF
virtual void setCurrentFolder(std::string const &fullpath)
double phi12(double phi1, double en1, double phi2, double en2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< MonitorElement * > occupancy_vs_ieta_HF
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
const CaloGeometry * geometry_
std::vector< MonitorElement * > Nhf
std::vector< MonitorElement * > meSimHitsEnergyHE
MonitorElement * meSimHitsEnergyHO
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
MonitorElement * meEnConeEtaProfile_E
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
std::vector< MonitorElement * > emean_vs_ieta_HB
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
std::vector< MonitorElement * > meSimHitsEnergyHB
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * emean_vs_ieta_HO
Abs< T >::type abs(const T &t)
std::vector< MonitorElement * > emean_vs_ieta_HE
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
virtual double getBinContent(int binx) const
get content of bin (1-D)
double dPhiWsign(double phi1, double phi2)
std::vector< MonitorElement * > occupancy_vs_ieta_HE
HcalSimHitsValidation(edm::ParameterSet const &conf)
const HcalDDDRecConstants * hcons_
T const * product() const
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
int getMaxDepth(const int &type) const
T getParameter(std::string const &) const
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * occupancy_vs_ieta_HO
~HcalSimHitsValidation() override
std::vector< MonitorElement * > occupancy_vs_ieta_HB
DetId relabel(const uint32_t testId) const
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
std::pair< int, int > getEtaRange(const int &i) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< MonitorElement * > Nhb
std::vector< MonitorElement * > Nhe
int getNPhi(const int &type) const
std::vector< MonitorElement * > meSimHitsEnergyHF