Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Geometry_MTDGeometryBuilder_MTDGeometry_H
0002 #define Geometry_MTDGeometryBuilder_MTDGeometry_H
0003 
0004 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0005 #include "Geometry/CommonDetUnit/interface/GeomDetEnumerators.h"
0006 #include "Geometry/CommonDetUnit/interface/MTDGeomDet.h"
0007 
0008 class GeometricTimingDet;
0009 
0010 /**
0011  * A specific MTD Builder which builds MTD from a list of DetUnits. 
0012  * Pattern recognition is used to discover layers, rings etc.
0013  */
0014 class MTDGeometry final : public TrackingGeometry {
0015 public:
0016   using SubDetector = GeomDetEnumerators::SubDetector;
0017 
0018   enum class ModuleType {
0019     UNKNOWN,
0020     BTL,
0021     ETL,
0022   };
0023 
0024   ~MTDGeometry() override;
0025 
0026   const DetTypeContainer& detTypes() const override { return theDetTypes; }
0027   const DetContainer& detUnits() const override { return theDetUnits; }
0028   const DetContainer& dets() const override { return theDets; }
0029   const DetIdContainer& detUnitIds() const override { return theDetUnitIds; }
0030   const DetIdContainer& detIds() const override { return theDetIds; }
0031   const MTDGeomDet* idToDetUnit(DetId) const override;
0032   const MTDGeomDet* idToDet(DetId) const override;
0033 
0034   const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const;
0035   unsigned int numberOfLayers(int subdet) const;
0036   bool isThere(GeomDetEnumerators::SubDetector subdet) const;
0037 
0038   unsigned int offsetDU(unsigned sid) const { return theOffsetDU[sid]; }
0039   unsigned int endsetDU(unsigned sid) const { return theEndsetDU[sid]; }
0040   // Magic : better be called at the right moment...
0041   void setOffsetDU(unsigned sid) { theOffsetDU[sid] = detUnits().size(); }
0042   void setEndsetDU(unsigned sid) { theEndsetDU[sid] = detUnits().size(); }
0043   void fillTestMap(const GeometricTimingDet* gd);
0044 
0045   ModuleType moduleType(const std::string& name) const;
0046 
0047   GeometricTimingDet const* trackerDet() const { return theTrackerDet; }
0048 
0049   const DetContainer& detsBTL() const;
0050   const DetContainer& detsETL() const;
0051 
0052   ModuleType getDetectorType(DetId) const;
0053   float getDetectorThickness(DetId) const;
0054 
0055 private:
0056   explicit MTDGeometry(GeometricTimingDet const* gd = nullptr);
0057 
0058   friend class MTDGeomBuilderFromGeometricTimingDet;
0059 
0060   void addType(GeomDetType const* p);
0061   void addDetUnit(GeomDet const* p);
0062   void addDetUnitId(DetId p);
0063   void addDet(GeomDet const* p);
0064   void addDetId(DetId p);
0065   void finalize();
0066 
0067   GeometricTimingDet const* theTrackerDet;
0068 
0069   /// Aligner has access to map
0070   friend class GeometryAligner;
0071 
0072   DetTypeContainer theDetTypes;  // owns the DetTypes
0073   DetContainer theDetUnits;      // they're all also into 'theDets', so we assume 'theDets' owns them
0074   unsigned int theOffsetDU[2];   // offsets in the above
0075   unsigned int theEndsetDU[2];   // end offsets in the above
0076   DetContainer theDets;          // owns *ONLY* the GeomDet * corresponding to GluedDets.
0077   DetIdContainer theDetUnitIds;
0078   DetIdContainer theDetIds;
0079   mapIdToDetUnit theMapUnit;  // does not own GeomDetUnit *
0080   mapIdToDet theMap;          // does not own GeomDet *
0081 
0082   DetContainer theBTLDets;  // not owned: they're also in 'theDets'
0083   DetContainer theETLDets;  // not owned: they're also in 'theDets'
0084 
0085   GeomDetEnumerators::SubDetector theSubDetTypeMap[2];
0086   unsigned int theNumberOfLayers[2];
0087   std::vector<std::tuple<DetId, MTDGeometry::ModuleType, float> > theDetTypetList;
0088 };
0089 
0090 #endif