1 // Macro designed for use with the AliAnalysisTaskDptDptCorrelations task.
2 // Author: Prabhat Pujahari & Claude Pruneau, Wayne State
3 // system: 0: PbPb 1: pPb
4 // singlesOnly: 0: full correlations 1: singles only
5 // useWeights: 0: no 1: yes
6 // centralityMethod: 3: track count 4: V0 centrality 7: V0A centrality for pPb
7 // chargeSet: 0: ++ 1: +- 2: -+ 3: --
8 /////////////////////////////////////////////////////////////////////////////////
9 AliAnalysisTaskDptDptCorrelations *AddTaskDptDptCorr_dca1
13 int centralityMethod = 4,
15 int trackFilterBit = 128,
17 double eta1Min = -0.8,
19 double eta2Min = -0.8,
21 double dcaZMin = -3.2,
23 double dcaXYMin = -2.4,
24 double dcaXYMax = 2.4,
26 Bool_t trigger = kFALSE,
27 const char* taskname = "dcaz2",
28 char *inputHistogramFileName = "alien:///alice/cern.ch/user/p/prabhat/CalibFiles/PbPbCalib_dca1.root")
31 // Set Default Configuration of this analysis
32 // ==========================================
35 int rejectPairConversion = 1;
39 double minCentrality[10];
40 double maxCentrality[10];
42 if (system==0) // PbPb
44 if (centralityMethod == 4)
47 minCentrality[0] = 0.0; maxCentrality[0] = 5.0;
48 minCentrality[1] = 5.0; maxCentrality[1] = 10.;
49 minCentrality[2] = 30.; maxCentrality[2] = 40.;
50 minCentrality[3] = 60.; maxCentrality[3] = 70.;
55 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
59 else if (system==1) // pPb
61 if (centralityMethod == 7)
63 minCentrality[0] = 0; maxCentrality[0] = 20.0;
64 minCentrality[1] = 20.; maxCentrality[1] = 40.;
65 minCentrality[2] = 40.; maxCentrality[2] = 60.;
66 minCentrality[3] = 60.; maxCentrality[3] = 80.;
70 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". centralityMethod:" << centralityMethod << " Option NOT AVAILABLE. ABORT."
76 //cout << "-F- AddTaskDptDptCorrelations() system:" << system << ". Option NOT CURRENTLY AVAILABLE. ABORT."
85 double dedxMax = 20000.0;
86 int requestedCharge1 = 1; //default
87 int requestedCharge2 = -1; //default
90 // Get the pointer to the existing analysis manager via the static access method.
91 // ==============================================================================
92 AliAnalysisManager *analysisManager = AliAnalysisManager::GetAnalysisManager();
96 ::Error("AddTaskDptDptCorrelations", "No analysis manager to connect to.");
103 TString prefixName = "Corr_";
104 TString pileupRejecSuffix = "_PileupRejec";
105 TString pairRejecSuffix = "_PairRejec";
106 TString calibSuffix = "_calib";
107 TString singlesOnlySuffix = "_SO";
110 TString inputPath = ".";
111 TString outputPath = ".";
115 //TString inputHistogramFileName;
116 TString outputHistogramFileName;
118 // Create the task and add subtask.
119 // ===========================================================================
120 int iTask = 0; // task counter
121 AliAnalysisDataContainer *taskInputContainer;
122 AliAnalysisDataContainer *taskOutputContainer;
123 AliAnalysisTaskDptDptCorrelations* task;
125 for (int iCentrality=0; iCentrality < nCentrality; ++iCentrality)
129 case 0: part1Name = "P_"; part2Name = "P_"; requestedCharge1 = 1; requestedCharge2 = 1; sameFilter = 1; break;
130 case 1: part1Name = "P_"; part2Name = "M_"; requestedCharge1 = 1; requestedCharge2 = -1; sameFilter = 0; break;
131 case 2: part1Name = "M_"; part2Name = "P_"; requestedCharge1 = -1; requestedCharge2 = 1; sameFilter = 0; break;
132 case 3: part1Name = "M_"; part2Name = "M_"; requestedCharge1 = -1; requestedCharge2 = -1; sameFilter = 1; break;
136 part1Name += int(1000*eta1Max);
138 part1Name += int(1000*ptMin);
140 part1Name += int(1000*ptMax);
142 part1Name += int(1000*dcaZMin);
144 part1Name += int(1000*dcaZMax);
148 part2Name += int(1000*eta2Max);
150 part2Name += int(1000*ptMin);
152 part2Name += int(1000*ptMax);
154 part2Name += int(1000*dcaZMin);
156 part2Name += int(1000*dcaZMax);
160 eventName += int(10.*minCentrality[iCentrality] );
162 eventName += int(10.*maxCentrality[iCentrality] );
164 baseName = prefixName;
165 baseName += part1Name;
166 baseName += part2Name;
167 baseName += eventName;
172 outputHistogramFileName = baseName;
173 if (singlesOnly) outputHistogramFileName += singlesOnlySuffix;
174 outputHistogramFileName += ".root";
177 TFile * inputFile = 0;
178 TList * histoList = 0;
183 TGrid::Connect("alien:");
184 inputFile = TFile::Open(inputHistogramFileName,"OLD");
187 //cout << "Requested file:" << inputHistogramFileName << " was not opened. ABORT." << endl;
190 TString nameHistoBase = "correction_";
192 nameHistoBase += eventName;
193 if (requestedCharge1 == 1)
195 nameHisto = nameHistoBase + "_p";
196 //cout << "Input Histogram named: " << nameHisto << endl;
197 weight_1 = (TH3F *) inputFile->Get(nameHisto);
201 nameHisto = nameHistoBase + "_m";
202 //cout << "Input Histogram named: " << nameHisto << endl;
203 weight_1 = (TH3F *) inputFile->Get(nameHisto);
207 //cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
214 if (requestedCharge2 == 1)
216 nameHisto = nameHistoBase + "_p";
217 //cout << "Input Histogram named: " << nameHisto << endl;
218 weight_2 = (TH3F *) inputFile->Get(nameHisto);
222 nameHisto = nameHistoBase + "_m";
223 //cout << "Input Histogram named: " << nameHisto << endl;
224 weight_2 = (TH3F *) inputFile->Get(nameHisto);
228 //cout << "Requested histogram 'correction_p/m' was not found. ABORT." << endl;
233 task = new AliAnalysisTaskDptDptCorrelations(taskName);
235 task->SetDebugLevel( debugLevel );
236 task->SetSameFilter( sameFilter );
237 task->SetSinglesOnly( singlesOnly );
238 task->SetUseWeights( useWeights );
239 task->SetRejectPileup( rejectPileup );
240 task->SetRejectPairConversion(rejectPairConversion);
241 task->SetVertexZMin( zMin );
242 task->SetVertexZMax( zMax );
243 task->SetVertexXYMin( -1. );
244 task->SetVertexXYMax( 1. );
245 task->SetCentralityMethod( centralityMethod);
246 task->SetCentrality( minCentrality[iCentrality], maxCentrality[iCentrality]);
247 task->SetPtMin1( ptMin );
248 task->SetPtMax1( ptMax );
249 task->SetEtaMin1( eta1Min );
250 task->SetEtaMax1( eta1Max );
251 task->SetPtMin2( ptMin );
252 task->SetPtMax2( ptMax );
253 task->SetEtaMin2( eta2Min );
254 task->SetEtaMax2( eta2Max );
255 task->SetDcaZMin( dcaZMin );
256 task->SetDcaZMax( dcaZMax );
257 task->SetDcaXYMin( dcaXYMin );
258 task->SetDcaXYMax( dcaXYMax ); //checking by prp
259 task->SetDedxMin( dedxMin );
260 task->SetDedxMax( dedxMax );
261 task->SetNClusterMin( nClusterMin );
262 task->SetTrackFilterBit( trackFilterBit );
263 task->SetRequestedCharge_1( requestedCharge1);
264 task->SetRequestedCharge_2( requestedCharge2);
265 task->SetWeigth_1( weight_1 );
266 task->SetWeigth_2( weight_2 );
269 if(trigger) task->SelectCollisionCandidates(AliVEvent::kINT7);
270 else task->SelectCollisionCandidates(AliVEvent::kMB);
272 cout << "Creating task output container" << endl;
274 taskOutputContainer = analysisManager->CreateContainer(listName,
276 AliAnalysisManager::kOutputContainer,
277 Form("%s:%s", AliAnalysisManager::GetCommonFileName(),taskname));
278 cout << "Add task to analysis manager and connect it to input and output containers" << endl;
280 analysisManager->AddTask(task);
281 analysisManager->ConnectInput( task, 0, analysisManager->GetCommonInputContainer());
282 analysisManager->ConnectOutput(task, 0, taskOutputContainer );
283 //cout << "Task added ...." << endl;