Skip to content
Snippets Groups Projects
Commit fe194d2d authored by Michael Duehrssen-Debling's avatar Michael Duehrssen-Debling
Browse files

Add Gaussian hit energy distribution to TFCSLateralShapeParametrizationFluctChain

parent f2835aa4
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ public:
///default for this class is to simulate get_number_of_expected_hits() hits,
///which gives fluctuations sigma^2=1/get_number_of_expected_hits()
virtual double get_sigma2_fluctuation(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const override;
virtual float get_sigma2_fluctuation(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const override;
/// default for this class is to simulate get_number_of_expected_hits() hits
virtual int get_number_of_hits(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) const override;
......
......@@ -14,7 +14,10 @@ public:
virtual FCSReturnCode simulate(TFCSSimulationState& simulstate,const TFCSTruthState* truth, const TFCSExtrapolationState* extrapol) override;
void Print(Option_t *option) const override;
private:
float m_RMS=1.0;
ClassDefOverride(TFCSLateralShapeParametrizationFluctChain,1) //TFCSLateralShapeParametrizationFluctChain
};
......
......@@ -33,7 +33,7 @@ TFCS2DFunctionLateralShapeParametrization::~TFCS2DFunctionLateralShapeParametriz
m_function=nullptr;
}
double TFCS2DFunctionLateralShapeParametrization::get_sigma2_fluctuation(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const
float TFCS2DFunctionLateralShapeParametrization::get_sigma2_fluctuation(TFCSSimulationState& /*simulstate*/,const TFCSTruthState* /*truth*/, const TFCSExtrapolationState* /*extrapol*/) const
{
return 1.0/m_nhits;
}
......
......@@ -6,6 +6,8 @@
#include "ISF_FastCaloSimEvent/FastCaloSim_CaloCell_ID.h"
#include "ISF_FastCaloSimEvent/TFCSSimulationState.h"
#include "CLHEP/Random/RandGauss.h"
#include "TMath.h"
//=============================================
......@@ -37,6 +39,7 @@ FCSReturnCode TFCSLateralShapeParametrizationFluctChain::simulate(TFCSSimulation
//Make a good guess of the needed hit energy, assuming all hits would have the same energy
float Eavghit=Elayer/nhit;
float Eavghit_tenth=Eavghit/10;
float sumEhit=0;
float error2_sumEhit=0;
float error2=1000;
......@@ -53,7 +56,10 @@ FCSReturnCode TFCSLateralShapeParametrizationFluctChain::simulate(TFCSSimulation
hit.reset_center();
do {
hit.reset();
hit.E()=Eavghit;
//hit.E()=Eavghit;
do {
hit.E()=CLHEP::RandGauss::shoot(simulstate.randomEngine(), Eavghit, m_RMS*Eavghit);
} while (hit.E()<Eavghit_tenth);
bool failed=false;
for(TFCSLateralShapeParametrizationHitBase* hitsim : m_chain) {
if (debug) {
......@@ -94,3 +100,13 @@ FCSReturnCode TFCSLateralShapeParametrizationFluctChain::simulate(TFCSSimulation
return FCSSuccess;
}
void TFCSLateralShapeParametrizationFluctChain::Print(Option_t *option) const
{
TString opt(option);
bool shortprint=opt.Index("short")>=0;
bool longprint=msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint);
TString optprint=opt;optprint.ReplaceAll("short","");
TFCSLateralShapeParametrizationHitChain::Print(option);
if(longprint) ATH_MSG_INFO(optprint <<" hit energy RMS="<<m_RMS);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment