]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPositionRandomizer.h
Do not unload gAlice, it is needed until the end of the simulation run
[u/mrichter/AliRoot.git] / HBTAN / AliHBTPositionRandomizer.h
1 #ifndef ALIHBTPOSITIONRANDOMIZER_H
2 #define ALIHBTPOSITIONRANDOMIZER_H
3 //___________________________________________________
4 ////////////////////////////////////////////////////////////////////////////////
5 // 
6 // class AliHBTPositionRandomizer
7 //
8 // These class randomizes particle vertex positions
9 // Piotr.Skowronski@cern.ch
10 // 
11 ////////////////////////////////////////////////////////////////////////////////
12
13 #include "AliReader.h"
14 class AliHBTRndm;
15 class TH1I;
16
17 class AliHBTPositionRandomizer: public AliReader
18 {
19  public:
20    enum EModelTypes{kGausBall,kCylinder,kCylinderSurf,kEllipse};
21    AliHBTPositionRandomizer();
22    AliHBTPositionRandomizer(AliReader* reader);
23    AliHBTPositionRandomizer(const AliHBTPositionRandomizer& in);
24    
25    virtual ~AliHBTPositionRandomizer();
26
27    AliHBTPositionRandomizer& operator=(const AliHBTPositionRandomizer& in);
28    
29    Int_t  Next(){return (fReader)?fReader->Next():1;}
30    void   Rewind(){if(fReader) fReader->Rewind();}
31    
32    Bool_t ReadsRec() const {return (fReader)?fReader->ReadsRec():kFALSE;}
33    Bool_t ReadsSim() const {return (fReader)?fReader->ReadsSim():kFALSE;}
34    
35    AliAOD* GetEventSim() const ;
36    AliAOD* GetEventRec() const ;
37
38    AliAOD* GetEventSim(Int_t n);
39    AliAOD* GetEventRec(Int_t n){return (fReader)?fReader->GetEventRec(n):0x0;}
40    
41    Int_t GetNumberOfSimEvents(){return (fReader)?fReader->GetNumberOfSimEvents():0;}
42    Int_t GetNumberOfRecEvents(){return (fReader)?fReader->GetNumberOfRecEvents():0;}
43    virtual TH1I* GetTrackCounter() const {return (fReader)?fReader->GetTrackCounter():0x0;}
44    virtual void  WriteTrackCounter() const {if(fReader) fReader->WriteTrackCounter();}
45
46    void Randomize(AliAOD* event) const;
47    void SetEventVertex(Double_t x, Double_t y,Double_t z);
48    
49    void SetRandomizer(Int_t pid,AliHBTRndm* rndm);
50    
51    void SetGaussianBall(Int_t pid, Double_t r, Double_t meantime, Double_t sigmatime);
52    void SetGaussianBall(Int_t pid, Double_t rx, Double_t ry, Double_t rz, Double_t meantime, Double_t sigmatime);
53    void SetCyllinderSurface(Int_t pid, Double_t r, Double_t l);
54    void SetEllipse(Int_t pid, Double_t rmin, Double_t rmax);
55    
56    void AddToPosition(Bool_t flag){fAddToExistingPos = flag;}
57    void RandomizeTracks(Bool_t flag){fRandomizeTracks = flag;}
58    
59    AliHBTRndm* GetRandomizer(Int_t pdg) const;
60    Int_t GetRandomizerIndex(Int_t pdg) const;
61    
62  protected:
63    void Randomize(Double_t& x,Double_t& y,Double_t&z,AliVAODParticle*p);
64    Int_t ReadNext(){return (fReader)?fReader->Next():1;}
65    
66  private:
67    AliReader*   fReader;      // Pointer to reader
68    AliHBTRndm*  fDefaultRandomizer;  // Pointer to class that performs randomization according to some model - default one
69    TObjArray*   fRandomizers;//array with randomizers - each particle type can have different randomization parameters/model
70    Int_t        fNPid;//number of randomizers defined in fPid and fRandomizers
71    Int_t*       fPids;//[fgkNumberOfPids]
72    
73    Bool_t       fAddToExistingPos;  //Determines if randomized position should be added to previous one, or overwrite old one
74    Bool_t       fOnlyParticlesFromVertex; //Determines if randomization should be performed for particles from vertex
75
76    Bool_t       fRandomizeTracks; //Determines if tracks should also be randimized 
77    
78    Double_t     fVX; //vertex position
79    Double_t     fVY; //vertex position
80    Double_t     fVZ; //vertex position
81    
82    static const Int_t fgkNumberOfPids;//size of fPid array
83    
84    ClassDef(AliHBTPositionRandomizer,1)
85 };
86
87 /*********************************************************************/
88 /*********************************************************************/
89 /*********************************************************************/
90
91 class AliHBTRndm: public TObject
92 {
93   public:
94    AliHBTRndm(){}
95    virtual ~AliHBTRndm(){}
96    virtual void Randomize(Double_t& x, Double_t& y, Double_t& z, Double_t& t, AliVAODParticle*p) const = 0;
97      ClassDef(AliHBTRndm,1)
98 };
99
100 /*********************************************************************/
101 /*********************************************************************/
102 /*********************************************************************/
103
104 class AliHBTRndmGaussBall: public AliHBTRndm
105 {
106   public:
107    AliHBTRndmGaussBall();
108    AliHBTRndmGaussBall(Float_t r, Double_t meantime, Double_t sigmatime);
109    AliHBTRndmGaussBall(Float_t rx, Float_t ry, Float_t rz, Double_t meantime, Double_t sigmatime);
110    virtual ~AliHBTRndmGaussBall(){}
111    void Randomize(Double_t& x,Double_t& y,Double_t&z, Double_t& t, AliVAODParticle*/*particle*/) const;
112   private:
113    Float_t fRx; //Dispertion in x 
114    Float_t fRy; //Dispertion in y
115    Float_t fRz; //Dispertion in z
116    Float_t fTmean; //Mean emision time in t
117    Float_t fTsigma; //Dispertion in t
118    ClassDef(AliHBTRndmGaussBall,1)
119 };
120
121 /*********************************************************************/
122 /*********************************************************************/
123 /*********************************************************************/
124
125 class AliHBTRndmCyllSurf: public AliHBTRndm
126 {
127   public:
128    AliHBTRndmCyllSurf():fR(0.0){}
129    AliHBTRndmCyllSurf(Float_t r, Float_t l):fR(r),fL(l){}
130    virtual ~AliHBTRndmCyllSurf(){}
131    
132    void Randomize(Double_t& x,Double_t& y,Double_t&z, Double_t& /*t*/t, AliVAODParticle* particle) const;
133   private:
134    Float_t fR; //Redius of cylinder
135    Float_t fL; //Length of cylinder
136  
137    ClassDef(AliHBTRndmCyllSurf,1)
138 };
139
140 /*********************************************************************/
141 /*********************************************************************/
142 /*********************************************************************/
143
144 class AliHBTRndmEllipse: public AliHBTRndm
145 {
146   public:
147    AliHBTRndmEllipse():fRmin(0.),fRmax(0.){};
148    AliHBTRndmEllipse(Float_t rmin, Float_t rmax);
149    virtual ~AliHBTRndmEllipse(){}
150    
151    void Randomize(Double_t& x,Double_t& y, Double_t& z,  Double_t& , AliVAODParticle* particle) const;
152   private:
153    Float_t fRmin; //Radius in x direction
154    Float_t fRmax; //Radius in y direction
155  
156    ClassDef(AliHBTRndmEllipse,2)
157 };
158
159
160
161 #endif
162