diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSFlatLateralShapeParametrization.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSFlatLateralShapeParametrization.h index c6c701068af1eac0028425f64e7e9b7398d0880c..fd516c4efd1f140c991296f6563f2b4ac4380580 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSFlatLateralShapeParametrization.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSFlatLateralShapeParametrization.h @@ -14,32 +14,32 @@ class TH2; class TFCSFlatLateralShapeParametrization:public TFCSLateralShapeParametrizationHitBase { public: TFCSFlatLateralShapeParametrization(const char* name=nullptr, const char* title=nullptr); - ~TFCSFlatLateralShapeParametrization(); + virtual ~TFCSFlatLateralShapeParametrization(); /// set the integral of the histogram to the desired number of hits void set_number_of_hits(float nhits); - float get_number_of_expected_hits() const {return m_nhits;}; + float get_number_of_expected_hits() const; /// default for this class is to simulate poisson(integral histogram) hits - int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const override; + virtual int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const override; /// set the radius in which hits should be generated - void set_dR(float _dR) {m_dR=_dR;}; + void set_dR(float _dR); - float dR() const {return m_dR;}; + float dR() const; /// set the radius in which hits should be generated - void set_scale(float _scale) {m_scale=_scale;}; + void set_scale(float _scale); - float scale() const {return m_scale;}; + float scale() const; /// simulated one hit position with weight that should be put into simulstate /// sometime later all hit weights should be resacled such that their final sum is simulstate->E(sample) /// someone also needs to map all hits into cells virtual FCSReturnCode simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) override; - void Print(Option_t *option = "") const override; + virtual void Print(Option_t *option = "") const override; protected: /// Simulate hits flat in radius dR float m_dR; @@ -51,6 +51,21 @@ private: ClassDefOverride(TFCSFlatLateralShapeParametrization,1) //TFCSFlatLateralShapeParametrization }; +inline float TFCSFlatLateralShapeParametrization::get_number_of_expected_hits() const +{ + return m_nhits; +} + +inline float TFCSFlatLateralShapeParametrization::dR() const +{ + return m_dR; +} + +inline float TFCSFlatLateralShapeParametrization::scale() const +{ + return m_scale; +} + #if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__) #pragma link C++ class TFCSFlatLateralShapeParametrization+; #endif diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeight.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeight.h index e69c20b37023ae69bae4fc78dbfccc53b29e5c81..dc650c2ca08d400c17315eca14fb1d8eeebd6e1a 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeight.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeight.h @@ -12,21 +12,21 @@ class TH1; class TFCSHistoLateralShapeWeight:public TFCSLateralShapeParametrizationHitBase { public: TFCSHistoLateralShapeWeight(const char* name=nullptr, const char* title=nullptr); - ~TFCSHistoLateralShapeWeight(); + virtual ~TFCSHistoLateralShapeWeight(); /// weight the energy of one hit in order to generate fluctuations - virtual FCSReturnCode simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol); + virtual FCSReturnCode simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) override; /// Init from histogram. The integral of the histogram is used as number of expected hits to be generated bool Initialize(TH1* hist); - void Print(Option_t *option = "") const; + virtual void Print(Option_t *option = "") const override; protected: /// Histogram to be used for the shape simulation /// The histogram x-axis should be in dR^2=deta^2+dphi^2 TH1* m_hist{nullptr}; - ClassDef(TFCSHistoLateralShapeWeight,1) //TFCSHistoLateralShapeWeight + ClassDefOverride(TFCSHistoLateralShapeWeight,1) //TFCSHistoLateralShapeWeight }; #if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeightHitAndMiss.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeightHitAndMiss.h index f6251edcb0123239d7a720dd7226424d2379533f..ebdce230bf4960dc0fb7dd0dba17c7d10b0c7ac2 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeightHitAndMiss.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSHistoLateralShapeWeightHitAndMiss.h @@ -11,15 +11,15 @@ class TH1; class TFCSHistoLateralShapeWeightHitAndMiss:public TFCSHistoLateralShapeWeight { public: - TFCSHistoLateralShapeWeightHitAndMiss(const char* name=nullptr, const char* title=nullptr):TFCSHistoLateralShapeWeight(name,title) {}; - ~TFCSHistoLateralShapeWeightHitAndMiss() {}; + TFCSHistoLateralShapeWeightHitAndMiss(const char* name=nullptr, const char* title=nullptr); + virtual ~TFCSHistoLateralShapeWeightHitAndMiss(); /// weight the energy of one hit in order to generate fluctuations. If the hit energy is 0, discard the hit - virtual FCSReturnCode simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol); + virtual FCSReturnCode simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) override; private: - ClassDef(TFCSHistoLateralShapeWeightHitAndMiss,1) //TFCSHistoLateralShapeWeightHitAndMiss + ClassDefOverride(TFCSHistoLateralShapeWeightHitAndMiss,1) //TFCSHistoLateralShapeWeightHitAndMiss }; #if defined(__ROOTCLING__) && defined(__FastCaloSimStandAlone__) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSFlatLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSFlatLateralShapeParametrization.cxx index 270730c47a5b3abffb9514d654cd2c78d4fef091..a84df0607ec92e269a7a43304deee3bb26c7708e 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSFlatLateralShapeParametrization.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSFlatLateralShapeParametrization.cxx @@ -41,6 +41,16 @@ void TFCSFlatLateralShapeParametrization::set_number_of_hits(float nhits) m_nhits=nhits; } +void TFCSFlatLateralShapeParametrization::set_dR(float _dR) +{ + m_dR=_dR; +} + +void TFCSFlatLateralShapeParametrization::set_scale(float _scale) +{ + m_scale=_scale; +} + FCSReturnCode TFCSFlatLateralShapeParametrization::simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) { if (!simulstate.randomEngine()) { diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx index 39e8dbe3d94be4debd1f50999520326ab8ffc3dc..860e87f933a8e7f5b9fd789ddfec14293661a336 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeParametrization.cxx @@ -33,6 +33,8 @@ TFCSHistoLateralShapeParametrization::~TFCSHistoLateralShapeParametrization() double TFCSHistoLateralShapeParametrization::get_sigma2_fluctuation(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const { + //Limit to factor 1000 fluctuations + if(m_nhits<0.001) return 1000; return 1.0/m_nhits; } diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeWeightHitAndMiss.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeWeightHitAndMiss.cxx index 99ccf88f7fa5c49956c7baec89b85a71cb88cd05..63726341a0873ad01ff03543e61c4dcde2e354a8 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeWeightHitAndMiss.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSHistoLateralShapeWeightHitAndMiss.cxx @@ -15,6 +15,14 @@ //======= TFCSHistoLateralShapeWeightHitAndMiss ========= //============================================= +TFCSHistoLateralShapeWeightHitAndMiss::TFCSHistoLateralShapeWeightHitAndMiss(const char* name, const char* title):TFCSHistoLateralShapeWeight(name,title) +{ +} + +TFCSHistoLateralShapeWeightHitAndMiss::~TFCSHistoLateralShapeWeightHitAndMiss() +{ +} + FCSReturnCode TFCSHistoLateralShapeWeightHitAndMiss::simulate_hit(Hit& hit,TFCSSimulationState& simulstate,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) { if (!simulstate.randomEngine()) {