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);
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);
96 ib.setCurrentFolder(
"HcalHitsV/HcalSimHitTask");
102 sprintf(
histo,
"N_HB");
111 sprintf(
histo,
"N_HE");
119 sprintf(
histo,
"N_HO");
124 sprintf(
histo,
"N_HF");
135 sprintf(
histo,
"emean_vs_ieta_HB");
141 ib.bookProfile(
histo,
histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB, -10., 2000.,
" "));
145 sprintf(
histo,
"emean_vs_ieta_HE");
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");
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);
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;
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;