32 #include "CLHEP/Units/GlobalSystemOfUnits.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;
165 cell = detId.
cellU();
175 }
else if (
hgcons_[ih]->waferHexagon8()) {
177 subdet =
static_cast<int>(detId.
det());
178 cell = detId.
cellU();
188 }
else if (
hgcons_[ih]->tileTrapezoid()) {
190 subdet =
static_cast<int>(detId.
det());
191 sector = detId.
ieta();
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);
208 <<
"i/p " << subdet <<
":" <<
zside <<
":" <<
layer <<
":" << sector <<
":" <<
sector2 <<
":" << cell <<
":" 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());
243 h_W1_[ih]->Fill(sector);
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
int layer() const
get the layer #
std::vector< TH2D * > h_EtFiZm_
std::vector< int > layerFront_
std::vector< TH1D * > h_C1_
int cellU() const
get the cell #'s in u,v or in x,y
const std::vector< edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > > tok_hgcGeom_
int type() const
get/set the type
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 >
constexpr Detector det() const
get the detector field from this detid
const std::string names[nVars_]
constexpr std::array< uint8_t, layerIndexSize > layer
HGCalSimHitStudy(const edm::ParameterSet &)
int layer() const
get the layer #
int iphi() const
get the phi index
~HGCalSimHitStudy() override=default
std::vector< TH1D * > h_LayerZp_
void analyzeHits(int, const std::string &, const std::vector< PCaloHit > &)
int layer() const
get the layer #
Abs< T >::type abs(const T &t)
std::vector< TH2D * > h_EtFiZp_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int cellU() const
get the cell #'s in u,v or in x,y
#define DEFINE_FWK_MODULE(type)
std::vector< TH1D * > h_C2_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getData(T &iHolder) const
int zside() const
get the z-side of the cell (1/-1)
int type() const
get the type
std::vector< int > layers_
int zside() const
get the z-side of the cell (1/-1)
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_
int type() const
get the type
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
int zside() const
get the z-side of the cell (1/-1)