Updates to Trains. create a job-script to help
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / IdentifiedHighPt / grid / AddTaskHighPtDeDxV0.C
CommitLineData
4ebdd20e 1AliAnalysisTask* AddTask(Bool_t AnalysisMC, const Char_t* taskname, Int_t typerun, UInt_t kTriggerInt[], Float_t minc[], Float_t maxc[] )
2{
3 // Creates a pid task and adds it to the analysis manager
4
5 // Get the pointer to the existing analysis manager via the static
6 //access method
7 //=========================================================================
8 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
9 if (!mgr) {
10 Error("AddTaskHighPtDeDx", "No analysis manager to connect to.");
11 return NULL;
12 }
13
14 // Check the analysis type using the event handlers connected to the
15 // analysis manager The availability of MC handler can also be
16 // checked here.
17 // =========================================================================
18 if (!mgr->GetInputEventHandler()) {
19 Error("AddTaskHighPtDeDx", "This task requires an input event handler");
20 return NULL;
21 }
22
23 //
24 // Add track filters, with Golden Cuts
25 //
26 AliAnalysisFilter* trackFilterGolden = new AliAnalysisFilter("trackFilter");
27 AliESDtrackCuts* esdTrackCutsGolden =
28 AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE);
29 trackFilterGolden->AddCuts(esdTrackCutsGolden);
30
31
32 //old cuts without golden cut
33 AliAnalysisFilter* trackFilter0 = new AliAnalysisFilter("trackFilter");
34 Bool_t clusterCut=0;
35 Bool_t selPrimaries=kTRUE;
36 AliESDtrackCuts* esdTrackCutsL0 = new AliESDtrackCuts;
37 // TPC
38 if(clusterCut == 0) esdTrackCutsL0->SetMinNClustersTPC(70);
39 else if (clusterCut == 1) {
40 esdTrackCutsL0->SetMinNCrossedRowsTPC(70);
41 esdTrackCutsL0->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
42 }
43 else {
44 AliWarningClass(Form("Wrong value of the clusterCut parameter (%d), using cut on Nclusters",clusterCut));
45 esdTrackCutsL0->SetMinNClustersTPC(70);
46 }
47 esdTrackCutsL0->SetMaxChi2PerClusterTPC(4);
48 esdTrackCutsL0->SetAcceptKinkDaughters(kFALSE);
49 esdTrackCutsL0->SetRequireTPCRefit(kTRUE);
50 // ITS
51 esdTrackCutsL0->SetRequireITSRefit(kTRUE);
52 esdTrackCutsL0->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
53 AliESDtrackCuts::kAny);
54 if(selPrimaries) {
55 // 7*(0.0026+0.0050/pt^1.01)
56 esdTrackCutsL0->SetMaxDCAToVertexXYPtDep("0.0182+0.0350/pt^1.01");
57 }
58 esdTrackCutsL0->SetMaxDCAToVertexZ(2);
59 esdTrackCutsL0->SetDCAToVertex2D(kFALSE);
60 esdTrackCutsL0->SetRequireSigmaToVertex(kFALSE);
61 esdTrackCutsL0->SetMaxChi2PerClusterITS(1e10);
62 esdTrackCutsL0->SetMaxChi2TPCConstrainedGlobal(1e10);
63
64
65 trackFilter0->AddCuts(esdTrackCutsL0);
66
67
68
69 AliAnalysisFilter* trackFilterTPC = new AliAnalysisFilter("trackFilterTPC");
70 AliESDtrackCuts* esdTrackCutsTPC =
71 AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
72 trackFilterTPC->AddCuts(esdTrackCutsTPC);
73
74
75 // Create the task and configure it
76 //========================================================================
77 if(typerun==2){//heavy ion analysis
78
79 AliAnalysisTaskHighPtDeDxV0* taskHighPtDeDxV0[6];
80 for( Int_t i=0; i<6; ++i ){
81 taskHighPtDeDxV0[i]=0;
82 Char_t TaskName[256]={0};
83 sprintf(TaskName,"%s_%1.0f_%1.0f",taskname,minc[i],maxc[i]);
84
85 taskHighPtDeDxV0[i] = new AliAnalysisTaskHighPtDeDxV0(TaskName);
86 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
87
88 taskHighPtDeDxV0[i]->SetAnalysisType(type);
89 taskHighPtDeDxV0[i]->SetAnalysisMC(AnalysisMC);
90 taskHighPtDeDxV0[i]->SetAnalysisPbPb(kTRUE);
91 taskHighPtDeDxV0[i]->SetProduceTPCBranch(kFALSE);
92 taskHighPtDeDxV0[i]->SetDebugLevel(0);
93 taskHighPtDeDxV0[i]->SetEtaCut(0.8);
94 taskHighPtDeDxV0[i]->SetVtxCut(10.0);
95 taskHighPtDeDxV0[i]->SetMinPt(0.0); // def: 2.0
96 taskHighPtDeDxV0[i]->SetMassCut(0.1); // def: 0.03
97 taskHighPtDeDxV0[i]->SetTreeOption(1);
98 taskHighPtDeDxV0[i]->SetRequireRecV0(kFALSE); // def: kTRUE
99 taskHighPtDeDxV0[i]->SetStoreMcIn(kTRUE); // def: kFALSE
100 taskHighPtDeDxV0[i]->SetTrigger1(kTriggerInt[0]);
101 taskHighPtDeDxV0[i]->SetTrigger2(kTriggerInt[1]);
102 taskHighPtDeDxV0[i]->SetMinCent(minc[i]);
103 taskHighPtDeDxV0[i]->SetMaxCent(maxc[i]);
104 //Set Filtesr
105 taskHighPtDeDxV0[i]->SetTrackFilterGolden(trackFilterGolden);
106 taskHighPtDeDxV0[i]->SetTrackFilter(trackFilter0);
107 taskHighPtDeDxV0[i]->SetTrackFilterTPC(trackFilterTPC);
108
109 mgr->AddTask(taskHighPtDeDxV0[i]);
110
111
112 }
113
114 // Create ONLY the output containers for the data produced by the
115 // task. Get and connect other common input/output containers via
116 // the manager as below
117 //=======================================================================
118 AliAnalysisDataContainer *cout_hist[6];
119 for( Int_t i=0; i<6; ++i ){
120
121 cout_hist[i]=0;
122 Char_t outFileName[256]={0};
123 sprintf(outFileName,"%s_Tree_%1.0f_%1.0f.root",taskname,minc[i],maxc[i]);
124 //AliAnalysisDataContainer *cout_hist = 0;
125
126 cout_hist[i] = mgr->CreateContainer(Form("output_%1.0f_%1.0f",minc[i],maxc[i]), TList::Class(), AliAnalysisManager::kOutputContainer, outFileName);
127 mgr->ConnectInput (taskHighPtDeDxV0[i], 0, mgr->GetCommonInputContainer());
128 mgr->ConnectOutput(taskHighPtDeDxV0[i], 1, cout_hist[i]);
129
130 }
131
132 // Return task pointer at the end
133 return taskHighPtDeDxV0[0];
134 }
135
136 if(typerun==3){//pp analysis
137
138 AliAnalysisTaskHighPtDeDxV0* taskHighPtDeDxV0 = new AliAnalysisTaskHighPtDeDxV0("taskHighPtDeDxV0pp");
139 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
140
141 taskHighPtDeDxV0->SetAnalysisType(type);
142 taskHighPtDeDxV0->SetAnalysisMC(AnalysisMC);
143 taskHighPtDeDxV0->SetAnalysisPbPb(kFALSE);
144 taskHighPtDeDxV0->SetProduceTPCBranch(kFALSE);
145 taskHighPtDeDxV0->SetDebugLevel(0);
146 taskHighPtDeDxV0->SetEtaCut(0.8);
147 taskHighPtDeDxV0->SetVtxCut(10.0);
148 taskHighPtDeDxV0->SetMinPt(0.0); // def: 2.0
149 taskHighPtDeDxV0->SetMassCut(0.03); // def: 0.03
150 taskHighPtDeDxV0->SetTreeOption(1);
151 taskHighPtDeDxV0->SetRequireRecV0(kTRUE); // def: kTRUE
152 taskHighPtDeDxV0->SetStoreMcIn(kFALSE); // def: kFALSE
153 taskHighPtDeDxV0->SetTrigger1(kTriggerInt[0]);
154 taskHighPtDeDxV0->SetTrigger2(kTriggerInt[1]);
155 //Set Filtesr
156 taskHighPtDeDxV0->SetTrackFilterGolden(trackFilterGolden);
157 taskHighPtDeDxV0->SetTrackFilter(trackFilter0);
158 taskHighPtDeDxV0->SetTrackFilterTPC(trackFilterTPC);
159
160 mgr->AddTask(taskHighPtDeDxV0);
161
162
163
164 // Create ONLY the output containers for the data produced by the
165 // task. Get and connect other common input/output containers via
166 // the manager as below
167 //=======================================================================
168 AliAnalysisDataContainer *cout_histdedxv0;
169
170 cout_histdedxv0=0;
171 Char_t outFileName[256]={0};
172 sprintf(outFileName,"%s_Tree.root",taskname);
173 //AliAnalysisDataContainer *cout_hist = 0;
174
175 cout_histdedxv0 = mgr->CreateContainer("output", TList::Class(), AliAnalysisManager::kOutputContainer, outFileName);
176 mgr->ConnectInput (taskHighPtDeDxV0, 0, mgr->GetCommonInputContainer());
177 mgr->ConnectOutput(taskHighPtDeDxV0, 1, cout_histdedxv0);
178
179 // Return task pointer at the end
180 return taskHighPtDeDxV0;
181
182
183 }
184
185
186
187
188
189
190}