]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/macros/mini/AddAnalysisTaskD0.C
Updated macros for D0 analysis (Massimo)
[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,
22 Float_t cutV = 10.0,
23 Int_t aodFilterBit = 5,
24 Float_t nsigmaTPCPi = 3.0,
25 Float_t nsigmaTPCKa = 3.0,
26 Float_t nsigmaTOFPi = 2.0,
27 Float_t nsigmaTOFKa = 2.0,
28 Float_t trackDCAcutMax = 7.0,
29 Float_t trackDCAcutMin = 0.0,
30 Int_t NTPCcluster = 70,
31 Double_t minpt = 0.15,
32 TString triggerMask = AliVEvent::kMB,
1cf860e3 33 Short_t maxSisters = 2,
34 Bool_t checkP = kTRUE,
35 Bool_t minDCAcutFixed = kFALSE,
36 Bool_t maxDCAcutFixed = kFALSE,
474a07ae 37 Int_t nmix = 5,
38 Double_t minYlab = -0.5,
39 Double_t maxYlab = 0.5,
8b48b94e 40 Double_t dcaProduct = -1E-4,
474a07ae 41 Float_t maxDiffVzMix = 1.0,
42 Float_t maxDiffMultMix = 10.0,
43 Float_t maxDiffAngleMixDeg = 20.0,
44 Int_t aodN = 0,
45 TString outNameSuffix = "D0"
46)
47{
48 //
49 // -- INITIALIZATION ----------------------------------------------------------------------------
50 // retrieve analysis manager
51 //
52
53 UInt_t trigger = triggerMask.Atoll();
54
55 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
56 if (!mgr) {
57 ::Error("AddAnalysisTaskD0", "No analysis manager to connect to.");
58 return NULL;
59 }
60
61 // create the task and configure
8b48b94e 62 TString taskName = Form("D0%s%s_%.1f_%d_%.1f_%.1f_%.1f_%.1f_%.1f_%.4f_%.5f_%.2f", (isPP? "pp" : "PbPb"), (isMC ? "MC" : "Data"), cutV, NTPCcluster, nsigmaTPCPi, nsigmaTPCKa, nsigmaTOFPi, nsigmaTOFKa, trackDCAcutMax, trackDCAcutMin, dcaProduct, minpt);
474a07ae 63 AliRsnMiniAnalysisTask *task = new AliRsnMiniAnalysisTask(taskName.Data(), isMC);
64 if (!isMC && !isPP){
65 Printf(Form("========== SETTING USE CENTRALITY PATCH AOD049 : %s", (aodN==49)? "yes" : "no"));
66 task->SetUseCentralityPatch(aodN==49);
67 }
68
69 task->SelectCollisionCandidates(trigger);
1cf860e3 70 task->SetMaxNDaughters(maxSisters);
71 task->SetCheckMomentumConservation(checkP);
72
73 ::Info("AddAnalysisTaskD0", Form("Maximum numbers of daughters allowed (-1 means cut not applied): %i",maxSisters));
74 ::Info("AddAnalysisTaskD0", Form("Are we checking the momentum conservation?: %s", checkP? "yes" : "no"));
474a07ae 75
76
77 if (isPP)
78 task->UseMultiplicity("QUALITY");
79 else
80 task->UseCentrality("V0M");
81 // set event mixing options
82 task->UseContinuousMix();
83 //task->UseBinnedMix();
84 task->SetNMix(nmix);
85 task->SetMaxDiffVz(maxDiffVzMix);
86 task->SetMaxDiffMult(maxDiffMultMix);
87 if (!isPP) task->SetMaxDiffAngle(maxDiffAngleMixDeg*TMath::DegToRad()); //set angle diff in rad
88 ::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 : maxDiffAngleMixDeg)));
89
90 mgr->AddTask(task);
91
92 //
93 // -- EVENT CUTS (same for all configs) ---------------------------------------------------------
94 //
95 // cut on primary vertex:
96 // - 2nd argument --> |Vz| range
97 // - 3rd argument --> minimum required number of contributors
98 // - 4th argument --> tells if TPC stand-alone vertexes must be accepted
99 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", cutV, 0, kFALSE);
100 if (isPP) cutVertex->SetCheckPileUp(kTRUE); // set the check for pileup
101
102 // define and fill cut set for event cut
103 AliRsnCutSet *eventCuts = new AliRsnCutSet("eventCuts", AliRsnTarget::kEvent);
104 eventCuts->AddCut(cutVertex);
105 eventCuts->SetCutScheme(cutVertex->GetName());
106 // set cuts in task
107 task->SetEventCuts(eventCuts);
108
109 //
110 // -- EVENT-ONLY COMPUTATIONS -------------------------------------------------------------------
111 //
112 //vertex
113 Int_t vtxID = task->CreateValue(AliRsnMiniValue::kVz, kFALSE);
114 AliRsnMiniOutput *outVtx = task->CreateOutput("eventVtx", "HIST", "EVENT");
115 outVtx->AddAxis(vtxID, 400, -20.0, 20.0);
116
117 //multiplicity or centrality
118 Int_t multID = task->CreateValue(AliRsnMiniValue::kMult, kFALSE);
119 AliRsnMiniOutput *outMult = task->CreateOutput("eventMult", "HIST", "EVENT");
120 if (isPP)
121 outMult->AddAxis(multID, 400, 0.0, 400.0);
122 else
123 outMult->AddAxis(multID, 100, 0.0, 100.0);
124
125 //event plane (only for PbPb)
126 Int_t planeID = task->CreateValue(AliRsnMiniValue::kPlaneAngle, kFALSE);
127 AliRsnMiniOutput *outPlane = 0x0;
128 if (!isPP){
129 outPlane = task->CreateOutput("eventPlane", "HIST", "EVENT");
130 outPlane->AddAxis(planeID, 180, 0.0, TMath::Pi());
131 }
132
133 TH2F* hvz=new TH2F("hVzVsCent","",100,0.,100., 220,-11.,11.);
134 task->SetEventQAHist("vz",hvz);//plugs this histogram into the fHAEventVz data member
135
136 TH2F* hmc=new TH2F("MultiVsCent","",100,0.,100.,4000,0.,4000.);
137 hmc->GetYaxis()->SetTitle("QUALITY");
138 task->SetEventQAHist("multicent",hmc);//plugs this histogram into the fHAEventMultiCent data member
139
140 TH2F* hep=new TH2F("hEventPlaneVsCent","",100,0.,100., 180,0.,TMath::Pi());
141 task->SetEventQAHist("eventplane",hep);//plugs this histogram into the fHAEventPlane data member
142
143 //
144 // -- PAIR CUTS (common to all resonances) ------------------------------------------------------
145 //
146 AliRsnCutMiniPair *cutY = new AliRsnCutMiniPair("cutRapidity", AliRsnCutMiniPair::kRapidityRange);
147 cutY->SetRangeD(minYlab, maxYlab);
148
149 AliRsnCutMiniPair *cutDCAproduct = new AliRsnCutMiniPair("cutDCAproduct", AliRsnCutMiniPair::kDCAproduct);
150 cutDCAproduct->SetRangeD(-1E20, dcaProduct);
151
152 AliRsnCutSet *cutsPairY = new AliRsnCutSet("pairCutsY", AliRsnTarget::kMother);
153 cutsPairY->AddCut(cutY);
154 cutsPairY->UseMonitor(kTRUE);
155 cutsPairY->SetCutScheme("setPairD0_Y");
156 cutsPairY->ShowCuts();
157 cutsPairY->PrintSetInfo();
158
1cf860e3 159 AliRsnCutSet *cutsPair = new AliRsnCutSet("pairCuts", AliRsnTarget::kMother);
160 cutsPair->AddCut(cutY);
161 cutsPair->AddCut(cutDCAproduct);
162 cutsPair->UseMonitor(kTRUE);
163 cutsPair->SetCutScheme(Form("%s&%s", cutY->GetName(), cutDCAproduct->GetName()));
164 cutsPair->ShowCuts();
165 cutsPair->PrintSetInfo();
8b48b94e 166
1cf860e3 167
474a07ae 168
169 //
170 // -- CONFIG ANALYSIS --------------------------------------------------------------------------
171 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/RESONANCES/macros/mini/ConfigD0.C");
172
173 if (isMC) {
1cf860e3 174 Printf("========================== MC analysis - PID cuts used");
474a07ae 175 } else
176 Printf("========================== DATA analysis - PID cuts used");
1cf860e3 177 if (!ConfigD0(task, isPP, isMC, nsigmaTPCPi, nsigmaTPCKa, nsigmaTOFPi, nsigmaTOFKa, aodFilterBit, trackDCAcutMax, trackDCAcutMin, NTPCcluster, minpt, maxSisters, checkP, minDCAcutFixed, maxDCAcutFixed, "", cutsPairY, cutsPair)) return 0x0;
474a07ae 178
179 //
180 // -- CONTAINERS --------------------------------------------------------------------------------
181 //
182 TString outputFileName = AliAnalysisManager::GetCommonFileName();
183 Printf("AddAnalysisTaskD0 - Set OutputFileName : \n %s\n", outputFileName.Data() );
184
185 AliAnalysisDataContainer *output = mgr->CreateContainer(Form("%s_%.1f_%d_%.1f_%.1f_%.1f_%.1f_%.1f_%.4f_%.5f_%.2f",outNameSuffix.Data(),cutV,NTPCcluster,nsigmaTPCPi,nsigmaTPCKa,nsigmaTOFPi,nsigmaTOFKa,trackDCAcutMax,trackDCAcutMin,dcaProduct,minpt),
186 TList::Class(),
187 AliAnalysisManager::kOutputContainer,
188 outputFileName);
189 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
190 mgr->ConnectOutput(task, 1, output);
191
192 return task;
193}