CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Geometry/CSCGeometry/interface/CSCGeometry.h

Go to the documentation of this file.
00001 #ifndef CSCGeometry_CSCGeometry_h
00002 #define CSCGeometry_CSCGeometry_h
00003 
00011 #include <DataFormats/DetId/interface/DetId.h>
00012 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00013 #include <Geometry/CommonDetUnit/interface/TrackingGeometry.h>
00014 #include <Geometry/CSCGeometry/interface/CSCLayer.h>
00015 #include <vector>
00016 #include <map>
00017 
00018 class GeomDetType;
00019 class GeomDetUnit;
00020 class CSCChamber;
00021 class CSCChamberSpecs;
00022 class CSCWireGroupPackage;
00023 
00024 class CSCGeometry : public TrackingGeometry {
00025 
00026   typedef std::map<DetId, GeomDet*> CSCDetMap;
00027   // The buffer for specs need not really be a map. Could do it with a vector!
00028   typedef std::map<int, const CSCChamberSpecs*, std::less<int> > CSCSpecsContainer;
00029   typedef std::vector<CSCChamber*> ChamberContainer;
00030   typedef std::vector<CSCLayer*> LayerContainer;
00031 
00032  public:
00033 
00034   friend class CSCGeometryBuilder; //FromDDD;
00035   friend class GeometryAligner;
00036 
00038   CSCGeometry();
00039 
00041   CSCGeometry( bool debugV, bool gangedstripsME1a_, bool onlywiresME1a_, bool realWireGeometry_, bool useCentreTIOffsets_ );
00042 
00044   virtual ~CSCGeometry();
00045 
00046   //---- Base class' interface
00047 
00048   // Return a vector of all det types
00049   virtual const DetTypeContainer&  detTypes() const;
00050 
00051   // Return a vector of all GeomDetUnit
00052   virtual const DetUnitContainer& detUnits() const;
00053 
00054   // Return a vector of all GeomDet (including all GeomDetUnits)
00055   virtual const DetContainer& dets() const;
00056   
00057   // Return a vector of all GeomDetUnit DetIds
00058   virtual const DetIdContainer&    detUnitIds() const;
00059 
00060   // Return a vector of all GeomDet DetIds (including those of GeomDetUnits)
00061   virtual const DetIdContainer& detIds() const;
00062 
00063   // Return the pointer to the GeomDetUnit corresponding to a given DetId
00064   virtual const GeomDetUnit* idToDetUnit(DetId) const;
00065 
00066   // Return the pointer to the GeomDet corresponding to a given DetId
00067   virtual const GeomDet* idToDet(DetId) const;
00068 
00069   //---- Extension of the interface
00070 
00072   const CSCChamber* chamber(CSCDetId id) const;
00073 
00075   const CSCLayer* layer(CSCDetId id) const;
00076 
00078   const ChamberContainer& chambers() const;
00079 
00081   const LayerContainer& layers() const;
00082 
00083 
00084 
00089   const CSCChamberSpecs* findSpecs( int iChamberType );
00090 
00096   const CSCChamberSpecs* buildSpecs( int iChamberType,
00097                                  const std::vector<float>& fpar,
00098                                  const std::vector<float>& fupar,
00099                                  const CSCWireGroupPackage& wg );
00100 
00101   void setGangedStripsInME1a(bool gs) { gangedstripsME1a_ = gs; }
00102   void setOnlyWiresInME1a(bool ow) { onlywiresME1a_ = ow; }
00103   void setUseRealWireGeometry(bool rwg) { realWireGeometry_ = rwg; }
00104   void setUseCentreTIOffsets(bool cti) { useCentreTIOffsets_ = cti; }
00105   void setDebugV(bool dbgv) { debugV_ = dbgv; }
00106 
00110   bool gangedStrips() const { return gangedstripsME1a_; }
00111 
00115   bool wiresOnly() const { return onlywiresME1a_; }
00116 
00124   bool realWireGeometry() const { return realWireGeometry_; }
00125 
00130   bool centreTIOffsets() const { return useCentreTIOffsets_; }
00131 
00133   void queryModelling() const;
00134 
00135  private:
00136 
00138   void addChamber(CSCChamber* ch);
00139   
00141   void addLayer(CSCLayer* l);
00142 
00144   void addDetType(GeomDetType* type);
00145 
00147   void addDetId(DetId id);
00148 
00150   void addDet(GeomDet* det);
00151 
00152   // The chambers are owned by the geometry (which in turn own layers)
00153   ChamberContainer  theChambers; 
00154 
00155   // Map for efficient lookup by DetId 
00156   CSCDetMap         theMap;
00157 
00158   // These are used rarely; they could be computed at runtime 
00159   // to save memory.
00160   DetTypeContainer  theDetTypes;
00161   DetContainer      theDets;       // all dets (chambers and layers)
00162   DetUnitContainer  theDetUnits;   // all layers
00163   DetIdContainer    theDetIds;
00164   DetIdContainer    theDetUnitIds;
00165 
00166   // These are reduntant copies, to satisfy the interface.
00167   LayerContainer    theLayers;
00168 
00169   // Parameters controlling modelling of geometry 
00170 
00171   bool debugV_; // for debug printout etc.
00172 
00173   bool gangedstripsME1a_;
00174   bool onlywiresME1a_;
00175   bool realWireGeometry_;
00176   bool useCentreTIOffsets_;
00177 
00178   // Store pointers to Specs objects as we build them.
00179   CSCSpecsContainer specsContainer;
00180 
00181 };
00182 
00183 #endif
00184