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 (const edm::ParameterSet &pSet)
 
const char * name () const override
 
void setConditions (const DetIdAssociatorRecord &iRecord) override
 
virtual void setCSCBadChambers (const CSCBadChambers *ptr)
 
virtual void setGeometry (const GlobalTrackingGeometry *ptr)
 
void setGeometry (const DetIdAssociatorRecord &iRecord) override
 
- 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 33 of file MuonDetIdAssociator.h.

Constructor & Destructor Documentation

MuonDetIdAssociator::MuonDetIdAssociator ( )
inline

Definition at line 35 of file MuonDetIdAssociator.h.

35 :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 36 of file MuonDetIdAssociator.h.

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 ( const edm::ParameterSet pSet)
inline

Definition at line 39 of file MuonDetIdAssociator.h.

40  :DetIdAssociator(pSet.getParameter<int>("nPhi"),pSet.getParameter<int>("nEta"),pSet.getParameter<double>("etaBinSize")),geometry_(nullptr),cscbadchambers_(nullptr),includeBadChambers_(pSet.getParameter<bool>("includeBadChambers")),includeGEM_(pSet.getParameter<bool>("includeGEM")),includeME0_(pSet.getParameter<bool>("includeME0")){};
T getParameter(std::string const &) const
const CSCBadChambers * cscbadchambers_
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 32 of file MuonDetIdAssociator.cc.

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

Referenced by name().

32  {
33  if (geometry_==nullptr) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
34  if (cscbadchambers_==nullptr) throw cms::Exception("ConfigurationProblem") << "CSCBadChambers is not set\n";
36 }
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 113 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().

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

Implements DetIdAssociator.

Definition at line 38 of file MuonDetIdAssociator.cc.

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

Referenced by getDetIdPoints(), getPosition(), and setConditions().

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

Implements DetIdAssociator.

Definition at line 47 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().

