CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
MuonDetIdAssociator Class Reference

#include <MuonDetIdAssociator.h>

Inheritance diagram for MuonDetIdAssociator:
DetIdAssociator

Public Member Functions

const GeomDetgetGeomDet (const DetId &id) const override
 
 MuonDetIdAssociator ()
 
 MuonDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 
 MuonDetIdAssociator (int nPhi, int nEta, double etaBinSize, const GlobalTrackingGeometry *geom, const CSCBadChambers *badChambers, bool includeBadChambers, bool includeGEM, bool includeME0)
 
const char * name () const override
 
virtual void setCSCBadChambers (const CSCBadChambers *ptr)
 
virtual void setGeometry (const GlobalTrackingGeometry *ptr)
 
- Public Member Functions inherited from DetIdAssociator
virtual void buildMap ()
 make the look-up map More...
 
 DetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 
double etaBinSize () const
 look-up map bin size in eta dimension More...
 
virtual std::vector< DetIdgetCrossedDetIds (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory) const
 
virtual std::vector< DetIdgetCrossedDetIds (const std::set< DetId > &, const std::vector< SteppingHelixStateInfo > &trajectory, const double toleranceInSigmas=-1) const
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &, const int iN=0) const
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &direction, const unsigned int iNEtaPlus, const unsigned int iNEtaMinus, const unsigned int iNPhiPlus, const unsigned int iNPhiMinus) const
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &direction, const MapRange &mapRange) const
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &point, const double d=0) const
 
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &point, const double dThetaPlus, const double dThetaMinus, const double dPhiPlus, const double dPhiMinus) const
 
virtual std::set< DetIdgetDetIdsInACone (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory, const double dR) const
 
virtual int iEta (const GlobalPoint &) const
 look-up map eta index More...
 
virtual int iPhi (const GlobalPoint &) const
 look-up map phi index More...
 
int nEtaBins () const
 number of bins of the look-up map in eta dimension More...
 
int nPhiBins () const
 number of bins of the look-up map in phi dimension More...
 
virtual bool selectAllInACone (const double dR) const
 helper to see if getDetIdsInACone is useful More...
 
const FiducialVolumevolume () const
 get active detector volume More...
 
virtual ~DetIdAssociator ()
 

Protected Member Functions

void check_setup () const override
 
std::pair< const_iterator, const_iteratorgetDetIdPoints (const DetId &id, std::vector< GlobalPoint > &points) const override
 
GlobalPoint getPosition (const DetId &id) const override
 
void getValidDetIds (unsigned int, std::vector< DetId > &) const override
 
bool insideElement (const GlobalPoint &point, const DetId &id) const override
 
- Protected Member Functions inherited from DetIdAssociator
virtual bool crossedElement (const GlobalPoint &, const GlobalPoint &, const DetId &, const double toleranceInSigmas=-1, const SteppingHelixStateInfo *=nullptr) const
 
virtual void dumpMapContent (int, int) const
 
virtual void dumpMapContent (int, int, int, int) const
 
void fillSet (std::set< DetId > &set, unsigned int iEta, unsigned int iPhi) const
 
virtual const unsigned int getNumberOfSubdetectors () const
 
unsigned int index (unsigned int iEta, unsigned int iPhi) const
 
virtual bool nearElement (const GlobalPoint &point, const DetId &id, const double distance) const
 

Protected Attributes

const CSCBadChamberscscbadchambers_
 
const GlobalTrackingGeometrygeometry_
 
bool includeBadChambers_
 
bool includeGEM_
 
bool includeME0_
 
- Protected Attributes inherited from DetIdAssociator
std::vector< DetIdcontainer_
 
const double etaBinSize_
 
std::vector< std::pair< unsigned int, unsigned int > > lookupMap_
 
double maxEta_
 
double minTheta_
 
const int nEta_
 
const int nPhi_
 
bool theMapIsValid_
 
FiducialVolume volume_
 

Additional Inherited Members

- Public Types inherited from DetIdAssociator
typedef std::vector< GlobalPoint >::const_iterator const_iterator
 
enum  PropagationTarget { Barrel, ForwardEndcap, BackwardEndcap }
 

Detailed Description

