34 #include "CLHEP/Geometry/Point3D.h"
35 #include "CLHEP/Geometry/Transform3D.h"
36 #include "CLHEP/Geometry/Vector3D.h"
37 #include "CLHEP/Units/GlobalSystemOfUnits.h"
38 #include "CLHEP/Units/GlobalPhysicalConstants.h"
73 std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> >
tok_hgcGeom_;
74 std::vector<const HGCalDDDConstants*>
hgcons_;
75 std::vector<edm::EDGetTokenT<edm::PCaloHitContainer> >
tok_hits_;
87 rmin_(iConfig.getUntrackedParameter<double>(
"rMin", 0.0)),
88 rmax_(iConfig.getUntrackedParameter<double>(
"rMax", 3000.0)),
89 zmin_(iConfig.getUntrackedParameter<double>(
"zMin", 3000.0)),
90 zmax_(iConfig.getUntrackedParameter<double>(
"zMax", 6000.0)),
91 etamin_(iConfig.getUntrackedParameter<double>(
"etaMin", 1.0)),
92 etamax_(iConfig.getUntrackedParameter<double>(
"etaMax", 3.0)),
93 nbinR_(iConfig.getUntrackedParameter<
int>(
"nBinR", 300)),
94 nbinZ_(iConfig.getUntrackedParameter<
int>(
"nBinZ", 300)),
95 nbinEta_(iConfig.getUntrackedParameter<
int>(
"nBinEta", 200)),
96 nLayers_(iConfig.getUntrackedParameter<
int>(
"layers", 50)),
97 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
98 ifNose_(iConfig.getUntrackedParameter<
bool>(
"ifNose",
false)),
99 ifLayer_(iConfig.getUntrackedParameter<
bool>(
"ifLayer",
false)) {
104 esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
edm::ESInputTag{
"",
name}));
111 std::vector<std::string>
names = {
"HGCalEESensitive",
"HGCalHESiliconSensitive",
"HGCalHEScintillatorSensitive"};
112 std::vector<std::string>
sources = {
"HGCHitsEE",
"HGCHitsHEfront",
"HGCHitsHEback"};
113 desc.add<std::vector<std::string> >(
"detectorNames",
names);
114 desc.add<std::vector<std::string> >(
"caloHitSources",
sources);
115 desc.addUntracked<
double>(
"rMin", 0.0);
116 desc.addUntracked<
double>(
"rMax", 3000.0);
117 desc.addUntracked<
double>(
"zMin", 3000.0);
118 desc.addUntracked<
double>(
"zMax", 6000.0);
119 desc.addUntracked<
double>(
"etaMin", 1.0);
120 desc.addUntracked<
double>(
"etaMax", 3.0);
121 desc.addUntracked<
int>(
"nBinR", 300);
122 desc.addUntracked<
int>(
"nBinZ", 300);
123 desc.addUntracked<
int>(
"nBinEta", 200);
124 desc.addUntracked<
int>(
"layers", 50);
125 desc.addUntracked<
int>(
"verbosity", 0);
126 desc.addUntracked<
bool>(
"ifNose",
false);
127 desc.addUntracked<
bool>(
"ifLayer",
false);
128 descriptions.
add(
"hgcalSimHitStudy",
desc);
136 if (theCaloHitContainers.
isValid()) {
138 edm::LogVerbatim(
"HGCalValidation") <<
" PcalohitItr = " << theCaloHitContainers->size();
139 std::vector<PCaloHit> caloHits;
140 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
153 std::map<uint32_t, hitsinfo> map_hits;
156 unsigned int nused(0);
160 uint32_t
id =
hit.
id();
163 HepGeom::Point3D<float> gcoord;
164 std::pair<float, float>
xy;
168 cell = detId.
cellU();
178 }
else if (
hgcons_[ih]->waferHexagon8()) {
180 subdet = static_cast<int>(detId.
det());
181 cell = detId.
cellU();
191 }
else if (
hgcons_[ih]->tileTrapezoid()) {
193 subdet = static_cast<int>(detId.
det());
194 sector = detId.
ieta();
207 double xp = (zp < 0) ? -
xy.first :
xy.first;
208 gcoord = HepGeom::Point3D<float>(xp,
xy.second, zp);
211 <<
"i/p " << subdet <<
":" <<
zside <<
":" <<
layer <<
":" << sector <<
":" <<
sector2 <<
":" << cell <<
":"
212 <<
cell2 <<
" o/p " <<
xy.first <<
":" <<
xy.second <<
":" << zp;
214 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
217 <<
"Detector " <<
name <<
" zside = " <<
zside <<
" layer = " <<
layer <<
" type = " <<
type
218 <<
" wafer = " << sector <<
":" <<
sector2 <<
" cell = " << cell <<
":" <<
cell2 <<
" positon = " << gcoord
219 <<
" energy = " <<
energy <<
" time = " <<
time <<
":" << tof;
224 if (map_hits.count(
id) != 0) {
228 hinfo.phi = gcoord.getPhi();
229 hinfo.eta = gcoord.getEta();
239 if (
hinfo.layer <= static_cast<int>(
h_XY_.size()))
240 h_XY_[
hinfo.layer - 1]->Fill(gcoord.x(), gcoord.y());
246 h_W1_[ih]->Fill(sector);
247 h_C1_[ih]->Fill(cell);
250 edm::LogVerbatim(
"HGCalValidation") <<
name <<
" with " << map_hits.size() <<
":" << nused <<
" detector elements"
253 for (
auto const&
hit : map_hits) {
257 <<
" ---------------------- eta = " <<
hinfo.eta <<
" phi = " <<
hinfo.phi <<
" layer = " <<
hinfo.layer
258 <<
" E = " <<
hinfo.energy <<
" T = " <<
hinfo.time;
301 name <<
"RZ_AllDetectors";
302 title <<
"R vs Z for All Detectors";
311 for (
int ly = 0; ly <
nLayers_; ++ly) {
314 name <<
"XY_L" << (ly + 1);
315 title <<
"Y vs X at Layer " << (ly + 1);
324 name <<
"EtaPhi_AllDetectors";
325 title <<
"#phi vs #eta for All Detectors";
335 name <<
"EtFiZp_AllDetectors";
336 title <<
"#phi vs #eta (+z) for All Detectors";
346 name <<
"EtFiZm_AllDetectors";
347 title <<
"#phi vs #eta (-z) for All Detectors";
358 name <<
"LayerZp_AllDetectors";
359 title <<
"Energy vs Layer (+z) for All Detectors";
368 name <<
"LayerZm_AllDetectors";
369 title <<
"Energy vs Layer (-z) for All Detectors";
379 name <<
"E_AllDetectors";
380 title <<
"Energy Deposit for All Detectors";
385 h_E_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 1000, 0.0, 1.0));
390 name <<
"T_AllDetectors";
391 title <<
"Time for All Detectors";
396 h_T_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 1000, 0.0, 200.0));
404 h_Ly_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, 0, 100));
410 h_W1_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, -50, 50));
415 h_C1_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 720, 0, 360));
421 h_W1_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, -50, 50));
426 h_W2_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, -50, 50));
431 h_C1_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, 0, 50));
436 h_C2_.emplace_back(fs->
make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, 0, 50));