24 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
66 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
67 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
68 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
76 float ieta_min_HB = -iEtaHBMax - 1.5;
77 float ieta_max_HB = iEtaHBMax + 1.5;
78 int ieta_bins_HB = (
int) (ieta_max_HB - ieta_min_HB);
80 float ieta_min_HE = -iEtaHEMax - 1.5;
81 float ieta_max_HE = iEtaHEMax + 1.5;
82 int ieta_bins_HE = (
int) (ieta_max_HE - ieta_min_HE);
84 float ieta_min_HF = -iEtaHFMax - 1.5;
85 float ieta_max_HF = iEtaHFMax + 1.5;
86 int ieta_bins_HF = (
int) (ieta_max_HF - ieta_min_HF);
88 float ieta_min_HO = -iEtaHOMax - 1.5;
89 float ieta_max_HO = iEtaHOMax + 1.5;
90 int ieta_bins_HO = (
int) (ieta_max_HO - ieta_min_HO);
100 if(
depth == 0){ sprintf (histo,
"N_HB" ); }
101 else { sprintf (histo,
"N_HB%d",
depth ); }
103 Nhb.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
106 if(
depth == 0){ sprintf (histo,
"N_HE" ); }
107 else { sprintf (histo,
"N_HE%d",
depth ); }
109 Nhe.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
112 sprintf (histo,
"N_HO" );
113 Nho = ib.
book1D(histo, histo, 2200,0.,2200.);
116 if(
depth == 0){ sprintf (histo,
"N_HF" ); }
117 else { sprintf (histo,
"N_HF%d",
depth ); }
119 Nhf.push_back( ib.
book1D(histo, histo, 1800,0.,1800.) );
124 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HB" ); }
125 else { sprintf (histo,
"emean_vs_ieta_HB%d",
depth ); }
130 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HE" ); }
131 else { sprintf (histo,
"emean_vs_ieta_HE%d",
depth ); }
136 sprintf (histo,
"emean_vs_ieta_HO" );
140 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HF" ); }
141 else { sprintf (histo,
"emean_vs_ieta_HF%d",
depth ); }
148 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HB" ); }
149 else { sprintf (histo,
"occupancy_vs_ieta_HB%d",
depth ); }
154 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HE" ); }
155 else { sprintf (histo,
"occupancy_vs_ieta_HE%d",
depth ); }
160 sprintf (histo,
"occupancy_vs_ieta_HO" );
164 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HF" ); }
165 else { sprintf (histo,
"occupancy_vs_ieta_HF%d",
depth ); }
172 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB" ); }
173 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth ); }
178 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE" ); }
179 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth ); }
184 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HO" );
188 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF" ); }
189 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth ); }
197 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
200 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
203 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
220 if (
std::abs(ieta) <= 20) phi_factor = 72.;
221 else if (
std::abs(ieta) < 40) phi_factor = 36.;
222 else phi_factor = 18.;
262 double phi_MC = -999.;
263 double eta_MC = -999.;
268 std::cout <<
"no HepMCProduct found" << std::endl;
272 double maxPt = -99999.;
275 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
276 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
277 p != myGenEvent->particles_end(); ++
p ) {
278 double phip = (*p)->momentum().phi();
279 double etap = (*p)->momentum().eta();
280 double pt = (*p)->momentum().perp();
281 if(pt > maxPt) {npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
290 const float calib_HB = 120.;
291 const float calib_HE = 190.;
292 const float calib_HF1 = 1.0/0.383;
293 const float calib_HF2 = 1.0/0.368;
307 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
312 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
313 double etaS = cellGeometry->getPosition().eta () ;
314 double phiS = cellGeometry->getPosition().phi () ;
315 double en = SimHits->energy();
318 int depth = cell.depth();
319 double ieta = cell.ieta();
322 double r =
dR(eta_MC, phi_MC, etaS, phiS);
326 if(eta_diff < etaMax) {
328 ietaMax = cell.ieta();
331 if (sub == 1) HcalCone += en*calib_HB;
332 else if (sub == 2) HcalCone += en*calib_HE;
333 else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
334 else if (sub == 4 && (depth == 2 || depth == 4)) HcalCone += en*calib_HF2;
393 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
397 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
398 double etaS = cellGeometry->getPosition().eta () ;
399 double phiS = cellGeometry->getPosition().phi () ;
400 double en = SimHits->energy();
402 double r =
dR(eta_MC, phi_MC, etaS, phiS);
404 if (r < partR) EcalCone += en;
414 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
418 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid) ;
419 double etaS = cellGeometry->getPosition().eta () ;
420 double phiS = cellGeometry->getPosition().phi () ;
421 double en = SimHits->energy();
423 double r =
dR(eta_MC, phi_MC, etaS, phiS);
425 if (r < partR) EcalCone += en;
440 double PI = 3.1415926535898;
441 double deltaphi= phi1 - phi2;
442 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
443 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
444 double deltaeta = eta2 - eta1;
445 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
453 double PI = 3.1415926535898;
454 double a1 = phi1;
double a2 = phi2;
456 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
457 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
458 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
459 if(tmp > PI) tmp -= 2.*
PI;
469 double PI = 3.1415926535898;
470 double a1 = phi1;
double a2 = phi2;
471 double tmp = a2 - a1;
473 if(a1 > 0.5 * PI) tmp += 2.*
PI;
474 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
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)
HcalSubdetector subdet() const
get the subdetector
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)
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
MonitorElement * meSimHitsEnergyHO
std::vector< MonitorElement * > occupancy_vs_ieta_HF
std::vector< MonitorElement * > Nhe
std::pair< int, int > getEtaRange(const int &i) const
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
MonitorElement * meEnConeEtaProfile_E
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
int getMaxDepth(const int &type) const
MonitorElement * meEnConeEtaProfile_EH
std::vector< MonitorElement * > Nhf
std::vector< std::vector< double > > tmp
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * occupancy_vs_ieta_HO
~HcalSimHitsValidation() override
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 * > occupancy_vs_ieta_HB
int getNPhi(const int &type) const