Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:32

0001 #ifndef Fireworks_Tracks_FWMagField_h
0002 #define Fireworks_Tracks_FWMagField_h
0003 // -*- C++ -*-
0004 //
0005 // Simplified model of the CMS detector magnetic field
0006 //
0007 #include "TEveTrackPropagator.h"
0008 class TH1F;
0009 
0010 namespace edm {
0011   class EventBase;
0012 }
0013 
0014 class FWMagField : public TEveMagField {
0015   Float_t GetFieldMag() const;
0016 
0017 public:
0018   enum ESource { kNone, kEvent, kUser };
0019 
0020   FWMagField();
0021   ~FWMagField() override;
0022 
0023   // get field values
0024   TEveVector GetField(Float_t x, Float_t y, Float_t z) const override;
0025   Float_t GetMaxFieldMag() const override;
0026 
0027   // auto/user behaviour
0028   void setUserField(float b) { m_userField = b; }
0029   float getUserField() const { return m_userField; }
0030   void setSource(ESource x) { m_source = x; }
0031   ESource getSource() const { return m_source; }
0032 
0033   // field model
0034   void setReverseState(bool state) { m_reverse = state; }
0035   bool isReverse() const { return m_reverse; }
0036   void setSimpleModel(bool simpleModel) { m_simpleModel = simpleModel; }
0037   bool isSimpleModel() const { return m_simpleModel; }
0038 
0039   // field estimate
0040   void guessFieldIsOn(bool guess) const;
0041   void guessField(float estimate) const;
0042   void resetFieldEstimate() const;
0043 
0044   void checkFieldInfo(const edm::EventBase*);
0045   void setFFFieldMag(float);
0046 
0047   FWMagField(const FWMagField&) = delete;                   // stop default
0048   const FWMagField& operator=(const FWMagField&) = delete;  // stop default
0049 
0050 private:
0051   ESource m_source;
0052   float m_userField;
0053   float m_eventField;
0054 
0055   bool m_reverse;
0056   bool m_simpleModel;
0057 
0058   // runtime estimate , have to be mutable becuse of GetField() is const
0059   mutable TH1F* m_guessValHist;
0060   mutable int m_numberOfFieldIsOnEstimates;
0061   mutable int m_numberOfFieldEstimates;
0062   mutable bool m_updateFieldEstimate;
0063   mutable float m_guessedField;
0064 };
0065 
0066 #endif