PandaRoot
PndFastSim.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // -------------------------------------------------------------------------
14 // ----- PndFastSim header file -----
15 // ----- Created 20/11/07 by K. Goetzen -----
16 // -------------------------------------------------------------------------
17 
18 #ifndef PNDFASTSIM_H
19 #define PNDFASTSIM_H 1
20 
21 #include "FairTask.h"
22 #include "PndPersistencyTask.h"
23 #include "TVector3.h"
24 #include "TMatrixD.h"
25 #include <string>
26 #include <list>
27 #include "TString.h"
28 #include "TClonesArray.h"
29 
30 class TObjectArray;
31 class PndFsmTrack;
32 class TRandom3;
33 class TLorentzVector;
34 class PndFsmAbsDet;
35 class PndFsmResponse;
36 class PndFsmDetFactory;
37 class TF1;
38 class TDatabasePDG;
40 
41 typedef std::list<PndFsmAbsDet *> FsmAbsDetList;
42 typedef std::list<PndFsmResponse *> FsmResponseList;
43 
45 
46  public:
47  // typedef std::map<Int_t, Float_t> mapper;
48 
50  PndFastSim(bool persist = true);
51 
53  ~PndFastSim();
54 
55  void Register(); //
56 
58  virtual InitStatus Init();
59 
60  virtual void Finish();
61 
63  virtual void Exec(Option_t *opt);
64 
65  bool AddDetector(std::string name, std::string params = "");
66  bool AddDetector(PndFsmAbsDet *det);
67  void SetVerbosity(int vb) { fVb = vb; }
68  bool EnableSplitoffs(std::string fname = "splitpars.dat");
69  bool MergeNeutralClusters(bool merge = true, double par = 0.389)
70  {
71  fMergeNeutralClusters = merge;
72  fMergeProbPar = par;
73  return true;
74  }
75  void EnableElectronBremsstrahlung(bool brems = true) { fElectronBrems = brems; }
76  void EnablePropagation(bool propagate = true, bool tostartvtx = true, bool usecovmatrix = true, double tolerance = 0.0);
77  void SetUseFlatCov(bool v = true) { fUseFlatCovMatrix = v; };
78 
79  void SetMultFilter(TString type, int min, int max = 1000);
80  void SetInvMassFilter(TString filter, double min, double max, int mult = 1);
81 
82  void SetSeed(unsigned int seed = 65539);
83  // void CreateStructure();
84 
85  private:
86  PndFsmResponse *sumResponse(FsmResponseList respList);
87 
88  int acceptFilters(RhoCandList &l);
89  int chCon(int i);
90  void copyAndSetMass(RhoCandList &l, RhoCandList &nl, int pdg);
91 
92  bool cutAndSmear(PndFsmTrack *t, PndFsmResponse *r);
93  bool cutAndSmear(PndFsmTrack *t);
94 
95  void smearEnergy(PndFsmTrack *t, double dE);
96  void smearMomentum(PndFsmTrack *t, double dp);
97  void smearTheta(PndFsmTrack *t, double dtheta);
98  void smearPhi(PndFsmTrack *t, double dphi);
99  void smearVertex(PndFsmTrack *t, TVector3 dV);
100  void smearM(PndFsmTrack *t, double dm);
101  void smearM2(PndFsmTrack *t, double m2);
102  void smearMvddEdx(PndFsmTrack *t, double dedx);
103  void smearTpcdEdx(PndFsmTrack *t, double dedx);
104  void smearSttdEdx(PndFsmTrack *t, double dedx);
105  void SetFlatCovMatrix(PndFsmTrack *t, double dp = 0., double dtheta = 0., double dphi = 0., double dE = 0., double dx = 0., double dy = 0., double dz = 0.);
106  void UpdateGammaHit(PndFsmTrack *t);
107 
109  TClonesArray *fMcCandidates;
110  TClonesArray *fPidChargedCand;
111  TClonesArray *fPidNeutralCand;
112  TClonesArray *fMicroCandidates;
113  TClonesArray *fPidChargedProb;
114  TClonesArray *fPidNeutralProb;
115 
116  std::map<TString, TClonesArray *> fPidArrayList;
117  // output array EventInfo
118  TClonesArray *fEventInfo;
119 
120  TRandom3 *fRand;
121  int fVb; // verbosity level
122  int evtcnt; // event counter for output
123  TF1 *fspo[5][4];
124  TF1 *fBremsEnergy;
125  bool fGenSplitOffs;
126  bool fMergeNeutralClusters;
127  bool fElectronBrems;
128  double fMergeProbPar;
129  bool fPropagate;
130  bool fToStartVtx;
131  bool fUseCovMatrix;
132  bool fUseFlatCovMatrix;
133  double fTolerance;
134 
135  // filter vars
136  bool fApplyFilter;
137  int fMultMin[6];
138  int fMultMax[6];
139  TString fInvMassFilter;
140  double fInvMassMin;
141  double fInvMassMax;
142  int fInvMassMult;
143  int fCombIndex[5];
144  int fCombMult;
145  bool fChargeConj;
146  int fNAccept;
147 
148  PndFsmDetFactory *fDetFac;
149  std::string fAddedDets;
150  FsmAbsDetList fDetList;
151 
152  TDatabasePDG *fdbPdg;
153 
155  virtual void SetParContainers();
156 
157  bool smearTrack(PndFsmTrack *t, int idx = -1);
158 
159  static TMatrixD fRho;
160  static TMatrixD fEta;
161 
162  ClassDef(PndFastSim, 1);
163 };
164 
165 #endif
bool AddDetector(std::string name, std::string params="")
void SetSeed(unsigned int seed=65539)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:37
std::list< PndFsmResponse * > FsmResponseList
Definition: PndFastSim.h:42
__m128 v
Definition: P4_F32vec4.h:15
unsigned int i
Definition: P4_F32vec4.h:33
void SetUseFlatCov(bool v=true)
Definition: PndFastSim.h:77
bool MergeNeutralClusters(bool merge=true, double par=0.389)
Definition: PndFastSim.h:69
void SetInvMassFilter(TString filter, double min, double max, int mult=1)
void EnableElectronBremsstrahlung(bool brems=true)
Definition: PndFastSim.h:75
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:36
bool EnableSplitoffs(std::string fname="splitpars.dat")
void SetMultFilter(TString type, int min, int max=1000)
void SetVerbosity(int vb)
Definition: PndFastSim.h:67
void Register()
virtual void Finish()
virtual void Exec(Option_t *opt)
virtual InitStatus Init()
PndFastSim(bool persist=true)
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:64
std::list< PndFsmAbsDet * > FsmAbsDetList
Definition: PndFastSim.h:39
void EnablePropagation(bool propagate=true, bool tostartvtx=true, bool usecovmatrix=true, double tolerance=0.0)