32 #include <CLHEP/Units/SystemOfUnits.h> 33 #include <CLHEP/Units/GlobalPhysicalConstants.h> 68 const std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> >
tok_hgcGeom_;
69 const std::vector<edm::EDGetTokenT<edm::PCaloHitContainer> >
tok_hits_;
70 std::vector<const HGCalDDDConstants*>
hgcons_;
82 rmin_(iConfig.getUntrackedParameter<double>(
"rMin", 0.0)),
83 rmax_(iConfig.getUntrackedParameter<double>(
"rMax", 3000.0)),
84 zmin_(iConfig.getUntrackedParameter<double>(
"zMin", 3000.0)),
85 zmax_(iConfig.getUntrackedParameter<double>(
"zMax", 6000.0)),
86 etamin_(iConfig.getUntrackedParameter<double>(
"etaMin", 1.0)),
87 etamax_(iConfig.getUntrackedParameter<double>(
"etaMax", 3.0)),
88 nbinR_(iConfig.getUntrackedParameter<
int>(
"nBinR", 300)),
89 nbinZ_(iConfig.getUntrackedParameter<
int>(
"nBinZ", 300)),
90 nbinEta_(iConfig.getUntrackedParameter<
int>(
"nBinEta", 200)),
91 nLayers_(iConfig.getUntrackedParameter<
int>(
"layers", 50)),
92 verbosity_(iConfig.getUntrackedParameter<
int>(
"verbosity", 0)),
93 ifNose_(iConfig.getUntrackedParameter<
bool>(
"ifNose",
false)),
94 ifLayer_(iConfig.getUntrackedParameter<
bool>(
"ifLayer",
false)),
98 return esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
109 std::vector<std::string>
names = {
"HGCalEESensitive",
"HGCalHESiliconSensitive",
"HGCalHEScintillatorSensitive"};
110 std::vector<std::string>
sources = {
"HGCHitsEE",
"HGCHitsHEfront",
"HGCHitsHEback"};
111 desc.add<std::vector<std::string> >(
"detectorNames",
names);
112 desc.add<std::vector<std::string> >(
"caloHitSources",
sources);
113 desc.addUntracked<
double>(
"rMin", 0.0);
114 desc.addUntracked<
double>(
"rMax", 3000.0);
115 desc.addUntracked<
double>(
"zMin", 3000.0);
116 desc.addUntracked<
double>(
"zMax", 6000.0);
117 desc.addUntracked<
double>(
"etaMin", 1.0);
118 desc.addUntracked<
double>(
"etaMax", 3.0);
119 desc.addUntracked<
int>(
"nBinR", 300);
120 desc.addUntracked<
int>(
"nBinZ", 300);
121 desc.addUntracked<
int>(
"nBinEta", 200);
122 desc.addUntracked<
int>(
"layers", 50);
123 desc.addUntracked<
int>(
"verbosity", 0);
124 desc.addUntracked<
bool>(
"ifNose",
false);
125 desc.addUntracked<
bool>(
"ifLayer",
false);
126 descriptions.
add(
"hgcalSimHitStudy",
desc);
133 if (theCaloHitContainers.
isValid()) {
135 edm::LogVerbatim(
"HGCalValidation") <<
" PcalohitItr = " << theCaloHitContainers->size();
136 std::vector<PCaloHit> caloHits;
137 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
150 std::map<uint32_t, hitsinfo> map_hits;
153 unsigned int nused(0);
157 uint32_t
id =
hit.
id();
160 HepGeom::Point3D<float> gcoord;
161 std::pair<float, float>
xy;
164 subdet =
detId.subdetId();
165 cell =
detId.cellU();
172 xy =
hgcons_[ih]->locateCell(
zside,
layer,
sector,
sector2, cell,
cell2,
false,
true,
false,
false,
false);
175 }
else if (
hgcons_[ih]->waferHexagon8()) {
177 subdet =
static_cast<int>(
detId.det());
178 cell =
detId.cellU();
185 xy =
hgcons_[ih]->locateCell(
zside,
layer,
sector,
sector2, cell,
cell2,
false,
true,
false,
false,
false);
188 }
else if (
hgcons_[ih]->tileTrapezoid()) {
190 subdet =
static_cast<int>(
detId.det());
198 edm::LogError(
"HGCalValidation") <<
"HGCalSimHitStudy: Wrong geometry mode " <<
hgcons_[ih]->geomMode();
204 double xp = (zp < 0) ? -
xy.first :
xy.first;
205 gcoord = HepGeom::Point3D<float>(xp,
xy.second, zp);
209 <<
cell2 <<
" o/p " <<
xy.first <<
":" <<
xy.second <<
":" << zp;
211 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
214 <<
"Detector " <<
name <<
" zside = " <<
zside <<
" layer = " <<
layer <<
" type = " <<
type 215 <<
" wafer = " <<
sector <<
":" <<
sector2 <<
" cell = " << cell <<
":" <<
cell2 <<
" positon = " << gcoord
216 <<
" energy = " <<
energy <<
" time = " <<
time <<
":" << tof;
221 if (map_hits.count(
id) != 0) {
225 hinfo.phi = gcoord.getPhi();
226 hinfo.eta = gcoord.getEta();
236 if (
hinfo.layer <= static_cast<int>(
h_XY_.size()))
237 h_XY_[
hinfo.layer - 1]->Fill(gcoord.x(), gcoord.y());
244 h_C1_[ih]->Fill(cell);
247 edm::LogVerbatim(
"HGCalValidation") <<
name <<
" with " << map_hits.size() <<
":" << nused <<
" detector elements" 250 for (
auto const&
hit : map_hits) {
254 <<
" ---------------------- eta = " <<
hinfo.eta <<
" phi = " <<
hinfo.phi <<
" layer = " <<
hinfo.layer
255 <<
" E = " <<
hinfo.energy <<
" T = " <<
hinfo.time;
298 name <<
"RZ_AllDetectors";
299 title <<
"R vs Z for All Detectors";
308 for (
int ly = 0; ly <
nLayers_; ++ly) {
311 name <<
"XY_L" << (ly + 1);
312 title <<
"Y vs X at Layer " << (ly + 1);
321 name <<
"EtaPhi_AllDetectors";
322 title <<
"#phi vs #eta for All Detectors";
332 name <<
"EtFiZp_AllDetectors";
333 title <<
"#phi vs #eta (+z) for All Detectors";
343 name <<
"EtFiZm_AllDetectors";
344 title <<
"#phi vs #eta (-z) for All Detectors";
355 name <<
"LayerZp_AllDetectors";
356 title <<
"Energy vs Layer (+z) for All Detectors";
365 name <<
"LayerZm_AllDetectors";
366 title <<
"Energy vs Layer (-z) for All Detectors";
376 name <<
"E_AllDetectors";
377 title <<
"Energy Deposit for All Detectors";
382 h_E_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 1000, 0.0, 1.0));
387 name <<
"T_AllDetectors";
388 title <<
"Time for All Detectors";
393 h_T_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 1000, 0.0, 200.0));
401 h_Ly_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, 0, 100));
407 h_W1_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, -50, 50));
412 h_C1_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 720, 0, 360));
418 h_W1_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 200, -50, 50));
423 h_W2_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, -50, 50));
428 h_C1_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, 0, 50));
433 h_C2_.emplace_back(
fs->make<TH1D>(
name.str().c_str(),
title.str().c_str(), 100, 0, 50));
static const std::string kSharedResource
const std::vector< std::string > nameDetectors_
Log< level::Info, true > LogVerbatim
std::vector< TH2D * > h_XY_
void analyze(edm::Event const &, edm::EventSetup const &) override
std::vector< TH1D * > h_LayerZm_
std::vector< TH2D * > h_RZ_
std::vector< TH1D * > h_T_
std::vector< TH1D * > h_W1_
void beginRun(edm::Run const &, edm::EventSetup const &) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::vector< TH2D * > h_EtFiZm_
std::vector< int > layerFront_
std::vector< TH1D * > h_C1_
const std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > tok_hgcGeom_
Log< level::Error, false > LogError
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
const std::string names[nVars_]
HGCalSimHitStudy(const edm::ParameterSet &)
~HGCalSimHitStudy() override=default
std::vector< TH1D * > h_LayerZp_
void analyzeHits(int, const std::string &, const std::vector< PCaloHit > &)
Abs< T >::type abs(const T &t)
std::vector< TH2D * > h_EtFiZp_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
std::vector< TH1D * > h_C2_
std::vector< int > layers_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const std::vector< edm::EDGetTokenT< edm::PCaloHitContainer > > tok_hits_
std::vector< TH1D * > h_Ly_
std::vector< TH1D * > h_E_
std::vector< const HGCalDDDConstants * > hgcons_
std::vector< TH1D * > h_W2_
static std::string const source
const std::vector< std::string > caloHitSources_
std::vector< TH2D * > h_EtaPhi_
void endRun(edm::Run const &, edm::EventSetup const &) override