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 MapRange &mapRange) 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 &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){};

◆ 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){};

◆ MuonDetIdAssociator() [3/3]

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

Member Function Documentation

◆ check_setup()

void MuonDetIdAssociator::check_setup ( ) const
overrideprotectedvirtual

Reimplemented from DetIdAssociator.

Definition at line 31 of file MuonDetIdAssociator.cc.

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 }

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

◆ 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 122 of file MuonDetIdAssociator.cc.

123  {
124  points.clear();
125  points.reserve(8);
126  const GeomDet* geomDet = getGeomDet(id);
127 
128  // the coners of muon detector elements are not stored and can be only calculated
129  // based on methods defined in the interface class Bounds:
130  // width() - x
131  // length() - y
132  // thinkness() - z
133  // NOTE: this convention is implementation specific and can fail. Both
134  // RectangularPlaneBounds and TrapezoidalPlaneBounds use it.
135  // Even though the CSC geomtry is more complicated (trapezoid), it's enough
136  // to estimate which bins should contain this element. For the distance
137  // calculation from the edge, we will use exact geometry to get it right.
138 
139  const Bounds* bounds = &(geometry_->idToDet(id)->surface().bounds());
140  points.push_back(
141  geomDet->toGlobal(LocalPoint(+bounds->width() / 2, +bounds->length() / 2, +bounds->thickness() / 2)));
142  points.push_back(
143  geomDet->toGlobal(LocalPoint(-bounds->width() / 2, +bounds->length() / 2, +bounds->thickness() / 2)));
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 
157  return std::pair<const_iterator, const_iterator>(points.begin(), points.end());
158 }

References Surface::bounds(), geometry_, getGeomDet(), GlobalTrackingGeometry::idToDet(), Bounds::length(), HLT_FULL_cff::points, GeomDet::surface(), Bounds::thickness(), GeomDet::toGlobal(), and Bounds::width().

◆ getGeomDet()

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

Implements DetIdAssociator.

Definition at line 39 of file MuonDetIdAssociator.cc.

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 }

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

Referenced by getDetIdPoints(), and getPosition().

◆ getPosition()

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

Implements DetIdAssociator.

Definition at line 48 of file MuonDetIdAssociator.cc.

48  {
50  return GlobalPoint(point.x(), point.y(), point.z());
51 }

References getGeomDet(), point, and position.

◆ getValidDetIds()

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

Implements DetIdAssociator.

Definition at line 53 of file MuonDetIdAssociator.cc.

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  validIds.push_back(gem->id());
99  }
100  }
101  }
102  // ME0
103  if (includeME0_) {
105  throw cms::Exception("FatalError") << "Cannnot ME0Geometry\n";
106  auto const& geomDetsME0 = geometry_->slaveGeometry(ME0DetId())->dets();
107  for (auto it = geomDetsME0.begin(); it != geomDetsME0.end(); ++it) {
108  if (auto me0 = dynamic_cast<const ME0Chamber*>(*it)) {
109  validIds.push_back(me0->id());
110  }
111  }
112  }
113 }

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

◆ insideElement()

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

Implements DetIdAssociator.

Definition at line 115 of file MuonDetIdAssociator.cc.

115  {
116  if (geometry_ == nullptr)
117  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
119  return geometry_->idToDet(id)->surface().bounds().inside(lp);
120 }

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

◆ name()

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

Implements DetIdAssociator.

Definition at line 60 of file MuonDetIdAssociator.h.

60 { return "AllMuonDetectors"; }

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

◆ setCSCBadChambers()

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

Definition at line 56 of file MuonDetIdAssociator.h.

56 { cscbadchambers_ = ptr; }

References cscbadchambers_.

◆ setGeometry()

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

Definition at line 54 of file MuonDetIdAssociator.h.

54 { geometry_ = ptr; }

References 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().

Bounds::width
virtual float width() const =0
GeomDet
Definition: GeomDet.h:27
DetIdAssociator::DetIdAssociator
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
Definition: DetIdAssociator.cc:24
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21469
HLT_FULL_cff.nEta
nEta
Definition: HLT_FULL_cff.py:6585
RPCDetId
Definition: RPCDetId.h:16
Bounds
Definition: Bounds.h:18
TrackingGeometry::dets
virtual const DetContainer & dets() const =0
Returm a vector of all GeomDet (including all GeomDetUnits)
Bounds::length
virtual float length() const =0
dt
float dt
Definition: AMPTWrapper.h:136
csc
Definition: L1Track.h:19
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
DetIdAssociator::etaBinSize
double etaBinSize() const
look-up map bin size in eta dimension
Definition: DetIdAssociator.h:108
Bounds::inside
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
MuonDetIdAssociator::includeME0_
bool includeME0_
Definition: MuonDetIdAssociator.h:79
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, LocalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
CSCBadChambers::isInBadChamber
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index 'ichamber' flagged as bad?
Definition: CSCBadChambers.cc:4
Bounds::thickness
virtual float thickness() const =0
MuonDetIdAssociator::geometry_
const GlobalTrackingGeometry * geometry_
Definition: MuonDetIdAssociator.h:74
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
mixOne_premix_on_sim_cfi.me0
me0
Definition: mixOne_premix_on_sim_cfi.py:309
HLT_FULL_cff.includeME0
includeME0
Definition: HLT_FULL_cff.py:6590
GEMDetId
Definition: GEMDetId.h:18
CSCDetId
Definition: CSCDetId.h:26
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
HLT_FULL_cff.nPhi
nPhi
Definition: HLT_FULL_cff.py:6586
GlobalTrackingGeometry::slaveGeometry
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
Definition: GlobalTrackingGeometry.cc:54
ME0DetId
Definition: ME0DetId.h:16
HLT_FULL_cff.includeBadChambers
includeBadChambers
Definition: HLT_FULL_cff.py:6588
gem
Definition: AMC13Event.h:6
MuonDetIdAssociator::cscbadchambers_
const CSCBadChambers * cscbadchambers_
Definition: MuonDetIdAssociator.h:76
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HLT_FULL_cff.includeGEM
includeGEM
Definition: HLT_FULL_cff.py:6589
MuonDetIdAssociator::includeBadChambers_
bool includeBadChambers_
Definition: MuonDetIdAssociator.h:77
Exception
Definition: hltDiff.cc:245
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
DetIdAssociator::check_setup
virtual void check_setup() const
Definition: DetIdAssociator.cc:371
cms::Exception
Definition: Exception.h:70
DTChamberId
Definition: DTChamberId.h:14
MuonDetIdAssociator::getGeomDet
const GeomDet * getGeomDet(const DetId &id) const override
Definition: MuonDetIdAssociator.cc:39
point
*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
omtf::DataWord64::rpc
Definition: OmtfDataWord64.h:16
MuonDetIdAssociator::includeGEM_
bool includeGEM_
Definition: MuonDetIdAssociator.h:78