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");
88 sprintf (histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HB" ) ;
91 sprintf (histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HB" ) ;
95 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HB" ) ;
98 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
101 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB" ) ;
104 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB" ) ;
108 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
110 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
120 sprintf (histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HE" ) ;
123 sprintf (histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HE" ) ;
127 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HE" ) ;
130 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE" ) ;
133 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
137 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
139 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
148 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HO" ) ;
151 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
154 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO" ) ;
158 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
160 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
169 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HF" ) ;
172 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF" ) ;
175 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
179 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
181 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
183 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
185 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
187 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
189 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
210 double eHcalCone = 0.;
211 double eHcalConeHB = 0.;
212 double eHcalConeHE = 0.;
213 double eHcalConeHO = 0.;
214 double eHcalConeHF = 0.;
215 double eHcalConeHFL = 0.;
216 double eHcalConeHFS = 0.;
220 int nrechitsCone = 0;
221 int nrechitsThresh = 0;
227 double eEcalCone = 0.;
228 int numrechitsEcal = 0;
231 double phi_MC = -999999.;
232 double eta_MC = -999999.;
242 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
248 double maxPt = -99999.;
250 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
251 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p ) {
252 double phip = (*p)->momentum().phi();
253 double etap = (*p)->momentum().eta();
256 double pt = (*p)->momentum().perp();
257 if(pt > maxPt) { npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
289 for (; RecHit != RecHitEnd ; ++RecHit) {
292 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry (EBid) ;
293 double eta = cellGeometry->getPosition ().eta () ;
294 double phi = cellGeometry->getPosition ().phi () ;
295 double en = RecHit->energy();
299 double r =
dR(eta_MC, phi_MC, eta, phi);
315 for (; RecHit != RecHitEnd ; ++RecHit) {
318 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry (EEid) ;
319 double eta = cellGeometry->getPosition ().eta () ;
320 double phi = cellGeometry->getPosition ().phi () ;
321 double en = RecHit->energy();
325 double r =
dR(eta_MC, phi_MC, eta, phi);
347 double HcalCone = 0.;
355 for (
unsigned int i = 0;
i <
cen.size();
i++) {
365 double chi2_log10 = 9.99;
366 if (chi2 > 0.) chi2_log10 = log10(chi2);
370 if(en > 1. ) nrechitsThresh++;
372 double r =
dR(eta_MC, phi_MC, eta, phi);
374 if(sub == 1) eHcalConeHB += en;
375 if(sub == 2) eHcalConeHE += en;
376 if(sub == 3) eHcalConeHO += en;
379 if (depth == 1) eHcalConeHFL += en;
380 else eHcalConeHFS += en;
388 float eta_diff = fabs(eta_MC - eta);
389 if(eta_diff < etaMax) {
456 double enSimHits = 0.;
457 double enSimHitsHB = 0.;
458 double enSimHitsHE = 0.;
459 double enSimHitsHO = 0.;
460 double enSimHitsHF = 0.;
461 double enSimHitsHFL = 0.;
462 double enSimHitsHFS = 0.;
465 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
474 depth = cell.depth();
482 double en = SimHits->energy();
484 double r =
dR(eta_MC, phi_MC, etaS, phiS);
489 if(sub == static_cast<int>(
HcalBarrel)) enSimHitsHB += en;
490 if(sub == static_cast<int>(
HcalEndcap)) enSimHitsHE += en;
491 if(sub == static_cast<int>(
HcalOuter)) enSimHitsHO += en;
494 if(depth == 1) enSimHitsHFL += en;
495 else enSimHitsHFS += en;
548 if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
560 double eta = cellGeometry->getPosition(cell).eta () ;
561 double phi = cellGeometry->getPosition(cell).phi () ;
562 double zc = cellGeometry->getPosition(cell).z ();
563 int sub = cell.subdet();
564 int depth = cell.depth();
565 int inteta = cell.ieta();
566 int intphi = cell.iphi()-1;
567 double en = j->energy();
568 double t = j->time();
569 double chi2 = j->chi2();
571 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
578 cieta.push_back(inteta);
579 ciphi.push_back(intphi);
582 cchi2.push_back(chi2);
590 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
599 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
601 double eta = cellGeometry->getPosition().eta () ;
602 double phi = cellGeometry->getPosition().phi () ;
603 double zc = cellGeometry->getPosition().z ();
604 int sub = cell.subdet();
605 int depth = cell.depth();
606 int inteta = cell.ieta();
607 int intphi = cell.iphi()-1;
608 double en = j->energy();
609 double t = j->time();
611 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
618 cieta.push_back(inteta);
619 ciphi.push_back(intphi);
629 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
637 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry (cell) ;
639 double eta = cellGeometry->getPosition().eta () ;
640 double phi = cellGeometry->getPosition().phi () ;
641 double zc = cellGeometry->getPosition().z ();
642 int sub = cell.subdet();
643 int depth = cell.depth();
644 int inteta = cell.ieta();
645 int intphi = cell.iphi()-1;
646 double t = j->time();
647 double en = j->energy();
649 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
655 cieta.push_back(inteta);
656 ciphi.push_back(intphi);
667 double PI = 3.1415926535898;
668 double deltaphi= phi1 - phi2;
669 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
670 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
671 double deltaeta = eta2 - eta1;
672 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
680 double PI = 3.1415926535898;
681 double a1 = phi1;
double a2 = phi2;
683 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
684 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
685 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
686 if(tmp > PI) tmp -= 2.*
PI;
696 double PI = 3.1415926535898;
697 double a1 = phi1;
double a2 = phi2;
698 double tmp = a2 - a1;
700 if(a1 > 0.5 * PI) tmp += 2.*
PI;
701 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
std::vector< double > cchi2
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meRecHitsM2Chi2HB
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 * meLog10Chi2profileHB
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
void setCurrentFolder(std::string const &fullpath)
MonitorElement * meRecHitsM2Chi2HE
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)
MonitorElement * meLog10Chi2profileHE
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
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