31 #include <CLHEP/Geometry/Point3D.h> 32 #include <CLHEP/Geometry/Transform3D.h> 33 #include <CLHEP/Geometry/Vector3D.h> 34 #include <CLHEP/Units/SystemOfUnits.h> 35 #include <CLHEP/Units/PhysicalConstants.h> 71 std::map<std::pair<int, int>, TH1D*>
h_phi_;
77 : caloHitSource_(iConfig.getParameter<
std::
string>(
"caloHitSource")),
78 ietaMin_(iConfig.getUntrackedParameter<
int>(
"ietaMin", -41)),
79 ietaMax_(iConfig.getUntrackedParameter<
int>(
"ietaMax", 41)),
80 depthMax_(iConfig.getUntrackedParameter<
int>(
"depthMax", 7)),
81 rmin_(iConfig.getUntrackedParameter<double>(
"rMin", 0.0)),
82 rmax_(iConfig.getUntrackedParameter<double>(
"rMax", 5500.0)),
83 zmin_(iConfig.getUntrackedParameter<double>(
"zMin", -12500.0)),
84 zmax_(iConfig.getUntrackedParameter<double>(
"zMax", 12500.0)),
85 nbinR_(iConfig.getUntrackedParameter<
int>(
"nBinR", 550)),
86 nbinZ_(iConfig.getUntrackedParameter<
int>(
"nBinZ", 2500)),
87 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
96 desc.addUntracked<
int>(
"ietaMin", -41);
97 desc.addUntracked<
int>(
"ietaMax", 41);
98 desc.addUntracked<
int>(
"depthMax", 7);
99 desc.addUntracked<
double>(
"rMin", 0.0);
100 desc.addUntracked<
double>(
"rMax", 5500.0);
101 desc.addUntracked<
double>(
"zMin", -12500.0);
102 desc.addUntracked<
double>(
"zMax", 12500.0);
103 desc.addUntracked<
int>(
"nBinR", 550);
104 desc.addUntracked<
int>(
"nBinZ", 250);
105 desc.addUntracked<
int>(
"verbosity", 0);
106 descriptions.
add(
"hcalGeomCheck",
desc);
112 if (theCaloHitContainer.
isValid()) {
114 edm::LogVerbatim(
"HcalValidation") <<
" PcalohitItr = " << theCaloHitContainer->size();
117 std::map<HcalDetId, hitsinfo> map_hits;
118 for (
auto const&
hit : *(theCaloHitContainer.
product())) {
119 unsigned int id =
hit.
id();
123 int subdet =
detId.subdet();
132 HepGeom::Point3D<float> gcoord = HepGeom::Point3D<float>(rz *
cos(
etaphi.second) / cosh(
etaphi.first),
135 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
138 <<
"Detector " << subdet <<
" ieta = " <<
ieta <<
" iphi = " <<
iphi <<
" depth = " <<
depth 139 <<
" positon = " << gcoord <<
" energy = " <<
energy <<
" time = " <<
time <<
":" << tof;
144 if (map_hits.count(
detId) != 0) {
147 hinfo.phi = gcoord.getPhi();
148 hinfo.eta = gcoord.getEta();
154 h_RZ_->Fill(gcoord.z(), gcoord.rho());
158 for (
auto const&
hit : map_hits) {
160 int subdet =
hit.first.subdet();
161 if (subdet > 0 && subdet < static_cast<int>(
h_E_.size())) {
167 <<
" ---------------------- eta = " <<
ieta <<
":" <<
hinfo.eta <<
" phi = " <<
iphi <<
":" <<
hinfo.phi
168 <<
" depth = " <<
depth <<
" E = " <<
hinfo.energy <<
" T = " <<
hinfo.time;
173 itr1->second->Fill(
iphi);
176 itr2->second->Fill(
ieta);
190 edm::LogVerbatim(
"HcalValidation") <<
"Obtain HcalDDDRecConstants from Event Setup";
199 edm::LogVerbatim(
"HcalValidation") <<
"HcalGeomCheck: booked scatterplot RZ";
216 std::vector<std::string> dets = {
"HCAL",
"HB",
"HE",
"HF",
"HO"};
217 for (
unsigned int ih = 0; ih < dets.size(); ++ih) {
218 sprintf(
name,
"E_%s", dets[ih].c_str());
219 sprintf(
title,
"Energy deposit in %s (MeV)", dets[ih].c_str());
223 sprintf(
name,
"T_%s", dets[ih].c_str());
224 sprintf(
title,
"Time of hit in %s (ns)", dets[ih].c_str());
std::pair< T, T > etaphi(T x, T y, T z)
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::vector< PCaloHit > PCaloHitContainer
std::vector< TH1D * > h_T_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void tanh(data_T data[CONFIG_T::n_in], res_T res[CONFIG_T::n_in])
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Sin< T >::type sin(const T &t)
T const * product() const
void beginRun(edm::Run const &, edm::EventSetup const &) override
~HcalGeomCheck() override=default
const HcalDDDRecConstants * hcons_
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
void analyze(edm::Event const &, edm::EventSetup const &) override
std::map< std::pair< int, int >, TH1D * > h_phi_
void analyzeHits(int, const std::string &, const std::vector< PCaloHit > &)
std::map< int, TH1D * > h_eta_
Cos< T >::type cos(const T &t)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
std::vector< TH1D * > h_E_
#define DEFINE_FWK_MODULE(type)
void endRun(edm::Run const &, edm::EventSetup const &) override
DetId relabel(const uint32_t testId) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
const std::string caloHitSource_
HcalGeomCheck(const edm::ParameterSet &)