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 *=0) 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::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::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_
double etaBinSize() const
look-up map bin size in eta dimension
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
const GlobalTrackingGeometry * geometry_
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_
double etaBinSize() const
look-up map bin size in eta dimension
DetIdAssociator(const int nPhi, const int nEta, const double etaBinSize)
const GlobalTrackingGeometry * geometry_

Member Function Documentation

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_.

Referenced by name().

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_
virtual void check_setup() const
const GlobalTrackingGeometry * geometry_
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.

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

Referenced by name().

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 }
virtual float length() const =0
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const Bounds & bounds() const
Definition: Surface.h:89
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual float width() const =0
virtual float thickness() const =0
const GeomDet * getGeomDet(const DetId &id) const override
const GlobalTrackingGeometry * geometry_
const GeomDet * idToDet(DetId) const override
Definition: Bounds.h:20
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(), getPosition(), and setCSCBadChambers().

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 GlobalTrackingGeometry * geometry_
const GeomDet * idToDet(DetId) const override
GlobalPoint MuonDetIdAssociator::getPosition ( const DetId id) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 48 of file MuonDetIdAssociator.cc.

References getGeomDet(), point, position, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by name().

48  {
50  return GlobalPoint(point.x(), point.y(), point.z());
51 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const GeomDet * getGeomDet(const DetId &id) const override
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
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, geometry_, includeBadChambers_, includeGEM_, includeME0_, CSCBadChambers::isInBadChamber(), mixOne_premix_on_sim_cfi::me0, alignCSCRings::r, omtf::DataWord64::rpc, and GlobalTrackingGeometry::slaveGeometry().

Referenced by name().

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 }
float dt
Definition: AMPTWrapper.h:136
const CSCBadChambers * cscbadchambers_
Definition: AMC13Event.h:6
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
const TrackingGeometry * slaveGeometry(DetId id) const
Return the pointer to the actual geometry for a given DetId.
virtual const DetContainer & dets() const =0
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: L1Track.h:19
const GlobalTrackingGeometry * geometry_
bool MuonDetIdAssociator::insideElement ( const GlobalPoint point,
const DetId id 
) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 115 of file MuonDetIdAssociator.cc.

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

Referenced by name().

115  {
116  if (geometry_ == nullptr)
117  throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
118  LocalPoint lp = geometry_->idToDet(id)->toLocal(point);
119  return geometry_->idToDet(id)->surface().bounds().inside(lp);
120 }
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
const Bounds & bounds() const
Definition: Surface.h:89
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
const GlobalTrackingGeometry * geometry_
const GeomDet * idToDet(DetId) const override
const char* MuonDetIdAssociator::name ( void  ) const
inlineoverridevirtual

Implements DetIdAssociator.

Definition at line 60 of file MuonDetIdAssociator.h.

References check_setup(), getDetIdPoints(), getPosition(), getValidDetIds(), insideElement(), point, and HLT_2018_cff::points.

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

60 { return "AllMuonDetectors"; }
virtual void MuonDetIdAssociator::setCSCBadChambers ( const CSCBadChambers ptr)
inlinevirtual

Definition at line 56 of file MuonDetIdAssociator.h.

References cscbadchambers_, and getGeomDet().

56 { cscbadchambers_ = ptr; }
const CSCBadChambers * cscbadchambers_
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

const CSCBadChambers* MuonDetIdAssociator::cscbadchambers_
protected

Definition at line 76 of file MuonDetIdAssociator.h.

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

const GlobalTrackingGeometry* MuonDetIdAssociator::geometry_
protected
bool MuonDetIdAssociator::includeBadChambers_
protected

Definition at line 77 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

bool MuonDetIdAssociator::includeGEM_
protected

Definition at line 78 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

bool MuonDetIdAssociator::includeME0_
protected

Definition at line 79 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().