47  {
49  return GlobalPoint(point.x(),point.y(),point.z());
50 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const GeomDet * getGeomDet(const DetId &id) const override
static int position[264][3]
Definition: ReadPGInfo.cc:509
*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 52 of file MuonDetIdAssociator.cc.

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

Referenced by name().

52  {
53  validIds.clear();
54  if (geometry_==nullptr) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
55  if (subDectorIndex!=0) throw cms::Exception("FatalError") <<
56  "Muon sub-dectors are all handle as one sub-system, but subDetectorIndex is not zero.\n";
57 
58  // CSC
59  if (! geometry_->slaveGeometry(CSCDetId()) ) throw cms::Exception("FatalError") << "Cannnot CSCGeometry\n";
60  auto const & geomDetsCSC = geometry_->slaveGeometry(CSCDetId())->dets();
61  for(auto it = geomDetsCSC.begin(); it != geomDetsCSC.end(); ++it)
62  if (auto csc = dynamic_cast<const CSCChamber*>(*it)) {
63  if ((! includeBadChambers_) && (cscbadchambers_->isInBadChamber(CSCDetId(csc->id())))) continue;
64  validIds.push_back(csc->id());
65  }
66 
67  // DT
68  if (! geometry_->slaveGeometry(DTChamberId()) ) throw cms::Exception("FatalError") << "Cannnot DTGeometry\n";
69  auto const & geomDetsDT = geometry_->slaveGeometry(DTChamberId())->dets();
70  for(auto it = geomDetsDT.begin(); it != geomDetsDT.end(); ++it)
71  if (auto dt = dynamic_cast<const DTChamber*>(*it)) validIds.push_back(dt->id());
72 
73  // RPC
74  if (! geometry_->slaveGeometry(RPCDetId()) ) throw cms::Exception("FatalError") << "Cannnot RPCGeometry\n";
75  auto const & geomDetsRPC = geometry_->slaveGeometry(RPCDetId())->dets();
76  for(auto it = geomDetsRPC.begin(); it != geomDetsRPC.end(); ++it)
77  if (auto rpc = dynamic_cast<const RPCChamber*>(*it)) {
78  std::vector< const RPCRoll*> rolls = (rpc->rolls());
79  for(std::vector<const RPCRoll*>::iterator r = rolls.begin(); r != rolls.end(); ++r)
80  validIds.push_back((*r)->id().rawId());
81  }
82 
83  // GEM
84  if (includeGEM_){
85  if (! geometry_->slaveGeometry(GEMDetId()) ) throw cms::Exception("FatalError") << "Cannnot GEMGeometry\n";
86  auto const & geomDetsGEM = geometry_->slaveGeometry(GEMDetId())->dets();
87  for(auto it = geomDetsGEM.begin(); it != geomDetsGEM.end(); ++it){
88  if (auto gem = dynamic_cast<const GEMSuperChamber*>(*it)) {
89  validIds.push_back(gem->id());
90  }
91  }
92  }
93  // ME0
94  if (includeME0_){
95  if (! geometry_->slaveGeometry(ME0DetId()) ) throw cms::Exception("FatalError") << "Cannnot ME0Geometry\n";
96  auto const & geomDetsME0 = geometry_->slaveGeometry(ME0DetId())->dets();
97  for(auto it = geomDetsME0.begin(); it != geomDetsME0.end(); ++it){
98  if (auto me0 = dynamic_cast<const ME0Chamber*>(*it)) {
99  validIds.push_back(me0->id());
100  }
101  }
102  }
103 
104 }
float dt
Definition: AMPTWrapper.h:126
const CSCBadChambers * cscbadchambers_
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 106 of file MuonDetIdAssociator.cc.

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

Referenced by name().

106  {
107  if (geometry_==nullptr) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
108  LocalPoint lp = geometry_->idToDet(id)->toLocal(point);
109  return geometry_->idToDet(id)->surface().bounds().inside(lp);
110 }
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
const Bounds & bounds() const
Definition: Surface.h:120
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
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 56 of file MuonDetIdAssociator.h.

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

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

56 { return "AllMuonDetectors"; }
void MuonDetIdAssociator::setConditions ( const DetIdAssociatorRecord iRecord)
inlineoverridevirtual

Reimplemented from DetIdAssociator.

Definition at line 48 of file MuonDetIdAssociator.h.

References getGeomDet(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ESHandle< T >::product(), and setCSCBadChambers().

48  {
49  edm::ESHandle<CSCBadChambers> cscbadchambersH;
50  iRecord.getRecord<CSCBadChambersRcd>().get(cscbadchambersH);
51  setCSCBadChambers(cscbadchambersH.product());
52  };
virtual void setCSCBadChambers(const CSCBadChambers *ptr)
T const * product() const
Definition: ESHandle.h:86
virtual void MuonDetIdAssociator::setCSCBadChambers ( const CSCBadChambers ptr)
inlinevirtual

Definition at line 46 of file MuonDetIdAssociator.h.

References cscbadchambers_.

Referenced by setConditions().

46 { cscbadchambers_ = ptr; }
const CSCBadChambers * cscbadchambers_
virtual void MuonDetIdAssociator::setGeometry ( const GlobalTrackingGeometry ptr)
inlinevirtual

Definition at line 42 of file MuonDetIdAssociator.h.

References geometry_.

Referenced by setGeometry().

42 { geometry_ = ptr; }
const GlobalTrackingGeometry * geometry_
void MuonDetIdAssociator::setGeometry ( const DetIdAssociatorRecord iRecord)
overridevirtual

Member Data Documentation

const CSCBadChambers* MuonDetIdAssociator::cscbadchambers_
protected

Definition at line 72 of file MuonDetIdAssociator.h.

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

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

Definition at line 73 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

bool MuonDetIdAssociator::includeGEM_
protected

Definition at line 74 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().

bool MuonDetIdAssociator::includeME0_
protected

Definition at line 75 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().