11 edm::LogInfo(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
26 sprintf (histo,
"N_HB" );
28 sprintf (histo,
"N_HE" );
30 sprintf (histo,
"N_HO" );
32 sprintf (histo,
"N_HF" );
36 sprintf (histo,
"emean_vs_ieta_HB1" );
38 sprintf (histo,
"emean_vs_ieta_HB2" );
40 sprintf (histo,
"emean_vs_ieta_HE1" );
42 sprintf (histo,
"emean_vs_ieta_HE2" );
44 sprintf (histo,
"emean_vs_ieta_HE3" );
46 sprintf (histo,
"emean_vs_ieta_HO" );
48 sprintf (histo,
"emean_vs_ieta_HF1" );
50 sprintf (histo,
"emean_vs_ieta_HF2" );
54 sprintf (histo,
"occupancy_vs_ieta_HB1" );
56 sprintf (histo,
"occupancy_vs_ieta_HB2" );
58 sprintf (histo,
"occupancy_vs_ieta_HE1" );
60 sprintf (histo,
"occupancy_vs_ieta_HE2" );
62 sprintf (histo,
"occupancy_vs_ieta_HE3" );
64 sprintf (histo,
"occupancy_vs_ieta_HO" );
66 sprintf (histo,
"occupancy_vs_ieta_HF1" );
68 sprintf (histo,
"occupancy_vs_ieta_HF2" );
72 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HB" ) ;
75 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HE" ) ;
78 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HO" ) ;
81 sprintf (histo,
"HcalSimHitTask_energy_of_simhits_HF" ) ;
85 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
88 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
91 sprintf (histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
108 if (!
dbe_->
get(
"HcalSimHitsV/HcalSimHitTask/N_HB"))
return;
118 if(ieta >=0 ) ieta +=1;
122 if (fabs(ieta) <= 20) phi_factor = 72.;
123 else if (fabs(ieta) < 40) phi_factor = 36.;
124 else phi_factor = 18.;
166 double phi_MC = -999.;
167 double eta_MC = -999.;
172 if (!evtMC.isValid()) {
173 std::cout <<
"no HepMCProduct found" << std::endl;
177 double maxPt = -99999.;
180 const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
181 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
182 p != myGenEvent->particles_end(); ++
p ) {
183 double phip = (*p)->momentum().phi();
184 double etap = (*p)->momentum().eta();
185 double pt = (*p)->momentum().perp();
186 if(pt > maxPt) {
npart++; maxPt = pt; phi_MC = phip; eta_MC = etap; }
195 const float calib_HB = 120.;
196 const float calib_HE = 190.;
197 const float calib_HF1 = 1.0/0.383;
198 const float calib_HF2 = 1.0/0.368;
201 ev.
getByLabel(
"g4SimHits",
"HcalHits",hcalHits);
212 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
215 double etaS = cellGeometry->getPosition().eta () ;
216 double phiS = cellGeometry->getPosition().phi () ;
217 double en = SimHits->energy();
219 int sub = cell.subdet();
220 int depth = cell.depth();
221 double ieta = cell.ieta();
224 double r =
dR(eta_MC, phi_MC, etaS, phiS);
227 eta_diff = fabs(eta_MC - etaS);
230 ietaMax = cell.ieta();
233 if (sub == 1) HcalCone += en*calib_HB;
234 else if (sub == 2) HcalCone += en*calib_HE;
235 else if (sub == 4 && depth == 1) HcalCone += en*calib_HF1;
236 else if (sub == 4 && depth == 2) HcalCone += en*calib_HF2;
240 if (ieta > 0) ieta--;
292 ev.
getByLabel(
"g4SimHits",
"EcalHitsEB",ecalEBHits);
297 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
302 double etaS = cellGeometry->getPosition().eta () ;
303 double phiS = cellGeometry->getPosition().phi () ;
304 double en = SimHits->energy();
306 double r =
dR(eta_MC, phi_MC, etaS, phiS);
308 if (r < partR) EcalCone += en;
313 ev.
getByLabel(
"g4SimHits",
"EcalHitsEE",ecalEEHits);
316 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
321 double etaS = cellGeometry->getPosition().eta () ;
322 double phiS = cellGeometry->getPosition().phi () ;
323 double en = SimHits->energy();
325 double r =
dR(eta_MC, phi_MC, etaS, phiS);
327 if (r < partR) EcalCone += en;
331 if (ietaMax > 0) ietaMax--;
343 double PI = 3.1415926535898;
344 double deltaphi= phi1 - phi2;
345 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
346 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
347 double deltaeta = eta2 - eta1;
348 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
356 double PI = 3.1415926535898;
357 double a1 = phi1;
double a2 = phi2;
359 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
360 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
361 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
362 if(tmp > PI) tmp -= 2.*
PI;
372 double PI = 3.1415926535898;
373 double a1 = phi1;
double a2 = phi2;
374 double tmp = a2 - a1;
376 if(a1 > 0.5 * PI) tmp += 2.*
PI;
377 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)
#define DEFINE_FWK_MODULE(type)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
MonitorElement * meSimHitsEnergyHO
MonitorElement * emean_vs_ieta_HE1
MonitorElement * meEnConeEtaProfile_E
MonitorElement * occupancy_vs_ieta_HB2
MonitorElement * occupancy_vs_ieta_HE2
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")
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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)
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
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