TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWG / DevNanoAOD / runLocalESE.C
CommitLineData
778636d4 1#if !defined (__CINT__) || (defined(__MAKECINT__))
2#include <iostream>
3#include "AliAnalysisGrid.h"
4#include "TSystem.h"
5#include "TROOT.h"
6#include "AliAnalysisManager.h"
7#include "AliAnalysisGrid.h"
8#include "AliVEventHandler.h"
9#include "AliAODInputHandler.h"
10#include "AliAnalysisAlien.h"
11#include "AliMCEventHandler.h"
12#include "AliPhysicsSelectionTask.h"
13#include "TRegexp.h"
14#include "AliTriggerAnalysis.h"
15#include "TChain.h"
16#include "AliAnalysisTaskPIDResponse.h"
17#include "AliAODHandler.h"
18#include "AliAnalysisTaskNanoAODFilter.h"
19#include "AliESEHelpers.h"
20
21#endif
22void LoadLibs();
23
24class AliAnalysisGrid;
25class AliESETrkCut;
26class AliESEEvtCut;
27
28AliESETrkCut * TrkCuts() {
29
30 AliESETrkCut * trk = new AliESETrkCut;
31
32 AliSpectraAODTrackCuts * trcuts = new AliSpectraAODTrackCuts("TrackCuts");
33 trcuts->SetDCA(100000);
92473974 34 trcuts->SetTrackBits(1024);
35 trcuts->SetPt(15);
778636d4 36 trcuts->SetPtTOFMatching(0.6);
37 trcuts->SetEta(-0.8,0.8);
38 trcuts->SetMinTPCcls(70);
39 trcuts->PrintCuts();
40
41 trk->SetTrackCuts(trcuts);
42 trk->Init();
43
44 return trk;
45
46}
47
48AliESEEvtCut * EvtCuts(Int_t mc) {
49
50 AliESEEvtCut * evt = new AliESEEvtCut;
51
52 AliSpectraAODEventCuts * evcuts = new AliSpectraAODEventCuts("EventCuts");
53 evcuts->SetQVectorCut(0,100);
54 evcuts->SetCentralityCutMax(100);
55 evcuts->SetCentralityCutMin(0);
56 if(mc>0)evcuts->SetIsMC(kTRUE);
57 TFile * fCalib = new TFile("./calibV0New.root");
58 evcuts->SetCalibFile(fCalib);
59 evcuts->SetIsLHC10h(kTRUE);
60 evcuts->PrintCuts();
61 // evcuts->SetEventSelectionBit(AliVEvent::kAny);
62
63 evt->SetEventCuts(evcuts);
64 evt->Init();
65
66 return evt;
67
68}
69
70//______________________________________________________________________________
71void runLocalESE(
768ac2f5 72 const int iMCtruth = 0,
778636d4 73 const char * addTaskString = ".x AddTaskNanoAODFilter.C(%d,1)" //
74 )
75{
76 LoadLibs();
77 // analysis manager
78 AliAnalysisManager* mgr = new AliAnalysisManager("NanoAOD Filter", "NanoAOD filter for nanoAOD production");
79
80 AliAODInputHandler* iH = new AliAODInputHandler();
81 mgr->SetInputEventHandler(iH);
82
83 // Define aod output handler
84 AliAODHandler* aodOutputHandler = new AliAODHandler();
85 aodOutputHandler->SetOutputFileName("AliAOD.NanoAOD.root");
86 mgr->SetOutputEventHandler(aodOutputHandler);
87
88 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
89 AliAnalysisTaskPIDResponse *taskPID=AddTaskPIDResponse(iMCtruth);
90 taskPID->SetUseTPCEtaCorrection(kTRUE);
201dae36 91 taskPID->SetUserDataRecoPass(2);
778636d4 92 // create task
93 cout << "Macro: "<< addTaskString << " " << Form(addTaskString, iMCtruth) << endl;
94
95 AliAnalysisTaskNanoAODFilter * task = (AliAnalysisTaskNanoAODFilter*) gROOT->ProcessLine(Form(addTaskString, iMCtruth));
96
97 // Set Track event and vertex cuts here!
201dae36 98 // task->SetVarList("pt,theta,phi,cstNSigmaTPCPi,cstNSigmaTPCKa,cstNSigmaTPCPr,cstNSigmaTOFPi,cstNSigmaTOFKa,cstNSigmaTOFPr,cstBayesTPCPi,cstBayesTPCKa,cstBayesTPCPr,cstBayesTOFPi,cstBayesTOFKa,cstBayesTOFPr");
99 task->SetVarList("pt,theta,phi,cstNSigmaTPCPi,cstNSigmaTPCKa,cstNSigmaTPCPr,cstNSigmaTOFPi,cstNSigmaTOFKa,cstNSigmaTOFPr");
778636d4 100 task->SetVarListHead("cstCentr,cstQVec");
101 AliESETrkCut * trkCuts = TrkCuts();
102 AliESEEvtCut * evtCuts = EvtCuts(iMCtruth);
103 evtCuts->SetTrackCuts(trkCuts->GetTrackCuts());
104 AliAnalysisESESetter * setter = new AliAnalysisESESetter;
105 setter->SetEventCuts(evtCuts->GetEventCuts());
106
107 task->SetTrkCuts(trkCuts);
108 task->SetEvtCuts(evtCuts);
109 task->SetSetter(setter);
110
111 //task->SelectCollisionCandidates(AliVEvent::kMB);// FIXME
112 // enable debug printouts
113 mgr->SetDebugLevel(10);
114 // mgr->SetNSysInfo(100);
115 if (!mgr->InitAnalysis()) return;
116 mgr->PrintStatus();
117
118 // start analysis
119 // Always read the same file:
120 TChain * chain = new TChain("aodTree");
768ac2f5 121
122 chain->Add("~//Work/ALICE/ANALYSIS/current/nAOD/input/LHC10h/AOD86/0356/AliAOD.root");
123 chain->Add("~//Work/ALICE/ANALYSIS/current/nAOD/input/LHC10h/AOD86/0407/AliAOD.root");
124 chain->Add("~//Work/ALICE/ANALYSIS/current/nAOD/input/LHC10h/AOD86/0398/AliAOD.root");
778636d4 125
126 Printf("Starting Analysis....");
768ac2f5 127 chain->Print();
778636d4 128 mgr->StartAnalysis("local", chain,123456789);
129
130}
131
132//______________________________________________________________________________
133
134void LoadLibs() {
230b7aff 135 gSystem->Load("libCore");
136 gSystem->Load("libGeom");
137 gSystem->Load("libPhysics");
778636d4 138 gSystem->Load("libVMC");
139 gSystem->Load("libTree");
140 gSystem->Load("libProof");
141 gSystem->Load("libMatrix");
142 gSystem->Load("libMinuit");
143 gSystem->Load("libSTEERBase");
144 gSystem->Load("libESD");
145 gSystem->Load("libAOD");
146 gSystem->Load("libANALYSIS");
147 // return;
148 gSystem->Load("libOADB");
149 gSystem->Load("libANALYSISalice");
230b7aff 150 gSystem->Load("libTender");
778636d4 151 gSystem->Load("libCORRFW");
152
230b7aff 153 // gSystem->Load("libNanoAOD");
778636d4 154 gSystem->Load("libPWGLFspectra");
155 gSystem->Load("libPWGDevNanoAOD");
156
157}