Definition at line 29 of file MuonDetIdAssociator.h.

Constructor & Destructor Documentation

◆ MuonDetIdAssociator() [1/3]

MuonDetIdAssociator::MuonDetIdAssociator ( )
inline

Definition at line 31 of file MuonDetIdAssociator.h.

32  : DetIdAssociator(48, 48, 0.125), geometry_(nullptr), cscbadchambers_(nullptr), includeBadChambers_(false){};
const CSCBadChambers * cscbadchambers_
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
const GlobalTrackingGeometry * geometry_

◆ MuonDetIdAssociator() [2/3]

MuonDetIdAssociator::MuonDetIdAssociator ( const int  nPhi,
const int  nEta,
const double  etaBinSize 
)
inline

Definition at line 33 of file MuonDetIdAssociator.h.

35  geometry_(nullptr),
36  cscbadchambers_(nullptr),
37  includeBadChambers_(false){};
const CSCBadChambers * cscbadchambers_
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
const GlobalTrackingGeometry * geometry_
double etaBinSize() const
look-up map bin size in eta dimension

◆ MuonDetIdAssociator() [3/3]

MuonDetIdAssociator::MuonDetIdAssociator ( int  nPhi,
int  nEta,
double  etaBinSize,
const GlobalTrackingGeometry geom,
const CSCBadChambers badChambers,
bool  includeBadChambers,
bool  includeGEM,
bool  includeME0 
)
inline

Definition at line 39 of file MuonDetIdAssociator.h.

48  geometry_(geom),
49  cscbadchambers_(badChambers),
const CSCBadChambers * cscbadchambers_
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
const GlobalTrackingGeometry * geometry_
double etaBinSize() const
look-up map bin size in eta dimension

Member Function Documentation

◆ check_setup()

void MuonDetIdAssociator::check_setup ( ) const
overrideprotectedvirtual

Reimplemented from DetIdAssociator.

Definition at line 31 of file MuonDetIdAssociator.cc.

References DetIdAssociator::check_setup(), cscbadchambers_, Exception, and geometry_.

31  {
32  if (geometry_ == nullptr)
33  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
34  if (cscbadchambers_ == nullptr)
35  throw cms::Exception("ConfigurationProblem") << "CSCBadChambers is not set\n";
37 }
const CSCBadChambers * cscbadchambers_
const GlobalTrackingGeometry * geometry_
virtual void check_setup() const

◆ getDetIdPoints()

std::pair< DetIdAssociator::const_iterator, DetIdAssociator::const_iterator > MuonDetIdAssociator::getDetIdPoints ( const DetId id,
std::vector< GlobalPoint > &  points 
) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 126 of file MuonDetIdAssociator.cc.

References Surface::bounds(), geometry_, getGeomDet(), GlobalTrackingGeometry::idToDet(), hiPixelPairStep_cff::points, GeomDet::surface(), and GeomDet::toGlobal().

127  {
128  points.clear();
129  points.reserve(8);
130  const GeomDet* geomDet = getGeomDet(id);
131 
132  // the coners of muon detector elements are not stored and can be only calculated
133  // based on methods defined in the interface class Bounds:
134  // width() - x
135  // length() - y
136  // thinkness() - z
137  // NOTE: this convention is implementation specific and can fail. Both
138  // RectangularPlaneBounds and TrapezoidalPlaneBounds use it.
139  // Even though the CSC geomtry is more complicated (trapezoid), it's enough
140  // to estimate which bins should contain this element. For the distance
141  // calculation from the edge, we will use exact geometry to get it right.
142 
143  const Bounds* bounds = &(geometry_->idToDet(id)->surface().bounds());
144  points.push_back(
145  geomDet->toGlobal(LocalPoint(+bounds->width() / 2, +bounds->length() / 2, +bounds->thickness() / 2)));
146  points.push_back(
147  geomDet->toGlobal(LocalPoint(-bounds->width() / 2, +bounds->length() / 2, +bounds->thickness() / 2)));
148  points.push_back(
149  geomDet->toGlobal(LocalPoint(+bounds->width() / 2, -bounds->length() / 2, +bounds->thickness() / 2)));
150  points.push_back(
151  geomDet->toGlobal(LocalPoint(-bounds->width() / 2, -bounds->length() / 2, +bounds->thickness() / 2)));
152  points.push_back(
153  geomDet->toGlobal(LocalPoint(+bounds->width() / 2, +bounds->length() / 2, -bounds->thickness() / 2)));
154  points.push_back(
155  geomDet->toGlobal(LocalPoint(-bounds->width() / 2, +bounds->length() / 2, -bounds->thickness() / 2)));
156  points.push_back(
157  geomDet->toGlobal(LocalPoint(+bounds->width() / 2, -bounds->length() / 2, -bounds->thickness() / 2)));
158  points.push_back(
159  geomDet->toGlobal(LocalPoint(-bounds->width() / 2, -bounds->length() / 2, -bounds->thickness() / 2)));
160 
161  return std::pair<const_iterator, const_iterator>(points.begin(), points.end());
162 }
const GeomDet * getGeomDet(const DetId &id) const override
const GeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const GlobalTrackingGeometry * geometry_
Definition: Bounds.h:18
const Bounds & bounds() const
Definition: Surface.h:87

