00001 #ifndef Fireworks_Tracks_FWMagField_h 00002 #define Fireworks_Tracks_FWMagField_h 00003 // -*- C++ -*- 00004 // 00005 // Simplified model of the CMS detector magnetic field 00006 // 00007 // $id$ 00008 #include "TEveTrackPropagator.h" 00009 class TH1F; 00010 00011 namespace edm 00012 { 00013 class EventBase; 00014 } 00015 00016 class FWMagField: public TEveMagField 00017 { 00018 Float_t GetFieldMag() const; 00019 00020 public: 00021 enum ESource { kNone, kEvent, kUser }; 00022 00023 FWMagField(); 00024 virtual ~FWMagField(); 00025 00026 // get field values 00027 virtual TEveVector GetField(Float_t x, Float_t y, Float_t z) const; 00028 virtual Float_t GetMaxFieldMag() const; 00029 00030 // auto/user behaviour 00031 void setUserField(float b) { m_userField = b; } 00032 float getUserField() const { return m_userField; } 00033 void setSource(ESource x) { m_source = x; } 00034 ESource getSource() const { return m_source; } 00035 00036 // field model 00037 void setReverseState( bool state ){ m_reverse = state; } 00038 bool isReverse() const { return m_reverse;} 00039 void setSimpleModel( bool simpleModel ){ m_simpleModel = simpleModel; } 00040 bool isSimpleModel() const { return m_simpleModel;} 00041 00042 // field estimate 00043 void guessFieldIsOn( bool guess ) const; 00044 void guessField( float estimate ) const; 00045 void resetFieldEstimate() const; 00046 00047 void checkFieldInfo(const edm::EventBase*); 00048 00049 private: 00050 FWMagField(const FWMagField&); // stop default 00051 const FWMagField& operator=(const FWMagField&); // stop default 00052 00053 ESource m_source; 00054 float m_userField; 00055 float m_eventField; 00056 00057 bool m_reverse; 00058 bool m_simpleModel; 00059 00060 // runtime estimate , have to be mutable becuse of GetField() is const 00061 mutable TH1F *m_guessValHist; 00062 mutable int m_numberOfFieldIsOnEstimates; 00063 mutable int m_numberOfFieldEstimates; 00064 mutable bool m_updateFieldEstimate; 00065 mutable float m_guessedField; 00066 }; 00067 00068 #endif