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) {
277 geometry->getSubdetectorGeometry (EBid)->getGeometry (EBid) ;
278 double eta = cellGeometry->getPosition ().eta () ;
279 double phi = cellGeometry->getPosition ().phi () ;
280 double en = RecHit->energy();
284 double r =
dR(eta_MC, phi_MC, eta, phi);
300 for (; RecHit != RecHitEnd ; ++RecHit) {
304 geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
305 double eta = cellGeometry->getPosition ().eta () ;
306 double phi = cellGeometry->getPosition ().phi () ;
307 double en = RecHit->energy();
311 double r =
dR(eta_MC, phi_MC, eta, phi);
333 double HcalCone = 0.;
341 for (
unsigned int i = 0;
i <
cen.size();
i++) {
352 if(en > 1. ) nrechitsThresh++;
354 double r =
dR(eta_MC, phi_MC, eta, phi);
356 if(sub == 1) eHcalConeHB += en;
357 if(sub == 2) eHcalConeHE += en;
358 if(sub == 3) eHcalConeHO += en;
361 if (depth == 1) eHcalConeHFL += en;
362 else eHcalConeHFS += en;
370 float eta_diff = fabs(eta_MC - eta);
371 if(eta_diff < etaMax) {
428 double enSimHits = 0.;
429 double enSimHitsHB = 0.;
430 double enSimHitsHE = 0.;
431 double enSimHitsHO = 0.;
432 double enSimHitsHF = 0.;
433 double enSimHitsHFL = 0.;
434 double enSimHitsHFS = 0.;
437 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
446 depth = cell.depth();
456 double en = SimHits->energy();
458 double r =
dR(eta_MC, phi_MC, etaS, phiS);
463 if(sub == static_cast<int>(
HcalBarrel)) enSimHitsHB += en;
464 if(sub == static_cast<int>(
HcalEndcap)) enSimHitsHE += en;
465 if(sub == static_cast<int>(
HcalOuter)) enSimHitsHO += en;
468 if(depth == 1) enSimHitsHFL += en;
469 else enSimHitsHFS += en;
521 if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
535 double eta = cellGeometry->getPosition(cell).eta () ;
536 double phi = cellGeometry->getPosition(cell).phi () ;
537 double zc = cellGeometry->getPosition(cell).z ();
538 int sub = cell.subdet();
539 int depth = cell.depth();
540 int inteta = cell.ieta();
541 if(inteta > 0) inteta -= 1;
542 int intphi = cell.iphi()-1;
543 double en = j->energy();
544 double t = j->time();
546 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
553 cieta.push_back(inteta);
554 ciphi.push_back(intphi);
563 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
573 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
575 double eta = cellGeometry->getPosition().eta () ;
576 double phi = cellGeometry->getPosition().phi () ;
577 double zc = cellGeometry->getPosition().z ();
578 int sub = cell.subdet();
579 int depth = cell.depth();
580 int inteta = cell.ieta();
581 if(inteta > 0) inteta -= 1;
582 int intphi = cell.iphi()-1;
583 double en = j->energy();
584 double t = j->time();
586 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
593 cieta.push_back(inteta);
594 ciphi.push_back(intphi);
603 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
612 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
614 double eta = cellGeometry->getPosition().eta () ;
615 double phi = cellGeometry->getPosition().phi () ;
616 double zc = cellGeometry->getPosition().z ();
617 int sub = cell.subdet();
618 int depth = cell.depth();
619 int inteta = cell.ieta();
620 if(inteta > 0) inteta -= 1;
621 int intphi = cell.iphi()-1;
622 double t = j->time();
623 double en = j->energy();
625 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
631 cieta.push_back(inteta);
632 ciphi.push_back(intphi);
642 double PI = 3.1415926535898;
643 double deltaphi= phi1 - phi2;
644 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
645 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
646 double deltaeta = eta2 - eta1;
647 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
655 double PI = 3.1415926535898;
656 double a1 = phi1;
double a2 = phi2;
658 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
659 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
660 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
661 if(tmp > PI) tmp -= 2.*
PI;
671 double PI = 3.1415926535898;
672 double a1 = phi1;
double a2 = phi2;
673 double tmp = a2 - a1;
675 if(a1 > 0.5 * PI) tmp += 2.*
PI;
676 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
virtual void analyze(edm::Event const &ev, edm::EventSetup const &c)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup 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
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_
DetId relabel(const uint32_t testId) const
MonitorElement * meTEprofileHB_Low
MonitorElement * meRecHitSimHitHE
HcalRecHitsValidation(edm::ParameterSet const &conf)
MonitorElement * meTEprofileHB_High
std::vector< double > cen
const_iterator begin() const