29 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
68 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
69 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
70 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
79 float ieta_min_HB = -iEtaHBMax - 1.5;
80 float ieta_max_HB = iEtaHBMax + 1.5;
81 int ieta_bins_HB = (
int)(ieta_max_HB - ieta_min_HB);
83 float ieta_min_HE = -iEtaHEMax - 1.5;
84 float ieta_max_HE = iEtaHEMax + 1.5;
85 int ieta_bins_HE = (
int)(ieta_max_HE - ieta_min_HE);
87 float ieta_min_HF = -iEtaHFMax - 1.5;
88 float ieta_max_HF = iEtaHFMax + 1.5;
89 int ieta_bins_HF = (
int)(ieta_max_HF - ieta_min_HF);
91 float ieta_min_HO = -iEtaHOMax - 1.5;
92 float ieta_max_HO = iEtaHOMax + 1.5;
93 int ieta_bins_HO = (
int)(ieta_max_HO - ieta_min_HO);
103 sprintf(histo,
"N_HB");
105 sprintf(histo,
"N_HB%d",
depth);
108 Nhb.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
112 sprintf(histo,
"N_HE");
114 sprintf(histo,
"N_HE%d",
depth);
117 Nhe.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
120 sprintf(histo,
"N_HO");
121 Nho = ib.
book1D(histo, histo, 2200, 0., 2200.);
125 sprintf(histo,
"N_HF");
127 sprintf(histo,
"N_HF%d",
depth);
130 Nhf.push_back(ib.
book1D(histo, histo, 1800, 0., 1800.));
136 sprintf(histo,
"emean_vs_ieta_HB");
138 sprintf(histo,
"emean_vs_ieta_HB%d",
depth);
142 ib.
bookProfile(histo, histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB, -10., 2000.,
" "));
146 sprintf(histo,
"emean_vs_ieta_HE");
148 sprintf(histo,
"emean_vs_ieta_HE%d",
depth);
152 ib.
bookProfile(histo, histo, ieta_bins_HE, ieta_min_HE, ieta_max_HE, -10., 2000.,
" "));
155 sprintf(histo,
"emean_vs_ieta_HO");
160 sprintf(histo,
"emean_vs_ieta_HF");
162 sprintf(histo,
"emean_vs_ieta_HF%d",
depth);
166 ib.
bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 2000.,
" "));
172 sprintf(histo,
"occupancy_vs_ieta_HB");
174 sprintf(histo,
"occupancy_vs_ieta_HB%d",
depth);
181 sprintf(histo,
"occupancy_vs_ieta_HE");
183 sprintf(histo,
"occupancy_vs_ieta_HE%d",
depth);
189 sprintf(histo,
"occupancy_vs_ieta_HO");
194 sprintf(histo,
"occupancy_vs_ieta_HF");
196 sprintf(histo,
"occupancy_vs_ieta_HF%d",
depth);
205 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB");
207 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth);
214 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE");
216 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth);
222 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HO");
227 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF");
229 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth);
238 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
241 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
244 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
296 double phi_MC = -999.;
297 double eta_MC = -999.;
302 std::cout <<
"no HepMCProduct found" << std::endl;
306 double maxPt = -99999.;
310 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
312 double phip = (*p)->momentum().phi();
313 double etap = (*p)->momentum().eta();
314 double pt = (*p)->momentum().perp();
328 const float calib_HB = 120.;
329 const float calib_HE = 190.;
330 const float calib_HF1 =
hf1_;
331 const float calib_HF2 =
hf2_;
345 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
353 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
354 double etaS = cellGeometry->getPosition().eta();
355 double phiS = cellGeometry->getPosition().phi();
356 double en = SimHits->energy();
359 int depth = cell.depth();
360 double ieta = cell.ieta();
363 double r =
dR(eta_MC, phi_MC, etaS, phiS);
367 if (eta_diff < etaMax) {
369 ietaMax = cell.ieta();
373 HcalCone += en * calib_HB;
375 HcalCone += en * calib_HE;
376 else if (sub == 4 && (depth == 1 || depth == 3))
377 HcalCone += en * calib_HF1;
378 else if (sub == 4 && (depth == 2 || depth == 4))
379 HcalCone += en * calib_HF2;
437 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin(); SimHits != SimHitResultEB->end();
441 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
442 double etaS = cellGeometry->getPosition().eta();
443 double phiS = cellGeometry->getPosition().phi();
444 double en = SimHits->energy();
446 double r =
dR(eta_MC, phi_MC, etaS, phiS);
459 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin(); SimHits != SimHitResultEE->end();
463 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid);
464 double etaS = cellGeometry->getPosition().eta();
465 double phiS = cellGeometry->getPosition().phi();
466 double en = SimHits->energy();
468 double r =
dR(eta_MC, phi_MC, etaS, phiS);
485 double PI = 3.1415926535898;
486 double deltaphi = phi1 - phi2;
488 deltaphi = phi2 - phi1;
491 deltaphi = 2. * PI - deltaphi;
493 double deltaeta = eta2 - eta1;
494 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
502 double PI = 3.1415926535898;
506 if (a1 > 0.5 * PI && a2 < 0.)
508 if (a2 > 0.5 * PI && a1 < 0.)
510 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
521 double PI = 3.1415926535898;
524 double tmp = a2 - a1;
MonitorElement * meEnConeEtaProfile
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< PCaloHit > PCaloHitContainer
double dR(double eta1, double phi1, double eta2, double phi2)
std::vector< MonitorElement * > emean_vs_ieta_HF
HcalSubdetector subdet() const
get the subdetector
MonitorElement * bookProfile(Args &&...args)
double phi12(double phi1, double en1, double phi2, double en2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< MonitorElement * > occupancy_vs_ieta_HF
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
std::vector< MonitorElement * > Nhf
std::vector< MonitorElement * > meSimHitsEnergyHE
MonitorElement * meSimHitsEnergyHO
std::pair< int, int > getEtaRange(const int &i) const
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
MonitorElement * meEnConeEtaProfile_E
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHB
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * emean_vs_ieta_HO
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
std::vector< MonitorElement * > emean_vs_ieta_HE
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
double dPhiWsign(double phi1, double phi2)
std::vector< MonitorElement * > occupancy_vs_ieta_HE
HcalSimHitsValidation(edm::ParameterSet const &conf)
const HcalDDDRecConstants * hcons
const HepMC::GenEvent * GetEvent() const
T const * product() const
int getMaxDepth(const int &type) const
MonitorElement * meEnConeEtaProfile_EH
std::vector< std::vector< double > > tmp
double getBinContent(int binx) const
get content of bin (1-D)
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_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > Nhb
std::vector< MonitorElement * > Nhe
int getNPhi(const int &type) const
std::vector< MonitorElement * > meSimHitsEnergyHF