|
|
Go to the documentation of this file.
49 #include "CLHEP/Geometry/Point3D.h"
50 #include "CLHEP/Geometry/Transform3D.h"
51 #include "CLHEP/Geometry/Vector3D.h"
52 #include "CLHEP/Units/GlobalSystemOfUnits.h"
53 #include "CLHEP/Units/GlobalPhysicalConstants.h"
60 for (
int i = 0;
i < 6; ++
i)
88 void fillHitsInfo(std::pair<hitsinfo, energysum> hit_,
unsigned int itimeslice,
double esum);
114 : nameDetector_(iConfig.getParameter<
std::
string>(
"DetectorName")),
115 caloHitSource_(iConfig.getParameter<
std::
string>(
"CaloHitSource")),
116 times_(iConfig.getParameter<
std::
vector<double> >(
"TimeSlices")),
117 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
118 testNumber_(iConfig.getUntrackedParameter<
bool>(
"TestNumber",
true)),
120 fromDDD_(iConfig.getUntrackedParameter<
bool>(
"fromDDD",
true)),
130 std::vector<double> times = {25.0, 1000.0};
133 desc.add<std::vector<double> >(
"TimeSlices", times);
134 desc.addUntracked<
int>(
"Verbosity", 0);
135 desc.addUntracked<
bool>(
"TestNumber",
true);
136 desc.addUntracked<
bool>(
"fromDDD",
true);
137 descriptions.
add(
"hgcalSimHitValidationEE",
desc);
150 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
152 edm::LogVerbatim(
"HGCalValidation") <<
"Particle[" <<
k <<
"] with pt " << (*p)->momentum().perp() <<
" eta "
153 << (*p)->momentum().eta() <<
" phi " << (*p)->momentum().phi();
161 if (theCaloHitContainers.
isValid()) {
163 edm::LogVerbatim(
"HGCalValidation") <<
" PcalohitItr = " << theCaloHitContainers->size();
164 std::vector<PCaloHit> caloHits;
165 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
167 for (
unsigned int i = 0;
i < caloHits.size(); ++
i) {
168 unsigned int id_ = caloHits[
i].
id();
172 caloHits[
i].setID(hid.
rawId());
184 std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
185 OccupancyMap_plus.clear();
186 OccupancyMap_minus.clear();
188 std::map<uint32_t, std::pair<hitsinfo, energysum> > map_hits;
193 unsigned int nused(0);
194 for (
unsigned int i = 0;
i <
hits.size();
i++) {
197 uint32_t id_ =
hits[
i].id();
206 sector = detId.
iphi();
213 cell = detId.
cellU();
216 subsector = detId.
waferV();
237 <<
"Detector " <<
nameDetector_ <<
" zside = " <<
zside <<
" sector|wafer = " << sector <<
":" << subsector
238 <<
" type = " <<
type <<
" layer = " <<
layer <<
" cell = " << cell <<
":" <<
cell2 <<
" energy = " <<
energy
239 <<
" energyem = " <<
hits[
i].energyEM() <<
" energyhad = " <<
hits[
i].energyHad() <<
" time = " <<
time;
241 HepGeom::Point3D<float> gcoord;
246 edm::LogVerbatim(
"HGCalValidation") <<
"i/p " << subdet <<
":" <<
zside <<
":" << cell <<
":" << sector <<
":"
248 gcoord = HepGeom::Point3D<float>(rz *
cos(
etaphi.second) / cosh(
etaphi.first),
253 const HepGeom::Point3D<float> lcoord(
xy.first,
xy.second, 0);
254 int subs = (
symmDet_ ? 0 : subsector);
258 std::pair<float, float>
xy;
269 float xp = (zp < 0) ? -
xy.first :
xy.first;
270 gcoord = HepGeom::Point3D<float>(xp,
xy.second, zp);
272 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
275 << std::hex << id_ <<
std::dec <<
" global coordinate " << gcoord <<
" time " <<
time <<
":" << tof;
280 if (map_hits.count(id_) != 0) {
281 hinfo = map_hits[id_].first;
282 esum = map_hits[id_].second;
284 hinfo.x = gcoord.x();
285 hinfo.y = gcoord.y();
286 hinfo.z = gcoord.z();
287 hinfo.sector = sector;
288 hinfo.sector2 = subsector;
293 hinfo.phi = gcoord.getPhi();
294 hinfo.eta = gcoord.getEta();
304 <<
" gz = " <<
hinfo.z <<
" phi = " <<
hinfo.phi <<
" eta = " <<
hinfo.eta;
305 map_hits[id_] = std::pair<hitsinfo, energysum>(
hinfo, esum);
309 <<
" detector elements being hit";
311 std::map<uint32_t, std::pair<hitsinfo, energysum> >::iterator itr;
312 for (itr = map_hits.begin(); itr != map_hits.end(); ++itr) {
318 for (
unsigned int itimeslice = 0; itimeslice <
nTimes_; itimeslice++) {
328 edm::LogVerbatim(
"HGCalValidation") <<
"With map:used:total " <<
hits.size() <<
"|" << nused <<
"|"
329 << map_hits.size() <<
" hits";
331 for (
auto const& itr : OccupancyMap_plus) {
332 int layer = itr.first;
333 int occupancy = itr.second;
336 for (
auto const& itr : OccupancyMap_minus) {
337 int layer = itr.first;
338 int occupancy = itr.second;
344 if (OccupancyMap.find(
layer) != OccupancyMap.end()) {
345 ++OccupancyMap[
layer];
347 OccupancyMap[
layer] = 1;
352 unsigned int ilayer =
hits.first.layer;
354 energy_[itimeslice].at(ilayer)->Fill(esum);
355 if (itimeslice == 0) {
362 <<
"Problematic Hit for " <<
nameDetector_ <<
" at sector " <<
hits.first.sector <<
":" <<
hits.first.sector2
363 <<
" layer " <<
hits.first.layer <<
" cell " <<
hits.first.cell <<
":" <<
hits.first.cell2 <<
" energy "
364 <<
hits.second.etotal;
388 int nsiz = static_cast<int>(
copy.size());
389 int lay = (nsiz > 0) ?
copy[nsiz - 1] : -1;
390 int sec = (nsiz > 1) ?
copy[nsiz - 2] : -1;
391 int zp = (nsiz > 3) ?
copy[nsiz - 4] : -1;
394 const DDTrap& trp = static_cast<DDTrap>(sol);
395 int subs = (trp.
alpha1() > 0 ? 1 : 0);
400 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
401 const CLHEP::HepRotation hr(
rotation);
403 const HepGeom::Transform3D ht3d(hr, h3v);
404 transMap_.insert(std::make_pair(
id, ht3d));
431 int nsiz = static_cast<int>(
copy.size());
432 int lay = (nsiz > 0) ?
copy[0] : -1;
433 int sec = (nsiz > 1) ?
copy[1] : -1;
434 int zp = (nsiz > 3) ?
copy[3] : -1;
438 int subs = (pars[6] > 0 ? 1 : 0);
443 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
444 const CLHEP::HepRotation hr(
rotation);
446 const HepGeom::Transform3D ht3d(hr, h3v);
447 transMap_.insert(std::make_pair(
id, ht3d));
489 std::ostringstream histoname;
490 for (
unsigned int il = 0; il <
layers_; ++il) {
492 auto istr1 = std::to_string(ilayer);
493 while (istr1.size() < 2) {
494 istr1.insert(0,
"0");
497 histoname <<
"HitOccupancy_Plus_layer_" << istr1;
500 histoname <<
"HitOccupancy_Minus_layer_" << istr1;
504 histoname <<
"EtaPhi_Plus_"
505 <<
"layer_" << istr1;
508 histoname <<
"EtaPhi_Minus_"
509 <<
"layer_" << istr1;
513 for (
unsigned int itimeslice = 0; itimeslice <
nTimes_; itimeslice++) {
515 histoname <<
"energy_time_" << itimeslice <<
"_layer_" << istr1;
516 energy_[itimeslice].push_back(iB.
book1D(histoname.str().c_str(),
"energy_", 100, 0, 0.1));
const RotationMatrix rotation() const
std::vector< MonitorElement * > HitOccupancy_Plus_
int iphi() const
get the phi index
const std::vector< double > parameters() const
extract shape parameters
HGCalSimHitValidation(const edm::ParameterSet &)
constexpr int iphi() const
get the cell iphi
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
MonitorElement * MeanHitOccupancy_Plus_
HGCalGeometryMode::GeometryMode geomMode() const
const HGCalDDDConstants * hgcons_
const HcalDDDRecConstants * hcons_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
double waferZ(int layer, bool reco) const
void analyzeHits(std::vector< PCaloHit > &hits)
nav_type copyNumbers() const
return the stack of copy numbers
bool waferHexagon8() const
virtual void setCurrentFolder(std::string const &fullpath)
void analyze(const edm::Event &, const edm::EventSetup &) override
constexpr int depth() const
get the tower depth
static void unpackSquareIndex(const uint32_t &idx, int &z, int &lay, int &sec, int &subsec, int &cell)
bool defineGeometry(edm::ESTransientHandle< DDCompactView > &ddViewH)
std::string_view name() const
Sin< T >::type sin(const T &t)
const Translation translation() const
std::map< uint32_t, HepGeom::Transform3D > transMap_
int layer() const
get the layer #
Cos< T >::type cos(const T &t)
bool firstChild()
set the current node to the first child ...
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
bool next()
set current node to the next node in the filtered tree
Compact representation of the geometrical detector hierarchy.
const std::vector< int > copyNos() const
The list of the volume copy numbers.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void fillHitsInfo(std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
bool firstChild()
set the current node to the first child
std::vector< MonitorElement * > energy_[maxTime_]
int zside() const
get the z-side of the cell (1/-1)
std::vector< MonitorElement * > EtaPhi_Plus_
constexpr std::array< uint8_t, layerIndexSize > layer
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool tileTrapezoid() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Interface to a Trapezoid.
constexpr int ieta() const
get the cell ieta
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
unsigned int layers(bool reco) const
constexpr HcalSubdetector subdet() const
get the subdetector
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
std::string nameDetector_
int type() const
get/set the type
MonitorElement * MeanHitOccupancy_Minus_
const HepMC::GenEvent * GetEvent() const
int zside() const
get the z-side of the cell (1/-1)
DetId relabel(const uint32_t testId) const
constexpr uint32_t rawId() const
get the raw id
int cellU() const
get the cell #'s in u,v or in x,y
double getRZ(const int &subdet, const int &ieta, const int &depth) const
std::vector< MonitorElement * > EtaPhi_Minus_
std::vector< MonitorElement * > HitOccupancy_Minus_
Log< level::Info, true > LogVerbatim
const DDTranslation & translation() const
The absolute translation of the current node.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
static const unsigned int maxTime_
std::vector< double > times_
int type() const
get the type
A DDSolid represents the shape of a part.
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
~HGCalSimHitValidation() override
int getMaxDepth(const int &type) const
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const std::string fullname() const
constexpr int ietaAbs() const
get the absolute value of the cell ieta
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
constexpr int zside() const
get the z-side of the cell (1/-1)
std::pair< T, T > etaphi(T x, T y, T z)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::string caloHitSource_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int layer() const
get the layer #