15 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
47 if(sign_ ==
"-")
iz = -1;
48 if(sign_ ==
"*")
iz = 0;
51 if(mc_ ==
"no")
imc = 0;
69 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
72 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
75 sprintf (histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
82 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HB" ) ;
85 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
88 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB" ) ;
91 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB" ) ;
95 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
97 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
106 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HE" ) ;
109 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE" ) ;
112 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
116 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
118 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
127 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HO" ) ;
130 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
133 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO" ) ;
137 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
139 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
148 sprintf (histo,
"HcalRecHitTask_energy_of_rechits_HF" ) ;
151 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF" ) ;
154 sprintf (histo,
"HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
158 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
160 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
162 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
164 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
166 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
168 sprintf (histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
189 double eHcalCone = 0.;
190 double eHcalConeHB = 0.;
191 double eHcalConeHE = 0.;
192 double eHcalConeHO = 0.;
193 double eHcalConeHF = 0.;
194 double eHcalConeHFL = 0.;
195 double eHcalConeHFS = 0.;
199 int nrechitsCone = 0;
200 int nrechitsThresh = 0;
206 double eEcalCone = 0.;
207 int numrechitsEcal = 0;
210 double phi_MC = -999999.;
211 double eta_MC = -999999.;
221 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
227 double maxPt = -99999.;
229 const HepMC::GenEvent * myGenEvent = evtMC->
GetEvent();
230 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p ) {
231 double phip = (*p)->momentum().phi();
232 double etap = (*p)->momentum().eta();
235 double pt = (*p)->momentum().perp();
236 if(pt > maxPt) { npart++; maxPt =
pt; phi_MC = phip; eta_MC = etap; }
265 for (; RecHit != RecHitEnd ; ++RecHit) {
269 geometry->getSubdetectorGeometry (EBid)->getGeometry (EBid) ;
270 double eta = cellGeometry->getPosition ().eta () ;
271 double phi = cellGeometry->getPosition ().phi () ;
272 double en = RecHit->energy();
276 double r =
dR(eta_MC, phi_MC, eta, phi);
291 for (; RecHit != RecHitEnd ; ++RecHit) {
295 geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
296 double eta = cellGeometry->getPosition ().eta () ;
297 double phi = cellGeometry->getPosition ().phi () ;
298 double en = RecHit->energy();
302 double r =
dR(eta_MC, phi_MC, eta, phi);
323 double HcalCone = 0.;
331 for (
unsigned int i = 0;
i <
cen.size();
i++) {
342 if(en > 1. ) nrechitsThresh++;
344 double r =
dR(eta_MC, phi_MC, eta, phi);
346 if(sub == 1) eHcalConeHB += en;
347 if(sub == 2) eHcalConeHE += en;
348 if(sub == 3) eHcalConeHO += en;
351 if (depth == 1) eHcalConeHFL += en;
352 else eHcalConeHFS += en;
360 float eta_diff = fabs(eta_MC - eta);
361 if(eta_diff < etaMax) {
418 double enSimHits = 0.;
419 double enSimHitsHB = 0.;
420 double enSimHitsHE = 0.;
421 double enSimHitsHO = 0.;
422 double enSimHitsHF = 0.;
423 double enSimHitsHFL = 0.;
424 double enSimHitsHFS = 0.;
427 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
436 depth = cell.depth();
446 double en = SimHits->energy();
448 double r =
dR(eta_MC, phi_MC, etaS, phiS);
453 if(sub == static_cast<int>(
HcalBarrel)) enSimHitsHB += en;
454 if(sub == static_cast<int>(
HcalEndcap)) enSimHitsHE += en;
455 if(sub == static_cast<int>(
HcalOuter)) enSimHitsHO += en;
458 if(depth == 1) enSimHitsHFL += en;
459 else enSimHitsHFS += en;
511 if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
524 double eta = cellGeometry->getPosition(cell).eta () ;
525 double phi = cellGeometry->getPosition(cell).phi () ;
526 double zc = cellGeometry->getPosition(cell).z ();
527 int sub = cell.subdet();
528 int depth = cell.depth();
529 int inteta = cell.ieta();
530 if(inteta > 0) inteta -= 1;
531 int intphi = cell.iphi()-1;
532 double en =
j->energy();
533 double t =
j->time();
535 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
542 cieta.push_back(inteta);
543 ciphi.push_back(intphi);
551 if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
560 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
561 double eta = cellGeometry->getPosition().eta () ;
562 double phi = cellGeometry->getPosition().phi () ;
563 double zc = cellGeometry->getPosition().z ();
564 int sub = cell.subdet();
565 int depth = cell.depth();
566 int inteta = cell.ieta();
567 if(inteta > 0) inteta -= 1;
568 int intphi = cell.iphi()-1;
569 double en =
j->energy();
570 double t =
j->time();
572 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
579 cieta.push_back(inteta);
580 ciphi.push_back(intphi);
588 if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
596 geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
597 double eta = cellGeometry->getPosition().eta () ;
598 double phi = cellGeometry->getPosition().phi () ;
599 double zc = cellGeometry->getPosition().z ();
600 int sub = cell.subdet();
601 int depth = cell.depth();
602 int inteta = cell.ieta();
603 if(inteta > 0) inteta -= 1;
604 int intphi = cell.iphi()-1;
605 double t =
j->time();
606 double en =
j->energy();
608 if((
iz > 0 && eta > 0.) || (
iz < 0 && eta <0.) ||
iz == 0) {
614 cieta.push_back(inteta);
615 ciphi.push_back(intphi);
624 double PI = 3.1415926535898;
625 double deltaphi= phi1 - phi2;
626 if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
627 if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
628 double deltaeta = eta2 - eta1;
629 double tmp =
sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
637 double PI = 3.1415926535898;
638 double a1 = phi1;
double a2 = phi2;
640 if( a1 > 0.5*PI && a2 < 0.) a2 += 2*
PI;
641 if( a2 > 0.5*PI && a1 < 0.) a1 += 2*
PI;
642 tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
643 if(tmp > PI) tmp -= 2.*
PI;
653 double PI = 3.1415926535898;
654 double a1 = phi1;
double a2 = phi2;
655 double tmp = a2 - a1;
657 if(a1 > 0.5 * PI) tmp += 2.*
PI;
658 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)
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