CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual const GeomDetgetGeomDet (const DetId &id) const override
 
 MuonDetIdAssociator ()
 
 MuonDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 
 MuonDetIdAssociator (const edm::ParameterSet &pSet)
 
virtual const char * name () const override
 
virtual void setConditions (const DetIdAssociatorRecord &iRecord) override
 
virtual void setCSCBadChambers (const CSCBadChambers *ptr)
 
virtual void setGeometry (const GlobalTrackingGeometry *ptr)
 
virtual 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

virtual void check_setup () const override
 
virtual std::pair
< const_iterator,
const_iterator
getDetIdPoints (const DetId &id, std::vector< GlobalPoint > &points) const override
 
virtual GlobalPoint getPosition (const DetId &id) const override
 
virtual void getValidDetIds (unsigned int, std::vector< DetId > &) const override
 
virtual 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_
 
- 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 32 of file MuonDetIdAssociator.h.

Constructor & Destructor Documentation

MuonDetIdAssociator::MuonDetIdAssociator ( )
inline

Definition at line 34 of file MuonDetIdAssociator.h.

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

39  :DetIdAssociator(pSet.getParameter<int>("nPhi"),pSet.getParameter<int>("nEta"),pSet.getParameter<double>("etaBinSize")),geometry_(0),cscbadchambers_(0),includeBadChambers_(pSet.getParameter<bool>("includeBadChambers")){};
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 30 of file MuonDetIdAssociator.cc.

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

30  {
31  if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
32  if (cscbadchambers_==0) throw cms::Exception("ConfigurationProblem") << "CSCBadChambers is not set\n";
34 }
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 90 of file MuonDetIdAssociator.cc.

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

91 {
92  points.clear();
93  points.reserve(8);
94  const GeomDet* geomDet = getGeomDet( id );
95 
96  // the coners of muon detector elements are not stored and can be only calculated
97  // based on methods defined in the interface class Bounds:
98  // width() - x
99  // length() - y
100  // thinkness() - z
101  // NOTE: this convention is implementation specific and can fail. Both
102  // RectangularPlaneBounds and TrapezoidalPlaneBounds use it.
103  // Even though the CSC geomtry is more complicated (trapezoid), it's enough
104  // to estimate which bins should contain this element. For the distance
105  // calculation from the edge, we will use exact geometry to get it right.
106 
107  const Bounds* bounds = &(geometry_->idToDet(id)->surface().bounds());
108  points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2)));
109  points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,+bounds->thickness()/2)));
110  points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2)));
111  points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,+bounds->thickness()/2)));
112  points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2)));
113  points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,+bounds->length()/2,-bounds->thickness()/2)));
114  points.push_back(geomDet->toGlobal(LocalPoint(+bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2)));
115  points.push_back(geomDet->toGlobal(LocalPoint(-bounds->width()/2,-bounds->length()/2,-bounds->thickness()/2)));
116 
117  return std::pair<const_iterator,const_iterator>(points.begin(),points.end());
118 }
virtual float length() const =0
virtual const GeomDet * getGeomDet(const DetId &id) const override
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 thickness() const =0
virtual const GeomDet * idToDet(DetId) const
const GlobalTrackingGeometry * geometry_
Definition: Bounds.h:22
virtual float width() const =0
const GeomDet * MuonDetIdAssociator::getGeomDet ( const DetId id) const
overridevirtual

Implements DetIdAssociator.

Definition at line 36 of file MuonDetIdAssociator.cc.

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

Referenced by getDetIdPoints(), and getPosition().

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

Implements DetIdAssociator.

Definition at line 45 of file MuonDetIdAssociator.cc.

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

45  {
47  return GlobalPoint(point.x(),point.y(),point.z());
48 }
virtual const GeomDet * getGeomDet(const DetId &id) const override
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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 50 of file MuonDetIdAssociator.cc.

References cscbadchambers_, CSCDetId, TrackingGeometry::dets(), dt, DTChamberId, Exception, geometry_, includeBadChambers_, CSCBadChambers::isInBadChamber(), alignCSCRings::r, RPCDetId, and GlobalTrackingGeometry::slaveGeometry().

