File indexing completed on 2026-10-05 09:10:39
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 BACKWARD = 1 << 18,
0061 FAR = 1 << 19
0062 };
0063
0064
0065 DetType( ) : _type(0) {}
0066
0067
0068
0069
0070 DetType( unsigned long types ) : _type( types ){}
0071
0072
0073 inline void set( unsigned long prop ) {
0074 _type |= prop ;
0075 }
0076
0077
0078 inline void unset( unsigned long prop ) {
0079 _type &= ~prop ;
0080 }
0081
0082
0083 inline bool is( unsigned long prop ) const {
0084 return ( _type & prop ) == prop ;
0085 }
0086
0087
0088 inline bool isNot( unsigned long prop ) const {
0089 return ( _type & prop ) == 0 ;
0090 }
0091
0092
0093 inline unsigned long to_ulong() const {
0094 return _type ;
0095 }
0096
0097 private:
0098 unsigned long _type ;
0099 } ;
0100
0101 inline std::ostream& operator<<( std::ostream& os , const DetType& t ){
0102
0103 os << "DetType( " << std::hex << "0x" << t._type << ") : " << std::dec ;
0104 if( t.is( DetType::TRACKER ) ) os << "TRACKER, " ;
0105 if( t.is( DetType::CALORIMETER ) ) os << "CALORIMETER, " ;
0106 if( t.is( DetType::CHERENKOV ) ) os << "CHERENKOV, " ;
0107 if( t.is( DetType::ENDCAP ) ) os << "ENDCAP, " ;
0108 if( t.is( DetType::BARREL ) ) os << "BARREL, " ;
0109 if( t.is( DetType::FORWARD ) ) os << "FORWARD, " ;
0110 if( t.is( DetType::VERTEX ) ) os << "VERTEX, " ;
0111 if( t.is( DetType::STRIP ) ) os << "STRIP, " ;
0112 if( t.is( DetType::PIXEL ) ) os << "PIXEL, " ;
0113 if( t.is( DetType::GASEOUS ) ) os << "GASEOUS, " ;
0114 if( t.is( DetType::WIRE ) ) os << "WIRE, " ;
0115 if( t.is( DetType::ELECTROMAGNETIC ) ) os << "ELECTROMAGNETIC, " ;
0116 if( t.is( DetType::HADRONIC ) ) os << "HADRONIC, " ;
0117 if( t.is( DetType::MUON ) ) os << "MUON, " ;
0118 if( t.is( DetType::SUPPORT ) ) os << "SUPPORT, " ;
0119 if( t.is( DetType::BEAMPIPE ) ) os << "BEAMPIPE, " ;
0120 if( t.is( DetType::COIL ) ) os << "COIL, " ;
0121 if( t.is( DetType::AUXILIARY ) ) os << "AUXILIARY, " ;
0122
0123 return os ;
0124 }
0125
0126
0127 }
0128
0129 #endif