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)),
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();
123 double time =
hit.time();
124 int subdet = detId.
subdet();
125 int ieta = detId.
ieta();
126 int iphi = detId.
iphi();
131 edm::LogVerbatim(
"HcalValidation") <<
"i/p " << subdet <<
":" << ieta <<
":" << iphi <<
":" << depth <<
" o/p "
132 << etaphi.first <<
":" << etaphi.second <<
":" << rz;
133 HepGeom::Point3D<float> gcoord = HepGeom::Point3D<float>(rz *
cos(etaphi.second) / cosh(etaphi.first),
134 rz *
sin(etaphi.second) / cosh(etaphi.first),
135 rz * tanh(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())) {
165 int ieta =
hit.first.ieta();
166 int iphi =
hit.first.iphi();
169 <<
" ---------------------- eta = " << ieta <<
":" << hinfo.
eta <<
" phi = " << iphi <<
":" << hinfo.
phi
170 <<
" depth = " << depth <<
" E = " << hinfo.
energy <<
" T = " << hinfo.
time;
173 auto itr1 =
h_phi_.find(std::pair<int, int>(ieta, depth));
175 itr1->second->Fill(iphi);
176 auto itr2 =
h_eta_.find(depth);
178 itr2->second->Fill(ieta);
192 edm::LogVerbatim(
"HcalValidation") <<
"Obtain HcalDDDRecConstants from Event Setup";
201 edm::LogVerbatim(
"HcalValidation") <<
"HcalGeomCheck: booked scatterplot RZ";
205 sprintf(name,
"phi%d%d", ieta,
depth);
206 sprintf(title,
"i#phi (i#eta = %d, depth = %d)", ieta,
depth);
207 h_phi_[std::pair<int, int>(ieta,
depth)] = fs->
make<TH1D>(name, title, 400, -20, 380);
211 sprintf(name,
"eta%d",
depth);
212 sprintf(title,
"i#eta (depth = %d)",
depth);
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());
222 h_E_.emplace_back(fs->
make<TH1D>(name, title, 1000, 0.0, 1.0));
225 sprintf(name,
"T_%s", dets[ih].c_str());
226 sprintf(title,
"Time of hit in %s (ns)", dets[ih].c_str());
227 h_T_.emplace_back(fs->
make<TH1D>(name, title, 1000, 0.0, 200.0));
std::pair< T, T > etaphi(T x, T y, T z)
static const std::string kSharedResource
Log< level::Info, true > LogVerbatim
std::vector< PCaloHit > PCaloHitContainer
std::vector< TH1D * > h_T_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
T * make(const Args &...args) const
make new ROOT object
void beginRun(edm::Run const &, edm::EventSetup const &) override
~HcalGeomCheck() override=default
const HcalDDDRecConstants * hcons_
bool getData(T &iHolder) const
void analyze(edm::Event const &, edm::EventSetup const &) override
constexpr HcalSubdetector subdet() const
get the subdetector
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
constexpr int iphi() const
get the cell iphi
std::map< std::pair< int, int >, TH1D * > h_phi_
void analyzeHits(int, const std::string &, const std::vector< PCaloHit > &)
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::map< int, TH1D * > h_eta_
Cos< T >::type cos(const T &t)
const edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > tok_HRNDC_
constexpr int ieta() const
get the cell ieta
std::vector< TH1D * > h_E_
void endRun(edm::Run const &, edm::EventSetup const &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
const std::string caloHitSource_
DetId relabel(const uint32_t testId) const
constexpr int depth() const
get the tower depth
HcalGeomCheck(const edm::ParameterSet &)