CbmRoot
CbmFastSim Class Reference

#include <CbmFastSim.h>

Inheritance diagram for CbmFastSim:
[legend]
Collaboration diagram for CbmFastSim:
[legend]

Public Types

enum  EParticleType {
  kEle = 0, kPio, kKao, kPro,
  kMuo, kGam
}
 
enum  EEfficiencyMethod {
  kIgnoreFluct = 0, kInterpolate, kAverage, kFactorize,
  kLastDim
}
 

Public Member Functions

 CbmFastSim (bool persist=true)
 
 ~CbmFastSim ()
 
void Register ()
 
virtual InitStatus Init ()
 
virtual void InitTask ()
 
virtual void Finish ()
 
virtual void Exec (Option_t *opt)
 
void SetLookupEfficiency (THnBase *nom, THnBase *denom, EParticleType part)
 
void SetLookupResolutionP (TH2F *obj, EParticleType part)
 
void SetEfficiencyMethod (EEfficiencyMethod method)
 
void SetSeed (unsigned int seed=65539)
 

Private Member Functions

Bool_t PassEfficiencyFilter (Int_t pdg, Double_t *vals, Int_t *coord)
 
Double_t GetEfficiency (Int_t idx, Double_t *vals, Int_t *coord)
 
Bool_t Smearing (TLorentzVector *p4, Int_t pdg)
 
Double_t AnalyzeMap (TH2F *map, Double_t refValue)
 
virtual Bool_t IsSelected (TObject *sel, Int_t opt)
 
virtual void SetParContainers ()
 
 CbmFastSim (const CbmFastSim &obj)
 
CbmFastSimoperator= (const CbmFastSim &obj)
 
 ClassDef (CbmFastSim, 1)
 

Private Attributes

TRandom3 * fRand
 
TDatabasePDG * fdbPdg
 
EEfficiencyMethod fMethod = kIgnoreFluct
 
TClonesArray * fFastTracks = NULL
 
THnBase * fEFF [fgkNParts]
 
THnBase * fEFFdenom [fgkNParts]
 
TH1 * fEFFproj [fgkNParts][10]
 
TH2F * fRFp [fgkNParts]
 

Static Private Attributes

static const Int_t fgkNParts = 8
 

Detailed Description

Definition at line 27 of file CbmFastSim.h.

Member Enumeration Documentation

◆ EEfficiencyMethod

Enumerator
kIgnoreFluct 
kInterpolate 
kAverage 
kFactorize 
kLastDim 

Definition at line 32 of file CbmFastSim.h.

◆ EParticleType

Enumerator
kEle 
kPio 
kKao 
kPro 
kMuo 
kGam 

Definition at line 30 of file CbmFastSim.h.

Constructor & Destructor Documentation

◆ CbmFastSim() [1/2]

CbmFastSim::CbmFastSim ( bool  persist = true)

Default constructor

default constructor

Definition at line 55 of file CbmFastSim.cxx.

References fEFF, fEFFdenom, fEFFproj, fgkNParts, and fRFp.

◆ ~CbmFastSim()

CbmFastSim::~CbmFastSim ( )

Destructor

destructor

Definition at line 74 of file CbmFastSim.cxx.

References fFastTracks, and fRand.

◆ CbmFastSim() [2/2]

CbmFastSim::CbmFastSim ( const CbmFastSim obj)
private

Member Function Documentation

◆ AnalyzeMap()

Double_t CbmFastSim::AnalyzeMap ( TH2F *  map,
Double_t  refValue 
)
private

smear the refValue according to a TH2 map

check smearing map

get axes

find y-bin for mc variable

for under- or overflow, apply gaussian smearing with 2% resolution by this electrons are handled without bremsstrahlung (TODO: add crystal ball smearing) NOTE: in general this should not happen often, you have to provide smearing maps with large momentum ranges

get histogram array and calculate offset

get randomly smeared value: y-axis translates into x-axis (generated into reconstructed)

Definition at line 409 of file CbmFastSim.cxx.

References fRand.

Referenced by Smearing().

