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.;
269 if (!evtMC.isValid()) {
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 int sign = (z==0) ? (-1):(1);
325 double en = SimHits->energy();
329 double ieta = cell.
ieta();
332 double r =
dR(eta_MC, phi_MC, etaS, phiS);
338 ietaMax = cell.
ieta();
341 if (sub == 1) HcalCone += en*calib_HB;
342 else if (sub == 2) HcalCone += en*calib_HE;
343 else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
344 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) {
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;
416 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
421 double etaS = cellGeometry->getPosition().eta () ;
422 double phiS = cellGeometry->getPosition().phi () ;
423 double en = SimHits->energy();
425 double r =
dR(eta_MC, phi_MC, etaS, phiS);
427 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;
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)
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)
Geom::Phi< T > phi() const
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
int depth() const
get the tower depth
std::vector< MonitorElement * > Nhb
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * emean_vs_ieta_HO
int ieta() const
get the cell ieta
MonitorElement * book1D(Args &&...args)
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHF
Abs< T >::type abs(const T &t)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
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)
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
edm::ESHandle< CaloGeometry > geometry
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
virtual void analyze(edm::Event const &ev, edm::EventSetup const &c)
std::vector< MonitorElement * > occupancy_vs_ieta_HB
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)