]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Upgrade/AliToyMCEventGenerator.h
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / TPC / Upgrade / AliToyMCEventGenerator.h
1 #ifndef AliToyMCEventGenerator_H
2 #define AliToyMCEventGenerator_H
3
4 #include <TString.h>
5
6 class TFile;
7 class TTree;
8 class TObjArray;
9
10 class AliTPCParam;
11 class AliTPCCorrection;
12 class AliTrackPointArray;
13 class AliTrackPoint;
14 class AliTPCclusterMI;
15
16 class AliToyMCTrack;
17 class AliToyMCEvent;
18
19 class AliToyMCEventGenerator : public TObject {
20  public:
21    enum EGasType {
22      kNeCO2_9010=0,
23      kNeCO2N2_90105
24    };
25
26   enum EEpsilon {
27     kEps5=0,
28     kEps10,
29     kEps20,
30     kEps25,
31     kEps30,
32     kEps35,
33     kEps40
34   };
35
36   enum ECollRate {
37     k50kHz = 0
38   };
39
40   enum ECorrection {
41     kLookup=0,
42     kSpaceChargeFile
43   };
44   
45   AliToyMCEventGenerator();
46   AliToyMCEventGenerator(const AliToyMCEventGenerator &gen);
47   virtual ~AliToyMCEventGenerator();
48
49   virtual AliToyMCEvent* Generate(Double_t time) = 0;
50
51   Bool_t DistortTrack(AliToyMCTrack &trackIn, Double_t t0=0);
52   void MakeITSClusters(AliToyMCTrack &trackIn/*, Double_t t0*/);
53   void MakeTRDClusters(AliToyMCTrack &trackIn/*, Double_t t0*/);
54   void MakeTPCClusters(AliToyMCTrack &trackIn, Double_t t0);
55   void CreateSpacePoints(AliToyMCTrack &trackIn,
56                         AliTrackPointArray &arrUdist,
57                         AliTrackPointArray &arrDist);
58   void SetPoint(Float_t xyz[3], Float_t sigmaY, Float_t sigmaZ, AliTrackPoint &point);
59   void ConvertTrackPointsToLocalClusters(AliTrackPointArray &arrPoints, AliToyMCTrack &tr, Double_t t0, Int_t type);
60   Bool_t SetupCluster(AliTPCclusterMI &tempCl, Float_t xyz[3], Int_t sec, Double_t t0);
61   
62   void SetOutputFileName(const char* file) { fOutputFileName=file; }
63   const char* GetOutputFileName()    const { return fOutputFileName.Data(); }
64
65   void SetSpaceCharge(EEpsilon epsilon, EGasType gasType=kNeCO2_9010, ECollRate collRate=k50kHz, ECorrection corrType=kLookup);
66   void SetSpaceChargeFile(const char* file) { fCorrectionFile=file; }
67   
68   Int_t GetSector(Float_t xyz[3]);
69
70   void InitSpaceCharge();
71
72   void SetStepCorrection(Bool_t step=kTRUE) { fUseStepCorrection=step;   }
73   Bool_t GetStepCorrection() const          { return fUseStepCorrection; }
74
75   void SetUseMaterialBudget(Bool_t use) { fUseMaterialBudget=use;    }
76   Bool_t GetUseMaterialBudget() const   { return fUseMaterialBudget; }
77
78   void SetIsLaser(Bool_t use) { fIsLaser=use;    }
79   Bool_t GetIsLaser() const   { return fIsLaser; }
80
81   void   SetSCListFile(const char* file) { fSCListFile=file;              }
82   const char* GetSCListFile() const      { return fSCListFile.Data();     }
83   void   SetPrereadSCList(Bool_t b)      { fPrereadSCList=b;              }
84   Bool_t GetPrereadSCList() const        { return fPrereadSCList;         }
85   Bool_t HasSCList() const               { return  !fSCListFile.IsNull(); }
86
87   void SetCalculateScaling(Bool_t  val) { fCalculateScaling = val; }
88   Bool_t  GetCalculateScaling() const { return fCalculateScaling; }
89
90   static Float_t GetSCScalingFactor(AliTPCCorrection *corr, AliTPCCorrection *averageCorr, Float_t &chi2);
91   static void SetCorrectionFromFile(TString file, AliTPCCorrection* &corr);
92   
93  protected:
94   AliTPCParam *fTPCParam;                //! TPC params
95   AliToyMCEvent *fEvent;                 //! Toy event
96   
97   Bool_t ConnectOutputFile();
98   Bool_t CloseOutputFile();
99   void FillTree();
100   void IterateSC(Int_t ipos=-1);
101   void SetSCScalingFactor();
102   
103   UInt_t fCurrentTrack;                  // unique track id within the current event generation
104
105   
106  private:
107   AliToyMCEventGenerator& operator= (const AliToyMCEventGenerator& );
108    
109   AliTPCCorrection *fTPCCorrection;      //! distortion correction
110   AliTPCCorrection *fTPCCorrectionAv;    //! average distortion correction
111   
112   TObjArray   *fSCList;                  //! list with
113   TString fSCListFile;                   // file with a list of space charge files
114   TString fCorrectionFile;               // name of a sinfle SC file
115   TString fOutputFileName;               // name of the output file
116   TFile   *fOutFile;                     //! output file
117   TTree   *fOutTree;                     //! output tree
118
119   Bool_t fUseStepCorrection;             // use integralDz method?
120   Bool_t fUseMaterialBudget;             // use material budget in tracking?
121   Bool_t fIsLaser;                       // is a laser event?
122   Bool_t fPrereadSCList;                 // preread all SC files from the SC list
123   Bool_t fCalculateScaling;              // calculate scaling factor
124
125   void InitSpaceChargeList();
126   
127   ClassDef(AliToyMCEventGenerator, 2)
128   
129 };
130
131 #endif
132