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 *AddTaskDptDptCorrelationsforWeight(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)
36 minCentrality[0] = 0.0; maxCentrality[0] = 5.0;
37 minCentrality[1] = 5.0; maxCentrality[1] = 10.;
38 minCentrality[2] = 30.; maxCentrality[2] = 40.;
39 minCentrality[3] = 40.; maxCentrality[3] = 50.;
40 minCentrality[4] = 70.; maxCentrality[4] = 80.;
41 minCentrality[5] = 80.; maxCentrality[5] = 90.;
43 /* //To Get rid of Memory problem
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;
100 int requestedCharge1 = 1; //default
101 int requestedCharge2 = -1; //default
104 // Get the pointer to the existing analysis manager via the static access method.
105 // ==============================================================================
106 AliAnalysisManager *analysisManager = AliAnalysisManager::GetAnalysisManager();
108 if (!analysisManager)
110 ::Error("AddTaskDptDptCorrelations", "No analysis manager to connect to.");
117 TString prefixName = "Corr_";
118 TString pileupRejecSuffix = "_PileupRejec";
119 TString pairRejecSuffix = "_PairRejec";
120 TString calibSuffix = "_calib";
121 TString singlesOnlySuffix = "_SO";
124 TString inputPath = ".";
125 TString outputPath = ".";
129 TString inputHistogramFileName;
130 TString outputHistogramFileName;
132 // Create the task and add subtask.
133 // ===========================================================================
134 int iTask = 0; // task counter
135 AliAnalysisDataContainer *taskInputContainer;
136 AliAnalysisDataContainer *taskOutputContainer;
137 AliAnalysisTaskDptDptCorrelations* task;
139 for (int iCentrality=0; iCentrality < nCentrality; ++iCentrality)
143 case 0: part1Name = "P_"; part2Name = "P_"; requestedCharge1 = 1; requestedCharge2 = 1; sameFilter = 1; break;
144 case 1: part1Name = "P_"; part2Name = "M_"; requestedCharge1 = 1; requestedCharge2 = -1; sameFilter = 0; break;
145 case 2: part1Name = "M_"; part2Name = "P_"; requestedCharge1 = -1; requestedCharge2 = 1; sameFilter = 0; break;
146 case 3: part1Name = "M_"; part2Name = "M_"; requestedCharge1 = -1; requestedCharge2 = -1; sameFilter = 1; break;
148 //part1Name += int(1000*etaMin);
150 part1Name += int(1000*etaMax);
152 part1Name += int(1000*ptMin);
154 part1Name += int(1000*ptMax);
156 //part2Name += int(1000*etaMin);
158 part2Name += int(1000*etaMax);
160 part2Name += int(1000*ptMin);
162 part2Name += int(1000*ptMax);
165 eventName += int(10.*minCentrality[iCentrality] );
167 eventName += int(10.*maxCentrality[iCentrality] );
169 //eventName += int(10*zMin );
171 //eventName += int(10*zMax );
172 //if (rejectPileup) eventName += pileupRejecSuffix;
173 //if (rejectPairConversion) eventName += pairRejecSuffix;
174 baseName = prefixName;
175 baseName += part1Name;
176 baseName += part2Name;
177 baseName += eventName;
181 //inputHistogramFileName = "/Users/prabhat/Archive/calib/PbPb276Calibration_PP_2010.root";
183 outputHistogramFileName = baseName;
184 if (singlesOnly) outputHistogramFileName += singlesOnlySuffix;
185 outputHistogramFileName += ".root";
187 /* cout << "============================================================" << endl;
188 cout << " iTask: " << iTask << endl;
189 cout << " Task Name: " << taskName << endl;
190 cout << " List Name: " << listName << endl;
191 cout << " inputHistogramFileName: " << inputHistogramFileName << endl;
192 cout << " outputHistogramFileName: " << outputHistogramFileName << endl;
193 cout << " system: " << system << endl;
194 cout << " singlesOnly: " << singlesOnly << endl;
195 cout << " using weights: " << useWeights << endl;
196 cout << " centralityMethod: " << centralityMethod << endl;
197 cout << " chargeSet: " << chargeSet << endl;
198 cout << " debugLevel: " << debugLevel << endl;
199 cout << " rejectPileup: " << rejectPileup << endl;
200 cout << " rejectPairConversion: " << rejectPairConversion << endl;
201 cout << " sameFilter: " << sameFilter << endl;
202 cout << " zMin: " << zMin << endl;
203 cout << " zMax: " << zMax << endl;
204 cout << " ptMin: " << ptMin << endl;
205 cout << " ptMax: " << ptMax << endl;
206 cout << " etaMin: " << etaMin << endl;
207 cout << " etaMax: " << etaMax << endl;
208 cout << " dcaZMin: " << dcaZMin << endl;
209 cout << " dcaZMax: " << dcaZMax << endl;
210 cout << " dcaXYMin: " << dcaXYMin << endl;
211 cout << " dcaXYMax: " << dcaXYMax << endl;
212 cout << " dedxMin: " << dedxMin << endl;
213 cout << " dedxMax: " << dedxMax << endl;
214 cout << " nClusterMin: " << nClusterMin << endl;
215 cout << " trackFilterBit: " << trackFilterBit << endl;
216 cout << " requestedCharge1: " << requestedCharge1 << endl;
217 cout << " requestedCharge2: " << requestedCharge2 << endl;
218 cout << "============================================================" << endl;
220 TFile * inputFile = 0;
221 TList * histoList = 0;
226 TGrid::Connect("alien:");
227 inputFile = TFile::Open(inputHistogramFileName,"OLD");
230 cout << "Requested file:" << inputHistogramFileName << " was not opened. ABORT." << endl;
233 TString nameHistoBase = "correction_";
235 nameHistoBase += eventName;
236 if (requestedCharge1 == 1)
238 nameHisto = nameHistoBase + "_p";
239 cout << "Input Histogram named: " << nameHisto << endl;
240 weight_1 = (TH3F *) inputFile->Get(nameHisto);
244 nameHisto = nameHistoBase + "_m";
245 cout << "Input Histogram named: " << nameHisto << endl;
246 weight_1 = (TH3F *) inputFile->Get(nameHisto);
250 cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
257 if (requestedCharge2 == 1)
259 nameHisto = nameHistoBase + "_p";
260 cout << "Input Histogram named: " << nameHisto << endl;
261 weight_2 = (TH3F *) inputFile->Get(nameHisto);
265 nameHisto = nameHistoBase + "_m";
266 cout << "Input Histogram named: " << nameHisto << endl;
267 weight_2 = (TH3F *) inputFile->Get(nameHisto);
271 cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
276 task = new AliAnalysisTaskDptDptCorrelations(taskName);
278 task->SetDebugLevel( debugLevel );
279 task->SetSameFilter( sameFilter );
280 task->SetSinglesOnly( singlesOnly );
281 task->SetUseWeights( useWeights );
282 task->SetRejectPileup( rejectPileup );
283 task->SetRejectPairConversion(rejectPairConversion);
284 task->SetVertexZMin( zMin );
285 task->SetVertexZMax( zMax );
286 task->SetVertexXYMin( -1. );
287 task->SetVertexXYMax( 1. );
288 task->SetCentralityMethod( centralityMethod);
289 task->SetCentrality( minCentrality[iCentrality], maxCentrality[iCentrality]);
290 task->SetPtMin1( ptMin );
291 task->SetPtMax1( ptMax );
292 task->SetEtaMin1( etaMin );
293 task->SetEtaMax1( etaMax );
294 task->SetPtMin2( ptMin );
295 task->SetPtMax2( ptMax );
296 task->SetEtaMin2( etaMin );
297 task->SetEtaMax2( etaMax );
298 task->SetDcaZMin( dcaZMin );
299 task->SetDcaZMax( dcaZMax );
300 task->SetDcaXYMin( dcaXYMin );
301 task->SetDcaXYMax( dcaXYMax );
302 task->SetDedxMin( dedxMin );
303 task->SetDedxMax( dedxMax );
304 task->SetNClusterMin( nClusterMin );
305 task->SetTrackFilterBit( trackFilterBit );
306 task->SetRequestedCharge_1( requestedCharge1);
307 task->SetRequestedCharge_2( requestedCharge2);
308 task->SetWeigth_1( weight_1 );
309 task->SetWeigth_2( weight_2 );
312 cout << "Creating task output container" << endl;
313 taskOutputContainer = analysisManager->CreateContainer(listName,
315 AliAnalysisManager::kOutputContainer,
316 Form("%s:Histos", AliAnalysisManager::GetCommonFileName()));
317 cout << "Add task to analysis manager and connect it to input and output containers" << endl;
318 analysisManager->AddTask(task);
319 analysisManager->ConnectInput( task, 0, analysisManager->GetCommonInputContainer());
320 analysisManager->ConnectOutput(task, 0, taskOutputContainer );
321 cout << "Task added ...." << endl;