TENDER becomes Tender
[u/mrichter/AliRoot.git] / PWGPP / macros / AddTaskFilteredTree.C
CommitLineData
88222e62 1AliAnalysisTask* AddTaskFilteredTree(TString outputFile="")
1059f583 2{
3 gSystem->Load("libANALYSIS");
4 gSystem->Load("libANALYSISalice");
af472fff 5 gSystem->Load("libTender");
1059f583 6 gSystem->Load("libCORRFW");
7 gSystem->Load("libPWGUDbase");
8 gSystem->Load("libTPCcalib");
9 gSystem->Load("libPWGPP");
10 gSystem->Load("libPWGLFspectra");
11
12
13 gRandom->SetSeed(0);
14
15 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
16
17 if (!mgr) {
18 Error("AddTaskFilteredTree", "No analysis manager found.");
19 return 0;
20 }
21
22 // Switch off all AliInfo (too much output!!!)
23 AliLog::SetGlobalLogLevel(AliLog::kError);
24 mgr->SetDebugLevel(0);
25
26
27
28 //
29 // Create physics trigger selection class
30 //
31 //AliPhysicsSelection *physTrigSel = new AliPhysicsSelection();
32
33 //
34 // Create event cuts
35 //
36 Float_t zvWindow = 30. ;
37
38 AliFilteredTreeEventCuts *evtCuts = new AliFilteredTreeEventCuts("AliFilteredTreeEventCuts","Event cuts");
39 evtCuts->SetZvRange(-zvWindow,zvWindow);
40 evtCuts->SetMeanXYZv(0.0,0.0,0.0);
41 evtCuts->SetSigmaMeanXYZv(1.0,1.0,10.0);
42 evtCuts->SetTriggerRequired(kFALSE);
43 //evtCuts->SetTriggerRequired(kTRUE);
44
45 //
46 // Create geom. acceptance cuts
47 //
48 Float_t etaWindow = 1.0 ;
49 Float_t ptMin = 0.15 ;
50
51 AliFilteredTreeAcceptanceCuts *accCuts = new AliFilteredTreeAcceptanceCuts("AliFilteredTreeAcceptanceCuts","Geom. acceptance cuts");
52 accCuts->SetEtaRange(-etaWindow,etaWindow);
53 accCuts->SetPtRange(ptMin,1.e10);
54 accCuts->SetMaxDCAr(3.0);
55 accCuts->SetMaxDCAz(30.0);
56
57 //
58 // Create standard esd track cuts
59 //
60
61 AliESDtrackCuts* esdTrackCuts = CreateCuts();
62 if (!esdTrackCuts) {
63 printf("ERROR: esdTrackCuts could not be created\n");
64 return;
65 } else {
66 esdTrackCuts->SetHistogramsOn(kTRUE);
67 }
68
69 Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
70
71 //
72 // Create task
73 //
74 AliAnalysisTaskFilteredTree *task = new AliAnalysisTaskFilteredTree("AliAnalysisTaskFilteredTree");
b4c82bc9 75 //task->SetUseMCInfo(hasMC);
1059f583 76 //task->SetLowPtTrackDownscaligF(1.e4);
77 //task->SetLowPtV0DownscaligF(1.e2);
f9dcda2e 78 task->SetLowPtTrackDownscaligF(1.e5);
79 task->SetLowPtV0DownscaligF(2.e3);
1059f583 80 task->SetProcessAll(kTRUE);
81 task->SetProcessCosmics(kTRUE);
82 //task->SetProcessAll(kFALSE);
30530964 83 //task->SetFillTrees(kFALSE); // only histograms are filled
1059f583 84
85 // trigger
86 //task->SelectCollisionCandidates(AliVEvent::kMB);
87
88 //
89 // set analysis options from the Helper here !!!
90 //
91 // AlidNdPtHelper::OutputObject outputObject = AlidNdPtHelper::kCutAnalysisPbPb;
92 // AlidNdPtHelper::ParticleMode particleMode = AlidNdPtHelper::kAllPart ;
93 //AlidNdPtHelper::AnalysisMode analysisMode = AlidNdPtHelper::kTPCITS;
94
1059f583 95 task->SetEventCuts(evtCuts);
96 task->SetAcceptanceCuts(accCuts);
97 task->SetTrackCuts(esdTrackCuts);
98 task->SetAnalysisMode(AliAnalysisTaskFilteredTree::kTPCITSAnalysisMode);
99 task->SetCentralityEstimator("V0M");
100
101 // Add task
102 mgr->AddTask(task);
103
104 // Create containers for input
105 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
106 mgr->ConnectInput(task, 0, cinput);
107
25d4fe44 108 if (outputFile.IsNull())
109 outputFile=Form("%s", AliAnalysisManager::GetCommonFileName());
110
111 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("filtered1", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 112 mgr->ConnectOutput(task, 1, coutput1);
25d4fe44 113 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("filtered2", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 114 mgr->ConnectOutput(task, 2, coutput2);
25d4fe44 115 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("filtered3", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 116 mgr->ConnectOutput(task, 3, coutput3);
25d4fe44 117 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("filtered4", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 118 mgr->ConnectOutput(task, 4, coutput4);
25d4fe44 119 AliAnalysisDataContainer *coutput5 = mgr->CreateContainer("filtered5", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 120 mgr->ConnectOutput(task, 5, coutput5);
25d4fe44 121 AliAnalysisDataContainer *coutput6 = mgr->CreateContainer("filtered6", TTree::Class(), AliAnalysisManager::kOutputContainer, outputFile.Data());
1059f583 122 mgr->ConnectOutput(task, 6, coutput6);
25d4fe44 123
30530964 124
125 // store histograms in the separate file
126 TString outputFileHisto = "PtResHistograms.root";
127
128 AliAnalysisDataContainer *coutput7 = mgr->CreateContainer("histo7", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileHisto.Data());
129 mgr->ConnectOutput(task, 7, coutput7);
130
131
25d4fe44 132 return task;
1059f583 133}
134
135AliESDtrackCuts* CreateCuts(Bool_t fieldOn = kTRUE, Bool_t hists = kTRUE)
136{
137 AliESDtrackCuts* esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
138 if(!esdTrackCuts) return 0;
139
140 if (hists)
141 esdTrackCuts->DefineHistograms(1);
142
143 Double_t cov1, cov2, cov3, cov4, cov5;
144 Double_t nSigma;
145 Double_t maxDCAtoVertex, maxDCAtoVertexXY, maxDCAtoVertexZ;
146 Double_t minNClustersTPC;
147 Double_t maxChi2PerClusterTPC;
148 Double_t minPt, maxPt;
149
150 //
151 // TPC
152 //
153 esdTrackCuts->SetRequireTPCRefit(kTRUE);
154 esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
155 //
156 // ITS
157 //
158 //esdTrackCuts->SetRequireITSRefit(kTRUE);
159 //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
160 //
161
162 TString tag = "TPC+ITS refit and KinkRejection required - for cut studies";
163
164 // cuts for data without field
165 if (!fieldOn)
166 {
167 cov5 = 1e10;
168 tag += " without field";
169 }
170
171 Printf("Created track cuts for: %s", tag.Data());
172
173 return esdTrackCuts;
174}