7 : topFolderName_(conf.getParameter<std::
string>(
"TopFolderName")) {
14 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
33 tok_EB_ = consumes<EBRecHitCollection>(EBRecHitCollectionLabel);
35 tok_EE_ = consumes<EERecHitCollection>(EERecHitCollectionLabel);
39 tok_HRNDC_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>();
40 tok_Geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
80 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
83 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
86 sprintf(histo,
"HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
92 sprintf(histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HB");
95 sprintf(histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HB");
98 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HB");
101 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HB");
104 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB");
107 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB");
111 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
113 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");
126 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HE");
129 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE");
132 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HE");
136 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
138 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
145 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HO");
148 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HO");
151 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO");
155 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
157 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
164 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HF");
167 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF");
170 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HF");
174 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
176 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
178 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
180 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
182 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
184 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFS");
200 double eHcalCone = 0.;
201 double eHcalConeHB = 0.;
202 double eHcalConeHE = 0.;
203 double eHcalConeHO = 0.;
204 double eHcalConeHF = 0.;
205 double eHcalConeHFL = 0.;
206 double eHcalConeHFS = 0.;
210 int nrechitsCone = 0;
211 int nrechitsThresh = 0;
217 double eEcalCone = 0.;
218 int numrechitsEcal = 0;
221 double phi_MC = -999999.;
222 double eta_MC = -999999.;
231 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
237 double maxPt = -99999.;
240 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
242 double phip = (*p)->momentum().phi();
243 double etap = (*p)->momentum().eta();
246 double pt = (*p)->momentum().perp();
279 RecHit = rhitEB.
product()->begin();
280 RecHitEnd = rhitEB.
product()->end();
282 for (; RecHit != RecHitEnd; ++RecHit) {
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);
303 RecHit = rhitEE.
product()->begin();
304 RecHitEnd = rhitEE.
product()->end();
306 for (; RecHit != RecHitEnd; ++RecHit) {
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) {
439 double enSimHits = 0.;
440 double enSimHitsHB = 0.;
441 double enSimHitsHE = 0.;
442 double enSimHitsHO = 0.;
443 double enSimHitsHF = 0.;
444 double enSimHitsHFL = 0.;
445 double enSimHitsHFS = 0.;
448 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
459 depth = cell.depth();
470 double en = SimHits->energy();
472 double r =
dR(eta_MC, phi_MC, etaS, phiS);
538 if (subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
546 double eta = cellGeometry->getPosition(cell).eta();
547 double phi = cellGeometry->getPosition(cell).phi();
548 double zc = cellGeometry->getPosition(cell).z();
549 int sub = cell.subdet();
550 int depth = cell.depth();
551 int inteta = cell.ieta();
552 int intphi = cell.iphi() - 1;
553 double en =
j->energy();
554 double t =
j->time();
555 double chi2 =
j->chi2();
557 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
563 cieta.push_back(inteta);
564 ciphi.push_back(intphi);
567 cchi2.push_back(chi2);
573 if (subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
581 double eta = cellGeometry->getPosition().eta();
582 double phi = cellGeometry->getPosition().phi();
583 double zc = cellGeometry->getPosition().z();
584 int sub = cell.subdet();
585 int depth = cell.depth();
586 int inteta = cell.ieta();
587 int intphi = cell.iphi() - 1;
588 double en =
j->energy();
589 double t =
j->time();
591 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
597 cieta.push_back(inteta);
598 ciphi.push_back(intphi);
608 if (subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
615 double eta = cellGeometry->getPosition().eta();
616 double phi = cellGeometry->getPosition().phi();
617 double zc = cellGeometry->getPosition().z();
618 int sub = cell.subdet();
619 int depth = cell.depth();
620 int inteta = cell.ieta();
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);
643 double PI = 3.1415926535898;
644 double deltaphi = phi1 - phi2;
646 deltaphi = phi2 - phi1;
649 deltaphi = 2. * PI - deltaphi;
651 double deltaeta = eta2 -
eta1;
652 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
660 double PI = 3.1415926535898;
664 if (a1 > 0.5 * PI && a2 < 0.)
666 if (a2 > 0.5 * PI && a1 < 0.)
668 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
679 double PI = 3.1415926535898;
682 double tmp = a2 -
a1;
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
const edm::EventSetup & c
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hh_
MonitorElement * meRecHitsEnergyHF
virtual void setCurrentFolder(std::string const &fullpath)
double phi12(double phi1, double en1, double phi2, double en2)
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
const CaloGeometry * geometry_
MonitorElement * meRecHitSimHitHB
MonitorElement * meRecHitSimHitHFS
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
std::vector< double > cphi
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_Geom_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * meRecHitsM2Chi2HE
MonitorElement * meTEprofileHB
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
MonitorElement * meTEprofileHF_Low
edm::EDGetTokenT< EBRecHitCollection > tok_EB_
MonitorElement * meTEprofileHO_High
Log< level::Info, false > LogInfo
MonitorElement * meTEprofileHE
T const * product() const
MonitorElement * meTEprofileHF
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
MonitorElement * meRecHitSimHitProfileHO
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
edm::EDGetTokenT< EERecHitCollection > tok_EE_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
std::vector< double > ctime
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * meRecHitSimHitProfileHFL
std::vector< int > cdepth
MonitorElement * meRecHitsEnergyHO
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
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 * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meRecHitSimHitHE
HcalRecHitsValidation(edm::ParameterSet const &conf)
~HcalRecHitsValidation() override
MonitorElement * meTEprofileHB_High
std::vector< double > cen