]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTPositionRandomizer.h
Bug Correction (lacking Abs)
[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 "AliHBTReader.h"
14
15 class AliHBTRndm;
16 class AliHBTEvent;
17 class AliHBTRun;
18 class AliHBTParticle;
19 class TH1I;
20
21 class AliHBTPositionRandomizer: public AliHBTReader
22 {
23  public:
24    enum EModelTypes{kGausBall,kCylinder,kCylinderSurf};
25    AliHBTPositionRandomizer();
26    AliHBTPositionRandomizer(AliHBTReader* reader);
27    AliHBTPositionRandomizer(const AliHBTPositionRandomizer& in);
28    
29    virtual ~AliHBTPositionRandomizer();
30
31    AliHBTPositionRandomizer& operator=(const AliHBTPositionRandomizer& in);
32    
33    Int_t  Next(){return (fReader)?fReader->Next():1;}
34    void   Rewind(){if(fReader) fReader->Rewind();}
35    
36    Bool_t ReadsTracks() const {return (fReader)?fReader->ReadsTracks():kFALSE;}
37    Bool_t ReadsParticles() const {return (fReader)?fReader->ReadsParticles():kFALSE;}
38    
39    Int_t  Read(AliHBTRun* particles, AliHBTRun *tracks);
40    
41    AliHBTEvent* GetParticleEvent() ;
42    AliHBTEvent* GetTrackEvent() ;
43
44    AliHBTEvent* GetParticleEvent(Int_t n);
45    AliHBTEvent* GetTrackEvent(Int_t n){return (fReader)?fReader->GetTrackEvent(n):0x0;}
46    Int_t GetNumberOfPartEvents(){return (fReader)?fReader->GetNumberOfPartEvents():0;}
47    Int_t GetNumberOfTrackEvents(){return (fReader)?fReader->GetNumberOfTrackEvents():0;}
48    virtual TH1I* GetTrackCounter() const {return (fReader)?fReader->GetTrackCounter():0x0;}
49    virtual void  WriteTrackCounter() const {if(fReader) fReader->WriteTrackCounter();}
50
51    void Randomize(AliHBTEvent* event) const;
52    void Randomize(AliHBTRun* run) const;
53    void SetEventVertex(Double_t x, Double_t y,Double_t z);
54    
55    void SetGaussianBall(Double_t r);
56    void SetGaussianBall(Double_t rx, Double_t ry, Double_t rz);
57    void SetCyllinderSurface(Double_t r, Double_t l);
58    
59    void AddToPosition(Bool_t flag){fAddToExistingPos = flag;}
60    void RandomizeTracks(Bool_t flag){fRandomizeTracks = flag;}
61    
62    
63  protected:
64    void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p);
65    Int_t ReadNext(){return (fReader)?fReader->Next():1;}
66    
67  private:
68    AliHBTReader* fReader;      // Pointer to reader
69    AliHBTRndm*   fRandomizer;  // Pointer to class that performs randomization according to some model
70    
71    Int_t    fModel;            //Defines what model is used
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    ClassDef(AliHBTPositionRandomizer,1)
83 };
84
85 class AliHBTRndm: public TObject
86 {
87   public:
88    AliHBTRndm(){}
89    virtual ~AliHBTRndm(){}
90    virtual void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*p) const = 0;
91    ClassDef(AliHBTRndm,1)
92 };
93
94 class AliHBTRndmGaussBall: public AliHBTRndm
95 {
96   public:
97    AliHBTRndmGaussBall();
98    AliHBTRndmGaussBall(Float_t r);
99    AliHBTRndmGaussBall(Float_t rx, Float_t ry, Float_t rz);
100    virtual ~AliHBTRndmGaussBall(){}
101    void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle*/*particle*/) const;
102   private:
103    Float_t fRx; //Dispertion in x 
104    Float_t fRy; //Dispertion in y
105    Float_t fRz; //Dispertion in z
106    ClassDef(AliHBTRndmGaussBall,1)
107 };
108
109 class AliHBTRndmCyllSurf: public AliHBTRndm
110 {
111   public:
112    AliHBTRndmCyllSurf():fR(0.0){}
113    AliHBTRndmCyllSurf(Float_t r, Float_t l):fR(r),fL(l){}
114    virtual ~AliHBTRndmCyllSurf(){}
115    
116    void Randomize(Double_t& x,Double_t& y,Double_t&z, AliHBTParticle* particle) const;
117   private:
118    Float_t fR; //Redius of cylinder
119    Float_t fL; //Length of cylinder
120  
121    ClassDef(AliHBTRndmCyllSurf,1)
122 };
123
124 #endif
125