ROOT logo
const char *anatype = "ESD";

void takuv2c123456_2012_TEST()
{
// Analysis using ESD data
// Automatically generated analysis steering macro executed in grid subjobs

   TStopwatch timer;
   timer.Start();

// Set temporary merging directory to current one
   gSystem->Setenv("TMPDIR", gSystem->pwd());

// Set temporary compilation directory to current one
   gSystem->SetBuildDir(gSystem->pwd(), kTRUE);

// Reset existing include path and add current directory first in the search
   gSystem->SetIncludePath("-I.");
// Load analysis framework libraries
   gSystem->Load("libANALYSIS");
   gSystem->Load("libOADB");
   gSystem->Load("libANALYSISalice");
   gSystem->Load("libCORRFW");

// include path
   TString intPath = gInterpreter->GetIncludePath();
   TObjArray *listpaths = intPath.Tokenize(" ");
   TIter nextpath(listpaths);
   TObjString *pname;
   while ((pname=(TObjString*)nextpath())) {
      TString current = pname->GetName();
      if (current.Contains("AliRoot") || current.Contains("ALICE_ROOT")) continue;
      gSystem->AddIncludePath(current);
   }
   if (listpaths) delete listpaths;
   gSystem->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG2/FLOW/AliFlowCommon -I$ALICE_ROOT/PWG2/FLOW/AliFlowTasks -I$ALICE_ROOT/PWG3/dielectron/ -g ");
   gROOT->ProcessLine(".include $ALICE_ROOT/include");
   printf("Include path: %s\n", gSystem->GetIncludePath());

// Add aditional AliRoot libraries
   gSystem->Load("libCORRFW.so");
   gSystem->Load("libPWG3base.so");
   gSystem->Load("libPWG3dielectron.so");
   gSystem->Load("libPWG3hfe.so");

// analysis source to be compiled at runtime (if any)
   gROOT->ProcessLine(".L AliDielectronHistosTaku.cxx+g");
   gROOT->ProcessLine(".L AliDielectronDebugTreeTaku.cxx+g");
   gROOT->ProcessLine(".L AliDielectronTaku.cxx+g");
   gROOT->ProcessLine(".L AliAnalysisTaskMultiDielectronNewTaku.cxx+g");

// connect to AliEn and make the chain
   if (!TGrid::Connect("alien://")) return;
// read the analysis manager from file
   AliAnalysisManager *mgr = AliAnalysisAlien::LoadAnalysisManager("takuv2c123456_2012_TEST.root");
   if (!mgr) return;
   mgr->PrintStatus();
   AliLog::SetGlobalLogLevel(AliLog::kError);
   TChain *chain = CreateChain("wn.xml", anatype);

   mgr->StartAnalysis("localfile", chain);
   timer.Stop();
   timer.Print();
}

