00001 // 00002 // 0 -- kUnknown: should not happen 00003 // 1 -- kNeedSim: do Geant4 simulation 00004 // 00005 // Others: 00006 // bit 32: is always one. This will make geant4 skip this particle. 00007 // rpc and pool trigger information are packed into the other 31 bits. 00008 // 00009 // 00010 // Zhe Wang, 2 Oct 2009 at BNL 00011 // 00012 #ifndef _MP_MUON_FATE_H_ 00013 #define _MP_MUON_FATE_H_ 00014 00015 #include <iostream> 00016 #include "MpTriggerStat.h" 00017 00018 class MpMuonFate { 00019 public: 00020 enum { 00021 kUnknown =0, // Muon not found, and others 00022 kNeedSim =1, // Can't tell the fate of it. Need full simulation 00023 kDontSim =0xf0000000 // Don't do geant simulation 00024 }; 00025 00026 MpMuonFate( unsigned int code) { 00027 m_code = code; 00028 }; 00029 00030 MpMuonFate( MpTriggerStat rpc, MpTriggerStat pool) { 00031 setCode(rpc,pool); 00032 } 00033 00034 MpTriggerStat getRpcTriggerStat() { 00035 if(m_code == kNeedSim) { 00036 return MpTriggerStat::kNeedSim; // Note that here might not be consistent with previous input 00037 } else { 00038 return (m_code & 0xff00) >> 8; 00039 } 00040 } 00041 00042 MpTriggerStat getPoolTriggerStat() { 00043 if(m_code == kNeedSim) { 00044 return MpTriggerStat::kNeedSim; // Note that here might not be consistent with previous input 00045 } else { 00046 return m_code & 0xff; 00047 } 00048 } 00049 00050 unsigned int setCode( unsigned int code) { 00051 return m_code = code; 00052 } 00053 00054 unsigned int setCode( MpTriggerStat rpc, MpTriggerStat pool) { 00055 if( rpc.getCode() == MpTriggerStat::kNeedSim || 00056 pool.getCode() == MpTriggerStat::kNeedSim ) { 00057 return m_code = kNeedSim; 00058 } else { // I want to pack all trigger information into this status word 00059 return m_code = kDontSim | rpc.getCode()<<8 | pool.getCode(); 00060 } 00061 } 00062 00063 unsigned int getCode() const { 00064 return m_code; 00065 }; 00066 00067 MpMuonFate& operator=(const MpMuonFate& rh) { 00068 m_code=rh.getCode(); 00069 return *this; 00070 }; 00071 00072 private: 00073 unsigned int m_code; 00074 00075 }; 00076 00077 std::ostream & operator<<(std::ostream & os, const MpMuonFate & f); 00078 00079 #endif // _MP_MUON_FATE_H_