]>
Commit | Line | Data |
---|---|---|
014044ba | 1 | // definition of variables ranges |
2 | const Double_t nevtmin = 0; | |
3 | const Double_t nevtmax = 5; | |
4 | ||
5 | const Double_t trigmin = 0; | |
6 | const Double_t trigmax = 4; | |
7 | const Int_t trigsidemin = 0; | |
8 | const Int_t trigsidemax = 4; | |
9 | const Int_t chargemin = -3; | |
10 | const Int_t chargemax = 3; | |
11 | ||
12 | const Double_t ymin = -4.5; | |
13 | const Double_t ymax = -2.0; | |
14 | const Double_t etamin = -4.5; | |
15 | const Double_t etamax = -2.0; | |
16 | const Double_t rabsmin = 15; | |
17 | const Double_t rabsmax = 90; | |
18 | const Double_t ptmin = 0; | |
19 | const Double_t ptmax = 100; | |
20 | const Double_t thabsmin = 170; | |
21 | const Double_t thabsmax = 180; | |
22 | const Double_t vzmin = -50; | |
23 | const Double_t vzmax = 50; | |
24 | const Double_t dcamin = 0; | |
25 | const Double_t dcamax = 100; | |
26 | const Double_t pmin = 0; | |
27 | const Double_t pmax = 100; | |
28 | const Double_t mmin = 0; | |
29 | const Double_t mmax = 15; | |
30 | ||
31 | // Resonances | |
32 | const Int_t PDG = 553; // Upsilon | |
33 | ||
34 | ///// Setting up the container grid | |
35 | ||
36 | // CONTAINER DEFINITION | |
37 | UInt_t nevent = 0; // number of event | |
38 | UInt_t y = 1; // dimuon rapidity | |
39 | UInt_t pt = 2; // dimuon pt | |
40 | UInt_t imass = 3; // dimuon invariant mass | |
41 | UInt_t trig = 4; // single muon track-trigger matching | |
42 | UInt_t ptmu = 5; // single muon pt | |
43 | UInt_t pmu = 6; // single muon p | |
44 | UInt_t trigside = 7; // event trigger side (AC, B, E) | |
45 | UInt_t rabsmu = 8; // single muon Rabs | |
46 | UInt_t charge = 9; // total charge of dimuon tracks | |
47 | UInt_t etamu = 10; // single muon eta | |
48 | UInt_t thabsmu = 11; // single muon theta_abs | |
49 | UInt_t vzmu = 12; // single muon Vz | |
50 | UInt_t dcamu = 13; // single muon DCA | |
51 | ||
52 | ||
53 | ||
54 | // Setting up the container grid | |
55 | UInt_t nstep = 5 ; //number of selection steps : MC and ESD for simulation, CINT1B, CMUS1B for real data | |
56 | ||
57 | const Int_t nvar = 14; //number of variables on the grid | |
58 | const Int_t nbin1 = 5; | |
59 | const Int_t nbin2 = 15; | |
60 | const Int_t nbin3 = 100; | |
61 | const Int_t nbin4 = 300; | |
62 | const Int_t nbin5 = 40; | |
63 | const Int_t nbin6 = 100; | |
64 | const Int_t nbin7 = 100; | |
65 | const Int_t nbin8 = 4; | |
66 | const Int_t nbin9 = 300; | |
67 | const Int_t nbin10 = 6; | |
68 | const Int_t nbin11 = 100; | |
69 | const Int_t nbin12 = 200; | |
70 | const Int_t nbin13 = 100; | |
71 | const Int_t nbin14 = 100; | |
72 | ||
73 | class AliAnalysisGrid; | |
74 | class TChain; | |
75 | ||
76 | Bool_t AliCFMuonResUpsilon( | |
77 | const char* runtype = "local", // local, proof or grid | |
78 | const char* taskname = "CFMuonResUpsilon", // task name | |
79 | const bool readAOD = 0, // 1 = AOD based analysis | |
80 | const bool readMC = 0, // 1 = Read MC | |
81 | const bool usePlugin = 0, // grid mode : use plugin | |
82 | const char* gridmode = "test" // plugin mode ("full","test","offline","submit" or "terminate" | |
83 | ) | |
84 | { | |
85 | ||
86 | //load the required aliroot libraries | |
87 | gSystem->Load("libCore.so"); | |
88 | gSystem->Load("libTree.so"); | |
89 | gSystem->Load("libGeom.so"); | |
90 | gSystem->Load("libVMC.so"); | |
91 | gSystem->Load("libPhysics.so"); | |
92 | gSystem->Load("libSTEERBase"); | |
93 | gSystem->Load("libESD"); | |
94 | gSystem->Load("libAOD") ; | |
95 | gSystem->Load("libANALYSIS") ; | |
96 | gSystem->Load("libANALYSISalice") ; | |
97 | ||
98 | //load correction framework library | |
99 | gSystem->Load("libCORRFW.so") ; | |
100 | ||
101 | //compile online the task class | |
102 | gSystem->SetIncludePath("-I. -I$ALICE_ROOT/include -I$ROOTSYS/include -I$ALICE_ROOT/PWG3/muon"); | |
103 | gROOT->LoadMacro("./AliCFMuonResUpsilon.cxx++g"); | |
104 | ||
105 | ||
106 | // Setting Container | |
107 | // ----------------------------------------------- | |
108 | ||
109 | // arrays for the number of bins in each dimension | |
110 | Int_t iBin[nvar]; | |
111 | iBin[0]=nbin1; | |
112 | iBin[1]=nbin2; | |
113 | iBin[2]=nbin3; | |
114 | iBin[3]=nbin4; | |
115 | iBin[4]=nbin5; | |
116 | iBin[5]=nbin6; | |
117 | iBin[6]=nbin7; | |
118 | iBin[7]=nbin8; | |
119 | iBin[8]=nbin9; | |
120 | iBin[9]=nbin10; | |
121 | iBin[10]=nbin11; | |
122 | iBin[11]=nbin12; | |
123 | iBin[12]=nbin13; | |
124 | iBin[13]=nbin14; | |
125 | ||
126 | // arrays for lower bounds : | |
127 | Double_t *binLim1=new Double_t[nbin1+1]; | |
128 | Double_t *binLim2=new Double_t[nbin2+1]; | |
129 | Double_t *binLim3=new Double_t[nbin3+1]; | |
130 | Double_t *binLim4=new Double_t[nbin4+1]; | |
131 | Double_t *binLim5=new Double_t[nbin5+1]; | |
132 | Double_t *binLim6=new Double_t[nbin6+1]; | |
133 | Double_t *binLim7=new Double_t[nbin7+1]; | |
134 | Double_t *binLim8=new Double_t[nbin8+1]; | |
135 | Double_t *binLim9=new Double_t[nbin9+1]; | |
136 | Double_t *binLim10=new Double_t[nbin10+1]; | |
137 | Double_t *binLim11=new Double_t[nbin11+1]; | |
138 | Double_t *binLim12=new Double_t[nbin12+1]; | |
139 | Double_t *binLim13=new Double_t[nbin13+1]; | |
140 | Double_t *binLim14=new Double_t[nbin14+1]; | |
141 | ||
142 | // values for bin lower bounds | |
143 | for(Int_t i=0; i<=nbin1; i++) binLim1[i]=(Double_t)nevtmin+(nevtmax-nevtmin)/nbin1*(Double_t)i ; | |
144 | for(Int_t i=0; i<=nbin2; i++) binLim2[i]=(Double_t)ymin+(ymax-ymin)/nbin2*(Double_t)i ; | |
145 | for(Int_t i=0; i<=nbin3; i++) binLim3[i]=(Double_t)ptmin+(ptmax-ptmin)/nbin3*(Double_t)i ; | |
146 | for(Int_t i=0; i<=nbin4; i++) binLim4[i]=(Double_t)mmin+(mmax-mmin)/nbin4*(Double_t)i ; | |
147 | for(Int_t i=0; i<=nbin5; i++) binLim5[i]=(Double_t)trigmin+(trigmax-trigmin)/nbin5*(Double_t)i ; | |
148 | for(Int_t i=0; i<=nbin6; i++) binLim6[i]=(Double_t)ptmin+(ptmax-ptmin)/nbin6*(Double_t)i ; | |
149 | for(Int_t i=0; i<=nbin7; i++) binLim7[i]=(Double_t)pmin+(pmax-pmin)/nbin7*(Double_t)i ; | |
150 | for(Int_t i=0; i<=nbin8; i++) binLim8[i]=(Double_t)trigsidemin+(trigsidemax-trigsidemin)/nbin8*(Double_t)i ; | |
151 | for(Int_t i=0; i<=nbin9; i++) binLim9[i]=(Double_t)rabsmin+(rabsmax-rabsmin)/nbin9*(Double_t)i ; | |
152 | for(Int_t i=0; i<=nbin10; i++) binLim10[i]=(Double_t)chargemin+(chargemax-chargemin)/nbin10*(Double_t)i ; | |
153 | for(Int_t i=0; i<=nbin11; i++) binLim11[i]=(Double_t)etamin+(etamax-etamin)/nbin11*(Double_t)i ; | |
154 | for(Int_t i=0; i<=nbin12; i++) binLim12[i]=(Double_t)thabsmin+(thabsmax-thabsmin)/nbin12*(Double_t)i ; | |
155 | for(Int_t i=0; i<=nbin13; i++) binLim13[i]=(Double_t)vzmin+(vzmax-vzmin)/nbin13*(Double_t)i ; | |
156 | for(Int_t i=0; i<=nbin14; i++) binLim14[i]=(Double_t)dcamin+(dcamax-dcamin)/nbin14*(Double_t)i ; | |
157 | ||
158 | // one container of 2 steps (MC and ESD) with 12 variables | |
159 | AliCFContainer* container = new AliCFContainer("container","container for tracks",nstep,nvar,iBin); | |
160 | // setting the bin limits | |
161 | container -> SetBinLimits(nevent,binLim1); | |
162 | container -> SetBinLimits(y,binLim2); | |
163 | container -> SetBinLimits(pt,binLim3); | |
164 | container -> SetBinLimits(imass,binLim4); | |
165 | container -> SetBinLimits(trig,binLim5); | |
166 | container -> SetBinLimits(ptmu,binLim6); | |
167 | container -> SetBinLimits(pmu,binLim7); | |
168 | container -> SetBinLimits(trigside,binLim8); | |
169 | container -> SetBinLimits(rabsmu,binLim9); | |
170 | container -> SetBinLimits(charge,binLim10); | |
171 | container -> SetBinLimits(etamu,binLim11); | |
172 | container -> SetBinLimits(thabsmu,binLim12); | |
173 | container -> SetBinLimits(vzmu,binLim13); | |
174 | container -> SetBinLimits(dcamu,binLim14); | |
175 | ||
176 | // create AliCFManager | |
177 | AliCFManager* man = new AliCFManager(); | |
178 | // set particle container | |
179 | man->SetParticleContainer(container); | |
180 | ||
181 | // ---------------------------------------------- | |
182 | ||
183 | // check run type | |
184 | if(runtype != "local" && runtype != "proof" && runtype != "grid") { | |
185 | printf("Incorrect runtype! choose \"local\", \"prootf\" or \"grid\"\n"); | |
186 | return; | |
187 | } | |
188 | ||
189 | printf("runtype : %s\n", runtype); | |
190 | ||
191 | // Make the analysis manager | |
192 | AliAnalysisManager *mgr = new AliAnalysisManager(Form("%sAnalysis",taskname)); | |
193 | ||
194 | // set run mode | |
195 | if (runtype == "grid" && usePlugin) { | |
196 | // grid mode | |
197 | // set package for grid(API,ROOT,ALIROOT) | |
198 | const char *package[3] = {"V1.1x","v5-28-00a","v4-21-18-AN"}; | |
199 | ||
200 | AliAnalysisGrid *alienHandler = CreateAlienHandler(taskname,gridmode,package); | |
201 | if (!alienHandler) return; | |
202 | ||
203 | mgr->SetGridHandler(alienHandler); | |
204 | } | |
205 | else { | |
206 | // local mode | |
207 | if (readAOD) { | |
208 | // AOD | |
209 | analysisChain = new TChain("aodTree"); | |
210 | ||
211 | if(readMC) { | |
212 | analysisChain->Add("/home/sahn/alice/mc_prod/PDC09/AODs-100421-100436v2/000/033/AliAODs.root"); // PDC09 AOD | |
213 | //analysisChain->Add("/home/sahn/alice/mc_prod/upsilon/local/run/muonAcc/residual/AODs/AliAODs.root"); // muon acceptance production with residual alignment AOD | |
214 | } | |
215 | else { | |
216 | analysisChain->Add("/home/sahn/alice/p2_prod/LHC10g/AODs/135658/019/AliAOD.Dimuons.root"); // LHC10g-run135658 AOD | |
217 | //analysisChain->Add("/home/sahn/alice/p2_prod/LHC10g/AODs/135658/020/AliAOD.Dimuons.root"); // LHC10g-run135658 AOD | |
218 | } | |
219 | } | |
220 | else { | |
221 | // ESD | |
222 | analysisChain = new TChain("esdTree"); | |
223 | ||
224 | if(readMC) { | |
225 | analysisChain->Add("/home/sahn/alice/mc_prod/upsilon/local/run/muonAcc/residual/005/AliESDs.root"); // muon acceptance production with residual alignment | |
226 | } | |
227 | else { | |
228 | analysisChain->Add("/home/sahn/alice/p2_prod/LHC10g/000135748/ESDs/pass1/10000135748001.150/AliESDs.root"); // LHC10g-run135748 | |
229 | } | |
230 | } | |
231 | } | |
232 | ||
233 | // create the task | |
234 | AliCFMuonResUpsilon *task = new AliCFMuonResUpsilon(taskname); | |
235 | ||
236 | // Set list | |
237 | TList* qaList = new TList(); | |
238 | ||
239 | //CREATE THE CUTS | |
240 | // Choice of the Resonance | |
241 | if(readMC && !readAOD) { | |
242 | AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts"); | |
243 | mcGenCuts->SetRequirePdgCode(PDG); | |
244 | mcGenCuts->SetQAOn(qaList); | |
245 | ||
246 | // Set a pt range of the resonance | |
247 | AliCFTrackKineCuts *mcKineCuts = new AliCFTrackKineCuts("mcKineCuts","MC-level kinematic cuts"); | |
248 | mcKineCuts->SetPtRange(ptmin,ptmax); | |
249 | mcKineCuts->SetQAOn(qaList); | |
250 | ||
251 | // Create and fill the list associated | |
252 | TObjArray* mcList = new TObjArray(0) ; | |
253 | mcList->AddLast(mcKineCuts); | |
254 | mcList->AddLast(mcGenCuts); | |
255 | ||
256 | // kinematic cuts on muons rapidity | |
257 | AliCFTrackKineCuts *recKineCuts = new AliCFTrackKineCuts("recKineCuts","rec-level kine cuts"); | |
258 | recKineCuts->SetRapidityRange(ymin,ymax); | |
259 | recKineCuts->SetQAOn(qaList); | |
260 | TObjArray* recList = new TObjArray(0) ; | |
261 | recList->AddLast(recKineCuts); | |
262 | ||
263 | man->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList); | |
264 | man->SetParticleCutsList(AliCFManager::kPartAccCuts,recList); | |
265 | } | |
266 | else if(readMC && readAOD) { // for MC in AOD | |
267 | task->SetRequirePdgCode(PDG); | |
268 | task->SetPtRange(ptmin,ptmax); | |
269 | task->SetRapidityRange(ymin,ymax); | |
270 | } | |
271 | ||
272 | task->SetCFManager(man); //here is set the CF manager | |
273 | task->SetQAList(qaList); | |
274 | ||
275 | if(readAOD) task->SetReadAODData(); | |
276 | if(readMC) task->SetReadMCInfo(); | |
277 | ||
278 | if(readMC && !readAOD) { | |
279 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
280 | mgr->SetMCtruthEventHandler(mcHandler); | |
281 | } | |
282 | ||
283 | if(readAOD) { | |
284 | AliAODInputHandler *dataHandler = new AliAODInputHandler(); | |
285 | mgr->SetInputEventHandler(dataHandler); | |
286 | ||
287 | if(!readMC){ | |
288 | // physics selection | |
289 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
290 | AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(); | |
291 | } | |
292 | } | |
293 | else { | |
294 | AliESDInputHandler *dataHandler = new AliESDInputHandler(); | |
295 | mgr->SetInputEventHandler(dataHandler); | |
296 | ||
297 | if(!readMC) { | |
298 | // physics selection | |
299 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
300 | AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(); | |
301 | } | |
302 | } | |
303 | ||
304 | ||
305 | // Create and connect containers for input/output | |
306 | AliAnalysisDataContainer *cinput = mgr->CreateContainer("cchain",TChain::Class(),AliAnalysisManager::kInputContainer); | |
307 | ||
308 | // output data | |
309 | Char_t file[256]; | |
310 | sprintf(file,"container.%s.%s.%s.%s.root",taskname,runtype,readAOD ? "AOD":"ESD",readMC ? "MC":"Real"); | |
311 | ||
312 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1D::Class(),AliAnalysisManager::kOutputContainer,file); | |
313 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("container", AliCFContainer::Class(),AliAnalysisManager::kOutputContainer,file); | |
314 | ||
315 | mgr->AddTask(task); | |
316 | ||
317 | mgr->ConnectInput(task,0,mgr->GetCommonInputContainer()); | |
318 | mgr->ConnectOutput(task,1,coutput1); | |
319 | mgr->ConnectOutput(task,2,coutput2); | |
320 | ||
321 | if (!mgr->InitAnalysis()) return; | |
322 | ||
323 | mgr->PrintStatus(); | |
324 | if(usePlugin) mgr->StartAnalysis(runtype); | |
325 | else mgr->StartAnalysis(runtype,analysisChain); | |
326 | ||
327 | return kTRUE ; | |
328 | } | |
329 | ||
330 | AliAnalysisGrid* CreateAlienHandler(const char *taskname, const char *gridmode, const char* package[3]) | |
331 | { | |
332 | //if (!AliAnalysisGrid::CreateToken()) return NULL; | |
333 | AliAnalysisAlien *plugin = new AliAnalysisAlien(); | |
334 | ||
335 | // AliEn plugin mode | |
336 | plugin->SetRunMode(gridmode); | |
337 | ||
338 | // SE copy test | |
339 | //plugin->SetCheckCopy(kFALSE); | |
340 | ||
341 | // JDL Merge | |
342 | plugin->SetMergeViaJDL(kTRUE); | |
343 | plugin->SetOneStageMerging(kFALSE); | |
344 | plugin->SetMaxMergeStages(3); | |
345 | ||
346 | // Set package | |
347 | plugin->SetAPIVersion(package[0]); | |
348 | plugin->SetROOTVersion(package[1]); | |
349 | plugin->SetAliROOTVersion(package[2]); | |
350 | plugin->SetDataPattern("ESDs/pass1/*AliESDs.root"); | |
351 | ||
352 | ||
353 | // Set run numbers | |
354 | ||
355 | //______________________________________________________ | |
356 | // LHC10f | |
357 | plugin->SetGridDataDir("/alice/data/2010/LHC10f/"); | |
358 | const Int_t nruns=24; | |
359 | ||
360 | Int_t run_number[nruns] = { 133006, 133010, 133327, 133330, 133414, 133419, 133563, 133800, 133924, 133969, | |
361 | 133985, 134094, 134198, 134204, 134304, 134497, 134666, 134679, 134685, 134690, | |
362 | 134841, 134905, 134914, 134919 }; | |
363 | ||
364 | plugin->SetGridWorkingDir(Form("workdir-%s",taskname)); | |
365 | ||
366 | //______________________________________________________ | |
367 | // LHC10g | |
368 | /* | |
369 | plugin->SetGridDataDir("/alice/data/2010/LHC10g/"); | |
370 | ||
371 | const Int_t nruns=12; | |
372 | ||
373 | Int_t run_number[nruns] = { 135658, 135704, 135709, 135712, 135748, 135761, 135795, 136177, 136180, 136189, 136372, 136376 }; | |
374 | ||
375 | plugin->SetGridWorkingDir(Form("workdir-%s",taskname)); | |
376 | */ | |
377 | ||
378 | // Set Prefix for real data | |
379 | plugin->SetRunPrefix("000"); | |
380 | ||
381 | // Adding run numbers | |
382 | for(int i=0; i<nruns; i++) { | |
383 | plugin->AddRunNumber(run_number[i]); | |
384 | } | |
385 | ||
386 | // output and etc. | |
387 | plugin->SetGridOutputDir("output"); | |
388 | plugin->SetAnalysisSource("AliCFMuonResUpsilon.cxx"); | |
389 | plugin->SetAdditionalLibs("AliCFMuonResUpsilon.h AliCFMuonResUpsilon.cxx"); | |
390 | //plugin->SetSplitMaxInputFileNumber(20); | |
391 | plugin->SetTTL(86400); | |
392 | plugin->SetInputFormat("xml-single"); | |
393 | plugin->SetPrice(1); | |
394 | plugin->SetUseSubmitPolicy(); | |
395 | return plugin; | |
396 | } |