Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CSCGeometry_CSCGeometry_h
0002 #define CSCGeometry_CSCGeometry_h
0003 
0004 /** \class CSCGeometry
0005  *
0006  *  The model of the geometry of the endcap muon CSC detectors.
0007  *
0008  *  \author Tim Cox
0009  */
0010 
0011 #include <DataFormats/DetId/interface/DetId.h>
0012 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0013 #include <Geometry/CommonDetUnit/interface/TrackingGeometry.h>
0014 #include <Geometry/CSCGeometry/interface/CSCLayer.h>
0015 #include <vector>
0016 #include <map>
0017 
0018 class GeomDetType;
0019 
0020 class CSCChamber;
0021 class CSCChamberSpecs;
0022 class CSCWireGroupPackage;
0023 
0024 class CSCGeometry : public TrackingGeometry {
0025   typedef std::map<DetId, GeomDet*> CSCDetMap;
0026   // The buffer for specs need not really be a map. Could do it with a vector!
0027   typedef std::map<int, const CSCChamberSpecs*, std::less<int> > CSCSpecsContainer;
0028 
0029 public:
0030   typedef std::vector<const CSCChamber*> ChamberContainer;
0031   typedef std::vector<const CSCLayer*> LayerContainer;
0032 
0033   friend class CSCGeometryBuilder;  //FromDDD;
0034   friend class GeometryAligner;
0035 
0036   /// Default constructor
0037   CSCGeometry();
0038 
0039   /// Real constructor
0040   CSCGeometry(
0041       bool debugV, bool gangedstripsME1a_, bool onlywiresME1a_, bool realWireGeometry_, bool useCentreTIOffsets_);
0042 
0043   /// Destructor
0044   ~CSCGeometry() override;
0045 
0046   void clear();
0047 
0048   //---- Base class' interface
0049 
0050   // Return a vector of all det types
0051   const DetTypeContainer& detTypes() const override;
0052 
0053   // Return a vector of all GeomDetUnit
0054   const DetContainer& detUnits() const override;
0055 
0056   // Return a vector of all GeomDet (including all GeomDetUnits)
0057   const DetContainer& dets() const override;
0058 
0059   // Return a vector of all GeomDetUnit DetIds
0060   const DetIdContainer& detUnitIds() const override;
0061 
0062   // Return a vector of all GeomDet DetIds (including those of GeomDetUnits)
0063   const DetIdContainer& detIds() const override;
0064 
0065   // Return the pointer to the GeomDetUnit corresponding to a given DetId
0066   const GeomDet* idToDetUnit(DetId) const override;
0067 
0068   // Return the pointer to the GeomDet corresponding to a given DetId
0069   const GeomDet* idToDet(DetId) const override;
0070 
0071   //---- Extension of the interface
0072 
0073   /// Return the chamber corresponding to given DetId
0074   const CSCChamber* chamber(CSCDetId id) const;
0075 
0076   /// Return the layer corresponding to given DetId
0077   const CSCLayer* layer(CSCDetId id) const;
0078 
0079   /// Return a vector of all chambers
0080   const ChamberContainer& chambers() const;
0081 
0082   /// Return a vector of all layers
0083   const LayerContainer& layers() const;
0084 
0085   /**
0086    * Return the CSCChamberSpecs* for given chamber type
0087    * if it exists, or 0 if it has not been created.
0088    */
0089   const CSCChamberSpecs* findSpecs(int iChamberType);
0090 
0091   /**
0092    * Build CSCChamberSpecs for given chamber type.
0093    *
0094    * @@ a good candidate to be replaced by a factory?
0095    */
0096   const CSCChamberSpecs* buildSpecs(int iChamberType,
0097                                     const std::vector<float>& fpar,
0098                                     const std::vector<float>& fupar,
0099                                     const CSCWireGroupPackage& wg);
0100 
0101   void setGangedStripsInME1a(bool gs) { gangedstripsME1a_ = gs; }
0102   void setOnlyWiresInME1a(bool ow) { onlywiresME1a_ = ow; }
0103   void setUseRealWireGeometry(bool rwg) { realWireGeometry_ = rwg; }
0104   void setUseCentreTIOffsets(bool cti) { useCentreTIOffsets_ = cti; }
0105   void setDebugV(bool dbgv) { debugV_ = dbgv; }
0106 
0107   /**
0108    * Ganged strips in ME1a
0109    */
0110   bool gangedStrips() const { return gangedstripsME1a_; }
0111 
0112   /**
0113    * Wires only in ME1a
0114    */
0115   bool wiresOnly() const { return onlywiresME1a_; }
0116 
0117   /**
0118    * Wire geometry modelled as real hardware (complex
0119    * groupings of wires and dead regions) or as a pseudo
0120    * geometry with just one wire grouping per chamber type
0121    * (as was done in ORCA versions up to and including ORCA_8_8_1).
0122    *
0123    */
0124   bool realWireGeometry() const { return realWireGeometry_; }
0125 
0126   /**
0127    * Use the backed-out offsets for theCentreToIntersection in
0128    * CSCLayerGeometry
0129    */
0130   bool centreTIOffsets() const { return useCentreTIOffsets_; }
0131 
0132   /// Dump parameters for overall strip and wire modelling
0133   void queryModelling() const;
0134 
0135 private:
0136   /// deallocate managed memory
0137   void deallocate();
0138 
0139   /// Add a chamber with given DetId.
0140   void addChamber(CSCChamber* ch);
0141 
0142   /// Add a DetUnit
0143   void addLayer(CSCLayer* l);
0144 
0145   /// Add a DetType
0146   void addDetType(GeomDetType* type);
0147 
0148   /// Add a DetId
0149   void addDetId(DetId id);
0150 
0151   /// Add a GeomDet; not to be called by the builder.
0152   void addDet(GeomDet* det);
0153 
0154   // The chambers are owned by the geometry (which in turn own layers)
0155   ChamberContainer theChambers;
0156 
0157   // Map for efficient lookup by DetId
0158   CSCDetMap theMap;
0159 
0160   // These are used rarely; they could be computed at runtime
0161   // to save memory.
0162   DetTypeContainer theDetTypes;
0163   DetContainer theDets;      // all dets (chambers and layers)
0164   DetContainer theDetUnits;  // all layers
0165   DetIdContainer theDetIds;
0166   DetIdContainer theDetUnitIds;
0167 
0168   // These are reduntant copies, to satisfy the interface.
0169   LayerContainer theLayers;
0170 
0171   // Parameters controlling modelling of geometry
0172 
0173   bool debugV_;  // for debug printout etc.
0174 
0175   bool gangedstripsME1a_;
0176   bool onlywiresME1a_;
0177   bool realWireGeometry_;
0178   bool useCentreTIOffsets_;
0179 
0180   // Store pointers to Specs objects as we build them.
0181   CSCSpecsContainer specsContainer;
0182 };
0183 
0184 #endif