2 // Macro designed for use with the AliAnalysisTaskDptDptCorrelations task.
4 // Author: 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 *AddTaskDptDptCorrelations(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.5; maxCentrality[0] = 5.0;
37 minCentrality[1] = 5.0; maxCentrality[1] = 10.;
38 minCentrality[2] = 10.; maxCentrality[2] = 20.;
39 minCentrality[3] = 20.; maxCentrality[3] = 30.;
40 minCentrality[4] = 30.; maxCentrality[4] = 40.;
41 minCentrality[5] = 40.; maxCentrality[5] = 50.;
42 minCentrality[6] = 50.; maxCentrality[6] = 60.;
43 minCentrality[7] = 60.; maxCentrality[7] = 70.;
44 minCentrality[8] = 70.; maxCentrality[8] = 80.;
45 minCentrality[9] = 80.; maxCentrality[9] = 90.;
50 cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
54 else if (system==1) // pp
56 if (centralityMethod == 3)
59 minCentrality[0] = 2; maxCentrality[0] = 100.0;
60 minCentrality[1] = 2; maxCentrality[1] = 20.;
61 minCentrality[2] = 20.; maxCentrality[2] = 50.;
62 minCentrality[3] = 50.; maxCentrality[3] = 100.;
66 cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
72 cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". Option NOT CURRENTLY AVAILABLE. ABORT."
82 double dcaZMin = -3.0;
84 double dcaXYMin = -3.0;
85 double dcaXYMax = 3.0;
87 double dedxMax = 20000.0;
89 int trackFilterBit = 128;
91 int requestedCharge1 = 1; //default
92 int requestedCharge2 = -1; //default
95 // Get the pointer to the existing analysis manager via the static access method.
96 // ==============================================================================
97 AliAnalysisManager *analysisManager = AliAnalysisManager::GetAnalysisManager();
101 ::Error("AddTaskDptDptCorrelations", "No analysis manager to connect to.");
108 TString prefixName = "Corr_";
109 TString pileupRejecSuffix = "_PileupRejec";
110 TString pairRejecSuffix = "_PairRejec";
111 TString calibSuffix = "_calib";
112 TString singlesOnlySuffix = "_SO";
115 TString inputPath = ".";
116 TString outputPath = ".";
120 TString inputHistogramFileName;
121 TString outputHistogramFileName;
123 // Create the task and add subtask.
124 // ===========================================================================
125 int iTask = 0; // task counter
126 AliAnalysisDataContainer *taskInputContainer;
127 AliAnalysisDataContainer *taskOutputContainer;
128 AliAnalysisTaskDptDptCorrelations* task;
130 for (int iCentrality=0; iCentrality < nCentrality; ++iCentrality)
134 case 0: part1Name = "P_"; part2Name = "P_"; requestedCharge1 = 1; requestedCharge2 = 1; sameFilter = 1; break;
135 case 1: part1Name = "P_"; part2Name = "M_"; requestedCharge1 = 1; requestedCharge2 = -1; sameFilter = 0; break;
136 case 2: part1Name = "M_"; part2Name = "P_"; requestedCharge1 = -1; requestedCharge2 = 1; sameFilter = 0; break;
137 case 3: part1Name = "M_"; part2Name = "M_"; requestedCharge1 = -1; requestedCharge2 = -1; sameFilter = 1; break;
139 //part1Name += int(1000*etaMin);
141 part1Name += int(1000*etaMax);
143 part1Name += int(1000*ptMin);
145 part1Name += int(1000*ptMax);
147 //part2Name += int(1000*etaMin);
149 part2Name += int(1000*etaMax);
151 part2Name += int(1000*ptMin);
153 part2Name += int(1000*ptMax);
156 eventName += int(10.*minCentrality[iCentrality] );
158 eventName += int(10.*maxCentrality[iCentrality] );
160 //eventName += int(10*zMin );
162 //eventName += int(10*zMax );
163 //if (rejectPileup) eventName += pileupRejecSuffix;
164 //if (rejectPairConversion) eventName += pairRejecSuffix;
165 baseName = prefixName;
166 baseName += part1Name;
167 baseName += part2Name;
168 baseName += eventName;
171 //inputHistogramFileName = inputPath;
172 //inputHistogramFileName += "/";
173 //inputHistogramFileName = baseName;
174 //inputHistogramFileName += calibSuffix;
175 //inputHistogramFileName += ".root";
176 //outputHistogramFileName = outputPath;
177 //outputHistogramFileName += "/";
178 //inputHistogramFileName = "/home/pruneau//wrk/Alice/PbPb/2730GeV/DptDpt/Calib/PbPb273Calibration.root";
179 inputHistogramFileName = "alien:///alice/cern.ch/user/c/cpruneau/PbPb273Calibration.root"; //TFile::Open();
180 outputHistogramFileName = baseName;
181 if (singlesOnly) outputHistogramFileName += singlesOnlySuffix;
182 outputHistogramFileName += ".root";
184 cout << "============================================================" << endl;
185 cout << " iTask: " << iTask << endl;
186 cout << " Task Name: " << taskName << endl;
187 cout << " List Name: " << listName << endl;
188 cout << " inputHistogramFileName: " << inputHistogramFileName << endl;
189 cout << " outputHistogramFileName: " << outputHistogramFileName << endl;
190 cout << " system: " << system << endl;
191 cout << " singlesOnly: " << singlesOnly << endl;
192 cout << " using weights: " << useWeights << endl;
193 cout << " centralityMethod: " << centralityMethod << endl;
194 cout << " chargeSet: " << chargeSet << endl;
195 cout << " debugLevel: " << debugLevel << endl;
196 cout << " rejectPileup: " << rejectPileup << endl;
197 cout << " rejectPairConversion: " << rejectPairConversion << endl;
198 cout << " sameFilter: " << sameFilter << endl;
199 cout << " zMin: " << zMin << endl;
200 cout << " zMax: " << zMax << endl;
201 cout << " ptMin: " << ptMin << endl;
202 cout << " ptMax: " << ptMax << endl;
203 cout << " etaMin: " << etaMin << endl;
204 cout << " etaMax: " << etaMax << endl;
205 cout << " dcaZMin: " << dcaZMin << endl;
206 cout << " dcaZMax: " << dcaZMax << endl;
207 cout << " dcaXYMin: " << dcaXYMin << endl;
208 cout << " dcaXYMax: " << dcaXYMax << endl;
209 cout << " dedxMin: " << dedxMin << endl;
210 cout << " dedxMax: " << dedxMax << endl;
211 cout << " nClusterMin: " << nClusterMin << endl;
212 cout << " trackFilterBit: " << trackFilterBit << endl;
213 cout << " requestedCharge1: " << requestedCharge1 << endl;
214 cout << " requestedCharge2: " << requestedCharge2 << endl;
215 cout << "============================================================" << endl;
217 TFile * inputFile = 0;
218 TList * histoList = 0;
223 TGrid::Connect("alien:");
224 inputFile = TFile::Open(inputHistogramFileName,"OLD");
227 cout << "Requested file:" << inputHistogramFileName << " was not opened. ABORT." << endl;
230 TString nameHistoBase = "correction_";
232 nameHistoBase += eventName;
233 if (requestedCharge1 == 1)
235 nameHisto = nameHistoBase + "_p";
236 cout << "Input Histogram named: " << nameHisto << endl;
237 weight_1 = (TH3F *) inputFile->Get(nameHisto);
241 nameHisto = nameHistoBase + "_m";
242 cout << "Input Histogram named: " << nameHisto << endl;
243 weight_1 = (TH3F *) inputFile->Get(nameHisto);
247 cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
254 if (requestedCharge2 == 1)
256 nameHisto = nameHistoBase + "_p";
257 cout << "Input Histogram named: " << nameHisto << endl;
258 weight_2 = (TH3F *) inputFile->Get(nameHisto);
262 nameHisto = nameHistoBase + "_m";
263 cout << "Input Histogram named: " << nameHisto << endl;
264 weight_2 = (TH3F *) inputFile->Get(nameHisto);
268 cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
273 task = new AliAnalysisTaskDptDptCorrelations(taskName);
275 task->SetDebugLevel( debugLevel );
276 task->SetSameFilter( sameFilter );
277 task->SetSinglesOnly( singlesOnly );
278 task->SetUseWeights( useWeights );
279 task->SetRejectPileup( rejectPileup );
280 task->SetRejectPairConversion(rejectPairConversion);
281 task->SetVertexZMin( zMin );
282 task->SetVertexZMax( zMax );
283 task->SetVertexXYMin( -1. );
284 task->SetVertexXYMax( 1. );
285 task->SetCentralityMethod( centralityMethod);
286 task->SetCentrality( minCentrality[iCentrality], maxCentrality[iCentrality]);
287 task->SetPtMin1( ptMin );
288 task->SetPtMax1( ptMax );
289 task->SetEtaMin1( etaMin );
290 task->SetEtaMax1( etaMax );
291 task->SetPtMin2( ptMin );
292 task->SetPtMax2( ptMax );
293 task->SetEtaMin2( etaMin );
294 task->SetEtaMax2( etaMax );
295 task->SetDcaZMin( dcaZMin );
296 task->SetDcaZMax( dcaZMax );
297 task->SetDcaXYMin( dcaXYMin );
298 task->SetDcaXYMax( dcaXYMax );
299 task->SetDedxMin( dedxMin );
300 task->SetDedxMax( dedxMax );
301 task->SetNClusterMin( nClusterMin );
302 task->SetTrackFilterBit( trackFilterBit );
303 task->SetRequestedCharge_1( requestedCharge1);
304 task->SetRequestedCharge_2( requestedCharge2);
305 task->SetWeigth_1( weight_1 );
306 task->SetWeigth_2( weight_2 );
309 cout << "Creating task output container" << endl;
310 taskOutputContainer = analysisManager->CreateContainer(listName,
312 AliAnalysisManager::kOutputContainer,
313 Form("%s:Histos", AliAnalysisManager::GetCommonFileName()));
314 cout << "Add task to analysis manager and connect it to input and output containers" << endl;
315 analysisManager->AddTask(task);
316 analysisManager->ConnectInput( task, 0, analysisManager->GetCommonInputContainer());
317 analysisManager->ConnectOutput(task, 0, taskOutputContainer );
318 cout << "Task added ...." << endl;