]>
Commit | Line | Data |
---|---|---|
a65a7e70 | 1 | // now in options |
2 | //=============================================// | |
3 | //const char* centralityEstimator = "V0M"; | |
4 | //const char* centralityEstimator = "CL1"; | |
5 | //const char* centralityEstimator = "TRK"; | |
6 | //=============================================// | |
7 | //Bool_t gRunShuffling = kFALSE; | |
8 | //Bool_t gRunShuffling = kTRUE; | |
9 | //=============================================// | |
10 | ||
11 | //PID config | |
12 | Bool_t kUseNSigmaPID = kTRUE; | |
13 | Double_t nSigmaMax = 3.0; | |
14 | Bool_t kUseBayesianPID = kFALSE; | |
15 | Double_t gMinAcceptedProbability = 0.7; | |
16 | ||
17 | //_________________________________________________________// | |
18 | AliAnalysisTaskBF *AddTaskBalanceCentralityTrain(TString analysisType = "ESD", | |
19 | Double_t centrMin=0., | |
20 | Double_t centrMax=80., //100. | |
21 | Bool_t gRunShuffling=kFALSE, | |
22 | TString centralityEstimator="V0M", | |
23 | Double_t vertexZ=10., | |
24 | Double_t DCAxy=-1, | |
25 | Double_t DCAz=-1, | |
26 | Double_t ptMin=0.3, | |
27 | Double_t ptMax=1.5, | |
28 | Double_t etaMin=-0.8, | |
29 | Double_t etaMax=0.8, | |
30 | Double_t maxTPCchi2 = -1, | |
31 | Int_t minNClustersTPC = -1, | |
32 | Bool_t kUsePID = kFALSE, | |
33 | Int_t AODfilterBit = 128, | |
34 | Bool_t bCentralTrigger = kFALSE, | |
35 | Bool_t bHBTcut = kFALSE, | |
36 | Bool_t bConversionCut = kFALSE, | |
37 | TString fileNameBase="AnalysisResults") { | |
38 | ||
39 | // Creates a balance function analysis task and adds it to the analysis manager. | |
40 | // Get the pointer to the existing analysis manager via the static access method. | |
41 | TString centralityName(""); | |
42 | centralityName+=Form("%.0f",centrMin); | |
43 | centralityName+="-"; | |
44 | centralityName+=Form("%.0f",centrMax); | |
45 | centralityName+="_"; | |
46 | centralityName+=Form("%s",centralityEstimator.Data()); | |
47 | centralityName+="_"; | |
48 | centralityName+=Form("vZ%.1f",vertexZ); | |
49 | centralityName+="_"; | |
50 | centralityName+=Form("DCAxy%.1f",DCAxy); | |
51 | centralityName+="_"; | |
52 | centralityName+=Form("DCAz%.1f",DCAz); | |
53 | centralityName+="_Pt"; | |
54 | centralityName+=Form("%.1f",ptMin); | |
55 | centralityName+="-"; | |
56 | centralityName+=Form("%.1f",ptMax); | |
57 | centralityName+="_Eta"; | |
58 | centralityName+=Form("%.1f",etaMin); | |
59 | centralityName+="-"; | |
60 | centralityName+=Form("%.1f",etaMax); | |
61 | centralityName+="_Chi"; | |
62 | centralityName+=Form("%.1f",maxTPCchi2); | |
63 | centralityName+="_nClus"; | |
64 | centralityName+=Form("%d",minNClustersTPC); | |
65 | centralityName+="_Bit"; | |
66 | centralityName+=Form("%d",AODfilterBit); | |
67 | if(bCentralTrigger) centralityName+="_withCentralTrigger"; | |
68 | if(bHBTcut) centralityName+="_withHBTcut"; | |
69 | if(bConversionCut) centralityName+="_withConversionCut"; | |
70 | if(kUsePID) centralityName+="_PID"; | |
71 | ||
72 | ||
73 | ||
74 | ||
75 | ||
76 | TString outputFileName(fileNameBase); | |
77 | outputFileName.Append(".root"); | |
78 | ||
79 | //=========================================================================== | |
80 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
81 | if (!mgr) { | |
82 | ::Error("AddTaskBF", "No analysis manager to connect to."); | |
83 | return NULL; | |
84 | } | |
85 | ||
86 | // Check the analysis type using the event handlers connected to the analysis manager. | |
87 | //=========================================================================== | |
88 | if (!mgr->GetInputEventHandler()) { | |
89 | ::Error("AddTaskBF", "This task requires an input event handler"); | |
90 | return NULL; | |
91 | } | |
92 | TString analysisType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD" or "MC" | |
93 | if(dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())) analysisType = "AOD"; | |
94 | ||
95 | ||
96 | // for local changed BF configuration | |
97 | //gROOT->LoadMacro("./configBalanceFunctionAnalysis.C"); | |
98 | gROOT->LoadMacro("$ALICE_ROOT/PWGCF/EBYE/macros/configBalanceFunctionAnalysis.C"); | |
99 | AliBalance *bf = 0; // Balance Function object | |
100 | AliBalance *bfs = 0; // shuffled Balance function objects | |
101 | ||
102 | if (analysisType=="ESD"){ | |
103 | bf = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); | |
104 | if(gRunShuffling) bfs = GetBalanceFunctionObject("ESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); | |
105 | } | |
106 | else if (analysisType=="MCESD"){ | |
107 | bf = GetBalanceFunctionObject("MCESD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); | |
108 | if(gRunShuffling) bfs = GetBalanceFunctionObject("MCESD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); | |
109 | } | |
110 | else if (analysisType=="AOD"){ | |
111 | bf = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); | |
112 | if(gRunShuffling) bfs = GetBalanceFunctionObject("AOD",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); | |
113 | } | |
114 | else if (analysisType=="MC"){ | |
115 | bf = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kFALSE,bHBTcut,bConversionCut,kUsePID); | |
116 | if(gRunShuffling) bfs = GetBalanceFunctionObject("MC",centralityEstimator,centrMin,centrMax,kTRUE,bHBTcut,bConversionCut,kUsePID); | |
117 | } | |
118 | else{ | |
119 | ::Error("AddTaskBF", "analysis type NOT known."); | |
120 | return NULL; | |
121 | } | |
122 | ||
123 | // Create the task, add it to manager and configure it. | |
124 | //=========================================================================== | |
125 | AliAnalysisTaskBF *taskBF = new AliAnalysisTaskBF("TaskBF"); | |
126 | taskBF->SetAnalysisObject(bf); | |
127 | if(gRunShuffling) taskBF->SetShufflingObject(bfs); | |
128 | ||
129 | taskBF->SetCentralityPercentileRange(centrMin,centrMax); | |
130 | if((analysisType == "ESD")||(analysisType == "MCESD")) { | |
131 | AliESDtrackCuts *trackCuts = GetTrackCutsObject(ptMin,ptMax,etaMin,etaMax,maxTPCchi2,DCAxy,DCAz,minNClustersTPC); | |
132 | taskBF->SetAnalysisCutObject(trackCuts); | |
133 | if(kUsePID) { | |
134 | if(kUseBayesianPID) | |
135 | taskBF->SetUseBayesianPID(gMinAcceptedProbability); | |
136 | else if(kUseNSigmaPID) | |
137 | taskBF->SetUseNSigmaPID(nSigmaMax); | |
138 | taskBF->SetParticleOfInterest(AliAnalysisTaskBF::kPion); | |
139 | taskBF->SetDetectorUsedForPID(AliAnalysisTaskBF::kTPCpid); | |
140 | } | |
141 | } | |
142 | else if(analysisType == "AOD") { | |
143 | // pt and eta cut (pt_min, pt_max, eta_min, eta_max) | |
144 | taskBF->SetAODtrackCutBit(AODfilterBit); | |
145 | taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax); | |
146 | ||
147 | // set extra DCA cuts (-1 no extra cut) | |
148 | taskBF->SetExtraDCACutsAOD(DCAxy,DCAz); | |
149 | ||
150 | // PID | |
151 | if(kUsePID) { | |
152 | if(kUseBayesianPID) | |
153 | taskBF->SetUseBayesianPID(gMinAcceptedProbability); | |
154 | else if(kUseNSigmaPID) | |
155 | taskBF->SetUseNSigmaPID(nSigmaMax); | |
156 | taskBF->SetParticleOfInterest(AliAnalysisTaskBF::kPion); | |
157 | taskBF->SetDetectorUsedForPID(AliAnalysisTaskBF::kTPCpid); | |
158 | } | |
159 | ||
160 | // set extra TPC chi2 / nr of clusters cut | |
161 | taskBF->SetExtraTPCCutsAOD(maxTPCchi2, minNClustersTPC); | |
162 | ||
163 | } | |
164 | else if(analysisType == "MC") { | |
165 | taskBF->SetKinematicsCutsAOD(ptMin,ptMax,etaMin,etaMax); | |
166 | } | |
167 | ||
168 | // offline trigger selection (AliVEvent.h) | |
169 | // taskBF->UseOfflineTrigger(); // NOT used (selection is done with the AliAnalysisTaskSE::SelectCollisionCandidates()) | |
170 | // with this only selected events are analyzed (first 2 bins in event QA histogram are the same)) | |
171 | // documentation in https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PWG1EvSelDocumentation | |
172 | if(bCentralTrigger) taskBF->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral); | |
173 | else taskBF->SelectCollisionCandidates(AliVEvent::kMB); | |
174 | ||
175 | // centrality estimator (default = V0M) | |
176 | taskBF->SetCentralityEstimator(centralityEstimator); | |
177 | ||
178 | // vertex cut (x,y,z) | |
179 | taskBF->SetVertexDiamond(.3,.3,vertexZ); | |
180 | ||
181 | ||
182 | ||
183 | //bf->PrintAnalysisSettings(); | |
184 | mgr->AddTask(taskBF); | |
185 | ||
186 | // Create ONLY the output containers for the data produced by the task. | |
187 | // Get and connect other common input/output containers via the manager as below | |
188 | //============================================================================== | |
189 | TString outputFileName = AliAnalysisManager::GetCommonFileName(); | |
190 | outputFileName += ":PWGCFEbyE.outputBalanceFunctionAnalysis"; | |
191 | AliAnalysisDataContainer *coutQA = mgr->CreateContainer(Form("listQA_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); | |
192 | AliAnalysisDataContainer *coutBF = mgr->CreateContainer(Form("listBF_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); | |
193 | if(gRunShuffling) AliAnalysisDataContainer *coutBFS = mgr->CreateContainer(Form("listBFShuffled_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); | |
194 | if(kUsePID) AliAnalysisDataContainer *coutQAPID = mgr->CreateContainer(Form("listQAPID_%s",centralityName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputFileName.Data()); | |
195 | ||
196 | mgr->ConnectInput(taskBF, 0, mgr->GetCommonInputContainer()); | |
197 | mgr->ConnectOutput(taskBF, 1, coutQA); | |
198 | mgr->ConnectOutput(taskBF, 2, coutBF); | |
199 | if(gRunShuffling) mgr->ConnectOutput(taskBF, 3, coutBFS); | |
200 | if(kUsePID) mgr->ConnectOutput(taskBF, 4, coutQAPID); | |
201 | ||
202 | return taskBF; | |
203 | } |