Usage of weights in the analysis of MC data.
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_pPb / AddTaskPHOSPi0pPbMC.C
CommitLineData
783f313b 1AliAnalysisTaskPi0FlowMC* AddTaskPHOSPi0pPbMC (Bool_t kWeightsApplied = kFALSE,
2 const char* name = "PHOSPi0pPbMC",
3 const char* options = "",
e18a8315
YK
4 UInt_t offlineTriggerMask = AliVEvent::kINT7,
5 const char* centrality = "V0M",
6 const Int_t nCentBins = 5,
7 const Int_t centEdge0 = 0,
8 const Int_t centEdge1 = 20,
9 const Int_t centEdge2 = 40,
10 const Int_t centEdge3 = 60,
11 const Int_t centEdge4 = 80,
12 const Int_t centEdge5 = 100)
d2778244 13{
e18a8315 14 //Add a task AliAnalysisTaskPi0FlowMC to the analysis train, for LHC13 PbP MC productions
d2778244 15 //Author: Paul Baetzing
16 /* $Id$ */
17
18 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19 if (!mgr) {
e18a8315 20 ::Error("AddTaskPHOSPi0pPbMC", "No analysis manager to connect to");
d2778244 21 return NULL;
22 }
23
24 if (!mgr->GetInputEventHandler()) {
e18a8315 25 ::Error("AddTaskPHOSPi0pPbMC", "This task requires an input event handler");
d2778244 26 return NULL;
27 }
28
783f313b 29 AliAnalysisTaskPi0FlowMC* task;
30
31 if(kWeightsApplied) task = new AliAnalysisTaskPi0FlowMCParamWeights(Form("%sTask", name));
32 else task = new AliAnalysisTaskPi0FlowMC(Form("%sTask", name));
d2778244 33
e18a8315
YK
34 if( AliVEvent::kINT7 == offlineTriggerMask ) {
35 if (nCentBins<1) {
36 ::Error("AddTaskPHOSPi0pPb", Form("Invalid number of centrality bins: %d",nCentBins));
37 return NULL;
38 }
39 Double_t *cbin = new Double_t[nCentBins+1];
40 cbin[0] = centEdge0;
41 cbin[1] = centEdge1;
42 if (nCentBins > 1) cbin[2] = centEdge2;
43 if (nCentBins > 2) cbin[3] = centEdge3;
44 if (nCentBins > 3) cbin[4] = centEdge4;
45 if (nCentBins > 4) cbin[5] = centEdge5;
46 TArrayD tbin(nCentBins+1, cbin);
47
48 Int_t *nMixed = new Int_t[nCentBins];
49 for (Int_t ibin=0; ibin<nCentBins; ibin++) nMixed[ibin] = 20;
50 TArrayI tNMixed(nCentBins, nMixed);
51 task->SetCentralityBinning(tbin, tNMixed);
52 }
53
54 task->SetCentralityEstimator(centrality);
d2778244 55
d2778244 56
57 //task->SetEventMixingRPBinning(9);
58 //task->SetMixingArraysLength(10);
59 task->SelectCollisionCandidates(offlineTriggerMask);
60
e18a8315 61 task->SetEnablePHOSModule(2, kFALSE);
d2778244 62
63 mgr->AddTask(task);
64 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer() );
65
66 TString cname(Form("%sCoutput1", name));
67 TString pname(Form("%s:%s", AliAnalysisManager::GetCommonFileName(), name));
68 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(cname.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, pname.Data());
69 mgr->ConnectOutput(task, 1, coutput1);
70
71 return task;
72}