]>
Commit | Line | Data |
---|---|---|
6eb2a715 | 1 | /* $Id: $ */ |
2 | //-------------------------------------------------- | |
3 | // Example macro to do analysis with the | |
4 | // analysis classes in PWG4PartCorr | |
5 | // Can be executed with Root and AliRoot | |
6 | // | |
7 | // Pay attention to the options and definitions | |
8 | // set in the lines below | |
9 | // | |
10 | // Author : Gustavo Conesa Balbastre (INFN-LNF) | |
11 | // | |
12 | //------------------------------------------------- | |
13 | enum anaModes {mLocal, mLocalCAF,mPROOF,mGRID}; | |
14 | //mLocal: Analyze locally files in your computer | |
15 | //mLocalCAF: Analyze locally CAF files | |
16 | //mPROOF: Analyze CAF files with PROOF | |
17 | ||
18 | //--------------------------------------------------------------------------- | |
19 | //Settings to read locally several files, only for "mLocal" mode | |
20 | //The different values are default, they can be set with environmental | |
21 | //variables: INDIR, PATTERN, NFILES, respectivelly | |
22 | char * kInDir = "/user/data/files/"; | |
23 | char * kPattern = ""; // Data are in files kInDir/kPattern+i | |
24 | Int_t kFile = 1; // Number of files | |
25 | //--------------------------------------------------------------------------- | |
26 | //Collection file for grid analysis | |
27 | char * kXML = "collection.xml"; | |
28 | //--------------------------------------------------------------------------- | |
29 | ||
30 | const TString kInputData = "AOD"; //ESD, AOD, MC | |
9584c261 | 31 | TString kTreeName = "esdTree"; |
6eb2a715 | 32 | Bool_t copy = kFALSE; |
33 | ||
34 | void anaEMCALCalib(Int_t mode=mLocal) | |
35 | { | |
36 | // Main | |
9584c261 | 37 | char cmd[200] ; |
38 | sprintf(cmd, ".! rm -rf aod.root pi0calib.root") ; | |
39 | gROOT->ProcessLine(cmd) ; | |
6eb2a715 | 40 | //-------------------------------------------------------------------- |
41 | // Load analysis libraries | |
42 | // Look at the method below, | |
43 | // change whatever you need for your analysis case | |
44 | // ------------------------------------------------------------------ | |
45 | LoadLibraries(mode) ; | |
46 | //gSystem->Unload("libPWG4CaloCalib.so"); | |
47 | //Try to set the new library | |
48 | //gSystem->Load("./PWG4CaloCalib/libPWG4CaloCalib.so"); | |
49 | //gSystem->ListLibraries(); | |
50 | ||
51 | //------------------------------------------------------------------------------------------------- | |
52 | //Create chain from ESD and from cross sections files, look below for options. | |
53 | //------------------------------------------------------------------------------------------------- | |
54 | if(kInputData == "ESD") kTreeName = "esdTree" ; | |
55 | else if(kInputData == "AOD") kTreeName = "aodTree" ; | |
56 | else { | |
57 | cout<<"Wrong data type "<<kInputData<<endl; | |
58 | break; | |
59 | } | |
60 | ||
61 | TChain *chain = new TChain(kTreeName) ; | |
62 | CreateChain(mode, chain); | |
63 | ||
64 | if(chain){ | |
65 | AliLog::SetGlobalLogLevel(AliLog::kError);//Minimum prints on screen | |
66 | ||
67 | //-------------------------------------- | |
68 | // Make the analysis manager | |
69 | //------------------------------------- | |
70 | AliAnalysisManager *mgr = new AliAnalysisManager("Manager", "Manager"); | |
71 | ||
72 | // AOD output handler | |
73 | if(copy){ | |
74 | AliAODHandler* aodoutHandler = new AliAODHandler(); | |
75 | aodoutHandler->SetOutputFileName("aod.root"); | |
76 | ////aodoutHandler->SetCreateNonStandardAOD(); | |
77 | mgr->SetOutputEventHandler(aodoutHandler); | |
78 | } | |
79 | ||
80 | //input | |
81 | if(kInputData == "ESD") | |
82 | { | |
83 | // ESD handler | |
84 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); | |
85 | mgr->SetInputEventHandler(esdHandler); | |
86 | esdHandler->SetReadFriends(kFALSE); | |
87 | cout<<"ESD handler "<<mgr->GetInputEventHandler()<<endl; | |
88 | } | |
89 | if(kInputData == "AOD") | |
90 | { | |
91 | // AOD handler | |
92 | AliAODInputHandler *aodHandler = new AliAODInputHandler(); | |
93 | mgr->SetInputEventHandler(aodHandler); | |
94 | cout<<"AOD handler "<<mgr->GetInputEventHandler()<<endl; | |
95 | ||
96 | } | |
97 | ||
98 | //mgr->SetDebugLevel(1); | |
99 | ||
100 | //------------------------------------------------------------------------- | |
101 | //Define task, put here any other task that you want to use. | |
102 | //------------------------------------------------------------------------- | |
103 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
104 | AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); | |
9584c261 | 105 | |
6eb2a715 | 106 | |
107 | // ESD filter task | |
9584c261 | 108 | if(kInputData == "ESD"){ |
109 | ||
110 | gROOT->LoadMacro("AddTaskPhysicsSelection.C"); | |
111 | AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(); | |
112 | if(!copy){ | |
113 | gROOT->LoadMacro("AddTaskESDFilter.C"); | |
114 | AliAnalysisTaskESDfilter *esdfilter = AddTaskESDFilter(kFALSE); | |
115 | } | |
6eb2a715 | 116 | } |
117 | ||
9584c261 | 118 | |
119 | ||
6eb2a715 | 120 | AliAnalysisTaskEMCALPi0CalibSelection * pi0calib = new AliAnalysisTaskEMCALPi0CalibSelection ("EMCALPi0Calibration"); |
121 | //pi0calib->SetDebugLevel(10); | |
122 | pi0calib->CopyAOD(copy); | |
123 | pi0calib->SetClusterMinEnergy(0.5); | |
124 | pi0calib->SetClusterMaxEnergy(15.); | |
125 | pi0calib->SetClusterMinNCells(0); | |
126 | pi0calib->SetNCellsGroup(0); | |
127 | pi0calib->SwitchOnBadChannelsRemoval(); | |
2dfb1428 | 128 | pi0calib->SwitchOffSameSM(); |
9584c261 | 129 | pi0calib->SwitchOnOldAODs(); |
130 | pi0calib->SetNumberOfCellsFromEMCALBorder(1); | |
131 | AliEMCALRecoUtils * reco = pi0calib->GetEMCALRecoUtils(); | |
132 | reco->SetMisalShift(0,0.8); reco->SetMisalShift(1,8.3); reco->SetMisalShift(2,1.); | |
133 | reco->SetMisalShift(3,-7.5); reco->SetMisalShift(4,7.5); reco->SetMisalShift(5,2.); | |
134 | reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0GammaGamma); | |
135 | reco->SetNonLinearityParam(0,1.04); reco->SetNonLinearityParam(1,-0.1445); | |
136 | reco->SetNonLinearityParam(2,1.046); | |
137 | ||
138 | // reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0GammaConversion); | |
139 | // reco->SetNonLinearityParam(0,1.033); reco->SetNonLinearityParam(1,0.0566186); | |
140 | // reco->SetNonLinearityParam(2,0.982133); | |
141 | ||
142 | ||
143 | // reco->SetNonLinearityFunction(AliEMCALRecoUtils::kPi0MC); | |
144 | // reco->SetNonLinearityParam(0,1.001); reco->SetNonLinearityParam(1,-0.01264); | |
145 | // reco->SetNonLinearityParam(2,-0.03632); | |
146 | // reco->SetNonLinearityParam(3,0.1798); reco->SetNonLinearityParam(4,-0.522); | |
147 | ||
148 | reco->Print(""); | |
149 | ||
6eb2a715 | 150 | // SM0 |
151 | pi0calib->SetEMCALChannelStatus(0,3,13); pi0calib->SetEMCALChannelStatus(0,44,1); pi0calib->SetEMCALChannelStatus(0,3,13); | |
152 | pi0calib->SetEMCALChannelStatus(0,20,7); pi0calib->SetEMCALChannelStatus(0,38,2); | |
153 | // SM1 | |
154 | pi0calib->SetEMCALChannelStatus(1,4,7); pi0calib->SetEMCALChannelStatus(1,4,13); pi0calib->SetEMCALChannelStatus(1,9,20); | |
155 | pi0calib->SetEMCALChannelStatus(1,14,15); pi0calib->SetEMCALChannelStatus(1,23,16); pi0calib->SetEMCALChannelStatus(1,32,23); | |
156 | pi0calib->SetEMCALChannelStatus(1,37,5); pi0calib->SetEMCALChannelStatus(1,40,1); pi0calib->SetEMCALChannelStatus(1,40,2); | |
157 | pi0calib->SetEMCALChannelStatus(1,40,5); pi0calib->SetEMCALChannelStatus(1,41,0); pi0calib->SetEMCALChannelStatus(1,41,1); | |
158 | pi0calib->SetEMCALChannelStatus(1,41,2); pi0calib->SetEMCALChannelStatus(1,41,4); | |
159 | // SM2 | |
160 | pi0calib->SetEMCALChannelStatus(2,14,15); pi0calib->SetEMCALChannelStatus(2,18,16); pi0calib->SetEMCALChannelStatus(2,18,17); | |
161 | pi0calib->SetEMCALChannelStatus(2,18,18); pi0calib->SetEMCALChannelStatus(2,18,20); pi0calib->SetEMCALChannelStatus(2,18,21); | |
162 | pi0calib->SetEMCALChannelStatus(2,18,23); pi0calib->SetEMCALChannelStatus(2,19,16); pi0calib->SetEMCALChannelStatus(2,19,17); | |
163 | pi0calib->SetEMCALChannelStatus(2,19,19); pi0calib->SetEMCALChannelStatus(2,19,20); pi0calib->SetEMCALChannelStatus(2,19,21); | |
164 | pi0calib->SetEMCALChannelStatus(2,19,22); | |
165 | //SM3 | |
166 | pi0calib->SetEMCALChannelStatus(3,4,7); | |
167 | ||
168 | mgr->AddTask(pi0calib); | |
169 | ||
9584c261 | 170 | pi0calib->SwitchOnRecalibration(); |
171 | TFile * f = new TFile("RecalibrationFactors.root","read"); | |
172 | TH2F * h0 = (TH2F*)f->Get("EMCALRecalFactors_SM0")->Clone(); | |
173 | TH2F * h1 = (TH2F*)f->Get("EMCALRecalFactors_SM1")->Clone(); | |
174 | TH2F * h2 = (TH2F*)f->Get("EMCALRecalFactors_SM2")->Clone(); | |
175 | TH2F * h3 = (TH2F*)f->Get("EMCALRecalFactors_SM3")->Clone(); | |
176 | ||
177 | pi0calib->SetEMCALChannelRecalibrationFactors(0,h0); | |
178 | pi0calib->SetEMCALChannelRecalibrationFactors(1,h1); | |
179 | pi0calib->SetEMCALChannelRecalibrationFactors(2,h2); | |
180 | pi0calib->SetEMCALChannelRecalibrationFactors(3,h3); | |
6eb2a715 | 181 | |
182 | // Create containers for input/output | |
183 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
184 | if(copy) AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); | |
185 | AliAnalysisDataContainer *coutput2 = | |
186 | mgr->CreateContainer("pi0calib", TList::Class(), AliAnalysisManager::kOutputContainer, "pi0calib.root"); | |
187 | ||
188 | AliAnalysisDataContainer *cout_cuts = mgr->CreateContainer("Cuts", TList::Class(), | |
9584c261 | 189 | AliAnalysisManager::kOutputContainer, "pi0calib.root"); |
6eb2a715 | 190 | |
191 | mgr->ConnectInput (pi0calib, 0, cinput1); | |
192 | if(copy) mgr->ConnectOutput (pi0calib, 0, coutput1 ); | |
193 | mgr->ConnectOutput (pi0calib, 1, coutput2 ); | |
194 | mgr->ConnectOutput (pi0calib, 2, cout_cuts); | |
195 | ||
196 | //----------------------- | |
197 | // Run the analysis | |
198 | //----------------------- | |
199 | TString smode = ""; | |
200 | if (mode==mLocal || mode == mLocalCAF) | |
201 | smode = "local"; | |
202 | else if (mode==mPROOF) | |
203 | smode = "proof"; | |
204 | else if (mode==mGRID) | |
205 | smode = "local"; | |
206 | ||
207 | mgr->InitAnalysis(); | |
208 | mgr->PrintStatus(); | |
209 | mgr->StartAnalysis(smode.Data(),chain); | |
210 | ||
211 | cout <<" Analysis ended sucessfully "<< endl ; | |
212 | ||
213 | } | |
214 | else cout << "Chain was not produced ! "<<endl; | |
215 | ||
216 | } | |
217 | ||
218 | void LoadLibraries(const anaModes mode) { | |
219 | ||
220 | //-------------------------------------- | |
221 | // Load the needed libraries most of them already loaded by aliroot | |
222 | //-------------------------------------- | |
223 | gSystem->Load("libTree.so"); | |
224 | gSystem->Load("libGeom.so"); | |
225 | gSystem->Load("libVMC.so"); | |
226 | gSystem->Load("libXMLIO.so"); | |
227 | ||
228 | //---------------------------------------------------------- | |
229 | // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< | |
230 | //---------------------------------------------------------- | |
231 | if (mode==mLocal || mode == mLocalCAF || mode == mGRID) { | |
232 | //-------------------------------------------------------- | |
233 | // If you want to use already compiled libraries | |
234 | // in the aliroot distribution | |
235 | //-------------------------------------------------------- | |
236 | ||
237 | gSystem->Load("libSTEERBase.so"); | |
238 | gSystem->Load("libESD.so"); | |
239 | gSystem->Load("libAOD.so"); | |
240 | gSystem->Load("libANALYSIS.so"); | |
241 | gSystem->Load("libANALYSISalice.so"); | |
242 | gSystem->Load("libANALYSISalice.so"); | |
9584c261 | 243 | TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!! |
6eb2a715 | 244 | gSystem->Load("libPWG4CaloCalib.so"); |
245 | ||
246 | /* | |
247 | // gSystem->Load("libPWG4omega3pi.so"); | |
248 | // gSystem->Load("libCORRFW.so"); | |
249 | // gSystem->Load("libPWG3base.so"); | |
250 | // gSystem->Load("libPWG3muon.so"); | |
251 | */ | |
252 | //-------------------------------------------------------- | |
253 | //If you want to use root and par files from aliroot | |
254 | //-------------------------------------------------------- | |
255 | /* | |
256 | SetupPar("STEERBase"); | |
257 | SetupPar("ESD"); | |
258 | SetupPar("AOD"); | |
259 | SetupPar("ANALYSIS"); | |
260 | SetupPar("ANALYSISalice"); | |
261 | SetupPar("PHOSUtils"); | |
262 | SetupPar("EMCALUtils"); | |
263 | //Create Geometry | |
264 | TGeoManager::Import("geometry.root") ; //need file "geometry.root" in local dir!!!! | |
265 | SetupPar("PWG4CaloCalib"); | |
266 | */ | |
267 | } | |
268 | ||
269 | //--------------------------------------------------------- | |
270 | // <<<<<<<<<< PROOF mode >>>>>>>>>>>> | |
271 | //--------------------------------------------------------- | |
272 | else if (mode==mPROOF) { | |
273 | // | |
274 | // Connect to proof | |
275 | // Put appropriate username here | |
276 | // TProof::Reset("proof://mgheata@lxb6046.cern.ch"); | |
277 | TProof::Open("proof://mgheata@lxb6046.cern.ch"); | |
278 | ||
279 | // gProof->ClearPackages(); | |
280 | // gProof->ClearPackage("ESD"); | |
281 | // gProof->ClearPackage("AOD"); | |
282 | // gProof->ClearPackage("ANALYSIS"); | |
283 | // gProof->ClearPackage("PWG4PartCorrBase"); | |
284 | // gProof->ClearPackage("PWG4PartCorrDep"); | |
285 | ||
286 | // Enable the STEERBase Package | |
287 | gProof->UploadPackage("STEERBase.par"); | |
288 | gProof->EnablePackage("STEERBase"); | |
289 | // Enable the ESD Package | |
290 | gProof->UploadPackage("ESD.par"); | |
291 | gProof->EnablePackage("ESD"); | |
292 | // Enable the AOD Package | |
293 | gProof->UploadPackage("AOD.par"); | |
294 | gProof->EnablePackage("AOD"); | |
295 | // Enable the Analysis Package | |
296 | gProof->UploadPackage("ANALYSIS.par"); | |
297 | gProof->EnablePackage("ANALYSIS"); | |
298 | // Enable the PHOS geometry Package | |
299 | //gProof->UploadPackage("PHOSUtils.par"); | |
300 | //gProof->EnablePackage("PHOSUtils"); | |
301 | // Enable PartCorr analysis | |
302 | gProof->UploadPackage("PWG4PartCorrBase.par"); | |
303 | gProof->EnablePackage("PWG4PartCorrBase"); | |
304 | gProof->UploadPackage("PWG4PartCorrDep.par"); | |
305 | gProof->EnablePackage("PWG4PartCorrDep"); | |
306 | gProof->ShowEnabledPackages(); | |
307 | } | |
308 | ||
309 | } | |
310 | ||
311 | void SetupPar(char* pararchivename) | |
312 | { | |
313 | //Load par files, create analysis libraries | |
314 | //For testing, if par file already decompressed and modified | |
315 | //classes then do not decompress. | |
316 | ||
317 | TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; | |
318 | TString parpar(Form("%s.par", pararchivename)) ; | |
319 | if ( gSystem->AccessPathName(parpar.Data()) ) { | |
320 | gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; | |
321 | TString processline(Form(".! make %s", parpar.Data())) ; | |
322 | gROOT->ProcessLine(processline.Data()) ; | |
323 | gSystem->ChangeDirectory(cdir) ; | |
324 | processline = Form(".! mv $ALICE_ROOT/%s .", parpar.Data()) ; | |
325 | gROOT->ProcessLine(processline.Data()) ; | |
326 | } | |
327 | if ( gSystem->AccessPathName(pararchivename) ) { | |
328 | TString processline = Form(".! tar xvzf %s",parpar.Data()) ; | |
329 | gROOT->ProcessLine(processline.Data()); | |
330 | } | |
331 | ||
332 | TString ocwd = gSystem->WorkingDirectory(); | |
333 | gSystem->ChangeDirectory(pararchivename); | |
334 | ||
335 | // check for BUILD.sh and execute | |
336 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
337 | printf("*******************************\n"); | |
338 | printf("*** Building PAR archive ***\n"); | |
339 | cout<<pararchivename<<endl; | |
340 | printf("*******************************\n"); | |
341 | ||
342 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
343 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
344 | return -1; | |
345 | } | |
346 | } | |
347 | // check for SETUP.C and execute | |
348 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
349 | printf("*******************************\n"); | |
350 | printf("*** Setup PAR archive ***\n"); | |
351 | cout<<pararchivename<<endl; | |
352 | printf("*******************************\n"); | |
353 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
354 | } | |
355 | ||
356 | gSystem->ChangeDirectory(ocwd.Data()); | |
357 | printf("Current dir: %s\n", ocwd.Data()); | |
358 | } | |
359 | ||
360 | ||
361 | ||
362 | void CreateChain(const anaModes mode, TChain * chain){ | |
363 | //Fills chain with data | |
364 | TString ocwd = gSystem->WorkingDirectory(); | |
365 | ||
366 | //----------------------------------------------------------- | |
367 | //Analysis of CAF data locally and with PROOF | |
368 | //----------------------------------------------------------- | |
369 | if(mode ==mPROOF || mode ==mLocalCAF){ | |
370 | // Chain from CAF | |
371 | gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); | |
372 | // The second parameter is the number of input files in the chain | |
373 | chain = CreateESDChain("ESD12001.txt", 5); | |
374 | } | |
375 | ||
376 | //--------------------------------------- | |
377 | //Local files analysis | |
378 | //--------------------------------------- | |
379 | else if(mode == mLocal){ | |
380 | //If you want to add several ESD files sitting in a common directory INDIR | |
381 | //Specify as environmental variables the directory (INDIR), the number of files | |
382 | //to analyze (NFILES) and the pattern name of the directories with files (PATTERN) | |
383 | ||
384 | if(gSystem->Getenv("INDIR")) | |
385 | kInDir = gSystem->Getenv("INDIR") ; | |
386 | else cout<<"INDIR not set, use default: "<<kInDir<<endl; | |
387 | ||
388 | if(gSystem->Getenv("PATTERN")) | |
389 | kPattern = gSystem->Getenv("PATTERN") ; | |
390 | else cout<<"PATTERN not set, use default: "<<kPattern<<endl; | |
391 | ||
392 | if(gSystem->Getenv("NFILES")) | |
393 | kFile = atoi(gSystem->Getenv("NFILES")) ; | |
394 | else cout<<"NFILES not set, use default: "<<kFile<<endl; | |
395 | ||
396 | //Check if env variables are set and are correct | |
397 | if ( kInDir && kFile) { | |
398 | printf("Get %d files from directory %s\n",kFile,kInDir); | |
399 | if ( ! gSystem->cd(kInDir) ) {//check if ESDs directory exist | |
400 | printf("%s does not exist\n", kInDir) ; | |
401 | return ; | |
402 | } | |
403 | ||
404 | ||
405 | cout<<"INDIR : "<<kInDir<<endl; | |
406 | cout<<"NFILES : "<<kFile<<endl; | |
407 | cout<<"PATTERN : " <<kPattern<<endl; | |
408 | ||
409 | TString datafile=""; | |
410 | if(kInputData == "ESD") datafile = "AliESDs.root" ; | |
411 | else if(kInputData == "AOD") datafile = "aod.root" ; | |
412 | else if(kInputData == "MC") datafile = "galice.root" ; | |
413 | ||
414 | //Loop on ESD files, add them to chain | |
415 | Int_t event =0; | |
416 | Int_t skipped=0 ; | |
417 | char file[120] ; | |
418 | ||
419 | for (event = 0 ; event < kFile ; event++) { | |
420 | sprintf(file, "%s/%s%d/%s", kInDir,kPattern,event,datafile.Data()) ; | |
421 | TFile * fESD = 0 ; | |
422 | //Check if file exists and add it, if not skip it | |
423 | if ( fESD = TFile::Open(file)) { | |
424 | if ( fESD->Get(kTreeName) ) { | |
425 | printf("++++ Adding %s\n", file) ; | |
426 | chain->AddFile(file); | |
427 | } | |
428 | } | |
429 | else { | |
430 | printf("---- Skipping %s\n", file) ; | |
431 | skipped++ ; | |
432 | } | |
433 | } | |
434 | printf("number of entries # %lld, skipped %d\n", chain->GetEntries(), skipped*100) ; | |
435 | } | |
436 | else { | |
437 | TString input = "AliESDs.root" ; | |
438 | cout<<">>>>>> No list added, take a single file <<<<<<<<< "<<input<<endl; | |
439 | chain->AddFile(input); | |
440 | } | |
441 | ||
442 | }// local files analysis | |
443 | ||
444 | //------------------------------ | |
445 | //GRID xml files | |
446 | //----------------------------- | |
447 | else if(mode == mGRID){ | |
448 | //Get colection file. It is specified by the environmental | |
449 | //variable XML | |
450 | ||
451 | if(gSystem->Getenv("XML") ) | |
452 | kXML = gSystem->Getenv("XML"); | |
453 | else | |
454 | sprintf(kXML, "collection.xml") ; | |
455 | ||
456 | if (!TFile::Open(kXML)) { | |
457 | printf("No collection file with name -- %s -- was found\n",kXML); | |
458 | return ; | |
459 | } | |
460 | else cout<<"XML file "<<kXML<<endl; | |
461 | ||
462 | //Load necessary libraries and connect to the GRID | |
463 | gSystem->Load("libNetx.so") ; | |
464 | gSystem->Load("libRAliEn.so"); | |
465 | TGrid::Connect("alien://") ; | |
466 | ||
467 | //Feed Grid with collection file | |
468 | //TGridCollection * collection = (TGridCollection*)gROOT->ProcessLine(Form("TAlienCollection::Open(\"%s\", 0)", kXML)); | |
469 | TGridCollection * collection = (TGridCollection*) TAlienCollection::Open(kXML); | |
470 | if (! collection) { | |
471 | AliError(Form("%s not found", kXML)) ; | |
472 | return kFALSE ; | |
473 | } | |
474 | TGridResult* result = collection->GetGridResult("",0 ,0); | |
475 | ||
476 | // Makes the ESD chain | |
477 | printf("*** Getting the Chain ***\n"); | |
478 | for (Int_t index = 0; index < result->GetEntries(); index++) { | |
479 | TString alienURL = result->GetKey(index, "turl") ; | |
480 | cout << "================== " << alienURL << endl ; | |
481 | chain->Add(alienURL) ; | |
482 | } | |
483 | }// xml analysis | |
484 | ||
485 | gSystem->ChangeDirectory(ocwd.Data()); | |
486 | } | |
487 |