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