File indexing completed on 2025-02-21 09:58:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef DD4HEP_DETTYPE_H
0015 #define DD4HEP_DETTYPE_H
0016
0017 #include <ostream>
0018
0019
0020 namespace dd4hep {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 class DetType {
0034
0035 friend std::ostream& operator<<(std::ostream& os , const DetType& t ) ;
0036
0037 public:
0038
0039
0040 enum DetectorTypeEnumeration {
0041 IGNORE = 0 ,
0042 TRACKER = 1 << 0,
0043 CALORIMETER = 1 << 1,
0044 CHERENKOV = 1 << 2,
0045 ENDCAP = 1 << 3,
0046 BARREL = 1 << 4,
0047 FORWARD = 1 << 5,
0048 VERTEX = 1 << 6,
0049 STRIP = 1 << 7,
0050 PIXEL = 1 << 8,
0051 GASEOUS = 1 << 9,
0052 WIRE = 1 << 10,
0053 ELECTROMAGNETIC = 1 << 11,
0054 HADRONIC = 1 << 12,
0055 MUON = 1 << 13,
0056 SUPPORT = 1 << 14,
0057 BEAMPIPE = 1 << 15,
0058 COIL = 1 << 16,
0059 AUXILIARY = 1 << 17
0060 };
0061
0062
0063 DetType( ) : _type(0) {}
0064
0065
0066
0067
0068 DetType( unsigned long types ) : _type( types ){}
0069
0070
0071 inline void set( unsigned long prop ) {
0072 _type |= prop ;
0073 }
0074
0075
0076 inline void unset( unsigned long prop ) {
0077 _type &= ~prop ;
0078 }
0079
0080
0081 inline bool is( unsigned long prop ) const {
0082 return ( _type & prop ) == prop ;
0083 }
0084
0085
0086 inline bool isNot( unsigned long prop ) const {
0087 return ( _type & prop ) == 0 ;
0088 }
0089
0090
0091 inline unsigned long to_ulong() const {
0092 return _type ;
0093 }
0094
0095 private:
0096 unsigned long _type ;
0097 } ;
0098
0099 inline std::ostream& operator<<( std::ostream& os , const DetType& t ){
0100
0101 os << "DetType( " << std::hex << "0x" << t._type << ") : " << std::dec ;
0102 if( t.is( DetType::TRACKER ) ) os << "TRACKER, " ;
0103 if( t.is( DetType::CALORIMETER ) ) os << "CALORIMETER, " ;
0104 if( t.is( DetType::CHERENKOV ) ) os << "CHERENKOV, " ;
0105 if( t.is( DetType::ENDCAP ) ) os << "ENDCAP, " ;
0106 if( t.is( DetType::BARREL ) ) os << "BARREL, " ;
0107 if( t.is( DetType::FORWARD ) ) os << "FORWARD, " ;
0108 if( t.is( DetType::VERTEX ) ) os << "VERTEX, " ;
0109 if( t.is( DetType::STRIP ) ) os << "STRIP, " ;
0110 if( t.is( DetType::PIXEL ) ) os << "PIXEL, " ;
0111 if( t.is( DetType::GASEOUS ) ) os << "GASEOUS, " ;
0112 if( t.is( DetType::WIRE ) ) os << "WIRE, " ;
0113 if( t.is( DetType::ELECTROMAGNETIC ) ) os << "ELECTROMAGNETIC, " ;
0114 if( t.is( DetType::HADRONIC ) ) os << "HADRONIC, " ;
0115 if( t.is( DetType::MUON ) ) os << "MUON, " ;
0116 if( t.is( DetType::SUPPORT ) ) os << "SUPPORT, " ;
0117 if( t.is( DetType::BEAMPIPE ) ) os << "BEAMPIPE, " ;
0118 if( t.is( DetType::COIL ) ) os << "COIL, " ;
0119 if( t.is( DetType::AUXILIARY ) ) os << "AUXILIARY, " ;
0120
0121 return os ;
0122 }
0123
0124
0125 }
0126
0127 #endif