9 : topFolderName_(conf.getParameter<
std::
string>(
"TopFolderName")) {
16 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
79 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
82 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
85 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
91 sprintf(histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HB");
94 sprintf(histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HB");
97 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HB");
100 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HB");
103 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB");
106 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB");
110 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
112 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
119 sprintf(histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HE");
122 sprintf(histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HE");
125 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HE");
128 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE");
131 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HE");
135 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
137 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
144 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HO");
147 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HO");
150 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO");
154 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
156 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
163 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HF");
166 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF");
169 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HF");
173 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
175 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
177 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
179 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
181 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
183 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
201 double eHcalCone = 0.;
202 double eHcalConeHB = 0.;
203 double eHcalConeHE = 0.;
204 double eHcalConeHO = 0.;
205 double eHcalConeHF = 0.;
206 double eHcalConeHFL = 0.;
207 double eHcalConeHFS = 0.;
211 int nrechitsCone = 0;
212 int nrechitsThresh = 0;
218 double eEcalCone = 0.;
219 int numrechitsEcal = 0;
222 double phi_MC = -999999.;
223 double eta_MC = -999999.;
232 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
238 double maxPt = -99999.;
241 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
243 double phip = (*p)->momentum().phi();
244 double etap = (*p)->momentum().eta();
247 double pt = (*p)->momentum().perp();
282 for (; RecHit != RecHitEnd; ++RecHit) {
285 auto cellGeometry =
geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
286 double eta = cellGeometry->getPosition().eta();
287 double phi = cellGeometry->getPosition().phi();
288 double en = RecHit->energy();
292 double r =
dR(eta_MC, phi_MC, eta, phi);
306 for (; RecHit != RecHitEnd; ++RecHit) {
309 auto cellGeometry =
geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid);
310 double eta = cellGeometry->getPosition().eta();
311 double phi = cellGeometry->getPosition().phi();
312 double en = RecHit->energy();
316 double r =
dR(eta_MC, phi_MC, eta, phi);
334 double HcalCone = 0.;
341 for (
unsigned int i = 0;
i <
cen.size();
i++) {
351 double chi2_log10 = 9.99;
353 chi2_log10 = log10(chi2);
360 double r =
dR(eta_MC, phi_MC, eta, phi);
381 float eta_diff = fabs(eta_MC - eta);
382 if (eta_diff < etaMax) {
440 double enSimHits = 0.;
441 double enSimHitsHB = 0.;
442 double enSimHitsHE = 0.;
443 double enSimHitsHO = 0.;
444 double enSimHitsHF = 0.;
445 double enSimHitsHFL = 0.;
446 double enSimHitsHFS = 0.;
449 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
460 depth = cell.depth();
471 double en = SimHits->energy();
473 double r =
dR(eta_MC, phi_MC, etaS, phiS);
539 if (subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
549 double eta = cellGeometry->getPosition(cell).eta();
550 double phi = cellGeometry->getPosition(cell).phi();
551 double zc = cellGeometry->getPosition(cell).z();
552 int sub = cell.subdet();
553 int depth = cell.depth();
554 int inteta = cell.ieta();
555 int intphi = cell.iphi() - 1;
556 double en = j->energy();
557 double t = j->time();
558 double chi2 = j->chi2();
560 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
566 cieta.push_back(inteta);
567 ciphi.push_back(intphi);
570 cchi2.push_back(chi2);
576 if (subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
582 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
584 double eta = cellGeometry->getPosition().eta();
585 double phi = cellGeometry->getPosition().phi();
586 double zc = cellGeometry->getPosition().z();
587 int sub = cell.subdet();
588 int depth = cell.depth();
589 int inteta = cell.ieta();
590 int intphi = cell.iphi() - 1;
591 double en = j->energy();
592 double t = j->time();
594 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
600 cieta.push_back(inteta);
601 ciphi.push_back(intphi);
611 if (subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
616 auto cellGeometry =
geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
618 double eta = cellGeometry->getPosition().eta();
619 double phi = cellGeometry->getPosition().phi();
620 double zc = cellGeometry->getPosition().z();
621 int sub = cell.subdet();
622 int depth = cell.depth();
623 int inteta = cell.ieta();
624 int intphi = cell.iphi() - 1;
625 double t = j->time();
626 double en = j->energy();
628 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
634 cieta.push_back(inteta);
635 ciphi.push_back(intphi);
646 double PI = 3.1415926535898;
647 double deltaphi = phi1 - phi2;
649 deltaphi = phi2 - phi1;
652 deltaphi = 2. * PI - deltaphi;
654 double deltaeta = eta2 - eta1;
655 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
663 double PI = 3.1415926535898;
667 if (a1 > 0.5 * PI && a2 < 0.)
669 if (a2 > 0.5 * PI && a1 < 0.)
671 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
682 double PI = 3.1415926535898;
685 double tmp = a2 - a1;
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_
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
#define DEFINE_FWK_MODULE(type)
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