]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskTOFKStar.C
Update for centrality patch flag
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddAnalysisTaskTOFKStar.C
CommitLineData
da3e2cdb 1/***************************************************************************
2 fbellini@cern.ch - last modified on 06/08/2012
72439a68 3//
4// General macro to configure the RSN analysis task.
5// It calls all configs desired by the user, by means
6// of the boolean switches defined in the first lines.
7// ---
8// Inputs:
9// 1) flag to know if running on MC or data
10// 2) path where all configs are stored
11// ---
12// Returns:
13// kTRUE --> initialization successful
14// kFALSE --> initialization failed (some config gave errors)
15//
da3e2cdb 16****************************************************************************/
72439a68 17
18AliRsnMiniAnalysisTask * AddAnalysisTaskTOFKStar
19(
20 Bool_t isMC,
21 Bool_t isPP,
72439a68 22 Int_t aodFilterBit = 5,
23 AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutPiCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
24 AliRsnCutSetDaughterParticle::ERsnDaughterCutSet cutKaCandidate = AliRsnCutSetDaughterParticle::kTOFpidKstarPbPb2010,
25 Float_t nsigmaPi = 2.0,
26 Float_t nsigmaKa = 2.0,
27 Bool_t enableMonitor = kTRUE,
28 Bool_t IsMcTrueOnly = kFALSE,
29 Int_t nmix = 0,
30 Float_t maxDiffVzMix = 1.0,
31 Float_t maxDiffMultMix = 10.0,
32 Float_t maxDiffAngleMixDeg = 20.0,
aac6579c 33 Bool_t isAOD49 = kFALSE,
e042cc89 34 TString outNameSuffix = "",
eec5d1ed 35 Bool_t useMixLS = 0,
36 Int_t signedPdg = 313
72439a68 37)
38{
39 //
40 // -- INITIALIZATION ----------------------------------------------------------------------------
41 // retrieve analysis manager
42 //
43
44 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
45 if (!mgr) {
da3e2cdb 46 ::Error("AddAnalysisTaskTOFKStar", "No analysis manager to connect to.");
72439a68 47 return NULL;
48 }
49
50 // create the task and configure
51 TString taskName = Form("TOFKStar%s%s_%i%i", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), (Int_t)cutPiCandidate,(Int_t)cutKaCandidate );
52 AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
53 if (!isMC && !isPP){
aac6579c 54 Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", isAOD49 ? "yes" : "no"));
55 task->SetUseCentralityPatch(isAOD49);
72439a68 56 }
57 if (isPP)
58 task->UseMultiplicity("QUALITY");
59 else
60 task->UseCentrality("V0M");
61 // set event mixing options
62 task->UseContinuousMix();
63 //task->UseBinnedMix();
64 task->SetNMix(nmix);
65 task->SetMaxDiffVz(maxDiffVzMix);
66 task->SetMaxDiffMult(maxDiffMultMix);
67 if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
68 ::Info("AddAnalysisTaskTOFKStar", Form("Event mixing configuration: \n events to mix = %i \n max diff. vtxZ = cm %5.3f \n max diff multi = %5.3f \n max diff EP angle = %5.3f deg", nmix, maxDiffVzMix, maxDiffMultMix, (isPP ? 0.0 : maxDiffAngleMixDeg)));
69
70 mgr->AddTask(task);
71
72 //
73 // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
74 //
75 // cut on primary vertex:
76 // - 2nd argument --> |Vz| range
77 // - 3rd argument --> minimum required number of contributors
78 // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
79 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
80 if (isPP) cutVertex->SetCheckPileUp(kTRUE); // set the check for pileup
81
82 // define and fill cut set for event cut
83 AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
84 eventCuts->AddCut(cutVertex);
85 eventCuts->SetCutScheme(cutVertex->GetName());
86 // set cuts in task
87 task->SetEventCuts(eventCuts);
88
89 //
90 // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
91 //
92 //vertex
93 Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
94 AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
95 outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
96
97 //multiplicity or centrality
98 Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
99 AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
100 if (isPP)
101 outMult->AddAxis(multID, 400, 0.0, 400.0);
102 else
103 outMult->AddAxis(multID, 100, 0.0, 100.0);
104
105 //event plane (only for PbPb)
106 Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
e4b380b8 107 AliRsnMiniOutput *outPlane = 0x0;
108 if (!isPP){
afe57485 109 outPlane=task->CreateOutput("eventPlane", "HIST", "EVENT");
e4b380b8 110 outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
111 }
112
e1659be6 113 TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
114 task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
115
116 TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
117 hmc->GetYaxis()->SetTitle("QUALITY");
118 task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
119
120 TH2F* hep=new TH2F("hEventPlaneVsCent","",100,0.,100., 180,0.,TMath::Pi());
121 task->SetEventQAHist("eventplane",hep);//plugs this histogram into the fHAEventPlane data member
122
72439a68 123 //
124 // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
125 //
126 AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
127 cutY->SetRangeD(-0.5, 0.5);
128
129 AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
130 cutsPair->AddCut(cutY);
131 cutsPair->SetCutScheme(cutY->GetName());
132
133 //
134 // -- CONFIG ANALYSIS --------------------------------------------------------------------------
da3e2cdb 135 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigTOFanalysisKStar.C");
72439a68 136 if (isMC) {
137 if (((Int_t)cutPiCandidate<4) && ((Int_t)cutKaCandidate<4))
138 Printf("========================== MC analysis - no PID used for efficiency estimation");
139 else
140 Printf("========================== MC analysis - PID cuts used");
141 } else
142 Printf("========================== DATA analysis - PID cuts used");
aac6579c 143 if (!ConfigTOFanalysisKStar(task, isMC, isPP, "", cutsPair, aodFilterBit, cutPiCandidate, cutKaCandidate, nsigmaPi, nsigmaKa, enableMonitor, isMC&IsMcTrueOnly, useMixLS, signedPdg)) return 0x0;
72439a68 144
145 //
146 // -- CONTAINERS --------------------------------------------------------------------------------
147 //
148 TString outputFileName = AliAnalysisManager::GetCommonFileName();
149 // outputFileName += ":Rsn";
da3e2cdb 150 Printf("AddAnalysisTaskTOFKStar - Set OutputFileName : \n %s\n", outputFileName.Data() );
151
72439a68 152 AliAnalysisDataContainer *output = mgr->CreateContainer(Form("RsnOut_%s",outNameSuffix.Data()),
153 TList::Class(),
154 AliAnalysisManager::kOutputContainer,
155 outputFileName);
156 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
157 mgr->ConnectOutput(task, 1, output);
158
159 return task;
160}