Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGPP / VZERO / runAnaEPFlatenningProof.C
CommitLineData
345e2385 1void runAnaEPFlatenningProof(Int_t mode = 0, const char *folder = "/alice/data",
2 const char *dataset = "LHC10h_000138396_hlt_clustering",
3 Int_t workers=28,
4 Bool_t usePS = kFALSE,
5 const char *minBias = "CPBI",
6 Int_t firstFile = 0, Int_t lastFile = -1)
7{
8 gSystem->Load("libANALYSIS");
9 gSystem->Load("libANALYSISalice");
10 gSystem->Load("libOADB");
11 gSystem->AddIncludePath("-I$ALICE_ROOT/include ");
12
13 if (mode==0 || mode==2) {
14 // Connect to Proof
15 gEnv->SetValue("XSec.GSI.DelegProxy","2");
16 Char_t *alienuser = gSystem->Getenv("alien_API_USER");
17 cout<<"==> Your AliEn username is: "<<alienuser<<endl;
18
0bd9e4f8 19 // TProof::Mgr("alice-caf.cern.ch")->SetROOTVersion("VO_ALICE@ROOT::v5-33-02a");
20
345e2385 21 TProof *p = TProof::Open(alienuser!=0 ? Form("%s@alice-caf.cern.ch",
22 alienuser) : "alice-caf.cern.ch",
23 workers>0 ? Form("workers=%d",workers) : "");
24
0bd9e4f8 25 gProof->EnablePackage("VO_ALICE@AliRoot::v5-03-23-AN");
26
27 if (1) {
28 gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE);
29 gSystem->Setenv("OADB_PATH","alien:///alice/cern.ch/user/c/cheshkov/OADB");
30 gProof->Exec("gSystem->Setenv(\"OADB_PATH\",\"alien:///alice/cern.ch/user/c/cheshkov/OADB\")",kTRUE);
31 }
345e2385 32 }
33
34 // Create the analysis manager
35 AliAnalysisManager *mgr = new AliAnalysisManager("EPFlatenningAnalysis");
36
0bd9e4f8 37 Bool_t esdData = kTRUE;
38 TString tempStr1 = folder;
39 if (tempStr1.Contains("AOD")) esdData = kFALSE;
40 TString tempStr2 = dataset;
41 if (tempStr2.Contains("AOD")) esdData = kFALSE;
42 if (esdData) {
43 AliESDInputHandler* esdH = new AliESDInputHandler();
44 esdH->SetInactiveBranches("FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend.fTracks Kinks MuonTracks TrdTracks");
45 esdH->SetReadFriends(kFALSE);
46 mgr->SetInputEventHandler(esdH);
47 }
48 else {
49 AliAODInputHandler* aodH = new AliAODInputHandler();
50 mgr->SetInputEventHandler(aodH);
51 }
345e2385 52
53 // physics and centrality selection
0bd9e4f8 54 if (esdData && usePS) {
63b6cbd0 55 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
345e2385 56 AliPhysicsSelectionTask *physicsSelectionTask = AddTaskPhysicsSelection(kFALSE);
57 }
58
1c06a186 59 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
345e2385 60 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
61
62 // Create task
63 if (mode==0 || mode==2) {
0bd9e4f8 64 if (0) {
65 gProof->Load(Form("%s/STEER/STEERBase/AliEventplane.cxx++g",
66 gSystem->Getenv("ALICE_ROOT")));
67 gProof->Load(Form("%s/ANALYSIS/AliVZEROEPSelectionTask.cxx++g",
68 gSystem->Getenv("ALICE_ROOT")));
69 }
345e2385 70 gProof->Load(Form("%s/AliAnaVZEROEPFlatenning.cxx++g",
71 gSystem->pwd()));
72 }
73 else {
74 gROOT->LoadMacro(Form("%s/AliAnaVZEROEPFlatenning.cxx++g",
75 gSystem->pwd()));
76 }
0bd9e4f8 77
78 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskVZEROEPSelection.C");
79 AliVZEROEPSelectionTask *selTask = AddTaskVZEROEPSelection();
80
345e2385 81 AliAnaVZEROEPFlatenning *task = new AliAnaVZEROEPFlatenning("AliAnaVZEROEPFlatenning");
82 task->SetMBTrigName(minBias);
83 if (usePS) task->SetUsePhysSel(kTRUE);
0bd9e4f8 84 task->SetInput("/home/cheshkov/alice/AliRoot/PWGPP/VZERO/save/VZERO.EPFlatenning.PS.LHC11h_000170162_p1_muon_.root");
345e2385 85
86 // Add task
87 mgr->AddTask(task);
88
89 // Create containers for input/output
90 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
91 AliAnalysisDataContainer *coutput =
92 mgr->CreateContainer("coutput", TList::Class(),
93 AliAnalysisManager::kOutputContainer, (!usePS) ? Form("VZERO.EPFlatenning.%s.root",dataset) : Form("VZERO.EPFlatenning.PS.%s.root",dataset));
94
95 // Connect input/output
96 mgr->ConnectInput(task, 0, cinput);
97 mgr->ConnectOutput(task, 1, coutput);
98
345e2385 99 // Enable debug printouts
100 mgr->SetDebugLevel(3);
101
102 if (!mgr->InitAnalysis())
103 return;
104
105 mgr->PrintStatus();
106
107 if (mode==0)
108 mgr->StartAnalysis("proof", Form("%s/%s",folder,dataset));
109 else {
110 TGrid::Connect("alien://");
111 TChain *chain = new TChain("esdTree");
112 TGridResult *res = gGrid->Query(folder,"AliESDs.root");
113 Int_t nFiles = res->GetEntries();
114 if (lastFile < 0) lastFile = nFiles - 1;
115 for(Int_t iFile = firstFile; iFile <= lastFile; ++iFile) {
116 TString filename = res->GetKey(iFile, "turl");
117 if(filename == "") continue;
118 chain->AddFile(filename.Data());
119 }
120 if (mode==2) {
121 gProof->Exec("TGrid::Connect(\"alien://\")",kTRUE);
122 mgr->StartAnalysis("proof", chain);
123 }
124 else
125 mgr->StartAnalysis("local", chain);
126 }
127}
128