◆ getGeomDet()

const GeomDet * MuonDetIdAssociator::getGeomDet ( const DetId id) const
overridevirtual

Implements DetIdAssociator.

Definition at line 39 of file MuonDetIdAssociator.cc.

References Exception, geometry_, and GlobalTrackingGeometry::idToDet().

Referenced by getDetIdPoints(), and getPosition().

39  {
40  if (geometry_ == nullptr)
41  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
42  const GeomDet* gd = geometry_->idToDet(id);
43  if (gd == nullptr)
44  throw cms::Exception("NoGeometry") << "Cannot find GeomDet for DetID: " << id.rawId() << "\n";
45  return gd;
46 }
const GeomDet * idToDet(DetId) const override
const GlobalTrackingGeometry * geometry_

◆ getPosition()

GlobalPoint MuonDetIdAssociator::getPosition ( const DetId id) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 48 of file MuonDetIdAssociator.cc.

References getGeomDet(), point, and position.

48  {
50  return GlobalPoint(point.x(), point.y(), point.z());
51 }
const GeomDet * getGeomDet(const DetId &id) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static int position[264][3]
Definition: ReadPGInfo.cc:289
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ getValidDetIds()

void MuonDetIdAssociator::getValidDetIds ( unsigned int  subDectorIndex,
std::vector< DetId > &  validIds 
) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 53 of file MuonDetIdAssociator.cc.

