17 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
32 sprintf (histo,
"N_HB" );
34 sprintf (histo,
"N_HE" );
36 sprintf (histo,
"N_HO" );
38 sprintf (histo,
"N_HF" );
42 sprintf (histo,
"emean_vs_ieta_HB1" );
44 sprintf (histo,
"emean_vs_ieta_HB2" );
46 sprintf (histo,
"emean_vs_ieta_HE1" );
48 sprintf (histo,
"emean_vs_ieta_HE2" );
50 sprintf (histo,
"emean_vs_ieta_HE3" );
52 sprintf (histo,
"emean_vs_ieta_HO" );
54 sprintf (histo,
"emean_vs_ieta_HF1" );
56 sprintf (histo,
"emean_vs_ieta_HF2" );
60 sprintf (histo,
"occupancy_vs_ieta_HB1" );
62 sprintf (histo,
"occupancy_vs_ieta_HB2" );
64 sprintf (histo,
"occupancy_vs_ieta_HE1" );
66 sprintf (histo,
"occupancy_vs_ieta_HE2" );
68 sprintf (histo,
"occupancy_vs_ieta_HE3" );
70 sprintf (histo,
"occupancy_vs_ieta_HO" );
72 sprintf (histo,
"occupancy_vs_ieta_HF1" );
74 sprintf (histo,
"occupancy_vs_ieta_HF2" );
78 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB" ) ;
81 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE" ) ;
84 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HO" ) ;
87 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF" ) ;
91 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
94 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
97 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
114 if (!
dbe_->
get(
"HcalSimHitsV/HcalSimHitTask/N_HB"))
return;
124 if(ieta >=0 ) ieta +=1;
128 if (fabs(ieta) <= 20) phi_factor = 72.;
129 else if (fabs(ieta) < 40) phi_factor = 36.;
130 else phi_factor = 18.;
172 double phi_MC = -999.;
173 double eta_MC = -999.;
177 if (!evtMC.isValid()) {
178 std::cout <<
"no HepMCProduct found" << std::endl;
182 double maxPt = -99999.;
185 const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
186 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
187 p != myGenEvent->particles_end(); ++
p ) {
188 double phip = (*p)->momentum().phi();
189 double etap = (*p)->momentum().eta();
190 double pt = (*p)->momentum().perp();
191 if(pt > maxPt) {
npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
200 const float calib_HB = 120.;
201 const float calib_HE = 190.;
202 const float calib_HF1 = 1.0/0.383;
203 const float calib_HF2 = 1.0/0.368;
217 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
220 double etaS = cellGeometry->getPosition().eta () ;
221 double phiS = cellGeometry->getPosition().phi () ;
222 double en = SimHits->energy();
224 int sub = cell.subdet();
225 int depth = cell.depth();
226 double ieta = cell.ieta();
229 double r =
dR(eta_MC, phi_MC, etaS, phiS);
232 eta_diff = fabs(eta_MC - etaS);
233 if(eta_diff < etaMax) {
235 ietaMax = cell.ieta();
238 if (sub == 1) HcalCone += en*calib_HB;
239 else if (sub == 2) HcalCone += en*calib_HE;
240 else if (sub == 4 && depth == 1) HcalCone += en*calib_HF1;
241 else if (sub == 4 && depth == 2) HcalCone += en*calib_HF2;
245 if (ieta > 0) ieta--;
302 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
307 double etaS = cellGeometry->getPosition().eta () ;
308 double phiS = cellGeometry->getPosition().phi () ;
309 double en = SimHits->energy();
311 double r =
dR(eta_MC, phi_MC, etaS, phiS);
313 if (r < partR) EcalCone += en;
321 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
326 double etaS = cellGeometry->getPosition().eta () ;
327 double phiS = cellGeometry->getPosition().phi () ;
328 double en = SimHits->energy();
330 double r =
dR(eta_MC, phi_MC, etaS, phiS);
332 if (r < partR) EcalCone += en;
336 if (ietaMax > 0) ietaMax--;
348 double PI = 3.1415926535898;
349 double deltaphi= phi1 - phi2;
350 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
351 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
352 double deltaeta = eta2 - eta1;
353 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
361 double PI = 3.1415926535898;
362 double a1 = phi1;
double a2 = phi2;
364 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
365 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
366 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
367 if(tmp > PI) tmp -= 2.*
PI;
377 double PI = 3.1415926535898;
378 double a1 = phi1;
double a2 = phi2;
379 double tmp = a2 - a1;
381 if(a1 > 0.5 * PI) tmp += 2.*
PI;
382 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
MonitorElement * meEnConeEtaProfile
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meSimHitsEnergyHE
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)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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
MonitorElement * emean_vs_ieta_HE1
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
MonitorElement * meEnConeEtaProfile_E
MonitorElement * occupancy_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HE2
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * meSimHitsEnergyHF
MonitorElement * emean_vs_ieta_HO
MonitorElement * occupancy_vs_ieta_HE3
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
double dPhiWsign(double phi1, double phi2)
MonitorElement * emean_vs_ieta_HE2
HcalSimHitsValidation(edm::ParameterSet const &conf)
MonitorElement * emean_vs_ieta_HE3
MonitorElement * emean_vs_ieta_HF1
MonitorElement * occupancy_vs_ieta_HB1
MonitorElement * emean_vs_ieta_HF2
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * emean_vs_ieta_HB1
std::vector< std::vector< double > > tmp
double getBinContent(int binx) const
get content of bin (1-D)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
MonitorElement * occupancy_vs_ieta_HF2
MonitorElement * occupancy_vs_ieta_HO
int getNbinsX(void) const
get # of bins in X-axis
edm::ESHandle< CaloGeometry > geometry
MonitorElement * meSimHitsEnergyHB
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
virtual void analyze(edm::Event const &ev, edm::EventSetup const &c)
MonitorElement * emean_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HF1
void setCurrentFolder(const std::string &fullpath)
MonitorElement * occupancy_vs_ieta_HE1