f60ddabc |
1 | void AnaTask(const char* dataset="minbias_LHC09a4_81040_81050.xml") |
2 | { |
3 | |
4 | gSystem->Load("libTree.so"); |
5 | gSystem->Load("libGeom.so"); |
6 | gSystem->Load("libVMC.so"); |
7 | gSystem->Load("libPhysics.so"); |
8 | |
9 | //load analysis framework |
10 | gSystem->Load("libANALYSIS"); |
11 | gSystem->Load("libANALYSISalice"); //AliAnalysisTaskSE |
5fdef45d |
12 | gSystem->Load("libPWGGAPHOSTasks"); |
f60ddabc |
13 | gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/PHOS"); |
14 | |
15 | // A task can be compiled dynamically with AClic |
16 | //gROOT->LoadMacro("AliAnalysisTaskOmegaPi0PiPi.cxx+g"); |
17 | |
18 | // Connect to alien |
19 | TString token = gSystem->Getenv("GRID_TOKEN") ; |
20 | if ( token == "OK" ) |
21 | TGrid::Connect("alien://"); |
22 | else |
23 | AliInfo("You are not connected to the GRID") ; |
24 | |
25 | // Create the chain |
26 | TChain* chain = new TChain("esdTree"); |
27 | TGridCollection * collection = dynamic_cast<TGridCollection*>(TAlienCollection::Open(dataset)); |
28 | |
29 | TAlienResult* result = collection->GetGridResult("",0 ,0); |
30 | TList* rawFileList = result->GetFileInfoList(); |
31 | |
32 | for (Int_t counter=0 ; counter < rawFileList->GetEntries() ; counter++) { |
33 | TFileInfo * fi = static_cast<TFileInfo*>(rawFileList->At(counter)) ; |
34 | const char * rawFile = fi->GetCurrentUrl()->GetUrl() ; |
35 | printf("Processing %s\n", rawFile) ; |
36 | chain->Add(rawFile); |
37 | printf("Chain: %d entries.\n",chain->GetEntries()); |
38 | } |
39 | |
40 | // Make the analysis manager |
41 | AliAnalysisManager *mgr = new AliAnalysisManager("OmegaPi0Pi+Pi-","Omega->pi0pi+pi- analysis"); |
42 | |
43 | // ESD input handler |
44 | AliESDInputHandler* esdH = new AliESDInputHandler(); |
45 | mgr->SetInputEventHandler(esdH); |
46 | |
47 | // Debug level |
48 | mgr->SetDebugLevel(10); |
49 | |
50 | // Add task |
51 | AliAnalysisTaskOmegaPi0PiPi *task = new AliAnalysisTaskOmegaPi0PiPi("OmegaPi0PiPi"); |
52 | mgr->AddTask(task); |
53 | |
54 | // Create containers for input/output |
55 | AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer(); |
56 | AliAnalysisDataContainer *coutput = mgr->CreateContainer("histos",TList::Class(),AliAnalysisManager::kOutputContainer,"histos.root"); |
57 | |
58 | // Connect input/output |
59 | mgr->ConnectInput(task, 0, cinput); |
60 | mgr->ConnectOutput(task, 1, coutput); |
61 | |
62 | if (mgr->InitAnalysis()) { |
63 | mgr->PrintStatus(); |
64 | mgr->StartAnalysis("local", chain); |
65 | } |
66 | |
67 | } |
68 | |
69 | |