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");
217 if(ieta >=0 ) ieta +=1;
221 if (
std::abs(ieta) <= 20) phi_factor = 72.;
222 else if (
std::abs(ieta) < 40) phi_factor = 36.;
223 else phi_factor = 18.;
263 double phi_MC = -999.;
264 double eta_MC = -999.;
269 std::cout <<
"no HepMCProduct found" << std::endl;
273 double maxPt = -99999.;
276 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
277 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
278 p != myGenEvent->particles_end(); ++
p ) {
279 double phip = (*p)->momentum().phi();
280 double etap = (*p)->momentum().eta();
281 double pt = (*p)->momentum().perp();
282 if(pt > maxPt) {npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
291 const float calib_HB = 120.;
292 const float calib_HE = 190.;
293 const float calib_HF1 = 1.0/0.383;
294 const float calib_HF2 = 1.0/0.368;
308 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
313 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
314 double etaS = cellGeometry->getPosition().eta () ;
315 double phiS = cellGeometry->getPosition().phi () ;
316 double en = SimHits->energy();
319 int depth = cell.depth();
320 double ieta = cell.ieta();
323 double r =
dR(eta_MC, phi_MC, etaS, phiS);
327 if(eta_diff < etaMax) {
329 ietaMax = cell.ieta();
332 if (sub == 1) HcalCone += en*calib_HB;
333 else if (sub == 2) HcalCone += en*calib_HE;
334 else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
335 else if (sub == 4 && (depth == 2 || depth == 4)) HcalCone += en*calib_HF2;
394 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
398 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
399 double etaS = cellGeometry->getPosition().eta () ;
400 double phiS = cellGeometry->getPosition().phi () ;
401 double en = SimHits->energy();
403 double r =
dR(eta_MC, phi_MC, etaS, phiS);
405 if (r < partR) EcalCone += en;
415 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
419 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid) ;
420 double etaS = cellGeometry->getPosition().eta () ;
421 double phiS = cellGeometry->getPosition().phi () ;
422 double en = SimHits->energy();
424 double r =
dR(eta_MC, phi_MC, etaS, phiS);
426 if (r < partR) EcalCone += en;
431 if (ietaMax > 0) ietaMax--;
443 double PI = 3.1415926535898;
444 double deltaphi= phi1 - phi2;
445 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
446 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
447 double deltaeta = eta2 - eta1;
448 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
456 double PI = 3.1415926535898;
457 double a1 = phi1;
double a2 = phi2;
459 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
460 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
461 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
462 if(tmp > PI) tmp -= 2.*
PI;
472 double PI = 3.1415926535898;
473 double a1 = phi1;
double a2 = phi2;
474 double tmp = a2 - a1;
476 if(a1 > 0.5 * PI) tmp += 2.*
PI;
477 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