2 // Macro designed for use with the AliAnalysisTaskDptDptCorrelations task.
4 // Author: Prabhat Pujahari & Claude Pruneau, Wayne State
6 // system: 0: PbPb 1: pp
7 // singlesOnly: 0: full correlations 1: singles only
8 // useWeights: 0: no 1: yes
9 // centralityMethod: 3: track count 4: V0 centrality
10 // chargeSet: 0: ++ 1: +- 2: -+ 3: --
11 /////////////////////////////////////////////////////////////////////////////////
12 AliAnalysisTaskDptDptCorrelations *AddTaskDptDptCorrelations2010(int system = 0,
15 int centralityMethod = 4,
19 // Set Default Configuration of this analysis
20 // ==========================================
23 int rejectPairConversion = 1;
28 double minCentrality[10];
29 double maxCentrality[10];
31 if (system==0) // PbPb
33 if (centralityMethod == 4)
37 minCentrality[0] = 0.0; maxCentrality[0] = 5.0;
38 minCentrality[1] = 5.0; maxCentrality[1] = 10.;
39 minCentrality[2] = 30.; maxCentrality[2] = 40.;
40 minCentrality[3] = 40.; maxCentrality[3] = 50.;
41 minCentrality[4] = 70.; maxCentrality[4] = 80.;
42 minCentrality[5] = 80.; maxCentrality[5] = 90.;*/
45 minCentrality[0] = 0.0; maxCentrality[0] = 5.0;
46 minCentrality[1] = 5.0; maxCentrality[1] = 10.;
47 minCentrality[2] = 10.; maxCentrality[2] = 20.;
48 minCentrality[3] = 20.; maxCentrality[3] = 30.;
49 minCentrality[4] = 30.; maxCentrality[4] = 40.;
50 minCentrality[5] = 40.; maxCentrality[5] = 50.;
51 minCentrality[6] = 50.; maxCentrality[6] = 60.;
52 minCentrality[7] = 60.; maxCentrality[7] = 70.;
53 minCentrality[8] = 70.; maxCentrality[8] = 80.;
54 minCentrality[9] = 80.; maxCentrality[9] = 90.;
59 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
63 else if (system==1) // pp
65 if (centralityMethod == 3)
68 minCentrality[0] = 2; maxCentrality[0] = 100.0;
69 minCentrality[1] = 2; maxCentrality[1] = 20.;
70 minCentrality[2] = 20.; maxCentrality[2] = 50.;
71 minCentrality[3] = 50.; maxCentrality[3] = 100.;
75 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
81 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". Option NOT CURRENTLY AVAILABLE. ABORT."
91 double dcaZMin = -3.0;
93 double dcaXYMin = -2.4;
94 double dcaXYMax = 2.4;
96 double dedxMax = 20000.0;
98 //int trackFilterBit = 128;//TPC only
99 int trackFilterBit = 272; //Hybrid
101 int requestedCharge1 = 1; //default
102 int requestedCharge2 = -1; //default
105 // Get the pointer to the existing analysis manager via the static access method.
106 // ==============================================================================
107 AliAnalysisManager *analysisManager = AliAnalysisManager::GetAnalysisManager();
109 if (!analysisManager)
111 ::Error("AddTaskDptDptCorrelations", "No analysis manager to connect to.");
118 TString prefixName = "Corr_";
119 TString pileupRejecSuffix = "_PileupRejec";
120 TString pairRejecSuffix = "_PairRejec";
121 TString calibSuffix = "_calib";
122 TString singlesOnlySuffix = "_SO";
125 TString inputPath = ".";
126 TString outputPath = ".";
130 TString inputHistogramFileName;
131 TString outputHistogramFileName;
133 // Create the task and add subtask.
134 // ===========================================================================
135 int iTask = 0; // task counter
136 AliAnalysisDataContainer *taskInputContainer;
137 AliAnalysisDataContainer *taskOutputContainer;
138 AliAnalysisTaskDptDptCorrelations* task;
140 for (int iCentrality=0; iCentrality < nCentrality; ++iCentrality)
144 case 0: part1Name = "P_"; part2Name = "P_"; requestedCharge1 = 1; requestedCharge2 = 1; sameFilter = 1; break;
145 case 1: part1Name = "P_"; part2Name = "M_"; requestedCharge1 = 1; requestedCharge2 = -1; sameFilter = 0; break;
146 case 2: part1Name = "M_"; part2Name = "P_"; requestedCharge1 = -1; requestedCharge2 = 1; sameFilter = 0; break;
147 case 3: part1Name = "M_"; part2Name = "M_"; requestedCharge1 = -1; requestedCharge2 = -1; sameFilter = 1; break;
149 //part1Name += int(1000*etaMin);
151 part1Name += int(1000*etaMax);
153 part1Name += int(1000*ptMin);
155 part1Name += int(1000*ptMax);
157 //part2Name += int(1000*etaMin);
159 part2Name += int(1000*etaMax);
161 part2Name += int(1000*ptMin);
163 part2Name += int(1000*ptMax);
166 eventName += int(10.*minCentrality[iCentrality] );
168 eventName += int(10.*maxCentrality[iCentrality] );
170 //eventName += int(10*zMin );
172 //eventName += int(10*zMax );
173 //if (rejectPileup) eventName += pileupRejecSuffix;
174 //if (rejectPairConversion) eventName += pairRejecSuffix;
175 baseName = prefixName;
176 baseName += part1Name;
177 baseName += part2Name;
178 baseName += eventName;
182 //inputHistogramFileName = "/Users/prabhat/MyTestforEta/PbPb276Calibration_2010.root";
183 inputHistogramFileName = "alien:///alice/cern.ch/user/p/prabhat/CalibFiles/PbPb276Calibration_2010.root";
185 outputHistogramFileName = baseName;
186 if (singlesOnly) outputHistogramFileName += singlesOnlySuffix;
187 outputHistogramFileName += ".root";
189 /*cout << "============================================================" << endl;
190 cout << " iTask: " << iTask << endl;
191 cout << " Task Name: " << taskName << endl;
192 cout << " List Name: " << listName << endl;
193 cout << " inputHistogramFileName: " << inputHistogramFileName << endl;
194 cout << " outputHistogramFileName: " << outputHistogramFileName << endl;
195 cout << " system: " << system << endl;
196 cout << " singlesOnly: " << singlesOnly << endl;
197 cout << " using weights: " << useWeights << endl;
198 cout << " centralityMethod: " << centralityMethod << endl;
199 cout << " chargeSet: " << chargeSet << endl;
200 cout << " debugLevel: " << debugLevel << endl;
201 cout << " rejectPileup: " << rejectPileup << endl;
202 cout << " rejectPairConversion: " << rejectPairConversion << endl;
203 cout << " sameFilter: " << sameFilter << endl;
204 cout << " zMin: " << zMin << endl;
205 cout << " zMax: " << zMax << endl;
206 cout << " ptMin: " << ptMin << endl;
207 cout << " ptMax: " << ptMax << endl;
208 cout << " etaMin: " << etaMin << endl;
209 cout << " etaMax: " << etaMax << endl;
210 cout << " dcaZMin: " << dcaZMin << endl;
211 cout << " dcaZMax: " << dcaZMax << endl;
212 cout << " dcaXYMin: " << dcaXYMin << endl;
213 cout << " dcaXYMax: " << dcaXYMax << endl;
214 cout << " dedxMin: " << dedxMin << endl;
215 cout << " dedxMax: " << dedxMax << endl;
216 cout << " nClusterMin: " << nClusterMin << endl;
217 cout << " trackFilterBit: " << trackFilterBit << endl;
218 cout << " requestedCharge1: " << requestedCharge1 << endl;
219 cout << " requestedCharge2: " << requestedCharge2 << endl;
220 cout << "============================================================" << endl;
222 TFile * inputFile = 0;
223 TList * histoList = 0;
228 TGrid::Connect("alien:");
229 inputFile = TFile::Open(inputHistogramFileName,"OLD");
232 //cout << "Requested file:" << inputHistogramFileName << " was not opened. ABORT." << endl;
235 TString nameHistoBase = "correction_";
237 nameHistoBase += eventName;
238 if (requestedCharge1 == 1)
240 nameHisto = nameHistoBase + "_p";
241 //cout << "Input Histogram named: " << nameHisto << endl;
242 weight_1 = (TH3F *) inputFile->Get(nameHisto);
246 nameHisto = nameHistoBase + "_m";
247 //cout << "Input Histogram named: " << nameHisto << endl;
248 weight_1 = (TH3F *) inputFile->Get(nameHisto);
252 //cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
259 if (requestedCharge2 == 1)
261 nameHisto = nameHistoBase + "_p";
262 //cout << "Input Histogram named: " << nameHisto << endl;
263 weight_2 = (TH3F *) inputFile->Get(nameHisto);
267 nameHisto = nameHistoBase + "_m";
268 //cout << "Input Histogram named: " << nameHisto << endl;
269 weight_2 = (TH3F *) inputFile->Get(nameHisto);
273 //cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
278 task = new AliAnalysisTaskDptDptCorrelations(taskName);
280 task->SetDebugLevel( debugLevel );
281 task->SetSameFilter( sameFilter );
282 task->SetSinglesOnly( singlesOnly );
283 task->SetUseWeights( useWeights );
284 task->SetRejectPileup( rejectPileup );
285 task->SetRejectPairConversion(rejectPairConversion);
286 task->SetVertexZMin( zMin );
287 task->SetVertexZMax( zMax );
288 task->SetVertexXYMin( -1. );
289 task->SetVertexXYMax( 1. );
290 task->SetCentralityMethod( centralityMethod);
291 task->SetCentrality( minCentrality[iCentrality], maxCentrality[iCentrality]);
292 task->SetPtMin1( ptMin );
293 task->SetPtMax1( ptMax );
294 task->SetEtaMin1( etaMin );
295 task->SetEtaMax1( etaMax );
296 task->SetPtMin2( ptMin );
297 task->SetPtMax2( ptMax );
298 task->SetEtaMin2( etaMin );
299 task->SetEtaMax2( etaMax );
300 task->SetDcaZMin( dcaZMin );
301 task->SetDcaZMax( dcaZMax );
302 task->SetDcaXYMin( dcaXYMin );
303 task->SetDcaXYMax( dcaXYMax );
304 task->SetDedxMin( dedxMin );
305 task->SetDedxMax( dedxMax );
306 task->SetNClusterMin( nClusterMin );
307 task->SetTrackFilterBit( trackFilterBit );
308 task->SetRequestedCharge_1( requestedCharge1);
309 task->SetRequestedCharge_2( requestedCharge2);
310 task->SetWeigth_1( weight_1 );
311 task->SetWeigth_2( weight_2 );
314 //cout << "Creating task output container" << endl;
315 taskOutputContainer = analysisManager->CreateContainer(listName,
317 AliAnalysisManager::kOutputContainer,
318 Form("%s:Histos", AliAnalysisManager::GetCommonFileName()));
319 //cout << "Add task to analysis manager and connect it to input and output containers" << endl;
320 analysisManager->AddTask(task);
321 analysisManager->ConnectInput( task, 0, analysisManager->GetCommonInputContainer());
322 analysisManager->ConnectOutput(task, 0, taskOutputContainer );
323 //cout << "Task added ...." << endl;