Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:51

0001 #ifndef GlobalTrackingGeometry_h
0002 #define GlobalTrackingGeometry_h
0003 
0004 /** \class GlobalTrackingGeometry
0005  *
0006  *  Single entry point to the tracker and muon geometries.
0007  *  The main purpose is to provide the methods idToDetUnit(DetId) and idToDet(DetId)
0008  *  that allow to get an element of the geometry given its DetId, regardless of wich subdetector it belongs.
0009  * 
0010  *  The slave geometries (TrackerGeometry, MTDGeometry, DTGeometry, CSCGeometry, RPCGeometry, GEMGeometry, ME0Geometry) 
0011  *  are accessible with the method slaveGeometry(DetId).
0012  *
0013  *  \author M. Sani
0014  */
0015 
0016 #include "Geometry/CommonTopologies/interface/TrackingGeometry.h"
0017 #include <vector>
0018 #include <atomic>
0019 
0020 class GlobalTrackingGeometry : public TrackingGeometry {
0021 public:
0022   GlobalTrackingGeometry(std::vector<const TrackingGeometry*>& geos);
0023 
0024   ~GlobalTrackingGeometry() override;
0025 
0026   // Return a vector of all det types.
0027   const DetTypeContainer& detTypes() const override;
0028 
0029   // Returm a vector of all GeomDetUnit
0030   const DetContainer& detUnits() const override;
0031 
0032   // Returm a vector of all GeomDet (including all GeomDetUnits)
0033   const DetContainer& dets() const override;
0034 
0035   // Returm a vector of all GeomDetUnit DetIds
0036   const DetIdContainer& detUnitIds() const override;
0037 
0038   // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
0039   const DetIdContainer& detIds() const override;
0040 
0041   // Return the pointer to the GeomDetUnit corresponding to a given DetId
0042   const GeomDet* idToDetUnit(DetId) const override;
0043 
0044   // Return the pointer to the GeomDet corresponding to a given DetId
0045   // (valid also for GeomDetUnits)
0046   const GeomDet* idToDet(DetId) const override;
0047 
0048   /// Return the pointer to the actual geometry for a given DetId
0049   const TrackingGeometry* slaveGeometry(DetId id) const;
0050 
0051 private:
0052   std::vector<const TrackingGeometry*> theGeometries;
0053 
0054   // The const methods claim to simply return these vectors,
0055   // but actually, they'll fill them up the first time they
0056   // are called, which is rare (or never).
0057   mutable std::atomic<DetTypeContainer*> theDetTypes;
0058   mutable std::atomic<DetContainer*> theDetUnits;
0059   mutable std::atomic<DetContainer*> theDets;
0060   mutable std::atomic<DetIdContainer*> theDetUnitIds;
0061   mutable std::atomic<DetIdContainer*> theDetIds;
0062 };
0063 
0064 #endif