References cscbadchambers_, TrackingGeometry::dets(), dt, Exception, mixOne_premix_on_sim_cfi::gem, geometry_, includeBadChambers_, includeGEM_, includeME0_, CSCBadChambers::isInBadChamber(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, mixOne_premix_on_sim_cfi::me0, alignCSCRings::r, omtf::DataWord64::rpc, and GlobalTrackingGeometry::slaveGeometry().

53  {
54  validIds.clear();
55  if (geometry_ == nullptr)
56  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
57  if (subDectorIndex != 0)
58  throw cms::Exception("FatalError")
59  << "Muon sub-dectors are all handle as one sub-system, but subDetectorIndex is not zero.\n";
60 
61  // CSC
63  throw cms::Exception("FatalError") << "Cannnot CSCGeometry\n";
64  auto const& geomDetsCSC = geometry_->slaveGeometry(CSCDetId())->dets();
65  for (auto it = geomDetsCSC.begin(); it != geomDetsCSC.end(); ++it)
66  if (auto csc = dynamic_cast<const CSCChamber*>(*it)) {
68  continue;
69  validIds.push_back(csc->id());
70  }
71 
72  // DT
74  throw cms::Exception("FatalError") << "Cannnot DTGeometry\n";
75  auto const& geomDetsDT = geometry_->slaveGeometry(DTChamberId())->dets();
76  for (auto it = geomDetsDT.begin(); it != geomDetsDT.end(); ++it)
77  if (auto dt = dynamic_cast<const DTChamber*>(*it))
78  validIds.push_back(dt->id());
79 
80  // RPC
82  throw cms::Exception("FatalError") << "Cannnot RPCGeometry\n";
83  auto const& geomDetsRPC = geometry_->slaveGeometry(RPCDetId())->dets();
84  for (auto it = geomDetsRPC.begin(); it != geomDetsRPC.end(); ++it)
85  if (auto rpc = dynamic_cast<const RPCChamber*>(*it)) {
86  std::vector<const RPCRoll*> rolls = (rpc->rolls());
87  for (std::vector<const RPCRoll*>::iterator r = rolls.begin(); r != rolls.end(); ++r)
88  validIds.push_back((*r)->id().rawId());
89  }
90 
91  // GEM
92  if (includeGEM_) {
94  throw cms::Exception("FatalError") << "Cannnot GEMGeometry\n";
95  auto const& geomDetsGEM = geometry_->slaveGeometry(GEMDetId())->dets();
96  for (auto it = geomDetsGEM.begin(); it != geomDetsGEM.end(); ++it) {
97  if (auto gem = dynamic_cast<const GEMSuperChamber*>(*it)) {
98  if (gem->id().station() == 0)
99  validIds.push_back(gem->id());
100  else
101  for (auto ch : gem->chambers())
102  validIds.push_back(ch->id());
103  }
104  }
105  }
106  // ME0
107  if (includeME0_) {
109  throw cms::Exception("FatalError") << "Cannnot ME0Geometry\n";
110  auto const& geomDetsME0 = geometry_->slaveGeometry(ME0DetId())->dets();
111  for (auto it = geomDetsME0.begin(); it != geomDetsME0.end(); ++it) {
112  if (auto me0 = dynamic_cast<const ME0Chamber*>(*it)) {
113  validIds.push_back(me0->id());
114  }
115  }
116  }
117 }
float dt
Definition: AMPTWrapper.h:136
const CSCBadChambers * cscbadchambers_
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
Definition: L1Track.h:19
virtual const DetContainer & dets() const =0
Returm a vector of all GeomDet (including all GeomDetUnits)
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
const GlobalTrackingGeometry * geometry_

◆ insideElement()

bool MuonDetIdAssociator::insideElement ( const GlobalPoint point,
const DetId id 
) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 119 of file MuonDetIdAssociator.cc.

References Surface::bounds(), Exception, geometry_, GlobalTrackingGeometry::idToDet(), Bounds::inside(), point, GeomDet::surface(), and GeomDet::toLocal().

119  {
120  if (geometry_ == nullptr)
121  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
123  return geometry_->idToDet(id)->surface().bounds().inside(lp);
124 }
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
const GeomDet * idToDet(DetId) const override
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const GlobalTrackingGeometry * geometry_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const Bounds & bounds() const
Definition: Surface.h:87

◆ name()

const char* MuonDetIdAssociator::name ( void  ) const
inlineoverridevirtual

Implements DetIdAssociator.

Definition at line 60 of file MuonDetIdAssociator.h.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

60 { return "AllMuonDetectors"; }

◆ setCSCBadChambers()

virtual void MuonDetIdAssociator::setCSCBadChambers ( const CSCBadChambers ptr)
inlinevirtual

Definition at line 56 of file MuonDetIdAssociator.h.

References cscbadchambers_.

56 { cscbadchambers_ = ptr; }
const CSCBadChambers * cscbadchambers_

◆ setGeometry()

virtual void MuonDetIdAssociator::setGeometry ( const GlobalTrackingGeometry ptr)
inlinevirtual

Definition at line 54 of file MuonDetIdAssociator.h.

References geometry_.

54 { geometry_ = ptr; }
const GlobalTrackingGeometry * geometry_

Member Data Documentation

◆ cscbadchambers_

const CSCBadChambers* MuonDetIdAssociator::cscbadchambers_
protected

Definition at line 76 of file MuonDetIdAssociator.h.

Referenced by check_setup(), getValidDetIds(), and setCSCBadChambers().

◆ geometry_

const GlobalTrackingGeometry* MuonDetIdAssociator::geometry_
protected

◆ includeBadChambers_

bool MuonDetIdAssociator::includeBadChambers_
protected

Definition at line 77 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

◆ includeGEM_

bool MuonDetIdAssociator::includeGEM_
protected

Definition at line 78 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

◆ includeME0_

bool MuonDetIdAssociator::includeME0_
protected

Definition at line 79 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().