5 : g4Label_(conf.getUntrackedParameter<std::
string>(
"ModuleLabel",
"g4SimHits")),
6 hcalHits_(conf.getUntrackedParameter<std::
string>(
"HcalHitCollection",
"HcalHits")),
7 ebHits_(conf.getUntrackedParameter<std::
string>(
"EBHitCollection",
"EcalHitsEB")),
8 eeHits_(conf.getUntrackedParameter<std::
string>(
"EEHitCollection",
"EcalHitsEE")),
9 hf1_(conf.getParameter<double>(
"hf1")),
10 hf2_(conf.getParameter<double>(
"hf2")),
11 outputFile_(conf.getUntrackedParameter<std::
string>(
"outputFile",
"myfile.root")),
12 testNumber_(conf.getUntrackedParameter<bool>(
"TestNumber",
false)),
13 auxPlots_(conf.getUntrackedParameter<bool>(
"auxiliaryPlots",
false)),
29 edm::LogVerbatim(
"OutputInfo") <<
" Hcal SimHit Task histograms will NOT be saved";
64 int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
65 iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
66 iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
75 float ieta_min_HB = -iEtaHBMax - 1.5;
76 float ieta_max_HB = iEtaHBMax + 1.5;
77 int ieta_bins_HB = (int)(ieta_max_HB - ieta_min_HB);
79 float ieta_min_HE = -iEtaHEMax - 1.5;
80 float ieta_max_HE = iEtaHEMax + 1.5;
81 int ieta_bins_HE = (int)(ieta_max_HE - ieta_min_HE);
83 float ieta_min_HF = -iEtaHFMax - 1.5;
84 float ieta_max_HF = iEtaHFMax + 1.5;
85 int ieta_bins_HF = (int)(ieta_max_HF - ieta_min_HF);
87 float ieta_min_HO = -iEtaHOMax - 1.5;
88 float ieta_max_HO = iEtaHOMax + 1.5;
89 int ieta_bins_HO = (int)(ieta_max_HO - ieta_min_HO);
99 sprintf(histo,
"N_HB");
101 sprintf(histo,
"N_HB%d",
depth);
104 Nhb.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
108 sprintf(histo,
"N_HE");
110 sprintf(histo,
"N_HE%d",
depth);
113 Nhe.push_back(ib.
book1D(histo, histo, 2600, 0., 2600.));
116 sprintf(histo,
"N_HO");
117 Nho = ib.
book1D(histo, histo, 2200, 0., 2200.);
121 sprintf(histo,
"N_HF");
123 sprintf(histo,
"N_HF%d",
depth);
126 Nhf.push_back(ib.
book1D(histo, histo, 1800, 0., 1800.));
132 sprintf(histo,
"emean_vs_ieta_HB");
134 sprintf(histo,
"emean_vs_ieta_HB%d",
depth);
138 ib.
bookProfile(histo, histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB, -10., 2000.,
" "));
142 sprintf(histo,
"emean_vs_ieta_HE");
144 sprintf(histo,
"emean_vs_ieta_HE%d",
depth);
148 ib.
bookProfile(histo, histo, ieta_bins_HE, ieta_min_HE, ieta_max_HE, -10., 2000.,
" "));
151 sprintf(histo,
"emean_vs_ieta_HO");
156 sprintf(histo,
"emean_vs_ieta_HF");
158 sprintf(histo,
"emean_vs_ieta_HF%d",
depth);
162 ib.
bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 2000.,
" "));
168 sprintf(histo,
"occupancy_vs_ieta_HB");
170 sprintf(histo,
"occupancy_vs_ieta_HB%d",
depth);
177 sprintf(histo,
"occupancy_vs_ieta_HE");
179 sprintf(histo,
"occupancy_vs_ieta_HE%d",
depth);
185 sprintf(histo,
"occupancy_vs_ieta_HO");
190 sprintf(histo,
"occupancy_vs_ieta_HF");
192 sprintf(histo,
"occupancy_vs_ieta_HF%d",
depth);
201 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB");
203 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HB%d",
depth);
210 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE");
212 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HE%d",
depth);
218 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HO");
223 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF");
225 sprintf(histo,
"HcalSimHitTask_energy_of_simhits_HF%d",
depth);
234 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
237 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
240 sprintf(histo,
"HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
289 double phi_MC = -999.;
290 double eta_MC = -999.;
298 double maxPt = -99999.;
302 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
304 double phip = (*p)->momentum().phi();
305 double etap = (*p)->momentum().eta();
306 double pt = (*p)->momentum().perp();
320 const float calib_HB = 120.;
321 const float calib_HE = 190.;
322 const float calib_HF1 =
hf1_;
323 const float calib_HF2 =
hf2_;
326 const auto SimHitResult = hcalHits.
product();
336 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
345 double etaS = cellGeometry->getPosition().eta();
346 double phiS = cellGeometry->getPosition().phi();
347 double en = SimHits->energy();
350 int depth = cell.depth();
351 double ieta = cell.ieta();
354 double r =
dR(eta_MC, phi_MC, etaS, phiS);
358 if (eta_diff < etaMax) {
360 ietaMax = cell.ieta();
364 HcalCone += en * calib_HB;
366 HcalCone += en * calib_HE;
367 else if (sub == 4 && (depth == 1 || depth == 3))
368 HcalCone += en * calib_HF1;
369 else if (sub == 4 && (depth == 2 || depth == 4))
370 HcalCone += en * calib_HF2;
426 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin(); SimHits != SimHitResultEB->end();
431 double etaS = cellGeometry->getPosition().eta();
432 double phiS = cellGeometry->getPosition().phi();
433 double en = SimHits->energy();
435 double r =
dR(eta_MC, phi_MC, etaS, phiS);
446 for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin(); SimHits != SimHitResultEE->end();
451 double etaS = cellGeometry->getPosition().eta();
452 double phiS = cellGeometry->getPosition().phi();
453 double en = SimHits->energy();
455 double r =
dR(eta_MC, phi_MC, etaS, phiS);
472 double PI = 3.1415926535898;
473 double deltaphi = phi1 - phi2;
475 deltaphi = phi2 - phi1;
478 deltaphi = 2. * PI - deltaphi;
480 double deltaeta = eta2 -
eta1;
481 double tmp =
sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
489 double PI = 3.1415926535898;
493 if (a1 > 0.5 * PI && a2 < 0.)
495 if (a2 > 0.5 * PI && a1 < 0.)
497 tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
508 double PI = 3.1415926535898;
511 double tmp = a2 -
a1;
MonitorElement * meEnConeEtaProfile
Log< level::Info, true > LogVerbatim
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::vector< PCaloHit > PCaloHitContainer
const edm::EventSetup & c
double dR(double eta1, double phi1, double eta2, double phi2)
std::vector< MonitorElement * > emean_vs_ieta_HF
virtual void setCurrentFolder(std::string const &fullpath)
double phi12(double phi1, double en1, double phi2, double en2)
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
std::vector< MonitorElement * > occupancy_vs_ieta_HF
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
const CaloGeometry * geometry_
std::vector< MonitorElement * > Nhf
std::vector< MonitorElement * > meSimHitsEnergyHE
const std::string outputFile_
MonitorElement * meSimHitsEnergyHO
const std::string eeHits_
MonitorElement * meEnConeEtaProfile_E
bool getData(T &iHolder) const
constexpr HcalSubdetector subdet() const
get the subdetector
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHB
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
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 * emean_vs_ieta_HO
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
std::vector< MonitorElement * > emean_vs_ieta_HE
virtual double getBinContent(int binx) const
get content of bin (1-D)
double dPhiWsign(double phi1, double phi2)
std::vector< MonitorElement * > occupancy_vs_ieta_HE
HcalSimHitsValidation(edm::ParameterSet const &conf)
const std::string ebHits_
const HcalDDDRecConstants * hcons_
T const * product() const
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
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.
int getMaxDepth(const int &type) const
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * occupancy_vs_ieta_HO
std::vector< MonitorElement * > occupancy_vs_ieta_HB
DetId relabel(const uint32_t testId) const
std::pair< int, int > getEtaRange(const int &i) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
std::vector< MonitorElement * > Nhb
std::vector< MonitorElement * > Nhe
tok_geom_(esConsumes< CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun >())
int getNPhi(const int &type) const
std::vector< MonitorElement * > meSimHitsEnergyHF