GlobalTrackingGeometry

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#ifndef GlobalTrackingGeometry_h
#define GlobalTrackingGeometry_h

/** \class GlobalTrackingGeometry
 *
 *  Single entry point to the tracker and muon geometries.
 *  The main purpose is to provide the methods idToDetUnit(DetId) and idToDet(DetId)
 *  that allow to get an element of the geometry given its DetId, regardless of wich subdetector it belongs.
 * 
 *  The slave geometries (TrackerGeometry, MTDGeometry, DTGeometry, CSCGeometry, RPCGeometry, GEMGeometry, ME0Geometry) 
 *  are accessible with the method slaveGeometry(DetId).
 *
 *  \author M. Sani
 */

#include "Geometry/CommonTopologies/interface/TrackingGeometry.h"
#include <vector>
#include <atomic>

class GlobalTrackingGeometry : public TrackingGeometry {
public:
  GlobalTrackingGeometry(std::vector<const TrackingGeometry*>& geos);

  ~GlobalTrackingGeometry() override;

  // Return a vector of all det types.
  const DetTypeContainer& detTypes() const override;

  // Returm a vector of all GeomDetUnit
  const DetContainer& detUnits() const override;

  // Returm a vector of all GeomDet (including all GeomDetUnits)
  const DetContainer& dets() const override;

  // Returm a vector of all GeomDetUnit DetIds
  const DetIdContainer& detUnitIds() const override;

  // Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
  const DetIdContainer& detIds() const override;

  // Return the pointer to the GeomDetUnit corresponding to a given DetId
  const GeomDet* idToDetUnit(DetId) const override;

  // Return the pointer to the GeomDet corresponding to a given DetId
  // (valid also for GeomDetUnits)
  const GeomDet* idToDet(DetId) const override;

  /// Return the pointer to the actual geometry for a given DetId
  const TrackingGeometry* slaveGeometry(DetId id) const;

private:
  std::vector<const TrackingGeometry*> theGeometries;

  // The const methods claim to simply return these vectors,
  // but actually, they'll fill them up the first time they
  // are called, which is rare (or never).
  mutable std::atomic<DetTypeContainer*> theDetTypes;
  mutable std::atomic<DetContainer*> theDetUnits;
  mutable std::atomic<DetContainer*> theDets;
  mutable std::atomic<DetIdContainer*> theDetUnitIds;
  mutable std::atomic<DetIdContainer*> theDetIds;
};

#endif