◆ ClassDef()

CbmFastSim::ClassDef ( CbmFastSim  ,
 
)
private

◆ Exec()

void CbmFastSim::Exec ( Option_t *  opt)
virtual

Virtual method Exec

exec, executed once per event

get mc stack of generated particles

Reset output array

array of variables and coordinates used for look-up tables

loop over the full mc stack

get generated mc particle

process only known and charged particles

collect mc truth variables NOTE: TVector3 & TLorentzVector return phi from -pi to pi, while TPartilce (base of CbmMCTrack) in 0 to 2pi

apply efficiency cuts based on mc truth quantities for pt, theta, phi NOTE: special case for efficiency map of conversion electrons

smear the momentum components according to the resolution (diff. btw. gen. & rec.)

start vertex

smearing in p

Add smeared track to output tree IMPORTANT NOTE: set MC index as FirstMother

Definition at line 211 of file CbmFastSim.cxx.

References fdbPdg, fFastTracks, CbmStack::GetNtrack(), CbmStack::GetParticle(), PassEfficiencyFilter(), and Smearing().

◆ Finish()

void CbmFastSim::Finish ( )
virtual

finish

Definition at line 203 of file CbmFastSim.cxx.

◆ GetEfficiency()

Double_t CbmFastSim::GetEfficiency ( Int_t  idx,
Double_t *  vals,
Int_t *  coord 
)
private

Calculate the efficieny from the integrated projections of the map

find bin or use coordinates

method dependent

protect against first(last) bin NOTE: interpolation cannot be done for values smaller(larger) bin center

efficiency is 0. for this particle (e.g. outside acceptance)

efficiency is 0. for this particle (e.g. outside acceptance)

Definition at line 523 of file CbmFastSim.cxx.

References fEFF, fEFFproj, fMethod, kAverage, kFactorize, kIgnoreFluct, kInterpolate, and kLastDim.

Referenced by PassEfficiencyFilter().

◆ Init()

InitStatus CbmFastSim::Init ( )
virtual

Virtual method Init

loop over all particle species

TODO: include muons

method dependent scaling, normalisation, ...

NOTE: do not fill projections

NOTE: only last dimension is used for efficiency

NOTE: use all ndim 1D-histograms

NOTE: use all ndim 1D-histograms, but dim=j>0 are scaled to max=1

NOTE: prepare a single 3D-histogram

prepare histograms for smearing

Definition at line 104 of file CbmFastSim.cxx.

References PairAnalysisHelper::CumulateSlicesX(), fEFF, fEFFdenom, fEFFproj, fgkNParts, fMethod, fRFp, kAverage, kFactorize, kIgnoreFluct, kInterpolate, kLastDim, and Register().

Referenced by InitTask().

◆ InitTask()

void CbmFastSim::InitTask ( )
virtual

Definition at line 101 of file CbmFastSim.cxx.

References Init().

◆ IsSelected()

Bool_t CbmFastSim::IsSelected ( TObject *  sel,
Int_t  opt 
)
privatevirtual

no efficiency map added?

array of variables used for look-up table

collect mc truth variables NOTE: TVector3 & TLorentzVector return phi from -pi to pi, while TPartilce (base of CbmMCTrack) in 0 to 2pi

find bin for mc pt, theta, phi

clean up

Definition at line 594 of file CbmFastSim.cxx.

References fEFF, fRand, kEle, kGam, kGamma, kKao, kMuo, kPio, and kPro.

◆ operator=()

CbmFastSim& CbmFastSim::operator= ( const CbmFastSim obj)
private

◆ PassEfficiencyFilter()

Bool_t CbmFastSim::PassEfficiencyFilter ( Int_t  pdg,
Double_t *  vals,
Int_t *  coord 
)
private

function for selection and smearing

no efficiency map added?

debug

find bin for mc pt, theta, phi

lookup efficiency and check for statistical error beeing less than 30%

check statistical fluctuations

Definition at line 305 of file CbmFastSim.cxx.

