Split: fix refs to AddTaskPhysicsSelection.C
[u/mrichter/AliRoot.git] / PWGCF / Correlations / macros / twoplusone / RunDiJetCorrelations.C
1
2
3 class AliAnalysisGrid;
4 class AliAnalysisAlien;
5
6
7 //______________| Loading Proper Libraries
8 void Load() {
9     
10     gSystem->SetIncludePath("-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/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWGCF -I$ALICE_ROOT/PWGCF/Correlations -I$ALICE_ROOT/PWGCF/Correlations/DPhi -I$ALICE_ROOT/PWGCF/Correlations/macros -g");
11     
12     gROOT->ProcessLine(".include $ALICE_ROOT/include");
13     
14     //load the required aliroot libraries
15     gSystem->Load("libTree.so");
16     gSystem->Load("libGeom.so");
17     gSystem->Load("libPhysics.so");
18     gSystem->Load("libVMC.so");
19     gSystem->Load("libMinuit.so");
20     gSystem->Load("libSTEERBase.so");
21     gSystem->Load("libESD.so");
22     gSystem->Load("libAOD.so");
23     gSystem->Load("libANALYSIS.so");
24     gSystem->Load("libOADB.so");
25     gSystem->Load("libANALYSISalice.so");
26     gSystem->Load("libCORRFW.so");
27     gSystem->Load("libPWGTools.so");
28     gSystem->Load("libPWGCFCorrelationsBase.so");
29     gSystem->Load("libPWGCFCorrelationsDPhi.so");
30
31
32 }
33
34 //______________| Run Di-Jet Function
35 void RunDiJetCorrelations()
36 {
37     
38     
39   // Seeting for analysis run
40   Load();
41   TString      analysisMode = "grid"; // "local", "grid", or "proof"
42   TString        pluginmode = "full"; // full terminate or test mode
43   Bool_t     useAlienPlugin =  kTRUE;
44   TString         inputMode = "list"; // "list", "xml", or "dataset"
45   Long64_t         nentries =  123567890,  firstentry=0;
46   TString testfileslistWithPlugin = "./filesAOD.txt";
47   TString loadMacroPath="$ALICE_ROOT/PWGCF/Correlations/macros/";
48   
49   if(analysisMode=="grid"){
50     TGrid::Connect("alien://");
51   } 
52    
53   // Create Alien plugin, if requested 
54   TChain *chainAOD = 0;
55   if(useAlienPlugin){
56     AliAnalysisGrid *alienHandler = CreateAlienHandler(pluginmode,testfileslistWithPlugin.Data());
57     if(!alienHandler) return;
58   }  else{
59     TString makeAODInputChain="../MakeAODInputChain.C"; makeAODInputChain.Prepend(loadMacroPath.Data());
60     if(inputMode=="list") {
61       // Local files
62       gROOT->LoadMacro(makeAODInputChain.Data());
63       chainAOD = MakeAODInputChain();// with this it reads ./AliAOD.root and ./AliAOD.VertexingHF.root
64       printf("ENTRIES %d\n",chainAOD->GetEntries());
65     } else if(inputMode=="xml") {
66       // xml
67       gROOT->LoadMacro(makeAODInputChain.Data());
68       chainAOD = MakeAODInputChain("collection_aod.xml","collection_aodHF.xml");
69     } 
70   }
71   
72   // Create the analysis manager
73   AliAnalysisManager *mgr  = new AliAnalysisManager("My Manager","My Manager");
74   mgr->SetDebugLevel(10);
75   if(useAlienPlugin) mgr->SetGridHandler(alienHandler);
76   
77   // Input
78   AliAODInputHandler *inputHandler = new AliAODInputHandler("handler","handler for Di-Jets Correlations\13");
79   mgr->SetInputEventHandler(inputHandler);
80   
81   gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C");
82     
83   gROOT->LoadMacro("AliAnalysisTaskDiJetCorrelations.cxx++g");
84   gROOT->LoadMacro("AddTaskDiJetCorrelations.C");
85     AliAnalysisTaskDiJetCorrelations *taskSE1  = AddTaskDiJetCorrelations("SE_1", kFALSE, kTRUE, 7.0, 12.0, 3.0, 8.0);
86     AliAnalysisTaskDiJetCorrelations *taskME1  = AddTaskDiJetCorrelations("ME_1", kTRUE, kTRUE,  7.0, 12.0, 3.0, 8.0);
87   
88   // Run the analysis   
89   if(chainAOD) printf("CHAIN HAS %d ENTRIES\n",(Int_t)chainAOD->GetEntries());
90   if(!mgr->InitAnalysis()) return;
91   mgr->PrintStatus();
92     
93   
94   if(analysisMode=="grid" && !useAlienPlugin) analysisMode="local";
95   if(analysisMode!="proof") {
96     mgr->StartAnalysis(analysisMode.Data(),chainAOD,nentries,firstentry);
97   } else {
98     mgr->StartAnalysis(analysisMode.Data(),dataset.Data(),nentries,firstentry);
99   }
100   
101   return;
102   
103 }
104
105 //___________________________________| Alien Handler function and plugin|______________________________________
106 AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test", TString testfileslistWithPlugin="")
107 {
108   
109   AliAnalysisAlien *plugin = new AliAnalysisAlien();
110   // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
111   plugin->SetRunMode(pluginmode.Data());
112   plugin->SetUser("gkoyitha");
113   // Set versions of used packages
114   plugin->SetAPIVersion("V1.1x");
115   plugin->SetROOTVersion("v5-34-08-6");
116   plugin->SetAliROOTVersion("vAN-20141230");
117     //plugin->SetAliROOTVersion("vAN-20141021");
118   plugin->SetFileForTestMode(testfileslistWithPlugin.Data());
119   plugin->SetNtestFiles(1); // if "test mode"
120   
121   
122   //________________________Set data search pattern for DATA and MC
123   //Method 1: To create automatically xml through plugin
124   gROOT->LoadMacro("./AddGoodRuns.C");
125   plugin->SetGridDataDir("/alice/data/2010/LHC10h/"); // specify LHC period
126   plugin->SetDataPattern("*/AOD086/*/AliAOD.root"); // specify reco pass and AOD set
127   Int_t totruns=0;
128   totruns += AddGoodRuns(plugin,"LHC10h_Gir",""); // specify LHC period
129   plugin->SetNrunsPerMaster(totruns);    
130   
131   plugin->SetGridWorkingDir("/Jan13/CrossCheck/");
132   plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output
133   plugin->SetExecutable("AnalysisDiJetCorr.sh");
134   plugin->SetAnalysisSource("AliAnalysisTaskDiJetCorrelations.cxx");
135                             
136
137   // Declare all addtional libraries  here.  
138   plugin->SetAdditionalLibs("libCORRFW.so libEMCALUtils.so libJETAN.so AliAnalysisTaskDiJetCorrelations.h AliAnalysisTaskDiJetCorrelations.cxx");
139    
140   plugin->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/STEER -I$ALICE_ROOT/STEER/STEERBase -I$ALICE_ROOT/STEER/ESD -I$ALICE_ROOT/STEER/AOD -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWGCF -I$ALICE_ROOT/PWGCF/Correlations -I$ALICE_ROOT/PWGCF/Correlations/DPhi -I$ALICE_ROOT/PWGCF/Correlations/macros -g");
141
142   plugin->SetDefaultOutputs(kTRUE);
143   plugin->SetSplitMaxInputFileNumber(10);
144   
145   // merging via jdl
146   //plugin->SetMergeViaJDL(kFALSE);
147   plugin->SetMergeViaJDL(kTRUE);
148   plugin->SetOneStageMerging(kFALSE);
149   plugin->SetMaxMergeStages(2);
150   plugin->SetMaxMergeFiles(10);
151   plugin->SetTTL(30000);
152   plugin->SetKeepLogs();
153   plugin->SetAnalysisMacro("AnalysisDiJetCorr.C");
154   plugin->SetJDLName("DiJetCorr.jdl");
155   
156   return plugin;
157
158 }
159
160
161
162
163 // Loading Libs
164
165
166