]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/EBYE/PIDFluctuation/macros/AddEbyEPidRatioTask.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / macros / AddEbyEPidRatioTask.C
1 /* *************************************************************************
2  *             AliEbyE Analysis for Particle Ratio Fluctuation             *
3  *                   Deepika Rathee  | Satyajit Jena                       *
4  *                   drathee@cern.ch | sjena@cern.ch                       *
5  *                  Date: Wed Jul  9 18:38:30 CEST 2014                    * 
6  *          New approch to find particle ratio to reduce memory            *
7  *                             (Test Only)                                 *
8  ***************************************************************************/
9
10 AliAnalysisTask *AddEbyEPidRatioTask(const Char_t *name      = "NuDyn", //  0      
11                                      Int_t   isModeDist      = 1,       //  1
12                                      Bool_t  isModeEff       = 0,       //  2
13                                      Bool_t  isModeDCA       = 0,       //  3
14                                      Bool_t  isModeQA        = 0,       //  4
15                                      Int_t   isRatio         = 3,       //  5
16                                      Bool_t  isModeAOD       = 0,       //  6
17                                      Bool_t  isSetExt        = 0,       //  7
18                                      Int_t   aodFilterBit    = 1024,    //  8 
19                                      Float_t gEta            = 0.8,     //  9
20                                      Int_t   modeCuts        = 0,       // 10 
21                                      Int_t   modePID         =-1,       // 11
22                                      Float_t gMinPt          = 0.3,     // 12
23                                      Float_t gMaxPt          = 2.5,     // 13
24                                      Float_t gMinPtForTof    = 0.21,    // 14
25                                      Float_t gMaxPtForTPClow = 0.69,    // 15
26                                      Float_t gMinPtEff       = 0.3,     // 16
27                                      Float_t gMaxPtEff       = 2.5,     // 17 
28                                      Float_t gSigmaITS       = 4.0,     // 18
29                                      Float_t gSigmaTOF       = 4.0,     // 19
30                                      Float_t gSigmaTPC       = 4.0,     // 20
31                                      Float_t gSigmaTPClow    = 3.0,
32                                      Bool_t  isPer           = 0,
33                                      Int_t   nSub            = 25) {   // 21
34   
35   TString sName(name);
36
37   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
38   if (!mgr) {
39     Error("AddTaskNetParticle", "No analysis manager found.");
40     return NULL;
41   }
42   
43   Bool_t isMC = (mgr->GetMCtruthEventHandler() != NULL);
44   if (isMC)
45     Info("AddTaskNetParticle", "This task has MC.");
46   
47   AliEbyEPidRatioTask *task = new AliEbyEPidRatioTask("EbyEPidRatio");
48   if (!task) {
49     Error("EbyEPidRatio", "Task could not be created.");
50     return NULL;
51   }
52
53   if (isMC) 
54     task->SetIsMC();
55   if (isModeEff) 
56     task->SetModeEffCreation(1);             // => 1 = on    | 0 = off (default)
57   if (isModeDCA)
58     task->SetModeDCACreation(1);             // => 1 = on    | 0 = off (default)
59      
60   if (isModeAOD) {
61     task->SetIsAOD(1);                       // => 1 = AOD   | 0 = ESD (default)
62     task->SetTrackFilterBit(aodFilterBit);   
63   }
64   if (isModeQA)
65     task->SetModeQACreation(1);              // => 1 = on    | 0 = off (default)
66   
67   task->SetModeDistCreation(isModeDist);  // 0 nothing, 1 only dist, 2, with qa            
68   task->SetIsRatio(isRatio);
69
70   Float_t minPt,     maxPt,     minPtEff,     maxPtEff,  minPtForTOF;
71   Float_t nSigmaITS, nSigmaTPC, nSigmaTPClow, nSigmaTOF, maxPtForTPClow; 
72   Float_t etaMax,    etaMaxEff, maxRap; 
73   Int_t   pidStrategy;
74
75   minPtForTOF    = 0.69;   
76   maxPtForTPClow = 0.69;
77   minPt          = 0.5;     
78   maxPt          = 2.0; 
79   minPtEff       = 0.3;    
80   maxPtEff       = 2.5; 
81   
82   maxRap         = 0.5;
83   etaMax         = 0.8;  
84  
85   etaMaxEff      = 0.8;  
86   nSigmaITS      = 4.0;   
87   nSigmaTPC      = 4.0;   
88   nSigmaTPClow   = 3.0;   
89   nSigmaTOF      = 4.0; 
90     
91   if (isSetExt) {
92     minPt          = gMinPt;    
93     maxPt          = gMaxPt;
94     minPtForTOF    = gMinPtForTof;     
95     maxPtForTPClow = gMaxPtForTPClow;
96     minPtEff       = gMinPtEff;
97     maxPtEff       = gMaxPtEff;
98
99     etaMax         = gEta;
100
101     nSigmaITS      = gSigmaITS;   
102     nSigmaTPC      = gSigmaTPC;   
103     nSigmaTPClow   = gSigmaTPClow;  
104     nSigmaTOF      = gSigmaTOF;
105   }
106  
107   if (modePID    == -1) { // default
108     pidStrategy   = 7;         // 7: ITS + TPC + TOF (using minPtForTOF)
109     if (modeCuts == 1)
110       pidStrategy = 5;       // 5: TPC + TOF (using minPtForTOF) 
111   }
112   else
113     pidStrategy = modePID;
114   
115   AliEbyEPidRatioHelper *helper = new AliEbyEPidRatioHelper;
116   if (!helper) {
117     Error("AddTaskNetParticle", "Helper could not be created.");
118     delete task;
119     return NULL;
120   }
121   
122
123   task->SetESDTrackCutMode(modeCuts);       // => 0 = normal | 1 = LF
124   task->SetEtaMax(etaMax);                  // eta cut
125   task->SetEtaMaxEff(etaMaxEff);            // eta cut for efficiency
126   task->SetPtRange(minPt, maxPt);           // pt cut range for the analysis
127   task->SetPtRangeEff(minPtEff, maxPtEff);  // pt cut range for the correction / efficiency / contamination creation
128   if (isPer) task->SetIsPer();  // 
129  
130   helper->SetVertexZMax(10.);   
131   helper->SetCentralityBinMax(11);
132   helper->SetRapidityMax(maxRap); 
133   helper->SetMinTrackLengthMC(70.);  
134   helper->SetNSigmaMaxCdd(0.);              //  3. ||   ->> Turn off sigmaDCA cuts for now
135   helper->SetNSigmaMaxCzz(0.);              //  3. ||   ->> Turn off sigmaDCA cuts for now
136   helper->SetPhiRange(0., 3.88);            //  Only used if requested in task - default is TwoPi
137   helper->SetPIDStrategy(pidStrategy);
138   helper->SetNSigmaMaxITS(nSigmaITS);
139   helper->SetNSigmaMaxTPC(nSigmaTPC);
140   helper->SetNSigmaMaxTPClow(nSigmaTPClow);
141   helper->SetNSigmaMaxTOF(nSigmaTOF);
142   helper->SetMinPtForTOFRequired(minPtForTOF);
143   helper->SetMaxPtForTPClow(maxPtForTPClow);
144   helper->SetNSubSamples(nSub);
145   
146   task->SetNetParticleHelper(helper);
147   mgr->AddTask(task);
148   
149   AliAnalysisDataContainer *cinput  = mgr->GetCommonInputContainer();
150   TString outputFileName   = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
151   TString outputQAFileName = Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name);
152     
153   AliAnalysisDataContainer *coutput     = mgr->CreateContainer(name, TList::Class(),  AliAnalysisManager::kOutputContainer, outputFileName);
154   AliAnalysisDataContainer *coutputEff  = mgr->CreateContainer(Form("%s_eff",  name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
155   AliAnalysisDataContainer *coutputCont = mgr->CreateContainer(Form("%s_cont", name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
156   AliAnalysisDataContainer *coutputDca  = mgr->CreateContainer(Form("%s_dca",  name), TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
157
158   AliAnalysisDataContainer *coutputQA   = mgr->CreateContainer(Form("%sQA",    name), TList::Class(), AliAnalysisManager::kOutputContainer, outputQAFileName);
159     
160   mgr->ConnectInput  (task,  0, cinput );
161   mgr->ConnectOutput (task,  1, coutput);
162   mgr->ConnectOutput (task,  2, coutputEff);
163   mgr->ConnectOutput (task,  3, coutputCont);
164   mgr->ConnectOutput (task,  4, coutputDca);
165   mgr->ConnectOutput (task,  5, coutputQA);
166
167   return task;
168 }