]>
Commit | Line | Data |
---|---|---|
2fbc0b17 | 1 | //DEFINITION OF A FEW CONSTANTS |
2 | const Double_t ymin = -2.0 ; | |
3 | const Double_t ymax = 2.0 ; | |
4 | const Double_t ptmin = 0.0 ; | |
5 | const Double_t ptmax = 8.0 ; | |
6 | const Double_t phimin = 0 ; | |
7 | const Double_t phimax = 360 ; | |
8 | const Int_t mintrackrefsTPC = 2 ; | |
9 | const Int_t mintrackrefsITS = 3 ; | |
10 | const Int_t PDG = 3122; | |
11 | const Int_t minclustersTPC = 10 ; | |
12 | const Int_t chargeV0 = 0 ; | |
13 | //---------------------------------------------------- | |
14 | ||
15 | Bool_t AliCFV0Task( | |
16 | const Bool_t useGrid = 1, | |
17 | const char * kTagXMLFile="wn.xml", // XML file containing tags | |
18 | ) | |
19 | { | |
20 | ||
21 | TBenchmark benchmark; | |
22 | benchmark.Start("AliSingleTrackTask"); | |
23 | ||
24 | AliLog::SetGlobalDebugLevel(0); | |
25 | ||
26 | Load(useGrid) ; //load the required libraries | |
27 | ||
28 | AliLog::SetGlobalDebugLevel(0); | |
29 | ||
30 | TChain * analysisChain ; | |
31 | ||
32 | if (useGrid) { //data located on AliEn | |
33 | TGrid::Connect("alien://") ; | |
34 | // Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria | |
35 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
36 | AliEventTagCuts *eventCuts = new AliEventTagCuts(); | |
37 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
38 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
39 | eventCuts->SetMultiplicityRange(0,20000); | |
40 | // Create an AliTagAnalysis Object and chain the tags | |
41 | AliTagAnalysis *tagAna = new AliTagAnalysis(); | |
42 | tagAna->SetType("ESD"); //for aliroot > v4-05 | |
43 | TAlienCollection *coll = TAlienCollection::Open(kTagXMLFile); | |
44 | TGridResult *tagResult = coll->GetGridResult("",0,0); | |
45 | tagResult->Print(); | |
46 | tagAna->ChainGridTags(tagResult); | |
47 | // Create a new esd chain and assign the chain that is returned by querying the tags | |
48 | analysisChain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts); | |
49 | } | |
50 | else {// local data | |
51 | analysisChain = new TChain("esdTree"); | |
52 | //here put your input data path | |
53 | analysisChain->Add("AliESDs.root"); | |
54 | } | |
55 | ||
56 | ||
57 | Info("AliCFV0Task",Form("CHAIN HAS %d ENTRIES",(Int_t)analysisChain->GetEntries())); | |
58 | ||
59 | //CONTAINER DEFINITION | |
60 | Info("AliCFV0Task","SETUP CONTAINER"); | |
61 | //the sensitive variables, their indices | |
62 | Int_t ipt = 0; | |
63 | Int_t iy = 1; | |
64 | //Setting up the container grid... | |
65 | Int_t nstep = 4 ; //number of selection steps MC | |
66 | const Int_t nvar = 2 ; //number of variables on the grid:pt,y,phi,vtx | |
67 | const Int_t nbin1 = 8 ; //bins in pt | |
68 | const Int_t nbin2 = 8 ; //bins in y | |
69 | //arrays for the number of bins in each dimension | |
70 | const Int_t iBin[nvar] ={nbin1,nbin2}; | |
71 | //arrays for lower bounds : | |
72 | Double_t binLim1[nbin1+1]; | |
73 | Double_t binLim2[nbin2+1]; | |
74 | //values for bin lower bounds | |
75 | for(Int_t i=0; i<=nbin1; i++) binLim1[i]=ptmin + (ptmax-ptmin)/nbin1*(Double_t)i ; | |
76 | for(Int_t i=0; i<=nbin2; i++) binLim2[i]=ymin + (ymax-ymin) /nbin2*(Double_t)i ; | |
77 | //one "container" for MC | |
78 | AliCFContainer* container = new AliCFContainer("container","container for V0s",nstep,nvar,iBin); | |
79 | //setting the bin limits | |
80 | container -> SetBinLimits(ipt,binLim1); | |
81 | container -> SetBinLimits(iy,binLim2); | |
82 | ||
83 | ||
84 | //CREATE THE CUTS ----------------------------------------------- | |
85 | ||
86 | // Gen-Level kinematic cuts | |
87 | AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts"); | |
88 | mcKineCuts->SetPtRange(ptmin,ptmax); | |
89 | mcKineCuts->SetRapidityRange(ymin,ymax); | |
90 | mcKineCuts->SetChargeMC(0); | |
91 | ||
92 | AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts"); | |
93 | mcGenCuts->SetRequireIsPrimary(); | |
94 | mcGenCuts->SetRequirePdgCode(PDG); | |
95 | ||
96 | //Acceptance Cuts | |
97 | AliCFPairAcceptanceCuts *mcAccCuts = new AliCFPairAcceptanceCuts("mcAccCuts","MC acceptance cuts for V0"); | |
98 | mcAccCuts->SetMinNHitITS(mintrackrefsITS,mintrackrefsITS); | |
99 | mcAccCuts->SetMinNHitTPC(mintrackrefsTPC,mintrackrefsTPC); | |
100 | ||
101 | // Rec-Level kinematic cuts | |
102 | AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","V0 rec-level kine cuts"); | |
103 | recKineCuts->SetPtRange(ptmin,ptmax); | |
104 | recKineCuts->SetRapidityRange(ymin,ymax); | |
105 | ||
106 | AliCFPairQualityCuts *recQualityCuts = new AliCFPairQualityCuts("recQualityCuts","V0 rec-level quality cuts"); | |
107 | recQualityCuts->SetMinNClusterTPC(minclustersTPC,minclustersTPC); | |
108 | ||
109 | AliCFV0TopoCuts *recTopoCuts = new AliCFV0TopoCuts("recTopoCuts","V0 Topological Cuts"); | |
110 | recTopoCuts->SetMaxDcaDaughters(0.1); | |
111 | recTopoCuts->SetMinCosPointAngle(0.995); | |
112 | recTopoCuts->SetMinDcaNeg(0.1); | |
113 | recTopoCuts->SetMinDcaPos(0.1); | |
114 | ||
115 | ||
116 | AliCFPairPidCut* cutPID = new AliCFPairPidCut("cutPID","ESD_PID") ; | |
117 | Double_t prior_pp[AliPID::kSPECIES] = {0.0244519, | |
118 | 0.0143988, | |
119 | 0.805747 , | |
120 | 0.0928785, | |
121 | 0.0625243 }; | |
122 | ||
123 | Double_t prior_pbpb[AliPID::kSPECIES] = {0.0609, | |
124 | 0.1064, | |
125 | 0.7152 , | |
126 | 0.0442, | |
127 | 0.0733 }; | |
128 | cutPID->SetPriors(prior_pbpb); | |
129 | cutPID->SetDetectors("ITS TPC TRD","ITS TPC TRD"); | |
130 | cutPID->SetProbabilityCut(0,0); | |
131 | switch(TMath::Abs(PDG)) { | |
132 | case 310 : cutPID->SetParticleType(AliPID::kPion , kTRUE, AliPID::kPion , kTRUE); break; | |
133 | case 3122 : cutPID->SetParticleType(AliPID::kPion , kTRUE, AliPID::kProton, kTRUE); break; | |
134 | case -3122 : cutPID->SetParticleType(AliPID::kProton, kTRUE, AliPID::kPion , kTRUE); break; | |
135 | default : printf("UNDEFINED PID\n"); break; | |
136 | } | |
137 | ||
138 | Info("AliCFV0Task","CREATE MC KINE CUTS"); | |
139 | TObjArray* mcList = new TObjArray(0) ; | |
140 | mcList->AddLast(mcKineCuts); | |
141 | mcList->AddLast(mcGenCuts); | |
142 | ||
143 | Info("AliCFV0Task","CREATE ACCEPTANCE CUTS"); | |
144 | TObjArray* accList = new TObjArray(0) ; | |
145 | accList->AddLast(mcAccCuts); | |
146 | ||
147 | Info("AliCFV0Task","CREATE RECONSTRUCTION CUTS"); | |
148 | TObjArray* recList = new TObjArray(0) ; | |
149 | recList->AddLast(recKineCuts); | |
150 | recList->AddLast(recQualityCuts); | |
151 | recList->AddLast(recTopoCuts); | |
152 | ||
153 | Info("AliCFV0Task","CREATE PID CUTS"); | |
154 | TObjArray* fPIDCutList = new TObjArray(0) ; | |
155 | fPIDCutList->AddLast(cutPID); | |
156 | ||
157 | ||
158 | //CREATE THE INTERFACE TO CORRECTION FRAMEWORK USED IN THE TASK | |
159 | Info("AliCFV0Task","CREATE INTERFACE AND CUTS"); | |
160 | AliCFManager* man = new AliCFManager() ; | |
161 | man->SetParticleContainer(container); | |
162 | man->SetParticleCutsList (AliCFManager::kPartGenCuts,mcList); | |
163 | man->SetParticleCutsList (AliCFManager::kPartAccCuts,accList); | |
164 | man->SetParticleCutsList (AliCFManager::kPartRecCuts,recList); | |
165 | man->SetParticleCutsList (AliCFManager::kPartSelCuts,fPIDCutList); | |
166 | ||
167 | //CREATE THE TASK | |
168 | Info("AliCFV0Task","CREATE TASK"); | |
169 | // create the task | |
170 | AliCFV0Task *task = new AliCFV0Task("AliCFV0Task"); | |
171 | task->SetCFManager(man); //here is set the CF manager | |
172 | task->SetRebuildV0s(0); | |
173 | task->SetV0PDG(PDG); | |
174 | ||
175 | //SETUP THE ANALYSIS MANAGER TO READ INPUT CHAIN AND WRITE DESIRED OUTPUTS | |
176 | Info("AliCFV0Task","CREATE ANALYSIS MANAGER"); | |
177 | // Make the analysis manager | |
178 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
179 | ||
180 | // Create and connect containers for input/output | |
181 | ||
182 | //input data | |
183 | AliAnalysisDataContainer *cinput0 = mgr->CreateContainer("cchain0",TChain::Class(),AliAnalysisManager::kInputContainer); | |
184 | // output histo (number of events processed) | |
185 | AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root"); | |
186 | // output Correction Framework Container (for acceptance & efficiency calculations) | |
187 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("ccontainer0", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root"); | |
188 | // output QA histograms | |
189 | // AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("clist0", TList::Class(),AliAnalysisManager::kOutputContainer,"outputV0.root"); | |
190 | ||
191 | mgr->AddTask(task); | |
192 | mgr->ConnectInput(task,0,cinput0); | |
193 | mgr->ConnectOutput(task,0,coutput0); | |
194 | mgr->ConnectOutput(task,1,coutput1); | |
195 | ||
196 | cinput0->SetData(analysisChain); | |
197 | ||
198 | //NEW INTERFACE TO MC INFORMATION | |
199 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
200 | mgr->SetMCtruthEventHandler(mcHandler); | |
201 | ||
202 | Info("AliCFV0Task","READY TO RUN"); | |
203 | //RUN !!! | |
204 | if (mgr->InitAnalysis()) { | |
205 | mgr->PrintStatus(); | |
206 | mgr->StartAnalysis("local",analysisChain); | |
207 | } | |
208 | ||
209 | benchmark.Stop("AliCFV0Task"); | |
210 | benchmark.Show("AliCFV0Task"); | |
211 | ||
212 | return kTRUE ; | |
213 | } | |
214 | ||
215 | void Load(Bool_t useGrid) { | |
216 | //remove this file which can cause problems | |
217 | if (!useGrid) | |
218 | gSystem->Exec("rm $ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so"); | |
219 | ||
220 | //load the required aliroot libraries | |
221 | gSystem->Load("libANALYSIS") ; | |
222 | ||
223 | gSystem->SetIncludePath("-I. -I$ALICE_ROOT/include -I$ROOTSYS/include -I$ALICE_ROOT/PWG2/RESONANCES -I$ALICE_ROOT/CORRFW"); | |
224 | ||
225 | if (!useGrid) { | |
226 | //load local CF library | |
227 | gSystem->Load("libCORRFW"); | |
228 | } | |
229 | else { | |
230 | //compile online the task class | |
231 | gSystem->Exec("tar zxvf cf_classes.tgz"); | |
232 | gROOT->LoadMacro("./AliCFFrame.cxx+"); | |
233 | gROOT->LoadMacro("./AliCFVGrid.cxx+"); | |
234 | gROOT->LoadMacro("./AliCFGrid.cxx+"); | |
235 | gROOT->LoadMacro("./AliCFGridSparse.cxx+"); | |
236 | gROOT->LoadMacro("./AliCFContainer.cxx+"); | |
237 | gROOT->LoadMacro("./AliCFCutBase.cxx+"); | |
238 | gROOT->LoadMacro("./AliCFTrackKineCuts.cxx+"); | |
239 | gROOT->LoadMacro("./AliCFTrackQualityCuts.cxx+"); | |
240 | gROOT->LoadMacro("./AliCFParticleGenCuts.cxx+"); | |
241 | gROOT->LoadMacro("./AliCFAcceptanceCuts.cxx+"); | |
242 | gROOT->LoadMacro("./AliCFTrackCutPid.cxx+"); | |
243 | gROOT->LoadMacro("./AliCFManager.cxx+"); | |
244 | gSystem->Exec("tar zxvf cf_V0.tgz"); | |
245 | gROOT->LoadMacro("./AliCFPair.cxx+"); | |
246 | gROOT->LoadMacro("./AliCFPairAcceptanceCuts.cxx+"); | |
247 | gROOT->LoadMacro("./AliCFPairQualityCuts.cxx+"); | |
248 | gROOT->LoadMacro("./AliCFPairPidCut.cxx+"); | |
249 | gROOT->LoadMacro("./AliCFV0TopoCuts.cxx+"); | |
250 | } | |
251 | gROOT->LoadMacro("./AliCFV0Task.cxx+"); | |
252 | } |