|
![CMS Logo](/cmsdoxygen/common/rightImage.jpg) |
Go to the documentation of this file.
48 #include "CLHEP/Geometry/Point3D.h"
49 #include "CLHEP/Geometry/Transform3D.h"
50 #include "CLHEP/Geometry/Vector3D.h"
51 #include "CLHEP/Units/GlobalSystemOfUnits.h"
52 #include "CLHEP/Units/GlobalPhysicalConstants.h"
59 for (
int i = 0;
i < 6; ++
i)
87 void fillHitsInfo(std::pair<hitsinfo, energysum> hit_,
unsigned int itimeslice,
double esum);
112 : nameDetector_(iConfig.getParameter<
std::
string>(
"DetectorName")),
113 caloHitSource_(iConfig.getParameter<
std::
string>(
"CaloHitSource")),
114 times_(iConfig.getParameter<
std::vector<double> >(
"TimeSlices")),
115 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
116 testNumber_(iConfig.getUntrackedParameter<
bool>(
"TestNumber",
true)),
127 std::vector<double> times = {25.0, 1000.0};
130 desc.
add<std::vector<double> >(
"TimeSlices", times);
133 descriptions.
add(
"hgcalSimHitValidationEE", desc);
146 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
148 edm::LogVerbatim(
"HGCalValidation") <<
"Particle[" <<
k <<
"] with pt " << (*p)->momentum().perp() <<
" eta "
149 << (*p)->momentum().eta() <<
" phi " << (*p)->momentum().phi();
157 if (theCaloHitContainers.
isValid()) {
159 edm::LogVerbatim(
"HGCalValidation") <<
" PcalohitItr = " << theCaloHitContainers->size();
160 std::vector<PCaloHit> caloHits;
161 caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
163 for (
unsigned int i = 0;
i < caloHits.size(); ++
i) {
164 unsigned int id_ = caloHits[
i].
id();
168 caloHits[
i].setID(hid.
rawId());
180 std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
181 OccupancyMap_plus.clear();
182 OccupancyMap_minus.clear();
184 std::map<uint32_t, std::pair<hitsinfo, energysum> > map_hits;
189 unsigned int nused(0);
190 for (
unsigned int i = 0;
i <
hits.size();
i++) {
193 uint32_t id_ =
hits[
i].id();
194 int cell, sector, subsector(0), layer,
zside;
202 sector = detId.
iphi();
204 layer = detId.
depth();
210 cell = detId.
cellU();
213 subsector = detId.
waferV();
215 layer = detId.
layer();
226 layer = detId.
layer();
234 <<
"Detector " <<
nameDetector_ <<
" zside = " <<
zside <<
" sector|wafer = " << sector <<
":" << subsector
235 <<
" type = " <<
type <<
" layer = " << layer <<
" cell = " << cell <<
":" <<
cell2 <<
" energy = " <<
energy
236 <<
" energyem = " <<
hits[
i].energyEM() <<
" energyhad = " <<
hits[
i].energyHad() <<
" time = " <<
time;
238 HepGeom::Point3D<float> gcoord;
243 edm::LogVerbatim(
"HGCalValidation") <<
"i/p " << subdet <<
":" <<
zside <<
":" << cell <<
":" << sector <<
":"
244 << layer <<
" o/p " <<
etaphi.first <<
":" <<
etaphi.second <<
":" << rz;
245 gcoord = HepGeom::Point3D<float>(rz *
cos(
etaphi.second) / cosh(
etaphi.first),
250 const HepGeom::Point3D<float> lcoord(
xy.first,
xy.second, 0);
251 int subs = (
symmDet_ ? 0 : subsector);
255 std::pair<float, float>
xy;
267 float xp = (zp < 0) ? -
xy.first :
xy.first;
268 gcoord = HepGeom::Point3D<float>(xp,
xy.second, zp);
270 double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
273 << std::hex << id_ <<
std::dec <<
" global coordinate " << gcoord <<
" time " <<
time <<
":" << tof;
278 if (map_hits.count(id_) != 0) {
279 hinfo = map_hits[id_].first;
280 esum = map_hits[id_].second;
282 hinfo.x = gcoord.x();
283 hinfo.y = gcoord.y();
284 hinfo.z = gcoord.z();
285 hinfo.sector = sector;
286 hinfo.sector2 = subsector;
291 hinfo.phi = gcoord.getPhi();
292 hinfo.eta = gcoord.getEta();
302 <<
" gz = " <<
hinfo.z <<
" phi = " <<
hinfo.phi <<
" eta = " <<
hinfo.eta;
303 map_hits[id_] = std::pair<hitsinfo, energysum>(
hinfo, esum);
307 <<
" detector elements being hit";
309 std::map<uint32_t, std::pair<hitsinfo, energysum> >::iterator
itr;
310 for (
itr = map_hits.begin();
itr != map_hits.end(); ++
itr) {
313 int layer =
hinfo.layer;
316 for (
unsigned int itimeslice = 0; itimeslice <
nTimes_; itimeslice++) {
326 edm::LogVerbatim(
"HGCalValidation") <<
"With map:used:total " <<
hits.size() <<
"|" << nused <<
"|"
327 << map_hits.size() <<
" hits";
329 for (
auto const&
itr : OccupancyMap_plus) {
330 int layer =
itr.first;
331 int occupancy =
itr.second;
334 for (
auto const&
itr : OccupancyMap_minus) {
335 int layer =
itr.first;
336 int occupancy =
itr.second;
342 if (OccupancyMap.find(layer) != OccupancyMap.end()) {
343 ++OccupancyMap[layer];
345 OccupancyMap[layer] = 1;
350 unsigned int ilayer =
hits.first.layer;
352 energy_[itimeslice].at(ilayer)->Fill(esum);
353 if (itimeslice == 0) {
360 <<
"Problematic Hit for " <<
nameDetector_ <<
" at sector " <<
hits.first.sector <<
":" <<
hits.first.sector2
361 <<
" layer " <<
hits.first.layer <<
" cell " <<
hits.first.cell <<
":" <<
hits.first.cell2 <<
" energy "
362 <<
hits.second.etotal;
385 int nsiz = static_cast<int>(
copy.size());
386 int lay = (nsiz > 0) ?
copy[nsiz - 1] : -1;
387 int sec = (nsiz > 1) ?
copy[nsiz - 2] : -1;
388 int zp = (nsiz > 3) ?
copy[nsiz - 4] : -1;
391 const DDTrap& trp = static_cast<DDTrap>(sol);
392 int subs = (trp.
alpha1() > 0 ? 1 : 0);
397 const CLHEP::HepRep3x3
rotation(
x.X(),
y.X(),
z.X(),
x.Y(),
y.Y(),
z.Y(),
x.Z(),
y.Z(),
z.Z());
398 const CLHEP::HepRotation hr(
rotation);
400 const HepGeom::Transform3D ht3d(hr, h3v);
401 transMap_.insert(std::make_pair(
id, ht3d));
438 std::ostringstream histoname;
439 for (
unsigned int il = 0; il <
layers_; ++il) {
441 auto istr1 = std::to_string(ilayer);
442 while (istr1.size() < 2) {
443 istr1.insert(0,
"0");
446 histoname <<
"HitOccupancy_Plus_layer_" << istr1;
449 histoname <<
"HitOccupancy_Minus_layer_" << istr1;
453 histoname <<
"EtaPhi_Plus_"
454 <<
"layer_" << istr1;
457 histoname <<
"EtaPhi_Minus_"
458 <<
"layer_" << istr1;
462 for (
unsigned int itimeslice = 0; itimeslice <
nTimes_; itimeslice++) {
464 histoname <<
"energy_time_" << itimeslice <<
"_layer_" << istr1;
465 energy_[itimeslice].push_back(iB.
book1D(histoname.str().c_str(),
"energy_", 100, 0, 0.1));
std::vector< MonitorElement * > HitOccupancy_Plus_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int iphi() const
get the phi index
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
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)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
bool defineGeometry(edm::ESTransientHandle< DDCompactView > &ddViewH)
Sin< T >::type sin(const T &t)
std::map< uint32_t, HepGeom::Transform3D > transMap_
int layer() const
get the layer #
dqm::implementation::IBooker IBooker
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.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void fillHitsInfo(std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
std::vector< MonitorElement * > energy_[maxTime_]
int zside() const
get the z-side of the cell (1/-1)
std::vector< MonitorElement * > EtaPhi_Plus_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Interface to a Trapezoid.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
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 the type
MonitorElement * MeanHitOccupancy_Minus_
const HepMC::GenEvent * GetEvent() const
int zside() const
get the z-side of the cell (1/-1)
std::vector< std::pair< float, float > >::iterator itr
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_
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 #