13 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
45 if(sign_ ==
"-")
iz = -1;
46 if(sign_ ==
"*")
iz = 0;
49 if(mc_ ==
"no")
imc = 0;
67 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
70 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
73 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
80 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HB" ) ;
83 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
86 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB" ) ;
89 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB" ) ;
93 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
95 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
104 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HE" ) ;
107 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE" ) ;
110 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
114 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
116 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
125 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HO" ) ;
128 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
131 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO" ) ;
135 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
137 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
146 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HF" ) ;
149 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF" ) ;
152 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
156 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
158 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
160 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
162 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
164 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
166 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
183 double eHcalCone = 0.;
184 double eHcalConeHB = 0.;
185 double eHcalConeHE = 0.;
186 double eHcalConeHO = 0.;
187 double eHcalConeHF = 0.;
188 double eHcalConeHFL = 0.;
189 double eHcalConeHFS = 0.;
193 int nrechitsCone = 0;
194 int nrechitsThresh = 0;
200 double eEcalCone = 0.;
201 int numrechitsEcal = 0;
204 double phi_MC = -999999.;
205 double eta_MC = -999999.;
215 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
221 double maxPt = -99999.;
223 const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
224 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p ) {
225 double phip = (*p)->momentum().phi();
226 double etap = (*p)->momentum().eta();
229 double pt = (*p)->momentum().perp();
230 if(pt > maxPt) { npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
259 for (; RecHit != RecHitEnd ; ++RecHit) {
263 geometry->getSubdetectorGeometry (EBid)->getGeometry (EBid) ;
264 double eta = cellGeometry->getPosition ().eta () ;
265 double phi = cellGeometry->getPosition ().phi () ;
266 double en = RecHit->energy();
270 double r =
dR(eta_MC, phi_MC, eta, phi);
282 RecHit = rhitEE.
product()->begin();
283 RecHitEnd = rhitEE.
product()->end();
285 for (; RecHit != RecHitEnd ; ++RecHit) {
289 geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
290 double eta = cellGeometry->getPosition ().eta () ;
291 double phi = cellGeometry->getPosition ().phi () ;
292 double en = RecHit->energy();
296 double r =
dR(eta_MC, phi_MC, eta, phi);
317 double HcalCone = 0.;
325 for (
unsigned int i = 0;
i <
cen.size();
i++) {
336 if(en > 1. ) nrechitsThresh++;
338 double r =
dR(eta_MC, phi_MC, eta, phi);
340 if(sub == 1) eHcalConeHB += en;
341 if(sub == 2) eHcalConeHE += en;
342 if(sub == 3) eHcalConeHO += en;
345 if (depth == 1) eHcalConeHFL += en;
346 else eHcalConeHFS += en;
354 float eta_diff = fabs(eta_MC - eta);
355 if(eta_diff < etaMax) {
412 double enSimHits = 0.;
413 double enSimHitsHB = 0.;
414 double enSimHitsHE = 0.;
415 double enSimHitsHO = 0.;
416 double enSimHitsHF = 0.;
417 double enSimHitsHFL = 0.;
418 double enSimHitsHFS = 0.;
421 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
429 int sign = (z==0) ? (-1):(1);
436 cell =
HcalDetId(static_cast<HcalSubdetector>(sub),eta,phi,1);
443 depth = cell.
depth();
449 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
452 double en = SimHits->energy();
454 double r =
dR(eta_MC, phi_MC, etaS, phiS);
459 if(sub == static_cast<int>(
HcalBarrel)) enSimHitsHB += en;
460 if(sub == static_cast<int>(
HcalEndcap)) enSimHitsHE += en;
461 if(sub == static_cast<int>(
HcalOuter)) enSimHitsHO += en;
464 if(depth == 1) enSimHitsHFL += en;
465 else enSimHitsHFS += en;
517 if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
526 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
527 double eta = cellGeometry->getPosition().eta () ;
528 double phi = cellGeometry->getPosition().phi () ;
529 double zc = cellGeometry->getPosition().z ();
530 int sub = cell.subdet();
531 int depth = cell.depth();
532 int inteta = cell.ieta();
533 if(inteta > 0) inteta -= 1;
534 int intphi = cell.iphi()-1;
535 double en =
j->energy();
536 double t =
j->time();
538 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
545 cieta.push_back(inteta);
546 ciphi.push_back(intphi);
554 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
563 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
564 double eta = cellGeometry->getPosition().eta () ;
565 double phi = cellGeometry->getPosition().phi () ;
566 double zc = cellGeometry->getPosition().z ();
567 int sub = cell.subdet();
568 int depth = cell.depth();
569 int inteta = cell.ieta();
570 if(inteta > 0) inteta -= 1;
571 int intphi = cell.iphi()-1;
572 double en =
j->energy();
573 double t =
j->time();
575 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
582 cieta.push_back(inteta);
583 ciphi.push_back(intphi);
591 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
599 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
600 double eta = cellGeometry->getPosition().eta () ;
601 double phi = cellGeometry->getPosition().phi () ;
602 double zc = cellGeometry->getPosition().z ();
603 int sub = cell.subdet();
604 int depth = cell.depth();
605 int inteta = cell.ieta();
606 if(inteta > 0) inteta -= 1;
607 int intphi = cell.iphi()-1;
608 double t =
j->time();
609 double en =
j->energy();
611 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
617 cieta.push_back(inteta);
618 ciphi.push_back(intphi);
627 double PI = 3.1415926535898;
628 double deltaphi= phi1 - phi2;
629 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
630 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
631 double deltaeta = eta2 - eta1;
632 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
640 double PI = 3.1415926535898;
641 double a1 = phi1;
double a2 = phi2;
643 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
644 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
645 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
646 if(tmp > PI) tmp -= 2.*
PI;
656 double PI = 3.1415926535898;
657 double a1 = phi1;
double a2 = phi2;
658 double tmp = a2 - a1;
660 if(a1 > 0.5 * PI) tmp += 2.*
PI;
661 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< PCaloHit > PCaloHitContainer
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hh_
MonitorElement * meRecHitsEnergyHF
HcalSubdetector subdet() const
get the subdetector
double phi12(double phi1, double en1, double phi2, double en2)
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * meTEprofileHE_Low
std::string hcalselector_
#define DEFINE_FWK_MODULE(type)
Geom::Phi< T > phi() const
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * meEnConeEtaProfile
double dPhiWsign(double phi1, double phi2)
MonitorElement * meRecHitSimHitProfileHF
MonitorElement * meRecHitSimHitProfileHFS
MonitorElement * meRecHitsEnergyHB
std::vector< double > ceta
std::string ecalselector_
MonitorElement * meRecHitSimHitHF
MonitorElement * meRecHitsEnergyHE
MonitorElement * meRecHitSimHitProfileHE
edm::EDGetTokenT< HORecHitCollection > tok_ho_
MonitorElement * meEnConeEtaProfile_E
MonitorElement * meRecHitSimHitHB
MonitorElement * meRecHitSimHitHFS
std::vector< double > cphi
int depth() const
get the tower depth
edm::ESHandle< CaloGeometry > geometry
MonitorElement * meTEprofileHB
MonitorElement * book1D(Args &&...args)
virtual void fillRecHitsTmp(int subdet_, edm::Event const &ev)
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
double dR(double eta1, double phi1, double eta2, double phi2)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
MonitorElement * meRecHitSimHitHO
MonitorElement * meRecHitSimHitProfileHB
virtual void analyze(edm::Event const &ev, edm::EventSetup const &c)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
MonitorElement * meTEprofileHF_Low
edm::EDGetTokenT< EBRecHitCollection > tok_EB_
MonitorElement * meTEprofileHO_High
MonitorElement * meTEprofileHE
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
MonitorElement * meTEprofileHF
MonitorElement * meRecHitSimHitProfileHO
edm::EDGetTokenT< EERecHitCollection > tok_EE_
std::vector< double > ctime
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * meRecHitSimHitProfileHFL
std::vector< int > cdepth
std::vector< std::vector< double > > tmp
MonitorElement * meRecHitsEnergyHO
MonitorElement * meRecHitSimHitHFL
MonitorElement * meTEprofileHO
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
MonitorElement * meTEprofileHB_Low
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
MonitorElement * meRecHitSimHitHE
HcalRecHitsValidation(edm::ParameterSet const &conf)
MonitorElement * meTEprofileHB_High
std::vector< double > cen