Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:26

0001 #ifndef Geometry_TrackerGeometryBuilder_TrackerGeometry_H
0002 #define Geometry_TrackerGeometryBuilder_TrackerGeometry_H
0003 
0004 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0005 #include "Geometry/CommonDetUnit/interface/GeomDetEnumerators.h"
0006 #include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h"
0007 
0008 class GeometricDet;
0009 
0010 /**
0011  * A specific Tracker Builder which builds a Tracker from a list of DetUnits. 
0012  * Pattern recognition is used to discover layers, rings etc.
0013  */
0014 class TrackerGeometry final : public TrackingGeometry {
0015   explicit TrackerGeometry(GeometricDet const* gd = nullptr);
0016 
0017   friend class TrackerGeomBuilderFromGeometricDet;
0018 
0019   void addType(GeomDetType const* p);
0020   void addDetUnit(GeomDet const* p);
0021   void addDetUnitId(DetId p);
0022   void addDet(GeomDet const* p);
0023   void addDetId(DetId p);
0024   void finalize();
0025 
0026 public:
0027   typedef GeomDetEnumerators::SubDetector SubDetector;
0028 
0029   enum class ModuleType {
0030     UNKNOWN,
0031     PXB,
0032     PXF,
0033     IB1,
0034     IB2,
0035     OB1,
0036     OB2,
0037     W1A,
0038     W2A,
0039     W3A,
0040     W1B,
0041     W2B,
0042     W3B,
0043     W4,
0044     W5,
0045     W6,
0046     W7,
0047     Ph1PXB,
0048     Ph1PXF,
0049     Ph2PXB,
0050     Ph2PXF,
0051     Ph2PXB3D,
0052     Ph2PXF3D,
0053     Ph2PSP,
0054     Ph2PSS,
0055     Ph2SS
0056   };
0057 
0058   // deleted copy constructor and copy assignment operators
0059   TrackerGeometry(TrackerGeometry const&) = delete;
0060   TrackerGeometry& operator=(TrackerGeometry const&) = delete;
0061 
0062   // defaulted move constructor and move assignment operators
0063   TrackerGeometry(TrackerGeometry&&) = default;
0064   TrackerGeometry& operator=(TrackerGeometry&&) = default;
0065 
0066   ~TrackerGeometry() override;
0067 
0068   const DetTypeContainer& detTypes() const override { return theDetTypes; }
0069   const DetContainer& detUnits() const override { return theDetUnits; }
0070   const DetContainer& dets() const override { return theDets; }
0071   const DetIdContainer& detUnitIds() const override { return theDetUnitIds; }
0072   const DetIdContainer& detIds() const override { return theDetIds; }
0073   const TrackerGeomDet* idToDetUnit(DetId) const override;
0074   const TrackerGeomDet* idToDet(DetId) const override;
0075 
0076   const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const;
0077   unsigned int numberOfLayers(int subdet) const;
0078   bool isThere(GeomDetEnumerators::SubDetector subdet) const;
0079 
0080   unsigned int offsetDU(SubDetector sid) const { return theOffsetDU[sid]; }
0081   unsigned int endsetDU(SubDetector sid) const { return theEndsetDU[sid]; }
0082   // Magic : better be called at the right moment...
0083   void setOffsetDU(SubDetector sid) { theOffsetDU[sid] = detUnits().size(); }
0084   void setEndsetDU(SubDetector sid) { theEndsetDU[sid] = detUnits().size(); }
0085   void fillTestMap(const GeometricDet* gd);
0086 
0087   ModuleType moduleType(const std::string& name) const;
0088 
0089   GeometricDet const* trackerDet() const { return theTrackerDet; }
0090 
0091   const DetContainer& detsPXB() const;
0092   const DetContainer& detsPXF() const;
0093   const DetContainer& detsTIB() const;
0094   const DetContainer& detsTID() const;
0095   const DetContainer& detsTOB() const;
0096   const DetContainer& detsTEC() const;
0097 
0098   ModuleType getDetectorType(DetId) const;
0099   float getDetectorThickness(DetId) const;
0100 
0101 private:
0102   GeometricDet const* theTrackerDet;
0103 
0104   /// Aligner has access to map
0105   friend class GeometryAligner;
0106 
0107   DetTypeContainer theDetTypes;  // owns the DetTypes
0108   DetContainer theDetUnits;      // they're all also into 'theDets', so we assume 'theDets' owns them
0109   unsigned int theOffsetDU[6];   // offsets in the above
0110   unsigned int theEndsetDU[6];   // end offsets in the above
0111   DetContainer theDets;          // owns *ONLY* the GeomDet * corresponding to GluedDets.
0112   DetIdContainer theDetUnitIds;
0113   DetIdContainer theDetIds;
0114   mapIdToDetUnit theMapUnit;  // does not own GeomDetUnit *
0115   mapIdToDet theMap;          // does not own GeomDet *
0116 
0117   DetContainer thePXBDets;  // not owned: they're also in 'theDets'
0118   DetContainer thePXFDets;  // not owned: they're also in 'theDets'
0119   DetContainer theTIBDets;  // not owned: they're also in 'theDets'
0120   DetContainer theTIDDets;  // not owned: they're also in 'theDets'
0121   DetContainer theTOBDets;  // not owned: they're also in 'theDets'
0122   DetContainer theTECDets;  // not owned: they're also in 'theDets'
0123 
0124   GeomDetEnumerators::SubDetector theSubDetTypeMap[6];
0125   unsigned int theNumberOfLayers[6];
0126   std::vector<std::tuple<DetId, TrackerGeometry::ModuleType, float> > theDetTypetList;
0127 };
0128 
0129 #endif