31 #include "CLHEP/Geometry/Point3D.h" 32 #include "CLHEP/Geometry/Transform3D.h" 33 #include "CLHEP/Geometry/Vector3D.h" 34 #include "CLHEP/Units/GlobalSystemOfUnits.h" 35 #include "CLHEP/Units/GlobalPhysicalConstants.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 unsigned int nused(0);
119 for (
auto const&
hit : *(theCaloHitContainer.
product())) {
120 unsigned int id =
hit.
id();
124 int subdet = detId.
subdet();
133 HepGeom::Point3D<float> gcoord = HepGeom::Point3D<float>(rz *
cos(
etaphi.second) / cosh(
etaphi.first),
137 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
140 <<
"Detector " << subdet <<
" ieta = " <<
ieta <<
" iphi = " <<
iphi <<
" depth = " <<
depth 141 <<
" positon = " << gcoord <<
" energy = " <<
energy <<
" time = " <<
time <<
":" << tof;
146 if (map_hits.count(detId) != 0) {
147 hinfo = map_hits[detId];
149 hinfo.phi = gcoord.getPhi();
150 hinfo.eta = gcoord.getEta();
154 map_hits[detId] =
hinfo;
156 h_RZ_->Fill(gcoord.z(), gcoord.rho());
160 for (
auto const&
hit : map_hits) {
162 int subdet =
hit.first.subdet();
163 if (subdet > 0 && subdet < static_cast<int>(
h_E_.size())) {
169 <<
" ---------------------- eta = " <<
ieta <<
":" <<
hinfo.eta <<
" phi = " <<
iphi <<
":" <<
hinfo.phi
170 <<
" depth = " <<
depth <<
" E = " <<
hinfo.energy <<
" T = " <<
hinfo.time;
175 itr1->second->Fill(
iphi);
178 itr2->second->Fill(
ieta);
192 edm::LogVerbatim(
"HcalValidation") <<
"Obtain HcalDDDRecConstants from Event Setup";
201 edm::LogVerbatim(
"HcalValidation") <<
"HcalGeomCheck: booked scatterplot RZ";
218 std::vector<std::string> dets = {
"HCAL",
"HB",
"HE",
"HF",
"HO"};
219 for (
unsigned int ih = 0; ih < dets.size(); ++ih) {
220 sprintf(
name,
"E_%s", dets[ih].c_str());
221 sprintf(
title,
"Energy deposit in %s (MeV)", dets[ih].c_str());
225 sprintf(
name,
"T_%s", dets[ih].c_str());
226 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])
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
constexpr HcalSubdetector subdet() const
get the subdetector
std::map< std::pair< int, int >, TH1D * > h_phi_
constexpr int ieta() const
get the cell ieta
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)
bool getData(T &iHolder) const
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 &)
constexpr int iphi() const
get the cell iphi
constexpr int depth() const
get the tower depth