Converting PWG/TRD to native cmake
[u/mrichter/AliRoot.git] / EVGEN / AliGenHBTosl.h
CommitLineData
695dc56f 1#ifndef ALIGENHBTOSL_H
2#define ALIGENHBTOSL_H
3//__________________________________________________________
4/////////////////////////////////////////////////////////////
5// //
6// class AliGenHBTosl //
7// //
8// Genarator simulating particle correlations //
9// //
10// The main idea of the generator is to produce particles //
11// according to some distribution of two particle //
12// property. In HBT they are qout,qsie and qlong. //
13// In order to be able to generate signal that produces //
14// given two particle correlation background must be //
15// known before in order to produce the shape of signal //
16// to randomize given distribution from. //
17// //
18// The generator works as follows: //
19// 1. Coarse Background (fQCoarseBackground) is generated //
20// ade from the particles //
21// given by the external generator (variable //
22// fGenerator) by the mixing technique. //
23// 2. Coarse signal is prduced by multiplying Coarse //
24// background by a required function //
25// See method FillCoarseSignal //
26// 3. Signal is randomized out of the coarse signal //
27// histogram (two particle property). First particle //
28// is taken from the external generator, and the //
29// second one is CALCULATED on the basis of the first //
30// one and the two particle property (qout,qside,qlong)//
31// Background is made by the mixing out of the //
32// genereted signal events. //
33// This step is cotinued up to the moment signal //
34// histogram has enough statistics (data member //
35// fMinFill) //
36// See method StartSignalPass1() //
37// 4. chi is calculated for each bin (chiarray variqable) //
38// (not the chi2 because sign is important) //
39// Two particle prioperty //
40// (qout,qside,qlong) is chosen at the points that //
41// chi is the smallest. First particle is taken from //
42// the the external generator (fGenerator) and second's /
43// momenta are caclulated out of their momenta and //
44// (qout,qside,qlong). Background is updated //
45// continuesely for all the events. This step is //
46// continued until stability conditions are fullfiled //
47// or maximum number of iteration is reached. //
48// 5. The same as step 4 but events are stored. //
49// //
50////////////////////////////////////////////////////////////
51
52#include "AliGenerator.h"
53
54class TH3D;
55class AliStack;
56class TParticle;
e8d02863 57class TVector3;
83cb58d0 58using std::ofstream;
695dc56f 59
5fdc214b 60#include <Riostream.h>
61
695dc56f 62class AliGenHBTosl: public AliGenerator
63{
64 public:
65 AliGenHBTosl();
66 AliGenHBTosl(Int_t n,Int_t pid = 211);
1c56e311 67 AliGenHBTosl(const AliGenHBTosl& hbt);
695dc56f 68 virtual ~AliGenHBTosl();
69
70 void Init();
71 void Generate();
72
73 void SetGenerator(AliGenerator* gen){fGenerator = gen;}
f84379e8 74 void SetDebug(Int_t debug){fDebug = debug;}
75 Int_t GetDebug() const {return fDebug;}
695dc56f 76
77 void Rotate(TVector3& relvector, TVector3& vector);
78 Double_t Rotate(Double_t x,Double_t y,Double_t z);
79 void SetSamplePhiRange(Float_t min,Float_t max){fSamplePhiMin = min; fSamplePhiMax = max;}
80
81 Int_t GetThreeD(TParticle* first,TParticle* second, Double_t qout, Double_t qside, Double_t qlong);
82
83
84 protected:
85
86 void GetOneD(TParticle* first, TParticle* second,Double_t qinv);
87
88 void FillCoarse();
89 void FillCoarseSignal();
90 void StartSignal();
91 void StartSignalPass1();
92 void Mix(TList* eventbuffer,TH3D* denominator,TH3D* denominator2);
93 void Mix(AliStack* stack, TH3D* numerator, TH3D* numerator2);
94 Double_t GetQInv(TParticle* f, TParticle* s);
95 void GetQOutQSideQLong(TParticle* f, TParticle* s,Double_t& out, Double_t& side, Double_t& lon);
96 Double_t GetQInvCorrTheorValue(Double_t qinv) const;
97 Double_t GetQOutQSideQLongCorrTheorValue(Double_t& out, Double_t& side, Double_t& lon) const;
98
99 Double_t Scale(TH3D* num,TH3D* den);
5fdc214b 100 void SetTrack(TParticle* p, Int_t& ntr) ;
101 void SetTrack(TParticle* p, Int_t& ntr, AliStack* stack) const ;
695dc56f 102
103 AliStack* RotateStack();
104 void SwapGeneratingHistograms();
105 void TestCoarseSignal();
106
107 Bool_t CheckParticle(TParticle* p, TParticle* aupair,AliStack* stack);
1c56e311 108 void Copy(TObject&) const;
109 AliGenHBTosl & operator=(const AliGenHBTosl & rhs);
695dc56f 110 private:
111 TH3D* fQCoarseBackground;//Initial Background
5fdc214b 112 TH3D* fQCoarseSignal;//signal calculated by multiplying coarse background and model function
113 TH3D* fQSignal;//generating signal histogram
114 TH3D* fQBackground;//generating background histogram
695dc56f 115
5fdc214b 116 TH3D* fQSecondSignal;//second signal histogram
117 TH3D* fQSecondBackground;//seconf background histogram
695dc56f 118
5fdc214b 119 Float_t fQRange;//range of generating histograms
120 Int_t fQNBins;//number of bins of generating histograms
121 AliGenerator* fGenerator;//input generator
695dc56f 122
5fdc214b 123 TList* fStackBuffer;//List with stacks
124 Int_t fBufferSize;//defines number of events used for background mixing
125 Int_t fNBinsToScale;//defines how many bins are used to calculate scaling factor
f5b253b3 126 Int_t fDebug;//debug flag
5fdc214b 127 Bool_t fSignalShapeCreated;//flag indicating that generating histograms are ready
695dc56f 128
129 Int_t fMaxIterations; //maximal nuber of iterations on startup
130 Float_t fMaxChiSquereChange;//value of ChiSqr change in %, when sturtup process in stable
131 Float_t fMaxChiSquerePerNDF;//value of the chi2 where generating histograms are considered as good
132
133
5fdc214b 134 Double_t fQRadius;//simulated radius
695dc56f 135
5fdc214b 136 Int_t fPID;//pid of particle
695dc56f 137 //we limit mixing to some finit phi range to make it faster
5fdc214b 138 Float_t fSamplePhiMin;//min phi
139 Float_t fSamplePhiMax;//max phi
695dc56f 140
5fdc214b 141 Float_t fSignalRegion;//Defines signal region
695dc56f 142
5fdc214b 143 Int_t fMinFill;//Minimal allowed fill in background histograms - fill is continued until all bins have more than this
695dc56f 144
5fdc214b 145 Bool_t fSwapped;//indicates if generating histograms were already swapped
146
147 ofstream* fLogFile;//! File where logs are stored
695dc56f 148
149 ClassDef(AliGenHBTosl,1)
150};
151#endif