Primary charged tracks added
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / runAODProof.C
1 void runAODProof(Int_t c=2, const char * proofMode = "full")
2 { //1 data AOD049
3   //2 MC AOD048
4   //3 data AOD086
5   //4 MC AOD090
6   
7   gEnv->SetValue("XSec.GSI.DelegProxy", "2");
8   
9   gSystem->Load("libTree.so");
10    gSystem->Load("libGeom.so");
11    gSystem->Load("libVMC.so");
12    gSystem->Load("libPhysics.so");
13    gSystem->Load("libSTEERBase.so");
14    gSystem->Load("libESD.so");
15    gSystem->Load("libAOD.so");
16    gSystem->Load("libANALYSIS.so");
17    gSystem->Load("libOADB.so");
18    gSystem->Load("libANALYSISalice.so");
19    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
20
21
22    AliAnalysisAlien * handler = new AliAnalysisAlien("test");
23    handler->SetOverwriteMode();
24    handler->SetRunMode(proofMode);
25    handler->SetProofReset(0);
26    //handler->SetROOTVersion("v5-33-02a");
27    //handler->SetAliROOTVersion("v5-03-11-AN");
28    handler->SetAliROOTVersion("v5-03-16-AN");
29    
30    //handler->SetNproofWorkers();
31    handler->SetNproofWorkersPerSlave(1);
32    handler->SetProofCluster(Form("%s@alice-caf.cern.ch", gSystem->Getenv("CAFUSER")));
33    //handler->SetProofCluster(Form("%s@skaf.saske.sk",gSystem->Getenv("CAFUSER")));
34    
35    // Set handler for Real DATA:
36    if (c == 1){
37      handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree");
38      //handler->SetProofDataSet("/alice/data/LHC10h_000138653_p2_AOD049#aodTree|/alice/data/LHC10h_000138662_p2_AOD049#aodTree|/alice/data/LHC10h_000138666_p2_AOD049#aodTree|/alice/data/LHC10h_000138795_p2_AOD049#aodTree|/alice/data/LHC10h_000139107_p2_AOD049#aodTree|/alice/data/LHC10h_000139110_p2_AOD049#aodTree");
39    }
40    if (c == 2){
41      handler->SetProofDataSet("/alice/sim/LHC11a10a_000138653_AOD048#aodTree|/alice/sim/LHC11a10a_000138662_AOD048#aodTree|/alice/sim/LHC11a10a_000138666_AOD048#aodTree|/alice/sim/LHC11a10a_000138795_AOD048#aodTree|/alice/sim/LHC11a10a_000139107_AOD048#aodTree|/alice/sim/LHC11a10a_000139110_AOD048#aodTree");      
42    }
43    if (c == 3){
44      handler->SetProofDataSet("/default/lmilano/LHC10h_000138653_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138662_AOD086_p2#aodTree|/default/lmilano/LHC10h_000138666_AOD086_p2#aodTree|/default/lmilano/LHC10h_000139107_AOD086_p2#aodTree");      
45    }
46    if (c == 4){
47      handler->SetProofDataSet("/default/lmilano/LHC11a10a_bis_138653_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138662_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_138666_AOD090#aodTree|/default/lmilano/LHC11a10a_bis_139107_AOD090#aodTree");      
48    }
49    
50    handler->SetAliRootMode("default");
51    handler->SetAdditionalLibs("AliSpectraAODHistoManager.cxx AliSpectraAODHistoManager.h AliSpectraAODEventCuts.cxx AliSpectraAODEventCuts.h AliSpectraAODTrackCuts.cxx AliSpectraAODTrackCuts.h AliAnalysisTaskSpectraAOD.cxx AliAnalysisTaskSpectraAOD.h");
52    handler->SetAnalysisSource("AliSpectraAODHistoManager.cxx+ AliSpectraAODEventCuts.cxx+ AliSpectraAODTrackCuts.cxx+ AliAnalysisTaskSpectraAOD.cxx+");
53    handler->SetFileForTestMode("filelist.txt"); // list of local files for testing
54    //  handler->SetAliRootMode("");
55    handler->SetClearPackages();
56    
57    AliAnalysisManager *mgr = new AliAnalysisManager("testAnalysis");
58    mgr->SetGridHandler(handler);
59    AliAODInputHandler* aodH = new AliAODInputHandler();
60    mgr->SetInputEventHandler(aodH);
61    
62    gROOT->LoadMacro("AliSpectraAODTrackCuts.cxx+g");
63    gROOT->LoadMacro("AliSpectraAODEventCuts.cxx+g");
64    gROOT->LoadMacro("AliSpectraAODHistoManager.cxx+g");
65    gROOT->LoadMacro("AliAnalysisTaskSpectraAOD.cxx+g");
66    
67    // Add PID task
68    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
69    Bool_t isMC = kFALSE;
70    if (c == 2 || c == 4) isMC = kTRUE;   
71    AliAnalysisTask * taskPID = AddTaskPIDResponse(isMC);
72    mgr->AddTask(taskPID);
73    
74    //LOOP OVER SELECTION
75    Double_t CentCutMin[4]={0,0,20,20};
76    Double_t CentCutMax[4]={100,5,40,40};
77    Double_t QvecCutMin[4]={0,0,0,3};
78    Double_t QvecCutMax[4]={100,100,2,100};
79    // Double_t CentCutMin[4]={5,10,20,30};
80    // Double_t CentCutMax[4]={10,20,30,40};
81    // Double_t QvecCutMin[4]={0,0,0,0};
82    // Double_t QvecCutMax[4]={100,100,100,100};
83    for(Int_t iCut=1;iCut<2;iCut++){
84      AliAnalysisTaskSpectraAOD *task = new AliAnalysisTaskSpectraAOD("TaskAODExercise");
85      mgr->AddTask(task);
86      //physics selection
87      task->SelectCollisionCandidates();     
88      // Set the cuts
89      AliSpectraAODEventCuts * vcuts = new AliSpectraAODEventCuts("Event Cuts");
90      AliSpectraAODTrackCuts  * tcuts = new AliSpectraAODTrackCuts("Track Cuts");
91      if(c==1 || c==2)tcuts->SetTrackType(5); //AOD 046 & 047. Standard Cut with loose DCA
92      if(c==3 || c==4)tcuts->SetTrackType(10); //AOD 086 & 090. Standard Raa cut
93      tcuts->SetEta(.8);
94      //tcuts->SetDCA(.1);
95      tcuts->SetPt(5);
96      tcuts->SetPtTOFMatching(0.6);   
97      tcuts->SetQvecMin(QvecCutMin[iCut]);   
98      tcuts->SetQvecMax(QvecCutMax[iCut]);    
99      vcuts->SetCentralityCutMax(CentCutMax[iCut]);  
100      vcuts->SetCentralityCutMin(CentCutMin[iCut]);
101      task->SetEventCuts(vcuts);
102      task->SetTrackCuts(tcuts);
103      task->SetNSigmaForIdentification(5.); // FIXME
104      task->SetYCut(.5);
105      vcuts->PrintCuts();
106      tcuts->PrintCuts();
107      
108      // check for MC or real data
109      if (c == 2 || c == 4)
110        {
111          task->SetIsMC(kTRUE);
112          AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
113          AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
114                                                                      Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
115          AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
116                                                                      Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
117          AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
118                                                                      Form("Pt.AOD.1._MC_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
119        }
120      if (c == 1 || c==3)
121        {
122          AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
123          AliAnalysisDataContainer *coutputpt1 = mgr->CreateContainer(Form("chistpt%d",iCut), AliSpectraAODHistoManager::Class(),  AliAnalysisManager::kOutputContainer, 
124                                                                      Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
125          AliAnalysisDataContainer *coutputpt2 = mgr->CreateContainer(Form("cvcutpt%d",iCut), AliSpectraAODEventCuts::Class(),    AliAnalysisManager::kOutputContainer, 
126                                                                      Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
127          AliAnalysisDataContainer *coutputpt3 = mgr->CreateContainer(Form("ctcutpt%d",iCut), AliSpectraAODTrackCuts::Class(),     AliAnalysisManager::kOutputContainer, 
128                                                                      Form("Pt.AOD.1._data_ptcut_Cent%.0fto%.0f_QVec%.1fto%.1f.root",CentCutMin[iCut],CentCutMax[iCut],QvecCutMin[iCut],QvecCutMax[iCut]));
129          
130        }
131      mgr->ConnectInput(task, 0, cinput);
132      mgr->ConnectOutput(task, 1, coutputpt1);
133      mgr->ConnectOutput(task, 2, coutputpt2);
134      mgr->ConnectOutput(task, 3, coutputpt3);
135    }
136    mgr->SetDebugLevel(2);
137    
138    if (!mgr->InitAnalysis()) return;
139    mgr->PrintStatus();
140    mgr->StartAnalysis("proof");
141 }