9 : topFolderName_ (conf.getParameter<
std::
string>(
"TopFolderName"))
17 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
52 if(sign_ ==
"-")
iz = -1;
53 if(sign_ ==
"*")
iz = 0;
56 if(mc_ ==
"no")
imc = 0;
74 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
77 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
80 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
87 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HB" ) ;
90 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
93 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB" ) ;
96 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB" ) ;
100 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
102 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
111 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HE" ) ;
114 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE" ) ;
117 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
121 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
123 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
132 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HO" ) ;
135 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
138 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO" ) ;
142 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
144 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
153 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HF" ) ;
156 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF" ) ;
159 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
163 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
165 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
167 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
169 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
171 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
173 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
194 double eHcalCone = 0.;
195 double eHcalConeHB = 0.;
196 double eHcalConeHE = 0.;
197 double eHcalConeHO = 0.;
198 double eHcalConeHF = 0.;
199 double eHcalConeHFL = 0.;
200 double eHcalConeHFS = 0.;
204 int nrechitsCone = 0;
205 int nrechitsThresh = 0;
211 double eEcalCone = 0.;
212 int numrechitsEcal = 0;
215 double phi_MC = -999999.;
216 double eta_MC = -999999.;
226 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
232 double maxPt = -99999.;
234 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
235 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p ) {
236 double phip = (*p)->momentum().phi();
237 double etap = (*p)->momentum().eta();
240 double pt = (*p)->momentum().perp();
241 if(pt > maxPt) { npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
273 for (; RecHit != RecHitEnd ; ++RecHit) {
276 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry (EBid) ;
277 double eta = cellGeometry->getPosition ().eta () ;
278 double phi = cellGeometry->getPosition ().phi () ;
279 double en = RecHit->energy();
283 double r =
dR(eta_MC, phi_MC, eta, phi);
299 for (; RecHit != RecHitEnd ; ++RecHit) {
302 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry (EEid) ;
303 double eta = cellGeometry->getPosition ().eta () ;
304 double phi = cellGeometry->getPosition ().phi () ;
305 double en = RecHit->energy();
309 double r =
dR(eta_MC, phi_MC, eta, phi);
331 double HcalCone = 0.;
339 for (
unsigned int i = 0;
i <
cen.size();
i++) {
350 if(en > 1. ) nrechitsThresh++;
352 double r =
dR(eta_MC, phi_MC, eta, phi);
354 if(sub == 1) eHcalConeHB += en;
355 if(sub == 2) eHcalConeHE += en;
356 if(sub == 3) eHcalConeHO += en;
359 if (depth == 1) eHcalConeHFL += en;
360 else eHcalConeHFS += en;
368 float eta_diff = fabs(eta_MC - eta);
369 if(eta_diff < etaMax) {
426 double enSimHits = 0.;
427 double enSimHitsHB = 0.;
428 double enSimHitsHE = 0.;
429 double enSimHitsHO = 0.;
430 double enSimHitsHF = 0.;
431 double enSimHitsHFL = 0.;
432 double enSimHitsHFS = 0.;
435 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
444 depth = cell.depth();
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) {
529 double eta = cellGeometry->getPosition(cell).eta () ;
530 double phi = cellGeometry->getPosition(cell).phi () ;
531 double zc = cellGeometry->getPosition(cell).z ();
532 int sub = cell.subdet();
533 int depth = cell.depth();
534 int inteta = cell.ieta();
535 int intphi = cell.iphi()-1;
536 double en = j->energy();
537 double t = j->time();
539 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
546 cieta.push_back(inteta);
547 ciphi.push_back(intphi);
556 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
565 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
567 double eta = cellGeometry->getPosition().eta () ;
568 double phi = cellGeometry->getPosition().phi () ;
569 double zc = cellGeometry->getPosition().z ();
570 int sub = cell.subdet();
571 int depth = cell.depth();
572 int inteta = cell.ieta();
573 int intphi = cell.iphi()-1;
574 double en = j->energy();
575 double t = j->time();
577 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
584 cieta.push_back(inteta);
585 ciphi.push_back(intphi);
594 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
602 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
604 double eta = cellGeometry->getPosition().eta () ;
605 double phi = cellGeometry->getPosition().phi () ;
606 double zc = cellGeometry->getPosition().z ();
607 int sub = cell.subdet();
608 int depth = cell.depth();
609 int inteta = cell.ieta();
610 int intphi = cell.iphi()-1;
611 double t = j->time();
612 double en = j->energy();
614 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
620 cieta.push_back(inteta);
621 ciphi.push_back(intphi);
631 double PI = 3.1415926535898;
632 double deltaphi= phi1 - phi2;
633 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
634 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
635 double deltaeta = eta2 - eta1;
636 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
644 double PI = 3.1415926535898;
645 double a1 = phi1;
double a2 = phi2;
647 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
648 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
649 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
650 if(tmp > PI) tmp -= 2.*
PI;
660 double PI = 3.1415926535898;
661 double a1 = phi1;
double a2 = phi2;
662 double tmp = a2 - a1;
664 if(a1 > 0.5 * PI) tmp += 2.*
PI;
665 if(a2 > 0.5 * PI) tmp -= 2.*
PI;
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
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)
std::string topFolderName_
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
MonitorElement * meTEprofileHB
MonitorElement * book1D(Args &&...args)
virtual void fillRecHitsTmp(int subdet_, edm::Event const &ev)
double dR(double eta1, double phi1, double eta2, double phi2)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
MonitorElement * meRecHitSimHitHO
MonitorElement * meRecHitSimHitProfileHB
GlobalPoint getPosition(const DetId &id) const
const_iterator end() const
MonitorElement * meTEprofileHF_Low
edm::EDGetTokenT< EBRecHitCollection > tok_EB_
MonitorElement * meTEprofileHO_High
MonitorElement * meTEprofileHE
void setCurrentFolder(const std::string &fullpath)
const HepMC::GenEvent * GetEvent() const
T const * product() const
MonitorElement * book2D(Args &&...args)
MonitorElement * meTEprofileHF
MonitorElement * meRecHitSimHitProfileHO
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
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
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meTEprofileHO
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
DetId relabel(const uint32_t testId) const
MonitorElement * meTEprofileHB_Low
MonitorElement * meRecHitSimHitHE
HcalRecHitsValidation(edm::ParameterSet const &conf)
~HcalRecHitsValidation() override
MonitorElement * meTEprofileHB_High
std::vector< double > cen
const_iterator begin() const