//________________________________________________________________________________
TChain* CreateChain(const char *xmlfile, const char *type="ESD")
{
// Create a chain using url's from xml file
   TString filename;
   Int_t run = 0;
   TString treename = type;
   treename.ToLower();
   treename += "Tree";
   printf("***************************************\n");
   printf("    Getting chain of trees %s\n", treename.Data());
   printf("***************************************\n");
   TAlienCollection *coll = TAlienCollection::Open(xmlfile);
   if (!coll) {
      ::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
      return NULL;
   }
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   TChain *chain = new TChain(treename);
   coll->Reset();
   while (coll->Next()) {
      filename = coll->GetTURL();
      if (mgr) {
         Int_t nrun = AliAnalysisManager::GetRunFromAlienPath(filename);
         if (nrun && nrun != run) {
            printf("### Run number detected from chain: %d\n", nrun);
            mgr->SetRunFromPath(nrun);
            run = nrun;
         }
      }
      chain->Add(filename);
   }
   if (!chain->GetNtrees()) {
      ::Error("CreateChain", "No tree found from collection %s", xmlfile);
      return NULL;
   }
   return chain;
}

 takuv2c123456_2012_TEST.C:1
 takuv2c123456_2012_TEST.C:2
 takuv2c123456_2012_TEST.C:3
 takuv2c123456_2012_TEST.C:4
 takuv2c123456_2012_TEST.C:5
 takuv2c123456_2012_TEST.C:6
 takuv2c123456_2012_TEST.C:7
 takuv2c123456_2012_TEST.C:8
 takuv2c123456_2012_TEST.C:9
 takuv2c123456_2012_TEST.C:10
 takuv2c123456_2012_TEST.C:11
 takuv2c123456_2012_TEST.C:12
 takuv2c123456_2012_TEST.C:13
 takuv2c123456_2012_TEST.C:14
 takuv2c123456_2012_TEST.C:15
 takuv2c123456_2012_TEST.C:16
 takuv2c123456_2012_TEST.C:17
 takuv2c123456_2012_TEST.C:18
 takuv2c123456_2012_TEST.C:19
 takuv2c123456_2012_TEST.C:20
 takuv2c123456_2012_TEST.C:21
 takuv2c123456_2012_TEST.C:22
 takuv2c123456_2012_TEST.C:23
 takuv2c123456_2012_TEST.C:24
 takuv2c123456_2012_TEST.C:25
 takuv2c123456_2012_TEST.C:26
 takuv2c123456_2012_TEST.C:27
 takuv2c123456_2012_TEST.C:28
 takuv2c123456_2012_TEST.C:29
 takuv2c123456_2012_TEST.C:30
 takuv2c123456_2012_TEST.C:31
 takuv2c123456_2012_TEST.C:32
 takuv2c123456_2012_TEST.C:33
 takuv2c123456_2012_TEST.C:34
 takuv2c123456_2012_TEST.C:35
 takuv2c123456_2012_TEST.C:36
 takuv2c123456_2012_TEST.C:37
 takuv2c123456_2012_TEST.C:38
 takuv2c123456_2012_TEST.C:39
 takuv2c123456_2012_TEST.C:40
 takuv2c123456_2012_TEST.C:41
 takuv2c123456_2012_TEST.C:42
 takuv2c123456_2012_TEST.C:43
 takuv2c123456_2012_TEST.C:44
 takuv2c123456_2012_TEST.C:45
 takuv2c123456_2012_TEST.C:46
 takuv2c123456_2012_TEST.C:47
 takuv2c123456_2012_TEST.C:48
 takuv2c123456_2012_TEST.C:49
 takuv2c123456_2012_TEST.C:50
 takuv2c123456_2012_TEST.C:51
 takuv2c123456_2012_TEST.C:52
 takuv2c123456_2012_TEST.C:53
 takuv2c123456_2012_TEST.C:54
 takuv2c123456_2012_TEST.C:55
 takuv2c123456_2012_TEST.C:56
 takuv2c123456_2012_TEST.C:57
 takuv2c123456_2012_TEST.C:58
 takuv2c123456_2012_TEST.C:59
 takuv2c123456_2012_TEST.C:60
 takuv2c123456_2012_TEST.C:61
 takuv2c123456_2012_TEST.C:62
 takuv2c123456_2012_TEST.C:63
 takuv2c123456_2012_TEST.C:64
 takuv2c123456_2012_TEST.C:65
 takuv2c123456_2012_TEST.C:66
 takuv2c123456_2012_TEST.C:67
 takuv2c123456_2012_TEST.C:68
 takuv2c123456_2012_TEST.C:69
 takuv2c123456_2012_TEST.C:70
 takuv2c123456_2012_TEST.C:71
 takuv2c123456_2012_TEST.C:72
 takuv2c123456_2012_TEST.C:73
 takuv2c123456_2012_TEST.C:74
 takuv2c123456_2012_TEST.C:75
 takuv2c123456_2012_TEST.C:76
 takuv2c123456_2012_TEST.C:77
 takuv2c123456_2012_TEST.C:78
 takuv2c123456_2012_TEST.C:79
 takuv2c123456_2012_TEST.C:80
 takuv2c123456_2012_TEST.C:81
 takuv2c123456_2012_TEST.C:82
 takuv2c123456_2012_TEST.C:83
 takuv2c123456_2012_TEST.C:84
 takuv2c123456_2012_TEST.C:85
 takuv2c123456_2012_TEST.C:86
 takuv2c123456_2012_TEST.C:87
 takuv2c123456_2012_TEST.C:88
 takuv2c123456_2012_TEST.C:89
 takuv2c123456_2012_TEST.C:90
 takuv2c123456_2012_TEST.C:91
 takuv2c123456_2012_TEST.C:92
 takuv2c123456_2012_TEST.C:93
 takuv2c123456_2012_TEST.C:94
 takuv2c123456_2012_TEST.C:95
 takuv2c123456_2012_TEST.C:96
 takuv2c123456_2012_TEST.C:97
 takuv2c123456_2012_TEST.C:98
 takuv2c123456_2012_TEST.C:99
 takuv2c123456_2012_TEST.C:100
 takuv2c123456_2012_TEST.C:101
 takuv2c123456_2012_TEST.C:102
 takuv2c123456_2012_TEST.C:103
 takuv2c123456_2012_TEST.C:104
 takuv2c123456_2012_TEST.C:105