Location

SubDetector

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 65 66 67 68 69 70
#ifndef _COMMONDETUNIT_GEOMDETENUMERATORS_H_
#define _COMMONDETUNIT_GEOMDETENUMERATORS_H_

#include <iosfwd>

/** Global enumerators for Det types.
 */
namespace GeomDetEnumerators {
  enum Location { barrel, endcap, invalidLoc };
  enum SubDetector {
    PixelBarrel,
    PixelEndcap,
    TIB,
    TOB,
    TID,
    TEC,
    CSC,
    DT,
    RPCBarrel,
    RPCEndcap,
    GEM,
    ME0,
    P2OTB,
    P2OTEC,
    P1PXB,
    P1PXEC,
    P2PXB,
    P2PXEC,
    TimingBarrel,
    TimingEndcap,
    invalidDet
  };
  // gives subdetId in DetId conrrepsonding to the above
  constexpr unsigned int subDetId[21] = {1, 2, 3, 5, 4, 6, 0, 0, 0, 0, 0,
                                         0, 5, 4, 1, 2, 1, 2, 2, 2, 0};  // don't ask, don't ask, simply do not ask!
  //inverse (only for tracker)
  constexpr SubDetector tkDetEnum[8] = {
      invalidDet, PixelBarrel, PixelEndcap, TIB, TID, TOB, TEC, invalidDet};  // don't ask, don't ask, simply do not ask!
  //to convert a physical subdetector (it could be larger than 5) into a geometry subdetector (between 0 and 5). ONLY for tracker
  constexpr SubDetector subDetGeom[21] = {PixelBarrel, PixelEndcap, TIB,         TOB,         TID,         TEC,
                                          invalidDet,  invalidDet,  invalidDet,  invalidDet,  invalidDet,  invalidDet,
                                          TOB,         TID,         PixelBarrel, PixelEndcap, PixelBarrel, PixelEndcap,
                                          invalidDet,  invalidDet,  invalidDet};

  bool isBarrel(GeomDetEnumerators::SubDetector m);
  bool isEndcap(GeomDetEnumerators::SubDetector m);

  bool isTrackerPixel(GeomDetEnumerators::SubDetector m);
  bool isTrackerStrip(GeomDetEnumerators::SubDetector m);
  bool isTracker(GeomDetEnumerators::SubDetector m);
  bool isInnerTracker(GeomDetEnumerators::SubDetector m);
  bool isOuterTracker(GeomDetEnumerators::SubDetector m);

  bool isDT(GeomDetEnumerators::SubDetector m);
  bool isCSC(GeomDetEnumerators::SubDetector m);
  bool isRPC(GeomDetEnumerators::SubDetector m);
  bool isGEM(GeomDetEnumerators::SubDetector m);
  bool isME0(GeomDetEnumerators::SubDetector m);
  bool isMuon(GeomDetEnumerators::SubDetector m);
  bool isTiming(GeomDetEnumerators::SubDetector m);

}  // namespace GeomDetEnumerators

/* overload << for correct output of the enumerators 
 *  (e.g. to get "barrel" instead of "0")
 */
std::ostream& operator<<(std::ostream& s, GeomDetEnumerators::Location l);
std::ostream& operator<<(std::ostream& s, GeomDetEnumerators::SubDetector m);

#endif