28 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
70 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
71 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
72 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
80 float ieta_min_HB = -iEtaHBMax - 1.5;
81 float ieta_max_HB = iEtaHBMax + 1.5;
82 int ieta_bins_HB = (
int) (ieta_max_HB - ieta_min_HB);
84 float ieta_min_HE = -iEtaHEMax - 1.5;
85 float ieta_max_HE = iEtaHEMax + 1.5;
86 int ieta_bins_HE = (
int) (ieta_max_HE - ieta_min_HE);
88 float ieta_min_HF = -iEtaHFMax - 1.5;
89 float ieta_max_HF = iEtaHFMax + 1.5;
90 int ieta_bins_HF = (
int) (ieta_max_HF - ieta_min_HF);
92 float ieta_min_HO = -iEtaHOMax - 1.5;
93 float ieta_max_HO = iEtaHOMax + 1.5;
94 int ieta_bins_HO = (
int) (ieta_max_HO - ieta_min_HO);
104 if(
depth == 0){ sprintf (histo,
"N_HB" ); }
105 else { sprintf (histo,
"N_HB%d",
depth ); }
107 Nhb.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
110 if(
depth == 0){ sprintf (histo,
"N_HE" ); }
111 else { sprintf (histo,
"N_HE%d",
depth ); }
113 Nhe.push_back( ib.
book1D(histo, histo, 2600,0.,2600.) );
116 sprintf (histo,
"N_HO" );
117 Nho = ib.
book1D(histo, histo, 2200,0.,2200.);
120 if(
depth == 0){ sprintf (histo,
"N_HF" ); }
121 else { sprintf (histo,
"N_HF%d",
depth ); }
123 Nhf.push_back( ib.
book1D(histo, histo, 1800,0.,1800.) );
128 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HB" ); }
129 else { sprintf (histo,
"emean_vs_ieta_HB%d",
depth ); }
134 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HE" ); }
135 else { sprintf (histo,
"emean_vs_ieta_HE%d",
depth ); }
140 sprintf (histo,
"emean_vs_ieta_HO" );
144 if(
depth == 0){ sprintf (histo,
"emean_vs_ieta_HF" ); }
145 else { sprintf (histo,
"emean_vs_ieta_HF%d",
depth ); }
152 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HB" ); }
153 else { sprintf (histo,
"occupancy_vs_ieta_HB%d",
depth ); }
158 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HE" ); }
159 else { sprintf (histo,
"occupancy_vs_ieta_HE%d",
depth ); }
164 sprintf (histo,
"occupancy_vs_ieta_HO" );
168 if(
depth == 0){ sprintf (histo,
"occupancy_vs_ieta_HF" ); }
169 else { sprintf (histo,
"occupancy_vs_ieta_HF%d",
depth ); }
176 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB" ); }
177 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth ); }
182 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE" ); }
183 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth ); }
188 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HO" );
192 if(
depth == 0){ sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF" ); }
193 else { sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth ); }
201 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
204 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
207 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
224 if (
std::abs(ieta) <= 20) phi_factor = 72.;
225 else if (
std::abs(ieta) < 40) phi_factor = 36.;
226 else phi_factor = 18.;
266 double phi_MC = -999.;
267 double eta_MC = -999.;
272 std::cout <<
"no HepMCProduct found" << std::endl;
276 double maxPt = -99999.;
279 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
280 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
281 p != myGenEvent->particles_end(); ++
p ) {
282 double phip = (*p)->momentum().phi();
283 double etap = (*p)->momentum().eta();
284 double pt = (*p)->momentum().perp();
285 if(pt > maxPt) {npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
294 const float calib_HB = 120.;
295 const float calib_HE = 190.;
296 const float calib_HF1 =
hf1_;
297 const float calib_HF2 =
hf2_;
311 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
316 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
317 double etaS = cellGeometry->getPosition().eta () ;
318 double phiS = cellGeometry->getPosition().phi () ;
319 double en = SimHits->energy();
322 int depth = cell.depth();
323 double ieta = cell.ieta();
326 double r =
dR(eta_MC, phi_MC, etaS, phiS);
330 if(eta_diff < etaMax) {
332 ietaMax = cell.ieta();
335 if (sub == 1) HcalCone += en*calib_HB;
336 else if (sub == 2) HcalCone += en*calib_HE;
337 else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
338 else if (sub == 4 && (depth == 2 || depth == 4)) HcalCone += en*calib_HF2;
397 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
401 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
402 double etaS = cellGeometry->getPosition().eta () ;
403 double phiS = cellGeometry->getPosition().phi () ;
404 double en = SimHits->energy();
406 double r =
dR(eta_MC, phi_MC, etaS, phiS);
408 if (r < partR) EcalCone += en;
418 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
422 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid) ;
423 double etaS = cellGeometry->getPosition().eta () ;
424 double phiS = cellGeometry->getPosition().phi () ;
425 double en = SimHits->energy();
427 double r =
dR(eta_MC, phi_MC, etaS, phiS);
429 if (r < partR) EcalCone += en;
444 double PI = 3.1415926535898;
445 double deltaphi= phi1 - phi2;
446 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
447 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
448 double deltaeta = eta2 - eta1;
449 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
457 double PI = 3.1415926535898;
458 double a1 = phi1;
double a2 = phi2;
460 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
461 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
462 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
463 if(tmp > PI) tmp -= 2.*
PI;
473 double PI = 3.1415926535898;
474 double a1 = phi1;
double a2 = phi2;
475 double tmp = a2 - a1;
477 if(a1 > 0.5 * PI) tmp += 2.*
PI;
478 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
MonitorElement * meEnConeEtaProfile
std::vector< MonitorElement * > meSimHitsEnergyHB
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)
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_
void setCurrentFolder(std::string const &fullpath)
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
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