]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskD0.C
Fix path for running on the grid (Chitrasen)
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / macros / mini / AddAnalysisTaskD0.C
CommitLineData
474a07ae 1/***************************************************************************
2 fbellini@cern.ch - last modified on 06/08/2012
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//
16****************************************************************************/
17
18AliRsnMiniAnalysisTask * AddAnalysisTaskD0
19(
20 Bool_t isMC,
21 Bool_t isPP,
20fe1087 22 Bool_t ispPb,
da997f6c 23 Bool_t monitor = kTRUE,
43eeca31 24 Bool_t centortracklets = kTRUE,
25 Bool_t sanityhistos = kTRUE,
20fe1087 26 TString centrality = "V0M",
474a07ae 27 Int_t aodFilterBit = 5,
28 Float_t nsigmaTPCPi = 3.0,
29 Float_t nsigmaTPCKa = 3.0,
30 Float_t nsigmaTOFPi = 2.0,
31 Float_t nsigmaTOFKa = 2.0,
43eeca31 32 Float_t trackDCAcutMax = 7.0,
2b9ea980 33 Float_t trackDCAZcutMax = 2.0,
474a07ae 34 Int_t NTPCcluster = 70,
57b34356 35 Double_t NTPCcrratio = 0.8,
78512b8e 36 Int_t minSPDclt = 0,
474a07ae 37 Double_t minpt = 0.15,
38 TString triggerMask = AliVEvent::kMB,
43eeca31 39 Bool_t useNTPCclt = kTRUE,
1cf860e3 40 Bool_t maxDCAcutFixed = kFALSE,
670857a6 41 Bool_t ptdepPIDcut = kFALSE,
78512b8e 42 Bool_t fixedYcut = kTRUE,
da997f6c 43 Bool_t checkpileup = kFALSE,
78512b8e 44 Bool_t SPDpileup = kTRUE,
da997f6c 45 Bool_t doCalculationInMC = kTRUE,
e14e18cc 46 UShort_t originDselection = 0,
474a07ae 47 Int_t nmix = 5,
57b34356 48 Double_t minYlab = -0.5,
49 Double_t maxYlab = 0.5,
828a817b 50 Float_t mineta = -0.8,
51 Float_t maxeta = 0.8,
52 Float_t min_inv_mass = 0.6,
53 Float_t max_inv_mass = 2.2,
54 Int_t bins = 320,
474a07ae 55 Float_t maxDiffVzMix = 1.0,
56 Float_t maxDiffMultMix = 10.0,
57 Float_t maxDiffAngleMixDeg = 20.0,
05674e24 58 TString outNameSuffix = "D0"
474a07ae 59)
60{
61 //
62 // -- INITIALIZATION ----------------------------------------------------------------------------
63 // retrieve analysis manager
64 //
43eeca31 65 Float_t trackDCAcutMin = 0.0;
66 Bool_t minDCAcutFixed = kTRUE;
67 Double_t dcaProduct = 100.0;
05674e24 68 Float_t cutV = 10.0;
57b34356 69 Short_t maxSisters = 2;
70 Bool_t checkP = kTRUE;
da997f6c 71 Bool_t checkFeedDown = kTRUE;
72 Bool_t checkQuark = kTRUE;
05674e24 73 Int_t aodN = 0;
da997f6c 74
474a07ae 75
d8ffe5ee 76 UInt_t trigger = 0;
77
78
670857a6 79
80 TString eventType = "";
d8ffe5ee 81 if(triggerMask=="AliVEvent::kMB | AliVEvent::kCentral") {trigger = AliVEvent::kMB | AliVEvent::kCentral; eventType+="Central";}
82 else if(triggerMask=="AliVEvent::kMB | AliVEvent::kSemiCentral") {trigger = AliVEvent::kMB | AliVEvent::kSemiCentral; eventType+="SemiCentral";}
83 else if(triggerMask=="AliVEvent::kINT7") {trigger = AliVEvent::kINT7; eventType+="kINT7";}
84 else if(triggerMask=="AliVEvent::kMB") {trigger = AliVEvent::kMB; eventType+="MinimumBias";}
474a07ae 85
86 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
87 if (!mgr) {
88 ::Error("AddAnalysisTaskD0", "No analysis manager to connect to.");
89 return NULL;
90 }
91
92 // create the task and configure
43eeca31 93 TString taskName = Form("D0%s%s_%.1f_%d_%.2f_%d_%.1f_%.1f_%.1f_%.1f_%.1f_%.1f_%.2f_%d_%s", (isPP? "pp" : ispPb? "pPB": "PbPb"), (isMC ? "MC" : "Data"), cutV, NTPCcluster, NTPCcrratio, minSPDclt, nsigmaTPCPi, nsigmaTPCKa, nsigmaTOFPi, nsigmaTOFKa, trackDCAcutMax, trackDCAZcutMax, minpt, originDselection, eventType.Data());
474a07ae 94 AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
95 if (!isMC && !isPP){
96 Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", (aodN==49)? "yes" : "no"));
97 task->SetUseCentralityPatch(aodN==49);
98 }
d8ffe5ee 99
100 ::Info("AddAnalysisTaskD0", Form("TriggerMask: %i",trigger));
474a07ae 101
102 task->SelectCollisionCandidates(trigger);
1cf860e3 103 task->SetMaxNDaughters(maxSisters);
104 task->SetCheckMomentumConservation(checkP);
e14e18cc 105 task->SetCheckFeedDown(checkFeedDown);
106 task->SetRejectCandidateIfNotFromQuark(checkQuark);
107 task->SetDselection(originDselection);
4e6aff21 108 task->KeepMotherInAcceptance(kTRUE);
109 task->SetMotherAcceptanceCutMinPt(minpt);
110 task->SetMotherAcceptanceCutMaxEta(maxeta);
1cf860e3 111
e14e18cc 112
1cf860e3 113 ::Info("AddAnalysisTaskD0", Form("Maximum numbers of daughters allowed (-1 means cut not applied): %i",maxSisters));
e14e18cc 114 ::Info("AddAnalysisTaskD0", Form("Are we checking the momentum conservation? %s", checkP? "yes" : "no"));
4e6aff21 115 ::Info("AddAnalysisTaskD0", Form("Are we checking the feeddown? %s", checkFeedDown? "yes" : "no"));
e14e18cc 116 ::Info("AddAnalysisTaskD0", Form("Are we rejecting the Hijing generated? %s", checkQuark? "yes" : "no"));
117 ::Info("AddAnalysisTaskD0", Form("Which D0 are we keeping? %s", (originDselection==0? "only from c quark" : originDselection==1? "only from b quark" : "both from c and b quark") ));
4e6aff21 118 ::Info("AddAnalysisTaskD0", Form("Selecting Mother in Acceptance: Min pT %.1f, Eta Range %.1f - %.1f", minpt, mineta, maxeta));
474a07ae 119
120
121 if (isPP)
122 task->UseMultiplicity("QUALITY");
123 else
20fe1087 124 task->UseCentrality(centrality);
474a07ae 125 // set event mixing options
126 task->UseContinuousMix();
127 //task->UseBinnedMix();
128 task->SetNMix(nmix);
129 task->SetMaxDiffVz(maxDiffVzMix);
130 task->SetMaxDiffMult(maxDiffMultMix);
20fe1087 131 if (!isPP && !ispPb) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
132 ::Info("AddAnalysisTaskD0", 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 : ispPb ? 0.0 : maxDiffAngleMixDeg)));
474a07ae 133
134 mgr->AddTask(task);
135
136 //
137 // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
138 //
139 // cut on primary vertex:
140 // - 2nd argument --> |Vz| range
141 // - 3rd argument --> minimum required number of contributors
142 // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
57b34356 143 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", cutV, 1, kFALSE, kFALSE);
6bc6b585 144 AliRsnCutEventUtils *cutEventUtils = new AliRsnCutEventUtils("cutEventUtils", kFALSE, kTRUE);
145
da997f6c 146 if(checkpileup == kTRUE){
d607fa89 147
148 if(SPDpileup == kTRUE) {cutEventUtils->SetRemovePileUppA2013(kTRUE);
69990cbe 149 //cutEventUtils->SetRemoveFirstEvtInChunk(kTRUE);
150 //cutEventUtils->SetUseVertexSelection2013pA(kTRUE);
151 cutEventUtils->SetUseMVPlpSelection(kFALSE);
152 cutEventUtils->SetMinPlpContribSPD(5);
153 }
154 if(SPDpileup == kFALSE){cutEventUtils->SetRemovePileUppA2013(kTRUE);
155 //cutEventUtils->SetRemoveFirstEvtInChunk(kTRUE);
156 //cutEventUtils->SetUseVertexSelection2013pA(kTRUE);
157 cutEventUtils->SetUseMVPlpSelection(kTRUE);
158 cutEventUtils->SetMinPlpContribMV(5);
159 }
da997f6c 160 }
78512b8e 161
da997f6c 162 ::Info("AddAnalysisTaskD0", Form("Checking Pile up? %s", (checkpileup ? "yes" : "no") ));
163 ::Info("AddAnalysisTaskD0", Form("Which Method? %s", (checkpileup? (SPDpileup ? "SPD" : "Multi Vertex") : "none" )));
474a07ae 164
165 // define and fill cut set for event cut
166 AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
167 eventCuts->AddCut(cutVertex);
69990cbe 168 //if(SPDpileup == kFALSE) eventCuts->AddCut(cutEventUtils);
169 eventCuts->AddCut(cutEventUtils);
170 eventCuts->SetCutScheme(Form("%s&%s", cutEventUtils->GetName(), cutVertex->GetName() ));
57b34356 171 eventCuts->ShowCuts();
172 eventCuts->PrintSetInfo();
474a07ae 173 // set cuts in task
174 task->SetEventCuts(eventCuts);
175
176 //
177 // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
178 //
179 //vertex
180 Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
181 AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
182 outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
183
184 //multiplicity or centrality
185 Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
186 AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
187 if (isPP)
188 outMult->AddAxis(multID, 400, 0.0, 400.0);
189 else
190 outMult->AddAxis(multID, 100, 0.0, 100.0);
da997f6c 191
192 //tracklets
57b34356 193 Int_t trackletID = task->CreateValue(AliRsnMiniValue::kTracklets, kFALSE);
194 AliRsnMiniOutput *outTracklets = task->CreateOutput("eventTracklets", "HIST", "EVENT");
195 outTracklets->AddAxis(trackletID, 400, 0.0, 400.0);
da997f6c 196
474a07ae 197
198 //event plane (only for PbPb)
199 Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
200 AliRsnMiniOutput *outPlane = 0x0;
201 if (!isPP){
202 outPlane = task->CreateOutput("eventPlane", "HIST", "EVENT");
203 outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
204 }
205
206 TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
207 task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
208
209 TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
210 hmc->GetYaxis()->SetTitle("QUALITY");
211 task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
212
213 TH2F* hep=new TH2F("hEventPlaneVsCent","",100,0.,100., 180,0.,TMath::Pi());
214 task->SetEventQAHist("eventplane",hep);//plugs this histogram into the fHAEventPlane data member
215
216 //
217 // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
218 //
78512b8e 219 AliRsnCutMiniPair *cutY = 0x0;
220
221 if(fixedYcut == kTRUE){
222 cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
474a07ae 223 cutY->SetRangeD(minYlab, maxYlab);
78512b8e 224 }
225 else {
226 cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityFiducialRegion);
227 cutY->SetRangeD(-0.8, 0.8);
228 cutY->SetPtDepCut(kTRUE);
229 cutY->SetMinPt(0.0);
230 cutY->SetMaxPt(5.0);
231 cutY->SetPtDepCutMaxFormula("-0.2/15*pt*pt+1.9/15*pt+0.5");
232 cutY->SetPtDepCutMinFormula("0.2/15*pt*pt-1.9/15*pt-0.5");
233 }
234
235 ::Info("AddAnalysisTaskD0", Form("Fixed Y cut? %s", (fixedYcut ? "yes" : "no") ));
474a07ae 236
237 AliRsnCutMiniPair *cutDCAproduct = new AliRsnCutMiniPair("cutDCAproduct", AliRsnCutMiniPair::kDCAproduct);
238 cutDCAproduct->SetRangeD(-1E20, dcaProduct);
239
240 AliRsnCutSet *cutsPairY = new AliRsnCutSet("pairCutsY", AliRsnTarget::kMother);
241 cutsPairY->AddCut(cutY);
242 cutsPairY->UseMonitor(kTRUE);
243 cutsPairY->SetCutScheme("setPairD0_Y");
244 cutsPairY->ShowCuts();
245 cutsPairY->PrintSetInfo();
246
1cf860e3 247 AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
248 cutsPair->AddCut(cutY);
249 cutsPair->AddCut(cutDCAproduct);
250 cutsPair->UseMonitor(kTRUE);
251 cutsPair->SetCutScheme(Form("%s&%s", cutY->GetName(), cutDCAproduct->GetName()));
252 cutsPair->ShowCuts();
253 cutsPair->PrintSetInfo();
474a07ae 254
255 //
256 // -- CONFIG ANALYSIS --------------------------------------------------------------------------
d607fa89 257 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigD0.C");
474a07ae 258
259 if (isMC) {
1cf860e3 260 Printf("========================== MC analysis - PID cuts used");
474a07ae 261 } else
262 Printf("========================== DATA analysis - PID cuts used");
43eeca31 263 if (!ConfigD0(task, isPP, isMC, monitor, centortracklets, sanityhistos, nsigmaTPCPi, nsigmaTPCKa, nsigmaTOFPi, nsigmaTOFKa, aodFilterBit, trackDCAcutMax, trackDCAcutMin, trackDCAZcutMax, NTPCcluster, NTPCcrratio, minSPDclt, minpt, maxSisters, checkP, useNTPCclt, minDCAcutFixed, maxDCAcutFixed, ptdepPIDcut, checkFeedDown, checkQuark, doCalculationInMC, originDselection, mineta, maxeta, min_inv_mass, max_inv_mass, bins, "", cutsPairY, cutsPair)) return 0x0;
474a07ae 264
265 //
266 // -- CONTAINERS --------------------------------------------------------------------------------
267 //
268 TString outputFileName = AliAnalysisManager::GetCommonFileName();
269 Printf("AddAnalysisTaskD0 - Set OutputFileName : \n %s\n", outputFileName.Data() );
270
43eeca31 271 AliAnalysisDataContainer *output = mgr->CreateContainer(Form("%s_%.1f_%d_%.2f_%d_%.1f_%.1f_%.1f_%.1f_%.1f_%.1f_%.2f_%d_%s",outNameSuffix.Data(),cutV,NTPCcluster,NTPCcrratio,minSPDclt,nsigmaTPCPi,nsigmaTPCKa,nsigmaTOFPi,nsigmaTOFKa,trackDCAcutMax,trackDCAZcutMax,minpt,originDselection,eventType.Data()),
474a07ae 272 TList::Class(),
273 AliAnalysisManager::kOutputContainer,
274 outputFileName);
275 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
276 mgr->ConnectOutput(task, 1, output);
277
278 return task;
279}