18 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
61 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
62 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
63 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
71 float ieta_min_HB = -iEtaHBMax - 1.5;
72 float ieta_max_HB = iEtaHBMax + 1.5;
73 int ieta_bins_HB = (
int) (ieta_max_HB - ieta_min_HB);
75 float ieta_min_HE = -iEtaHEMax - 1.5;
76 float ieta_max_HE = iEtaHEMax + 1.5;
77 int ieta_bins_HE = (
int) (ieta_max_HE - ieta_min_HE);
79 float ieta_min_HF = -iEtaHFMax - 1.5;
80 float ieta_max_HF = iEtaHFMax + 1.5;
81 int ieta_bins_HF = (
int) (ieta_max_HF - ieta_min_HF);
83 float ieta_min_HO = -iEtaHOMax - 1.5;
84 float ieta_max_HO = iEtaHOMax + 1.5;
85 int ieta_bins_HO = (
int) (ieta_max_HO - ieta_min_HO);
93 if(
depth == 0){ sprintf (histo,
"N_HB" ); }
94 else { sprintf (histo,
"N_HB%d",
depth ); }
96 Nhb.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
99 if(
depth == 0){ sprintf (histo,
"N_HE" ); }
100 else { sprintf (histo,
"N_HE%d",
depth ); }
102 Nhe.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
105 sprintf (histo,
"N_HO" );
106 Nho = ib.
book1D(histo, histo, 2200,0.,2200.);
109 if(
depth == 0){ sprintf (histo,
"N_HF" ); }
110 else { sprintf (histo,
"N_HF%d",
depth ); }
112 Nhf.push_back( ib.
book1D(histo, histo, 1800,0.,1800.) );
117 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HB" ); }
118 else { sprintf (histo,
"emean_vs_ieta_HB%d",
depth ); }
123 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HE" ); }
124 else { sprintf (histo,
"emean_vs_ieta_HE%d",
depth ); }
129 sprintf (histo,
"emean_vs_ieta_HO" );
133 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HF" ); }
134 else { sprintf (histo,
"emean_vs_ieta_HF%d",
depth ); }
141 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HB" ); }
142 else { sprintf (histo,
"occupancy_vs_ieta_HB%d",
depth ); }
147 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HE" ); }
148 else { sprintf (histo,
"occupancy_vs_ieta_HE%d",
depth ); }
153 sprintf (histo,
"occupancy_vs_ieta_HO" );
157 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HF" ); }
158 else { sprintf (histo,
"occupancy_vs_ieta_HF%d",
depth ); }
165 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB" ); }
166 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth ); }
171 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE" ); }
172 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth ); }
177 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HO" );
181 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF" ); }
182 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth ); }
188 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
191 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
194 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
219 if(ieta >=0 ) ieta +=1;
223 if (
std::abs(ieta) <= 20) phi_factor = 72.;
224 else if (
std::abs(ieta) < 40) phi_factor = 36.;
225 else phi_factor = 18.;
264 double phi_MC = -999.;
265 double eta_MC = -999.;
270 std::cout <<
"no HepMCProduct found" << std::endl;
274 double maxPt = -99999.;
277 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
278 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
279 p != myGenEvent->particles_end(); ++
p ) {
280 double phip = (*p)->momentum().phi();
281 double etap = (*p)->momentum().eta();
282 double pt = (*p)->momentum().perp();
283 if(pt > maxPt) {npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
292 const float calib_HB = 120.;
293 const float calib_HE = 190.;
294 const float calib_HF1 = 1.0/0.383;
295 const float calib_HF2 = 1.0/0.368;
309 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
315 double etaS = cellGeometry->getPosition().eta () ;
316 double phiS = cellGeometry->getPosition().phi () ;
317 double en = SimHits->energy();
319 int sub = cell.subdet();
320 int depth = cell.depth();
321 double ieta = cell.ieta();
324 double r =
dR(eta_MC, phi_MC, etaS, phiS);
328 if(eta_diff < etaMax) {
330 ietaMax = cell.ieta();
333 if (sub == 1) HcalCone += en*calib_HB;
334 else if (sub == 2) HcalCone += en*calib_HE;
335 else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
336 else if (sub == 4 && (depth == 2 || depth == 4)) HcalCone += en*calib_HF2;
389 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
394 double etaS = cellGeometry->getPosition().eta () ;
395 double phiS = cellGeometry->getPosition().phi () ;
396 double en = SimHits->energy();
398 double r =
dR(eta_MC, phi_MC, etaS, phiS);
400 if (r < partR) EcalCone += en;
408 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
413 double etaS = cellGeometry->getPosition().eta () ;
414 double phiS = cellGeometry->getPosition().phi () ;
415 double en = SimHits->energy();
417 double r =
dR(eta_MC, phi_MC, etaS, phiS);
419 if (r < partR) EcalCone += en;
423 if (ietaMax > 0) ietaMax--;
435 double PI = 3.1415926535898;
436 double deltaphi= phi1 - phi2;
437 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
438 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
439 double deltaeta = eta2 - eta1;
440 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
448 double PI = 3.1415926535898;
449 double a1 = phi1;
double a2 = phi2;
451 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
452 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
453 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
454 if(tmp > PI) tmp -= 2.*
PI;
464 double PI = 3.1415926535898;
465 double a1 = phi1;
double a2 = phi2;
466 double tmp = a2 - a1;
468 if(a1 > 0.5 * PI) tmp += 2.*
PI;
469 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
int getNPhi(const int type) const
MonitorElement * meEnConeEtaProfile
std::vector< MonitorElement * > meSimHitsEnergyHB
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_HE
MonitorElement * bookProfile(Args &&...args)
double phi12(double phi1, double en1, double phi2, double en2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
MonitorElement * meSimHitsEnergyHO
std::vector< MonitorElement * > occupancy_vs_ieta_HF
std::vector< MonitorElement * > Nhe
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
MonitorElement * meEnConeEtaProfile_E
int getMaxDepth(const int type) const
std::vector< MonitorElement * > emean_vs_ieta_HF
std::vector< MonitorElement * > Nhb
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * emean_vs_ieta_HO
MonitorElement * book1D(Args &&...args)
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHF
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
double dPhiWsign(double phi1, double phi2)
HcalSimHitsValidation(edm::ParameterSet const &conf)
const HcalDDDRecConstants * hcons
std::vector< MonitorElement * > occupancy_vs_ieta_HE
std::vector< MonitorElement * > meSimHitsEnergyHE
void setCurrentFolder(const std::string &fullpath)
const HepMC::GenEvent * GetEvent() const
T const * product() const
MonitorElement * meEnConeEtaProfile_EH
std::vector< MonitorElement * > Nhf
std::pair< int, int > getEtaRange(const int i) const
std::vector< std::vector< double > > tmp
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * occupancy_vs_ieta_HO
DetId relabel(const uint32_t testId) const
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
virtual void analyze(edm::Event const &ev, edm::EventSetup const &c)
std::vector< MonitorElement * > occupancy_vs_ieta_HB
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)