50  {
51  validIds.clear();
52  if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
53  if (subDectorIndex!=0) throw cms::Exception("FatalError") <<
54  "Muon sub-dectors are all handle as one sub-system, but subDetectorIndex is not zero.\n";
55 
56  // CSC
57  if (! geometry_->slaveGeometry(CSCDetId()) ) throw cms::Exception("FatalError") << "Cannnot CSCGeometry\n";
58  auto const & geomDetsCSC = geometry_->slaveGeometry(CSCDetId())->dets();
59  for(auto it = geomDetsCSC.begin(); it != geomDetsCSC.end(); ++it)
60  if (auto csc = dynamic_cast<const CSCChamber*>(*it)) {
61  if ((! includeBadChambers_) && (cscbadchambers_->isInBadChamber(CSCDetId(csc->id())))) continue;
62  validIds.push_back(csc->id());
63  }
64 
65  // DT
66  if (! geometry_->slaveGeometry(DTChamberId()) ) throw cms::Exception("FatalError") << "Cannnot DTGeometry\n";
67  auto const & geomDetsDT = geometry_->slaveGeometry(DTChamberId())->dets();
68  for(auto it = geomDetsDT.begin(); it != geomDetsDT.end(); ++it)
69  if (auto dt = dynamic_cast<const DTChamber*>(*it)) validIds.push_back(dt->id());
70 
71  // RPC
72  if (! geometry_->slaveGeometry(RPCDetId()) ) throw cms::Exception("FatalError") << "Cannnot RPCGeometry\n";
73  auto const & geomDetsRPC = geometry_->slaveGeometry(RPCDetId())->dets();
74  for(auto it = geomDetsRPC.begin(); it != geomDetsRPC.end(); ++it)
75  if (auto rpc = dynamic_cast<const RPCChamber*>(*it)) {
76  std::vector< const RPCRoll*> rolls = (rpc->rolls());
77  for(std::vector<const RPCRoll*>::iterator r = rolls.begin(); r != rolls.end(); ++r)
78  validIds.push_back((*r)->id().rawId());
79  }
80 
81 }
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)
const GlobalTrackingGeometry * geometry_
bool MuonDetIdAssociator::insideElement ( const GlobalPoint point,
const DetId id 
) const
overrideprotectedvirtual

Implements DetIdAssociator.

Definition at line 83 of file MuonDetIdAssociator.cc.

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

83  {
84  if (geometry_==0) throw cms::Exception("ConfigurationProblem") << "GlobalTrackingGeomtry is not set\n";
85  LocalPoint lp = geometry_->idToDet(id)->toLocal(point);
86  return geometry_->idToDet(id)->surface().bounds().inside(lp);
87 }
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:69
const Bounds & bounds() const
Definition: Surface.h:120
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
virtual const GeomDet * idToDet(DetId) const
const GlobalTrackingGeometry * geometry_
virtual const char* MuonDetIdAssociator::name ( void  ) const
inlineoverridevirtual
virtual void MuonDetIdAssociator::setConditions ( const DetIdAssociatorRecord iRecord)
inlineoverridevirtual

Reimplemented from DetIdAssociator.

Definition at line 47 of file MuonDetIdAssociator.h.

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

47  {
48  edm::ESHandle<CSCBadChambers> cscbadchambersH;
49  iRecord.getRecord<CSCBadChambersRcd>().get(cscbadchambersH);
50  setCSCBadChambers(cscbadchambersH.product());
51  };
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 45 of file MuonDetIdAssociator.h.

References cscbadchambers_.

Referenced by setConditions().

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

Definition at line 41 of file MuonDetIdAssociator.h.

References geometry_.

Referenced by setGeometry().

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

Member Data Documentation

const CSCBadChambers* MuonDetIdAssociator::cscbadchambers_
protected

Definition at line 71 of file MuonDetIdAssociator.h.

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

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

Definition at line 72 of file MuonDetIdAssociator.h.

Referenced by getValidDetIds().