References fEFF, fMethod, fRand, GetEfficiency(), kEle, kGam, kGamma, kIgnoreFluct, kKao, kMuo, kPio, and kPro.

Referenced by Exec().

◆ Register()

void CbmFastSim::Register ( )

register output

Definition at line 90 of file CbmFastSim.cxx.

References fFastTracks.

Referenced by Init().

◆ SetEfficiencyMethod()

void CbmFastSim::SetEfficiencyMethod ( EEfficiencyMethod  method)
inline

Definition at line 60 of file CbmFastSim.h.

References fMethod.

◆ SetLookupEfficiency()

void CbmFastSim::SetLookupEfficiency ( THnBase *  nom,
THnBase *  denom,
EParticleType  part 
)

calculate lookup efficiencies

Definition at line 455 of file CbmFastSim.cxx.

References fEFF, and fEFFdenom.

◆ SetLookupResolutionP()

void CbmFastSim::SetLookupResolutionP ( TH2F *  obj,
EParticleType  part 
)
inline

Definition at line 59 of file CbmFastSim.h.

References fRFp.

◆ SetParContainers()

void CbmFastSim::SetParContainers ( )
privatevirtual

Get parameter containers

Definition at line 184 of file CbmFastSim.cxx.

◆ SetSeed()

void CbmFastSim::SetSeed ( unsigned int  seed = 65539)

set random seed by hand

Definition at line 195 of file CbmFastSim.cxx.

References fRand.

◆ Smearing()

Bool_t CbmFastSim::Smearing ( TLorentzVector *  p4,
Int_t  pdg 
)
private

smear the momentum components of the tlorentzvector according to a TH2 disttributions

references

get smeared components

calculate vector components

Definition at line 365 of file CbmFastSim.cxx.

References AnalyzeMap(), fdbPdg, fRFp, kEle, kKao, kMuo, kPio, and kPro.

Referenced by Exec().

Member Data Documentation

◆ fdbPdg

TDatabasePDG* CbmFastSim::fdbPdg
private

Definition at line 66 of file CbmFastSim.h.

Referenced by Exec(), and Smearing().

◆ fEFF

THnBase* CbmFastSim::fEFF[fgkNParts]
private

input objects

Definition at line 83 of file CbmFastSim.h.

Referenced by CbmFastSim(), GetEfficiency(), Init(), IsSelected(), PassEfficiencyFilter(), and SetLookupEfficiency().

◆ fEFFdenom

THnBase* CbmFastSim::fEFFdenom[fgkNParts]
private

Definition at line 84 of file CbmFastSim.h.

Referenced by CbmFastSim(), Init(), and SetLookupEfficiency().

◆ fEFFproj

TH1* CbmFastSim::fEFFproj[fgkNParts][10]
private

Definition at line 85 of file CbmFastSim.h.

Referenced by CbmFastSim(), GetEfficiency(), and Init().

◆ fFastTracks

TClonesArray* CbmFastSim::fFastTracks = NULL
private

Output array of Candidates

Definition at line 80 of file CbmFastSim.h.

Referenced by Exec(), Register(), and ~CbmFastSim().

◆ fgkNParts

const Int_t CbmFastSim::fgkNParts = 8
staticprivate

Definition at line 67 of file CbmFastSim.h.

Referenced by CbmFastSim(), and Init().

◆ fMethod

EEfficiencyMethod CbmFastSim::fMethod = kIgnoreFluct
private

Definition at line 68 of file CbmFastSim.h.

Referenced by GetEfficiency(), Init(), PassEfficiencyFilter(), and SetEfficiencyMethod().

◆ fRand

TRandom3* CbmFastSim::fRand
private

Definition at line 65 of file CbmFastSim.h.

Referenced by AnalyzeMap(), IsSelected(), PassEfficiencyFilter(), SetSeed(), and ~CbmFastSim().

◆ fRFp

TH2F* CbmFastSim::fRFp[fgkNParts]
private

Definition at line 87 of file CbmFastSim.h.

Referenced by CbmFastSim(), Init(), SetLookupResolutionP(), and Smearing().


The documentation for this class was generated from the following files: