7 : topFolderName_(conf.getParameter<std::
string>(
"TopFolderName")),
8 outputFile_(conf.getUntrackedParameter<std::
string>(
"outputFile",
"myfile.root")),
9 hcalselector_(conf.getUntrackedParameter<std::
string>(
"hcalselector",
"all")),
10 ecalselector_(conf.getUntrackedParameter<std::
string>(
"ecalselector",
"yes")),
11 sign_(conf.getUntrackedParameter<std::
string>(
"sign",
"*")),
12 mc_(conf.getUntrackedParameter<std::
string>(
"mc",
"yes")),
13 testNumber_(conf.getParameter<bool>(
"TestNumber")),
14 EBRecHitCollectionLabel_(conf.getParameter<edm::
InputTag>(
"EBRecHitCollectionLabel")),
15 EERecHitCollectionLabel_(conf.getParameter<edm::
InputTag>(
"EERecHitCollectionLabel")),
29 edm::LogInfo(
"OutputInfo") <<
" Hcal RecHit Task histograms will NOT be saved";
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");
86 sprintf(histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HB");
89 sprintf(histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HB");
92 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HB");
95 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HB");
98 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HB");
101 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HB");
105 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HB");
107 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HB");
114 sprintf(histo,
"HcalRecHitTask_M2Log10Chi2_of_rechits_HE");
117 sprintf(histo,
"HcalRecHitTask_Log10Chi2_vs_energy_profile_HE");
120 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HE");
123 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HE");
126 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HE");
130 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HE");
132 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HE");
139 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HO");
142 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HO");
145 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_High_HO");
149 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HO");
151 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HO");
158 sprintf(histo,
"HcalRecHitTask_energy_of_rechits_HF");
161 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_Low_HF");
164 sprintf(histo,
"HcalRecHitTask_timing_vs_energy_profile_HF");
168 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HF");
170 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFL");
172 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_HFS");
174 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HF");
176 sprintf(histo,
"HcalRecHitTask_energy_rechits_vs_simhits_profile_HFL");
178 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.;
224 edm::LogInfo(
"HcalRecHitsValidation") <<
"no HepMCProduct found";
230 double maxPt = -99999.;
233 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
235 double phip = (*p)->momentum().phi();
236 double etap = (*p)->momentum().eta();
239 double pt = (*p)->momentum().perp();
272 RecHit = rhitEB.
product()->begin();
273 RecHitEnd = rhitEB.
product()->end();
275 for (; RecHit != RecHitEnd; ++RecHit) {
279 double eta = cellGeometry->getPosition().eta();
280 double phi = cellGeometry->getPosition().phi();
281 double en = RecHit->energy();
285 double r =
dR(eta_MC, phi_MC, eta, phi);
296 RecHit = rhitEE.
product()->begin();
297 RecHitEnd = rhitEE.
product()->end();
299 for (; RecHit != RecHitEnd; ++RecHit) {
303 double eta = cellGeometry->getPosition().eta();
304 double phi = cellGeometry->getPosition().phi();
305 double en = RecHit->energy();
309 double r =
dR(eta_MC, phi_MC, eta, phi);
327 double HcalCone = 0.;
334 for (
unsigned int i = 0;
i <
cen.size();
i++) {
344 double chi2_log10 = 9.99;
346 chi2_log10 = log10(chi2);
353 double r =
dR(eta_MC, phi_MC, eta, phi);
374 float eta_diff = fabs(eta_MC - eta);
375 if (eta_diff < etaMax) {
432 double enSimHits = 0.;
433 double enSimHitsHB = 0.;
434 double enSimHitsHE = 0.;
435 double enSimHitsHO = 0.;
436 double enSimHitsHF = 0.;
437 double enSimHitsHFL = 0.;
438 double enSimHitsHFS = 0.;
441 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
452 depth = cell.depth();
463 double en = SimHits->energy();
465 double r =
dR(eta_MC, phi_MC, etaS, phiS);
531 if (subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
539 double eta = cellGeometry->getPosition(cell).eta();
540 double phi = cellGeometry->getPosition(cell).phi();
541 double zc = cellGeometry->getPosition(cell).z();
542 int sub = cell.subdet();
543 int depth = cell.depth();
544 int inteta = cell.ieta();
545 int intphi = cell.iphi() - 1;
546 double en =
j->energy();
547 double t =
j->time();
548 double chi2 =
j->chi2();
550 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
556 cieta.push_back(inteta);
557 ciphi.push_back(intphi);
560 cchi2.push_back(chi2);
566 if (subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
574 double eta = cellGeometry->getPosition().eta();
575 double phi = cellGeometry->getPosition().phi();
576 double zc = cellGeometry->getPosition().z();
577 int sub = cell.subdet();
578 int depth = cell.depth();
579 int inteta = cell.ieta();
580 int intphi = cell.iphi() - 1;
581 double en =
j->energy();
582 double t =
j->time();
584 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
590 cieta.push_back(inteta);
591 ciphi.push_back(intphi);
601 if (subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
608 double eta = cellGeometry->getPosition().eta();
609 double phi = cellGeometry->getPosition().phi();
610 double zc = cellGeometry->getPosition().z();
611 int sub = cell.subdet();
612 int depth = cell.depth();
613 int inteta = cell.ieta();
614 int intphi = cell.iphi() - 1;
615 double t =
j->time();
616 double en =
j->energy();
618 if ((
iz > 0 && eta > 0.) || (
iz < 0 && eta < 0.) ||
iz == 0) {
624 cieta.push_back(inteta);
625 ciphi.push_back(intphi);
636 double PI = 3.1415926535898;
637 double deltaphi = phi1 - phi2;
639 deltaphi = phi2 - phi1;
642 deltaphi = 2. * PI - deltaphi;
644 double deltaeta = eta2 -
eta1;
645 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
653 double PI = 3.1415926535898;
657 if (a1 > 0.5 * PI && a2 < 0.)
659 if (a2 > 0.5 * PI && a1 < 0.)
661 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
672 double PI = 3.1415926535898;
675 double tmp = a2 -
a1;
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::vector< double > cchi2
const std::string ecalselector_
MonitorElement * meRecHitsM2Chi2HB
std::vector< PCaloHit > PCaloHitContainer
const edm::EventSetup & c
MonitorElement * meRecHitsEnergyHF
virtual void setCurrentFolder(std::string const &fullpath)
double phi12(double phi1, double en1, double phi2, double en2)
MonitorElement * meTEprofileHE_Low
#define DEFINE_FWK_MODULE(type)
Geom::Phi< T > phi() const
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * meLog10Chi2profileHB
const std::string topFolderName_
MonitorElement * meEnConeEtaProfile
double dPhiWsign(double phi1, double phi2)
MonitorElement * meRecHitSimHitProfileHF
MonitorElement * meRecHitSimHitProfileHFS
MonitorElement * meRecHitsEnergyHB
std::vector< double > ceta
MonitorElement * meRecHitSimHitHF
MonitorElement * meRecHitsEnergyHE
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hh_
MonitorElement * meRecHitSimHitProfileHE
MonitorElement * meEnConeEtaProfile_E
const CaloGeometry * geometry_
MonitorElement * meRecHitSimHitHB
MonitorElement * meRecHitSimHitHFS
bool getData(T &iHolder) const
const std::string hcalselector_
constexpr HcalSubdetector subdet() const
get the subdetector
std::vector< double > cphi
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
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
const std::string outputFile_
virtual void fillRecHitsTmp(int subdet_, edm::Event const &ev)
double dR(double eta1, double phi1, double eta2, double phi2)
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
MonitorElement * meLog10Chi2profileHE
MonitorElement * meRecHitSimHitHO
MonitorElement * meRecHitSimHitProfileHB
GlobalPoint getPosition(const DetId &id) const
MonitorElement * meTEprofileHF_Low
const edm::EDGetTokenT< EBRecHitCollection > tok_EB_
MonitorElement * meTEprofileHO_High
Log< level::Info, false > LogInfo
MonitorElement * meTEprofileHE
const edm::EDGetTokenT< EERecHitCollection > tok_EE_
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
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
std::vector< double > ctime
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * meRecHitSimHitProfileHFL
std::vector< int > cdepth
MonitorElement * meRecHitsEnergyHO
MonitorElement * meRecHitSimHitHFL
const edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meTEprofileHO
const edm::EDGetTokenT< HORecHitCollection > tok_ho_
const edm::EDGetTokenT< HFRecHitCollection > tok_hf_
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())
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_Geom_
MonitorElement * meRecHitSimHitHE
HcalRecHitsValidation(edm::ParameterSet const &conf)
MonitorElement * meTEprofileHB_High
std::vector< double > cen