]>
Commit | Line | Data |
---|---|---|
aad6618e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
27de2dfb | 16 | /* $Id$ */ |
17 | ||
662e37fe | 18 | //----------------------------------------------------------------------------- |
19 | /// \class AliAnalysisTaskSingleMu | |
20 | /// Analysis task for single muons in the spectrometer. | |
9728bcfd | 21 | /// The output is a list of histograms. |
b201705a | 22 | /// The macro class can run on AODs or ESDs. |
23 | /// In the latter case a flag can be activated to produce a tree as output. | |
9728bcfd | 24 | /// If Monte Carlo information is present, some basics checks are performed. |
662e37fe | 25 | /// |
26 | /// \author Diego Stocco | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
aad6618e | 29 | //---------------------------------------------------------------------------- |
30 | // Implementation of the single muon analysis class | |
662e37fe | 31 | // An example of usage can be found in the macro RunSingleMuAnalysisFromAOD.C. |
aad6618e | 32 | //---------------------------------------------------------------------------- |
33 | ||
34 | #define AliAnalysisTaskSingleMu_cxx | |
35 | ||
36 | // ROOT includes | |
aad6618e | 37 | #include "TROOT.h" |
9728bcfd | 38 | #include "TH1.h" |
39 | #include "TH2.h" | |
40 | #include "TH3.h" | |
41 | #include "TAxis.h" | |
42 | #include "TList.h" | |
662e37fe | 43 | #include "TCanvas.h" |
9728bcfd | 44 | #include "TMath.h" |
b201705a | 45 | #include "TTree.h" |
46 | #include "TTimeStamp.h" | |
589e3f71 | 47 | #include "TMap.h" |
48 | #include "TObjString.h" | |
55065f3f | 49 | #include "TObjArray.h" |
589e3f71 | 50 | #include "TIterator.h" |
51 | #include "TParameter.h" | |
52 | #include "TMCProcess.h" | |
aad6618e | 53 | |
54 | // STEER includes | |
589e3f71 | 55 | #include "AliAODInputHandler.h" |
aad6618e | 56 | #include "AliAODEvent.h" |
57 | #include "AliAODTrack.h" | |
58 | #include "AliAODVertex.h" | |
aad6618e | 59 | |
9728bcfd | 60 | #include "AliMCParticle.h" |
61 | #include "AliStack.h" | |
62 | ||
b201705a | 63 | #include "AliESDInputHandler.h" |
64 | #include "AliESDEvent.h" | |
65 | #include "AliESDMuonTrack.h" | |
9728bcfd | 66 | |
589e3f71 | 67 | #include "AliMultiplicity.h" |
93d6def1 | 68 | #include "AliCentrality.h" |
589e3f71 | 69 | |
70 | // ANALYSIS includes | |
71 | #include "AliAnalysisManager.h" | |
9728bcfd | 72 | #include "AliAnalysisTaskSE.h" |
4ab8d5a6 | 73 | #include "AliAnalysisDataSlot.h" |
74 | #include "AliAnalysisDataContainer.h" | |
589e3f71 | 75 | |
76 | // CORRFW includes | |
77 | #include "AliCFManager.h" | |
78 | #include "AliCFContainer.h" | |
79 | #include "AliCFGridSparse.h" | |
80 | #include "AliCFTrackKineCuts.h" | |
81 | #include "AliCFParticleGenCuts.h" | |
82 | #include "AliCFEventRecCuts.h" | |
83 | ||
aad6618e | 84 | #include "AliAnalysisTaskSingleMu.h" |
85 | ||
662e37fe | 86 | /// \cond CLASSIMP |
87 | ClassImp(AliAnalysisTaskSingleMu) // Class implementation in ROOT context | |
88 | /// \endcond | |
aad6618e | 89 | |
9728bcfd | 90 | |
aad6618e | 91 | //________________________________________________________________________ |
589e3f71 | 92 | AliAnalysisTaskSingleMu::AliAnalysisTaskSingleMu(const char *name, Int_t fillTreeScaleDown, Bool_t keepAll) : |
9728bcfd | 93 | AliAnalysisTaskSE(name), |
589e3f71 | 94 | fFillTreeScaleDown(fillTreeScaleDown), |
b201705a | 95 | fKeepAll(keepAll), |
589e3f71 | 96 | fkNvtxContribCut(1), |
4ab8d5a6 | 97 | fTriggerClasses(0x0), |
589e3f71 | 98 | fCFManager(0), |
9728bcfd | 99 | fHistoList(0), |
b201705a | 100 | fHistoListMC(0), |
589e3f71 | 101 | fHistoListQA(0), |
b201705a | 102 | fTreeSingleMu(0), |
b201705a | 103 | fVarFloat(0), |
104 | fVarInt(0), | |
105 | fVarChar(0), | |
106 | fVarUInt(0), | |
107 | fVarFloatMC(0), | |
589e3f71 | 108 | fVarIntMC(0), |
93d6def1 | 109 | fAuxObjects(new TMap()), |
110 | fDebugString("") | |
aad6618e | 111 | { |
112 | // | |
113 | /// Constructor. | |
114 | // | |
589e3f71 | 115 | if ( fFillTreeScaleDown <= 0 ) |
b201705a | 116 | fKeepAll = kFALSE; |
117 | ||
589e3f71 | 118 | DefineOutput(1, AliCFContainer::Class()); |
9728bcfd | 119 | DefineOutput(2, TList::Class()); |
589e3f71 | 120 | DefineOutput(3, TList::Class()); |
121 | DefineOutput(4, TList::Class()); | |
122 | ||
123 | if ( fFillTreeScaleDown > 0 ) | |
124 | DefineOutput(5, TTree::Class()); | |
125 | ||
55065f3f | 126 | fAuxObjects->SetOwner(); |
b201705a | 127 | |
55065f3f | 128 | SetTriggerClasses(); |
aad6618e | 129 | } |
130 | ||
9728bcfd | 131 | |
132 | //________________________________________________________________________ | |
133 | AliAnalysisTaskSingleMu::~AliAnalysisTaskSingleMu() | |
aad6618e | 134 | { |
135 | // | |
9728bcfd | 136 | /// Destructor |
aad6618e | 137 | // |
589e3f71 | 138 | |
4ab8d5a6 | 139 | delete fTriggerClasses; |
140 | // For proof: do not delete output containers | |
661d6c29 | 141 | if ( ! AliAnalysisManager::GetAnalysisManager() || ! AliAnalysisManager::GetAnalysisManager()->IsProofMode() ) { |
142 | // In terminate mode fCFManager does not exist! | |
143 | // So, check before deleting | |
144 | if ( fCFManager ) | |
145 | delete fCFManager->GetParticleContainer(); // The container is not deleted by framework | |
4ab8d5a6 | 146 | delete fCFManager; |
147 | delete fHistoList; | |
148 | delete fHistoListMC; | |
149 | delete fHistoListQA; | |
150 | delete fTreeSingleMu; | |
151 | } | |
b201705a | 152 | delete fVarFloat; |
153 | delete fVarInt; | |
154 | delete [] fVarChar; | |
155 | delete fVarUInt; | |
156 | delete fVarFloatMC; | |
157 | delete fVarIntMC; | |
55065f3f | 158 | delete fAuxObjects; |
9728bcfd | 159 | } |
aad6618e | 160 | |
9728bcfd | 161 | |
162 | //___________________________________________________________________________ | |
b201705a | 163 | void AliAnalysisTaskSingleMu::NotifyRun() |
9728bcfd | 164 | { |
165 | // | |
166 | /// Use the event handler information to correctly fill the analysis flags: | |
167 | /// - check if Monte Carlo information is present | |
168 | // | |
169 | ||
589e3f71 | 170 | if ( fMCEvent ) { |
9728bcfd | 171 | AliInfo("Monte Carlo information is present"); |
172 | } | |
173 | else { | |
174 | AliInfo("No Monte Carlo information in run"); | |
aad6618e | 175 | } |
589e3f71 | 176 | } |
177 | ||
178 | ||
179 | //___________________________________________________________________________ | |
180 | void AliAnalysisTaskSingleMu::FinishTaskOutput() | |
181 | { | |
182 | // | |
183 | /// Perform histogram normalization after the last analyzed event | |
184 | /// but before merging | |
185 | // | |
186 | ||
589e3f71 | 187 | // Set the correct run limits for the histograms |
188 | // vs run number to cope with the merging | |
4ab8d5a6 | 189 | Int_t histoIndex = -1; |
589e3f71 | 190 | Int_t indexPerRun[2] = {kHistoNeventsPerRun, kHistoNmuonsPerRun}; |
191 | for ( Int_t ihisto=0; ihisto<2; ihisto++) { | |
192 | histoIndex = GetHistoIndex(indexPerRun[ihisto]); | |
193 | TH2F* histo2D = (TH2F*)fHistoList->At(histoIndex); | |
194 | Double_t minX = 1e10, maxX = -1e10; | |
195 | for (Int_t ibin=1; ibin<=histo2D->GetXaxis()->GetNbins(); ibin++){ | |
196 | TString runNum = histo2D->GetXaxis()->GetBinLabel(ibin); | |
197 | minX = TMath::Min(runNum.Atof()-0.5, minX); | |
198 | maxX = TMath::Max(runNum.Atof()+0.5, maxX); | |
199 | } | |
200 | histo2D->GetXaxis()->SetLimits(minX, maxX); | |
201 | AliInfo(Form("Histogram %s run limits (%f, %f)",histo2D->GetName(), minX, maxX)); | |
202 | } | |
91ff2fb3 | 203 | |
204 | // Add stat. info from physics selection | |
205 | // (usefull when running on AODs) | |
206 | AliInputEventHandler* inputHandler = dynamic_cast<AliInputEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
207 | TString histoName = ""; | |
208 | if ( inputHandler ) { | |
209 | for ( Int_t istat=0; istat<2; istat++ ) { | |
210 | TString statType = ( istat == 0 ) ? "ALL" : "BIN0"; | |
211 | TH2* hStat = dynamic_cast<TH2*>(inputHandler->GetStatistics(statType.Data())); | |
212 | if ( hStat ) { | |
213 | histoName = Form("%s_SingleMuon", hStat->GetName()); | |
661d6c29 | 214 | TH2* cloneStat = static_cast<TH2*>(hStat->Clone(histoName.Data())); |
91ff2fb3 | 215 | cloneStat->SetDirectory(0); |
216 | fHistoList->Add(cloneStat); | |
217 | } | |
218 | else { | |
219 | AliWarning("Stat histogram not available"); | |
220 | break; | |
221 | } | |
222 | } // loop on stat type | |
223 | } | |
aad6618e | 224 | } |
225 | ||
9728bcfd | 226 | |
aad6618e | 227 | //___________________________________________________________________________ |
9728bcfd | 228 | void AliAnalysisTaskSingleMu::UserCreateOutputObjects() |
aad6618e | 229 | { |
230 | // | |
231 | /// Create output histograms | |
232 | // | |
9728bcfd | 233 | AliInfo(Form(" CreateOutputObjects of task %s\n", GetName())); |
aad6618e | 234 | |
9728bcfd | 235 | // initialize histogram lists |
91ff2fb3 | 236 | fHistoList = new TList(); |
237 | fHistoList->SetOwner(); | |
238 | fHistoListMC = new TList(); | |
239 | fHistoListMC->SetOwner(); | |
240 | fHistoListQA = new TList(); | |
241 | fHistoListQA->SetOwner(); | |
b201705a | 242 | |
243 | // Init variables | |
244 | fVarFloat = new Float_t [kNvarFloat]; | |
245 | fVarInt = new Int_t [kNvarInt]; | |
246 | fVarChar = new Char_t *[kNvarChar]; | |
247 | fVarUInt = new UInt_t [kNvarUInt]; | |
248 | fVarFloatMC = new Float_t [kNvarFloatMC]; | |
249 | fVarIntMC = new Int_t [kNvarIntMC]; | |
589e3f71 | 250 | |
251 | const Int_t charWidth[kNvarChar] = {255}; | |
252 | for(Int_t ivar=0; ivar<kNvarChar; ivar++){ | |
253 | fVarChar[ivar] = new Char_t [charWidth[ivar]]; | |
254 | } | |
255 | ||
9728bcfd | 256 | Int_t nPtBins = 60; |
589e3f71 | 257 | Double_t ptMin = 0., ptMax = 30.; |
9728bcfd | 258 | TString ptName("Pt"), ptTitle("p_{t}"), ptUnits("GeV/c"); |
589e3f71 | 259 | |
55065f3f | 260 | Int_t nRapidityBins = 25; |
261 | Double_t rapidityMin = -4.5, rapidityMax = -2.; | |
4ab8d5a6 | 262 | //TString rapidityName("Rapidity"), rapidityTitle("y"), rapidityUnits(""); |
263 | TString rapidityName("Eta"), rapidityTitle("#eta"), rapidityUnits(""); | |
589e3f71 | 264 | |
265 | Int_t nPhiBins = 36; | |
266 | Double_t phiMin = 0.; Double_t phiMax = 2*TMath::Pi(); | |
267 | TString phiName("Phi"), phiTitle("#phi"), phiUnits("rad"); | |
9728bcfd | 268 | |
589e3f71 | 269 | Int_t nDcaBins = 30; |
270 | Double_t dcaMin = 0., dcaMax = 300.; | |
9728bcfd | 271 | TString dcaName("DCA"), dcaTitle("DCA"), dcaUnits("cm"); |
662e37fe | 272 | |
589e3f71 | 273 | Int_t nVzBins = 40; |
274 | Double_t vzMin = -20., vzMax = 20.; | |
9728bcfd | 275 | TString vzName("Vz"), vzTitle("Vz"), vzUnits("cm"); |
276 | ||
589e3f71 | 277 | Int_t nThetaAbsEndBins = 4; |
278 | Double_t thetaAbsEndMin = -0.5, thetaAbsEndMax = 3.5; | |
279 | TString thetaAbsEndName("ThetaAbsEnd"), thetaAbsEndTitle("#theta_{abs}"), thetaAbsEndUnits("a.u."); | |
280 | ||
281 | Int_t nChargeBins = 2; | |
282 | Double_t chargeMin = -2, chargeMax = 2.; | |
283 | TString chargeName("Charge"), chargeTitle("charge"), chargeUnits("e"); | |
284 | ||
285 | Int_t nMatchTrigBins = 4; | |
286 | Double_t matchTrigMin = -0.5, matchTrigMax = 3.5; | |
287 | TString matchTrigName("MatchTrig"), matchTrigTitle("Trigger match"), matchTrigUnits(""); | |
9728bcfd | 288 | |
55065f3f | 289 | Int_t nTrigClassBins = fTriggerClasses->GetEntries(); |
290 | Double_t trigClassMin = 0.5, trigClassMax = (Double_t)nTrigClassBins + 0.5; | |
4ab8d5a6 | 291 | TString trigClassName("TrigClass"), trigClassTitle("Fired trigger class"), trigClassUnits(""); |
589e3f71 | 292 | |
293 | Int_t nGoodVtxBins = 3; | |
294 | Double_t goodVtxMin = -0.5, goodVtxMax = 2.5; | |
295 | TString goodVtxName("GoodVtx"), goodVtxTitle("Vertex flags"), goodVtxUnits(""); | |
296 | ||
297 | Int_t nMotherTypeBins = kNtrackSources; | |
298 | Double_t motherTypeMin = -0.5, motherTypeMax = (Double_t)kNtrackSources - 0.5; | |
299 | TString motherType("MotherType"), motherTypeTitle("motherType"), motherTypeUnits(""); | |
9728bcfd | 300 | |
93d6def1 | 301 | Int_t nCentralityBins = 10; |
302 | Double_t centralityMin = 0., centralityMax = 100.; | |
303 | TString centralityName("Centrality"), centralityTitle("centrality"), centralityUnits("%"); | |
4ab8d5a6 | 304 | |
9728bcfd | 305 | TString trigName[kNtrigCuts]; |
306 | trigName[kNoMatchTrig] = "NoMatch"; | |
307 | trigName[kAllPtTrig] = "AllPt"; | |
308 | trigName[kLowPtTrig] = "LowPt"; | |
309 | trigName[kHighPtTrig] = "HighPt"; | |
310 | ||
311 | TString srcName[kNtrackSources]; | |
312 | srcName[kCharmMu] = "Charm"; | |
313 | srcName[kBeautyMu] = "Beauty"; | |
314 | srcName[kPrimaryMu] = "Decay"; | |
315 | srcName[kSecondaryMu] = "Secondary"; | |
316 | srcName[kRecoHadron] = "Hadrons"; | |
93d6def1 | 317 | srcName[kUnknownPart] = "Unidentified"; |
9728bcfd | 318 | |
319 | TH1F* histo1D = 0x0; | |
320 | TH2F* histo2D = 0x0; | |
321 | TString histoName, histoTitle; | |
322 | Int_t histoIndex = 0; | |
323 | ||
589e3f71 | 324 | // Multi-dimensional histo |
93d6def1 | 325 | Int_t nbins[kNvars] = {nPtBins, nRapidityBins, nPhiBins, nDcaBins, nVzBins, nThetaAbsEndBins, nChargeBins, nMatchTrigBins, nTrigClassBins, nGoodVtxBins, nMotherTypeBins, nCentralityBins}; |
326 | Double_t xmin[kNvars] = {ptMin, rapidityMin, phiMin, dcaMin, vzMin, thetaAbsEndMin, chargeMin, matchTrigMin, trigClassMin, goodVtxMin, motherTypeMin, centralityMin}; | |
327 | Double_t xmax[kNvars] = {ptMax, rapidityMax, phiMax, dcaMax, vzMax, thetaAbsEndMax, chargeMax, matchTrigMax, trigClassMax, goodVtxMax, motherTypeMax, centralityMax}; | |
328 | TString axisTitle[kNvars] = {ptTitle, rapidityTitle, phiTitle, dcaTitle, vzTitle, thetaAbsEndTitle, chargeTitle, matchTrigTitle, trigClassTitle, goodVtxTitle, motherTypeTitle, centralityTitle}; | |
329 | TString axisUnits[kNvars] = {ptUnits, rapidityUnits, phiUnits, dcaUnits, vzUnits, thetaAbsEndUnits, chargeUnits, matchTrigUnits, trigClassUnits, goodVtxUnits, motherTypeUnits, centralityUnits}; | |
662e37fe | 330 | |
4ab8d5a6 | 331 | //TString stepTitle[kNsteps] = {"reconstructed", "in acceptance", "generated", "in acceptance (MC)"}; |
332 | TString stepTitle[kNsteps] = {"reconstructed", "generated"}; | |
589e3f71 | 333 | |
334 | // Create CF container | |
4ab8d5a6 | 335 | |
336 | // The framework has problems if the name of the object | |
337 | // and the one of container differ | |
338 | // To be complaint, get the name from container and set it | |
339 | TString containerName = GetOutputSlot(1)->GetContainer()->GetName(); | |
340 | ||
341 | AliCFContainer* container = new AliCFContainer(containerName.Data(),"container for tracks",kNsteps,kNvars,nbins); | |
589e3f71 | 342 | |
343 | for ( Int_t idim = 0; idim<kNvars; idim++){ | |
344 | histoTitle = Form("%s (%s)", axisTitle[idim].Data(), axisUnits[idim].Data()); | |
345 | histoTitle.ReplaceAll("()",""); | |
346 | ||
347 | container->SetVarTitle(idim, histoTitle.Data()); | |
348 | container->SetBinLimits(idim, xmin[idim], xmax[idim]); | |
9728bcfd | 349 | } |
589e3f71 | 350 | |
351 | for (Int_t istep=0; istep<kNsteps; istep++){ | |
352 | container->SetStepTitle(istep, stepTitle[istep].Data()); | |
353 | AliCFGridSparse* gridSparse = container->GetGrid(istep); | |
354 | ||
355 | SetAxisLabel(gridSparse->GetAxis(kHvarTrigClass)); | |
356 | TAxis* isGoodVtxAxis = gridSparse->GetAxis(kHvarIsGoodVtx); | |
357 | isGoodVtxAxis->SetBinLabel(1,Form("No vertex (contrib<%i)",fkNvtxContribCut)); | |
358 | isGoodVtxAxis->SetBinLabel(2,"Good vertex"); | |
359 | isGoodVtxAxis->SetBinLabel(3,"Pileup"); | |
360 | TAxis* motherTypeAxis = gridSparse->GetAxis(kHvarMotherType); | |
361 | for (Int_t ibin=0; ibin<kNtrackSources; ibin++){ | |
362 | motherTypeAxis->SetBinLabel(ibin+1,srcName[ibin]); | |
363 | } | |
9728bcfd | 364 | } |
589e3f71 | 365 | |
366 | // Create cuts | |
367 | ||
368 | //Particle-Level cuts: | |
369 | AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts(); | |
370 | mcGenCuts->SetNameTitle("mcGenCuts","MC particle generation cuts"); | |
371 | mcGenCuts->SetRequirePdgCode(13,kTRUE); | |
372 | mcGenCuts->SetQAOn(fHistoListQA); | |
373 | ||
4ab8d5a6 | 374 | /* |
589e3f71 | 375 | // MC kinematic cuts |
376 | AliCFTrackKineCuts *mcAccCuts = new AliCFTrackKineCuts(); | |
377 | mcAccCuts->SetNameTitle("mcAccCuts","MC-level acceptance cuts"); | |
378 | mcAccCuts->SetEtaRange(-4.,-2.5); | |
589e3f71 | 379 | mcAccCuts->SetQAOn(fHistoListQA); |
380 | ||
589e3f71 | 381 | // Rec-Level kinematic cuts |
382 | AliCFTrackKineCuts *recAccCuts = new AliCFTrackKineCuts(); | |
383 | recAccCuts->SetNameTitle("recAccCuts","Reco-level acceptance cuts"); | |
384 | recAccCuts->SetEtaRange(-4.,-2.5); | |
385 | recAccCuts->SetQAOn(fHistoListQA); | |
4ab8d5a6 | 386 | */ |
589e3f71 | 387 | |
589e3f71 | 388 | TObjArray* mcGenList = new TObjArray(0) ; |
389 | mcGenList->AddLast(mcGenCuts); | |
390 | ||
4ab8d5a6 | 391 | /* |
589e3f71 | 392 | TObjArray* mcAccList = new TObjArray(0); |
393 | mcAccList->AddLast(mcAccCuts); | |
394 | ||
589e3f71 | 395 | TObjArray* recAccList = new TObjArray(0); |
396 | recAccList->AddLast(recAccCuts); | |
4ab8d5a6 | 397 | */ |
589e3f71 | 398 | |
589e3f71 | 399 | // Create CF manager |
400 | fCFManager = new AliCFManager() ; | |
401 | fCFManager->SetParticleContainer(container); | |
402 | ||
403 | // Add cuts | |
404 | // Dummy event container | |
405 | Int_t dummyBins[1] = {1}; | |
406 | AliCFContainer* evtContainer = new AliCFContainer("dummyContainer","dummy contaier for events",1,1,dummyBins); | |
407 | fCFManager->SetEventContainer(evtContainer); | |
408 | fCFManager->SetEventCutsList(0,0x0); | |
409 | ||
410 | // Init empty cuts (avoid warnings in framework) | |
411 | for (Int_t istep=0; istep<kNsteps; istep++) { | |
412 | fCFManager->SetParticleCutsList(istep,0x0); | |
662e37fe | 413 | } |
4ab8d5a6 | 414 | //fCFManager->SetParticleCutsList(kStepAcceptance,recAccList); |
589e3f71 | 415 | fCFManager->SetParticleCutsList(kStepGeneratedMC,mcGenList); |
4ab8d5a6 | 416 | //fCFManager->SetParticleCutsList(kStepAcceptanceMC,mcAccList); |
662e37fe | 417 | |
b201705a | 418 | // Summary histos |
589e3f71 | 419 | histoName = "histoNeventsPerTrig"; |
420 | histoTitle = "Number of events per trigger class"; | |
421 | histo2D = new TH2F(histoName.Data(), histoTitle.Data(), nTrigClassBins, trigClassMin, trigClassMax, 5, 0.5, 5.5); | |
422 | histo2D->GetXaxis()->SetTitle("Fired class"); | |
423 | SetAxisLabel(histo2D->GetXaxis()); | |
424 | histo2D->GetYaxis()->SetBinLabel(1, "All events"); | |
425 | histo2D->GetYaxis()->SetBinLabel(2, "Good vtx events"); | |
426 | histo2D->GetYaxis()->SetBinLabel(3, "Pileup events"); | |
427 | histo2D->GetYaxis()->SetBinLabel(4, "All vertices"); | |
428 | histo2D->GetYaxis()->SetBinLabel(5, "Pileup vertices"); | |
429 | histoIndex = GetHistoIndex(kHistoNeventsPerTrig); | |
430 | fHistoList->AddAt(histo2D, histoIndex); | |
431 | ||
b201705a | 432 | histoName = "histoMuonMultiplicity"; |
433 | histoTitle = "Muon track multiplicity"; | |
589e3f71 | 434 | histo2D = new TH2F(histoName.Data(), histoTitle.Data(), 15, -0.5, 15-0.5, |
435 | nTrigClassBins, trigClassMin, trigClassMax); | |
436 | histo2D->GetXaxis()->SetTitle("# of muons"); | |
437 | SetAxisLabel(histo2D->GetYaxis()); | |
438 | histoIndex = GetHistoIndex(kHistoMuonMultiplicity); | |
439 | fHistoList->AddAt(histo2D, histoIndex); | |
440 | ||
441 | histoName = "histoEventVz"; | |
442 | histoTitle = "All events IP Vz distribution"; | |
4ab8d5a6 | 443 | histo2D = new TH2F(histoName.Data(), histoTitle.Data(), nTrigClassBins, trigClassMin, trigClassMax, nVzBins, vzMin, vzMax); |
444 | histo2D->GetXaxis()->SetTitle("Fired class"); | |
445 | SetAxisLabel(histo2D->GetXaxis()); | |
589e3f71 | 446 | histoTitle = Form("%s (%s)", vzTitle.Data(), vzUnits.Data()); |
4ab8d5a6 | 447 | histo2D->GetYaxis()->SetTitle(histoTitle.Data()); |
589e3f71 | 448 | histoIndex = GetHistoIndex(kHistoEventVz); |
4ab8d5a6 | 449 | fHistoList->AddAt(histo2D, histoIndex); |
b201705a | 450 | |
589e3f71 | 451 | Int_t hRunIndex[2] = {kHistoNeventsPerRun, kHistoNmuonsPerRun}; |
452 | TString hRunName[2] = {"histoNeventsPerRun", "histoNmuonsPerRun"}; | |
453 | TString hRunTitle[2] = {"Number of events per run", "Number of muons per run"}; | |
454 | for ( Int_t ihisto=0; ihisto<2; ihisto++){ | |
455 | histoName = hRunName[ihisto]; | |
456 | histoTitle = hRunTitle[ihisto]; | |
457 | histo2D = new TH2F(histoName.Data(), histoTitle.Data(), | |
458 | 1, 0., 0., | |
459 | nTrigClassBins, trigClassMin, trigClassMax); | |
460 | histo2D->GetXaxis()->SetTitle("Run number"); | |
461 | SetAxisLabel(histo2D->GetYaxis()); | |
462 | histo2D->Sumw2(); | |
463 | histoIndex = hRunIndex[ihisto]; | |
464 | fHistoList->AddAt(histo2D, histoIndex); | |
465 | } | |
466 | ||
467 | // MC histos summary | |
93d6def1 | 468 | Int_t hCheckVzIndex[3] = {kHistoCheckVzMC, kHistoCheckVzHasVtxMC, kHistoCheckVzNoPileupMC}; |
469 | TString hCheckVzName[3] = {"histoCheckVz", "histoCheckVzHasVtx", "histoCheckVzIsPileup"}; | |
470 | TString hCheckVzTitle[3] = {"", " w/ vertex contributors", "w/ pileup SPD"}; | |
471 | ||
472 | for ( Int_t ihisto=0; ihisto<3; ihisto++ ) { | |
473 | histoName = hCheckVzName[ihisto]; | |
474 | histoTitle = Form("Check IP Vz distribution %s", hCheckVzTitle[ihisto].Data()); | |
475 | ||
476 | histo2D = new TH2F(histoName.Data(), histoTitle.Data(), | |
477 | nVzBins, vzMin, vzMax, | |
478 | nVzBins, vzMin, vzMax); | |
479 | histoTitle = Form("%s (%s)", vzTitle.Data(), vzUnits.Data()); | |
480 | histo2D->GetXaxis()->SetTitle(histoTitle.Data()); | |
481 | histoTitle = Form("%s MC (%s)", vzTitle.Data(), vzUnits.Data()); | |
482 | histo2D->GetYaxis()->SetTitle(histoTitle.Data()); | |
483 | histoIndex = GetHistoIndex(hCheckVzIndex[ihisto]); | |
484 | fHistoListMC->AddAt(histo2D, histoIndex); | |
485 | } | |
589e3f71 | 486 | |
9728bcfd | 487 | // MC histos |
488 | for (Int_t itrig=0; itrig < kNtrigCuts; itrig++) { | |
489 | for (Int_t isrc = 0; isrc < kNtrackSources; isrc++) { | |
490 | histoName = Form("%sResolution%sTrig%s", ptName.Data(), trigName[itrig].Data(), srcName[isrc].Data()); | |
491 | histoTitle = Form("%s resolution. Trigger: %s (%s)", ptTitle.Data(), trigName[itrig].Data(), srcName[isrc].Data()); | |
492 | histo1D = new TH1F(histoName.Data(), histoTitle.Data(), 100, -5., 5.); | |
493 | histo1D->GetXaxis()->SetTitle(Form("%s^{reco} - %s^{MC} (%s)", ptTitle.Data(), ptTitle.Data(), ptUnits.Data())); | |
b201705a | 494 | histoIndex = GetHistoIndex(kHistoPtResolutionMC, itrig, isrc); |
9728bcfd | 495 | fHistoListMC->AddAt(histo1D, histoIndex); |
496 | } | |
497 | } | |
498 | ||
b201705a | 499 | // Trees |
4ab8d5a6 | 500 | if ( fFillTreeScaleDown > 0 ) { |
b201705a | 501 | TString leavesFloat[kNvarFloat] = {"Px", "Py", "Pz", "Pt", |
502 | "PxAtDCA", "PyAtDCA", "PzAtDCA", "PtAtDCA", | |
503 | "PxUncorrected", "PyUncorrected", "PzUncorrected", "PtUncorrected", | |
504 | "XUncorrected", "YUncorrected", "ZUncorrected", | |
505 | "XatDCA", "YatDCA", "DCA", | |
589e3f71 | 506 | "Eta", "Rapidity", "Charge", "RAtAbsEnd", |
93d6def1 | 507 | "IPVx", "IPVy", "IPVz", "Centrality"}; |
589e3f71 | 508 | TString leavesInt[kNvarInt] = {"MatchTrig", "IsMuon", "IsGhost", "LoCircuit", "PassPhysicsSelection", "NVtxContrib", "NspdTracklets", "IsPileupVertex"}; |
b201705a | 509 | TString leavesChar[kNvarChar] = {"FiredTrigClass"}; |
b201705a | 510 | TString leavesUInt[kNvarUInt] = {"BunchCrossNum", "OrbitNum", "PeriodNum", "RunNum"}; |
93d6def1 | 511 | TString leavesFloatMC[kNvarFloatMC] = {"PxMC", "PyMC", "PzMC", "PtMC", |
512 | "EtaMC", "RapidityMC", | |
513 | "VxMC", "VyMC", "VzMC", | |
514 | "MotherPxMC", "MotherPyMC", "MotherPzMC", | |
515 | "MotherEtaMC", "MotherRapidityMC", | |
516 | "MotherVxMC", "MotherVyMC", "MotherVzMC", | |
517 | "IPVxMC", "IPVyMC", "IPVzMC"}; | |
518 | TString leavesIntMC[kNvarIntMC] = {"Pdg", "MotherPdg", "MotherType"}; | |
b201705a | 519 | |
4ab8d5a6 | 520 | TString treeName = GetOutputSlot(5)->GetContainer()->GetName(); |
521 | Bool_t hasMC = AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler(); | |
522 | TString treeTitle = ( hasMC ) ? "Single Mu" : "Single Mu MC"; | |
b201705a | 523 | |
4ab8d5a6 | 524 | OpenFile(5); |
525 | if ( ! fTreeSingleMu ) fTreeSingleMu = new TTree(treeName.Data(), treeTitle.Data()); | |
b201705a | 526 | |
527 | for(Int_t itree=0; itree<2; itree++){ | |
589e3f71 | 528 | TParameter<Int_t>* par1 = new TParameter<Int_t>("fillTreeScaleDown",fFillTreeScaleDown); |
529 | TParameter<Int_t>* par2 = new TParameter<Int_t>("keepAllEvents",fKeepAll); | |
4ab8d5a6 | 530 | fTreeSingleMu->GetUserInfo()->Add(par1); |
531 | fTreeSingleMu->GetUserInfo()->Add(par2); | |
b201705a | 532 | for(Int_t ivar=0; ivar<kNvarFloat; ivar++){ |
4ab8d5a6 | 533 | fTreeSingleMu->Branch(leavesFloat[ivar].Data(), &fVarFloat[ivar], Form("%s/F", leavesFloat[ivar].Data())); |
b201705a | 534 | } |
535 | for(Int_t ivar=0; ivar<kNvarInt; ivar++){ | |
4ab8d5a6 | 536 | fTreeSingleMu->Branch(leavesInt[ivar].Data(), &fVarInt[ivar], Form("%s/I", leavesInt[ivar].Data())); |
b201705a | 537 | } |
538 | for(Int_t ivar=0; ivar<kNvarChar; ivar++){ | |
b201705a | 539 | TString addString = leavesChar[ivar] + "/C"; |
4ab8d5a6 | 540 | fTreeSingleMu->Branch(leavesChar[ivar].Data(), fVarChar[ivar], addString.Data()); |
b201705a | 541 | } |
542 | for(Int_t ivar=0; ivar<kNvarUInt; ivar++){ | |
4ab8d5a6 | 543 | fTreeSingleMu->Branch(leavesUInt[ivar].Data(), &fVarUInt[ivar], Form("%s/i", leavesUInt[ivar].Data())); |
b201705a | 544 | } |
4ab8d5a6 | 545 | if ( hasMC ){ |
b201705a | 546 | for(Int_t ivar=0; ivar<kNvarFloatMC; ivar++){ |
4ab8d5a6 | 547 | fTreeSingleMu->Branch(leavesFloatMC[ivar].Data(), &fVarFloatMC[ivar], Form("%s/F", leavesFloatMC[ivar].Data())); |
b201705a | 548 | } |
549 | for(Int_t ivar=0; ivar<kNvarIntMC; ivar++){ | |
4ab8d5a6 | 550 | fTreeSingleMu->Branch(leavesIntMC[ivar].Data(), &fVarIntMC[ivar], Form("%s/I", leavesIntMC[ivar].Data())); |
b201705a | 551 | } |
552 | } | |
553 | } // loop on trees | |
4ab8d5a6 | 554 | PostData(5, fTreeSingleMu); |
b201705a | 555 | } // fillNTuple |
4ab8d5a6 | 556 | |
55065f3f | 557 | PostData(1, fCFManager->GetParticleContainer()); |
558 | PostData(2, fHistoList); | |
559 | PostData(3, fHistoListQA); | |
4ab8d5a6 | 560 | PostData(4, fHistoListMC); |
561 | ||
aad6618e | 562 | } |
563 | ||
564 | //________________________________________________________________________ | |
9728bcfd | 565 | void AliAnalysisTaskSingleMu::UserExec(Option_t * /*option*/) |
aad6618e | 566 | { |
567 | // | |
568 | /// Main loop | |
569 | /// Called for each event | |
570 | // | |
571 | ||
b201705a | 572 | AliESDEvent* esdEvent = 0x0; |
9728bcfd | 573 | AliAODEvent* aodEvent = 0x0; |
9728bcfd | 574 | |
b201705a | 575 | esdEvent = dynamic_cast<AliESDEvent*> (InputEvent()); |
576 | if ( ! esdEvent ){ | |
b201705a | 577 | aodEvent = dynamic_cast<AliAODEvent*> (InputEvent()); |
578 | } | |
aad6618e | 579 | |
b201705a | 580 | if ( ! aodEvent && ! esdEvent ) { |
581 | AliError ("AOD or ESD event not found. Nothing done!"); | |
aad6618e | 582 | return; |
583 | } | |
584 | ||
589e3f71 | 585 | if ( ! fMCEvent && InputEvent()->GetEventType() != 7 ) return; // Run only on physics events! |
586 | ||
589e3f71 | 587 | Bool_t fillCurrentEventTree = ( fFillTreeScaleDown == 0 ) ? kFALSE : ( Entry() % fFillTreeScaleDown == 0 ); |
588 | ||
589 | Reset(kFALSE); | |
590 | ||
591 | // Global event info | |
592 | TString firedTrigClasses = ( esdEvent ) ? esdEvent->GetFiredTriggerClasses() : aodEvent->GetFiredTriggerClasses(); | |
4ab8d5a6 | 593 | /* |
589e3f71 | 594 | if ( fMCEvent ) { |
595 | // Add the MB name (which is not there in simulation) | |
596 | // CAVEAT: to be checked if we perform beam-gas simulations | |
4ab8d5a6 | 597 | if ( ! firedTrigClasses.Contains("CINT") && ! firedTrigClasses.Contains("MB") ) { |
598 | TString trigName = ((TObjString*)fTriggerClasses->At(0))->GetString(); | |
599 | firedTrigClasses.Prepend(Form("%s ", trigName.Data())); | |
55065f3f | 600 | } |
589e3f71 | 601 | } |
4ab8d5a6 | 602 | */ |
55065f3f | 603 | |
93d6def1 | 604 | Double_t centralityValue = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M"); |
605 | // Avoid filling overflow bin when centrality is exactly 100. | |
606 | Double_t centralityForContainer = TMath::Min(centralityValue, 99.999); | |
607 | ||
589e3f71 | 608 | fVarFloat[kVarIPVz] = ( esdEvent ) ? esdEvent->GetPrimaryVertex()->GetZ() : aodEvent->GetPrimaryVertex()->GetZ(); |
609 | fVarInt[kVarNVtxContrib] = ( esdEvent ) ? esdEvent->GetPrimaryVertex()->GetNContributors() : aodEvent->GetPrimaryVertex()->GetNContributors(); | |
610 | fVarInt[kVarNspdTracklets] = ( esdEvent ) ? esdEvent->GetMultiplicity()->GetNumberOfTracklets() : aodEvent->GetTracklets()->GetNumberOfTracklets(); | |
55065f3f | 611 | fVarInt[kVarIsPileup] = ( esdEvent ) ? esdEvent->IsPileupFromSPD(3,0.8) : aodEvent->IsPileupFromSPD(3,0.8); // REMEMBER TO CHECK |
589e3f71 | 612 | |
613 | fVarUInt[kVarRunNumber] = ( esdEvent ) ? esdEvent->GetRunNumber() : aodEvent->GetRunNumber(); | |
614 | ||
615 | Int_t isGoodVtxBin = ( fVarInt[kVarNVtxContrib] >= fkNvtxContribCut ); | |
93d6def1 | 616 | if ( isGoodVtxBin && fVarInt[kVarIsPileup] > 0 ) |
589e3f71 | 617 | isGoodVtxBin = 2; |
618 | ||
619 | if ( fillCurrentEventTree ){ | |
4ab8d5a6 | 620 | strncpy(fVarChar[kVarTrigMask], firedTrigClasses.Data(),255); |
93d6def1 | 621 | fVarFloat[kVarCentrality] = centralityValue; |
b201705a | 622 | |
589e3f71 | 623 | fVarInt[kVarPassPhysicsSelection] = ( esdEvent ) ? ((AliESDInputHandler*)AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler())->IsEventSelected() : ((AliAODInputHandler*)AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler())->IsEventSelected(); |
b201705a | 624 | |
625 | // Small workaround: in MC the bunch ID are not properly set and the timestamp is in seconds | |
626 | // So fill bunchCrossing with the read timestamp | |
627 | // fill the orbit and period number with a timestamp created while reading the run | |
628 | TTimeStamp ts; | |
589e3f71 | 629 | fVarUInt[kVarBunchCrossNumber] = ( fMCEvent ) ? (UInt_t)Entry() : esdEvent->GetBunchCrossNumber(); |
630 | fVarUInt[kVarOrbitNumber] = ( fMCEvent ) ? ts.GetNanoSec() : esdEvent->GetOrbitNumber(); | |
631 | fVarUInt[kVarPeriodNumber] = ( fMCEvent ) ? ts.GetTime() : esdEvent->GetPeriodNumber(); | |
9728bcfd | 632 | |
589e3f71 | 633 | fVarFloat[kVarIPVx] = ( esdEvent ) ? esdEvent->GetPrimaryVertex()->GetX() : aodEvent->GetPrimaryVertex()->GetX(); |
634 | fVarFloat[kVarIPVy] = ( esdEvent ) ? esdEvent->GetPrimaryVertex()->GetY() : aodEvent->GetPrimaryVertex()->GetY(); | |
635 | } | |
aad6618e | 636 | |
93d6def1 | 637 | firedTrigClasses.Append(" ANY"); |
638 | ||
aad6618e | 639 | // Object declaration |
589e3f71 | 640 | AliMCParticle* mcPart = 0x0; |
641 | AliVParticle* track = 0x0; | |
aad6618e | 642 | |
589e3f71 | 643 | Double_t containerInput[kNvars]; |
644 | Int_t histoIndex = -1; | |
b201705a | 645 | |
589e3f71 | 646 | fCFManager->SetRecEventInfo(InputEvent()); |
b201705a | 647 | |
589e3f71 | 648 | // Pure Monte Carlo part |
649 | if ( fMCEvent ) { | |
650 | fCFManager->SetMCEventInfo (fMCEvent); | |
651 | Int_t nMCtracks = fMCEvent->GetNumberOfTracks(); | |
652 | if ( nMCtracks > 0 ) { | |
93d6def1 | 653 | fVarFloatMC[kVarIPVxMC] = fMCEvent->Stack()->Particle(0)->Vx(); |
654 | fVarFloatMC[kVarIPVyMC] = fMCEvent->Stack()->Particle(0)->Vy(); | |
655 | fVarFloatMC[kVarIPVzMC] = fMCEvent->Stack()->Particle(0)->Vz(); | |
656 | containerInput[kHvarVz] = fVarFloatMC[kVarIPVzMC]; | |
589e3f71 | 657 | containerInput[kHvarIsGoodVtx] = 1; |
93d6def1 | 658 | containerInput[kHvarCentrality] = centralityForContainer; |
589e3f71 | 659 | histoIndex = GetHistoIndex(kHistoCheckVzMC); |
93d6def1 | 660 | ((TH2F*)fHistoListMC->At(histoIndex))->Fill(fVarFloat[kVarIPVz], fVarFloatMC[kVarIPVzMC]); |
661 | if ( isGoodVtxBin >= 1 ) { | |
662 | histoIndex = GetHistoIndex(kHistoCheckVzHasVtxMC); | |
663 | ((TH2F*)fHistoListMC->At(histoIndex))->Fill(fVarFloat[kVarIPVz], fVarFloatMC[kVarIPVzMC]); | |
664 | } | |
665 | if ( isGoodVtxBin == 1 ) { | |
666 | histoIndex = GetHistoIndex(kHistoCheckVzNoPileupMC); | |
667 | ((TH2F*)fHistoListMC->At(histoIndex))->Fill(fVarFloat[kVarIPVz], fVarFloatMC[kVarIPVzMC]); | |
668 | } | |
589e3f71 | 669 | } |
670 | ||
671 | for (Int_t ipart=0; ipart<nMCtracks; ipart++) { | |
672 | mcPart = (AliMCParticle*)fMCEvent->GetTrack(ipart); | |
673 | ||
674 | //check the MC-level cuts | |
675 | if ( ! fCFManager->CheckParticleCuts(kStepGeneratedMC,mcPart) ) | |
676 | continue; | |
677 | ||
678 | containerInput[kHvarPt] = mcPart->Pt(); | |
4ab8d5a6 | 679 | //containerInput[kHvarY] = mcPart->Y(); |
680 | containerInput[kHvarEta] = mcPart->Eta(); | |
589e3f71 | 681 | containerInput[kHvarPhi] = mcPart->Phi(); |
682 | containerInput[kHvarDCA] = TMath::Sqrt(mcPart->Xv()*mcPart->Xv() + | |
683 | mcPart->Yv()*mcPart->Yv()); | |
684 | containerInput[kHvarThetaZones] = GetBinThetaAbsEnd(TMath::Pi()-mcPart->Theta(),kTRUE); | |
685 | containerInput[kHvarCharge] = mcPart->Charge()/3.; | |
686 | containerInput[kHvarMatchTrig] = 1.; | |
589e3f71 | 687 | containerInput[kHvarMotherType] = (Double_t)RecoTrackMother(mcPart); |
93d6def1 | 688 | //containerInput[kHvarP] = mcPart->P(); |
589e3f71 | 689 | |
55065f3f | 690 | for ( Int_t itrig=0; itrig<fTriggerClasses->GetEntries(); itrig++ ) { |
691 | TString trigName = ((TObjString*)fTriggerClasses->At(itrig))->GetString(); | |
692 | if ( ! firedTrigClasses.Contains(trigName.Data()) ) | |
693 | continue; | |
694 | containerInput[kHvarTrigClass] = (Double_t)(itrig+1); | |
695 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepGeneratedMC); | |
4ab8d5a6 | 696 | // if ( fCFManager->CheckParticleCuts(kStepAcceptanceMC,mcPart) ) fCFManager->GetParticleContainer()->Fill(containerInput,kStepAcceptanceMC); |
55065f3f | 697 | } // loop on trigger classes |
93d6def1 | 698 | if ( fDebug >= 2 ) printf("AliAnalysisTaskSingleMu: Pure MC. %s. Set mother %i\n", fDebugString.Data(), (Int_t)containerInput[kHvarMotherType]); |
589e3f71 | 699 | } // loop on MC particles |
700 | } // is MC | |
701 | ||
702 | ||
703 | Int_t trackLabel = -1; | |
b201705a | 704 | Bool_t isGhost = kFALSE; |
705 | Int_t nGhosts = 0, nMuons = 0; | |
706 | ||
589e3f71 | 707 | Int_t nTracks = ( esdEvent ) ? esdEvent->GetNumberOfMuonTracks() : aodEvent->GetNTracks(); |
9728bcfd | 708 | |
709 | for (Int_t itrack = 0; itrack < nTracks; itrack++) { | |
aad6618e | 710 | |
9728bcfd | 711 | // Get variables |
b201705a | 712 | if ( esdEvent ){ |
589e3f71 | 713 | // ESD only info |
9728bcfd | 714 | |
b201705a | 715 | track = esdEvent->GetMuonTrack(itrack); |
716 | isGhost = ( ((AliESDMuonTrack*)track)->ContainTriggerData() && ! ((AliESDMuonTrack*)track)->ContainTrackerData() ); | |
717 | ||
589e3f71 | 718 | if ( fillCurrentEventTree ) { |
719 | if ( itrack > 0 ) Reset(kTRUE); | |
720 | fVarFloat[kVarPxUncorrected] = ( isGhost ) ? -TMath::Tan(((AliESDMuonTrack*)track)->GetThetaXUncorrected()) : ((AliESDMuonTrack*)track)->PxUncorrected(); | |
721 | fVarFloat[kVarPyUncorrected] = ( isGhost ) ? -TMath::Tan(((AliESDMuonTrack*)track)->GetThetaYUncorrected()) : ((AliESDMuonTrack*)track)->PyUncorrected(); | |
722 | fVarFloat[kVarPzUncorrected] = ( isGhost ) ? -1 : ((AliESDMuonTrack*)track)->PzUncorrected(); | |
723 | ||
724 | fVarFloat[kVarPtUncorrected] = | |
725 | TMath::Sqrt(fVarFloat[kVarPxUncorrected] * fVarFloat[kVarPxUncorrected] + | |
726 | fVarFloat[kVarPyUncorrected] * fVarFloat[kVarPyUncorrected]); | |
b201705a | 727 | |
589e3f71 | 728 | fVarFloat[kVarXUncorrected] = ((AliESDMuonTrack*)track)->GetNonBendingCoorUncorrected(); |
729 | fVarFloat[kVarYUncorrected] = ((AliESDMuonTrack*)track)->GetBendingCoorUncorrected(); | |
730 | fVarFloat[kVarZUncorrected] = ((AliESDMuonTrack*)track)->GetZUncorrected(); | |
b201705a | 731 | |
589e3f71 | 732 | fVarInt[kVarLocalCircuit] = ((AliESDMuonTrack*)track)->LoCircuit(); |
733 | } | |
734 | ||
735 | if ( isGhost ) { | |
736 | // If is ghost fill only a partial information | |
737 | nGhosts++; | |
738 | if ( fillCurrentEventTree ) { | |
739 | fVarInt[kVarIsMuon] = 0; | |
740 | fVarInt[kVarIsGhost] = nGhosts; | |
741 | fVarInt[kVarMatchTrig] = ((AliESDMuonTrack*)track)->GetMatchTrigger(); | |
4ab8d5a6 | 742 | fTreeSingleMu->Fill(); |
589e3f71 | 743 | } |
b201705a | 744 | continue; |
745 | } | |
746 | } | |
747 | else { | |
748 | track = aodEvent->GetTrack(itrack); | |
749 | if ( ! ((AliAODTrack*)track)->IsMuonTrack() ) | |
750 | continue; | |
b201705a | 751 | } |
9728bcfd | 752 | |
b201705a | 753 | // Information for tracks in tracker |
754 | nMuons++; | |
b201705a | 755 | |
756 | fVarFloat[kVarPt] = track->Pt(); | |
4ab8d5a6 | 757 | //fVarFloat[kVarRapidity] = track->Y(); |
758 | fVarFloat[kVarEta] = track->Eta(); | |
b201705a | 759 | fVarFloat[kVarXatDCA] = (esdEvent ) ? ((AliESDMuonTrack*)track)->GetNonBendingCoorAtDCA() : ((AliAODTrack*)track)->XAtDCA(); |
760 | fVarFloat[kVarYatDCA] = (esdEvent ) ? ((AliESDMuonTrack*)track)->GetBendingCoorAtDCA() : ((AliAODTrack*)track)->YAtDCA(); | |
589e3f71 | 761 | fVarFloat[kVarDCA] = |
762 | TMath::Sqrt( fVarFloat[kVarXatDCA] * fVarFloat[kVarXatDCA] + | |
763 | fVarFloat[kVarYatDCA] * fVarFloat[kVarYatDCA] ); | |
764 | fVarFloat[kVarCharge] = (Float_t)track->Charge(); | |
765 | fVarFloat[kVarRAtAbsEnd] = (esdEvent ) ? ((AliESDMuonTrack*)track)->GetRAtAbsorberEnd() : ((AliAODTrack*)track)->GetRAtAbsorberEnd(); | |
b201705a | 766 | fVarInt[kVarMatchTrig] = (esdEvent ) ? ((AliESDMuonTrack*)track)->GetMatchTrigger() : ((AliAODTrack*)track)->GetMatchTrigger(); |
767 | ||
589e3f71 | 768 | if ( fillCurrentEventTree ){ |
769 | fVarInt[kVarIsMuon] = nMuons; | |
770 | fVarInt[kVarIsGhost] = 0; | |
4ab8d5a6 | 771 | //fVarFloat[kVarEta] = track->Eta(); |
772 | fVarFloat[kVarRapidity] = track->Y(); | |
b201705a | 773 | fVarFloat[kVarPx] = track->Px(); |
774 | fVarFloat[kVarPy] = track->Py(); | |
775 | fVarFloat[kVarPz] = track->Pz(); | |
589e3f71 | 776 | fVarFloat[kVarPxAtDCA] = ( esdEvent ) ? ((AliESDMuonTrack*)track)->PxAtDCA() : ((AliAODTrack*)track)->PxAtDCA(); |
777 | fVarFloat[kVarPyAtDCA] = ( esdEvent ) ? ((AliESDMuonTrack*)track)->PyAtDCA() : ((AliAODTrack*)track)->PyAtDCA(); | |
778 | fVarFloat[kVarPzAtDCA] = ( esdEvent ) ? ((AliESDMuonTrack*)track)->PzAtDCA() : ((AliAODTrack*)track)->PzAtDCA(); | |
b201705a | 779 | fVarFloat[kVarPtAtDCA] = TMath::Sqrt(fVarFloat[kVarPxAtDCA]*fVarFloat[kVarPxAtDCA] + fVarFloat[kVarPyAtDCA]*fVarFloat[kVarPyAtDCA]); |
b201705a | 780 | } |
9728bcfd | 781 | |
589e3f71 | 782 | fVarIntMC[kVarMotherType] = kUnknownPart; |
783 | ||
9728bcfd | 784 | // Monte Carlo part |
589e3f71 | 785 | if ( fMCEvent ) { |
9728bcfd | 786 | |
589e3f71 | 787 | trackLabel = track->GetLabel(); |
9728bcfd | 788 | |
93d6def1 | 789 | if ( trackLabel >= 0 ) { |
790 | AliMCParticle* matchedMCTrack = (AliMCParticle*)fMCEvent->GetTrack(trackLabel); | |
589e3f71 | 791 | fVarIntMC[kVarMotherType] = RecoTrackMother(matchedMCTrack); |
792 | fVarFloatMC[kVarPtMC] = matchedMCTrack->Pt(); | |
793 | FillTriggerHistos(kHistoPtResolutionMC, fVarInt[kVarMatchTrig], fVarIntMC[kVarMotherType], fVarFloat[kVarPt] - fVarFloatMC[kVarPtMC]); | |
794 | if ( fillCurrentEventTree ){ | |
795 | fVarFloatMC[kVarPxMC] = matchedMCTrack->Px(); | |
796 | fVarFloatMC[kVarPyMC] = matchedMCTrack->Py(); | |
797 | fVarFloatMC[kVarPzMC] = matchedMCTrack->Pz(); | |
798 | fVarFloatMC[kVarEtaMC] = matchedMCTrack->Eta(); | |
799 | fVarFloatMC[kVarRapidityMC] = matchedMCTrack->Y(); | |
800 | fVarFloatMC[kVarVxMC] = matchedMCTrack->Xv(); | |
801 | fVarFloatMC[kVarVyMC] = matchedMCTrack->Yv(); | |
802 | fVarFloatMC[kVarVzMC] = matchedMCTrack->Zv(); | |
803 | fVarIntMC[kVarPdg] = matchedMCTrack->PdgCode(); | |
93d6def1 | 804 | |
805 | Int_t imother = matchedMCTrack->GetMother(); | |
806 | if ( imother >= 0 ) { | |
807 | AliMCParticle* motherTrack = (AliMCParticle*)fMCEvent->GetTrack(imother); | |
808 | fVarFloatMC[kVarMotherPxMC] = motherTrack->Px(); | |
809 | fVarFloatMC[kVarMotherPyMC] = motherTrack->Py(); | |
810 | fVarFloatMC[kVarMotherPzMC] = motherTrack->Pz(); | |
811 | fVarFloatMC[kVarMotherEtaMC] = motherTrack->Eta(); | |
812 | fVarFloatMC[kVarMotherRapidityMC] = motherTrack->Y(); | |
813 | fVarFloatMC[kVarMotherVxMC] = motherTrack->Xv(); | |
814 | fVarFloatMC[kVarMotherVyMC] = motherTrack->Yv(); | |
815 | fVarFloatMC[kVarMotherVzMC] = motherTrack->Zv(); | |
816 | fVarIntMC[kVarMotherPdg] = motherTrack->PdgCode(); | |
817 | } | |
589e3f71 | 818 | } |
b201705a | 819 | } |
93d6def1 | 820 | if ( fDebug >= 1 ) printf("AliAnalysisTaskSingleMu: Reco track. %s. Set mother %i\n", fDebugString.Data(), fVarIntMC[kVarMotherType]); |
589e3f71 | 821 | } // if use MC |
822 | ||
823 | containerInput[kHvarPt] = fVarFloat[kVarPt]; | |
4ab8d5a6 | 824 | //containerInput[kHvarY] = fVarFloat[kVarRapidity]; |
825 | containerInput[kHvarEta] = fVarFloat[kVarEta]; | |
589e3f71 | 826 | containerInput[kHvarPhi] = track->Phi(); |
827 | containerInput[kHvarDCA] = fVarFloat[kVarDCA]; | |
828 | containerInput[kHvarVz] = fVarFloat[kVarIPVz]; | |
829 | containerInput[kHvarThetaZones] = GetBinThetaAbsEnd(fVarFloat[kVarRAtAbsEnd]); | |
830 | containerInput[kHvarCharge] = fVarFloat[kVarCharge]; | |
831 | containerInput[kHvarMatchTrig] = (Double_t)fVarInt[kVarMatchTrig]; | |
589e3f71 | 832 | containerInput[kHvarIsGoodVtx] = (Double_t)isGoodVtxBin; |
833 | containerInput[kHvarMotherType] = (Double_t)fVarIntMC[kVarMotherType]; | |
93d6def1 | 834 | containerInput[kHvarCentrality] = centralityForContainer; |
835 | //containerInput[kHvarP] = track->P(); | |
589e3f71 | 836 | |
55065f3f | 837 | histoIndex = GetHistoIndex(kHistoNmuonsPerRun); |
838 | for ( Int_t itrig=0; itrig<fTriggerClasses->GetEntries(); itrig++ ) { | |
839 | TString trigName = ((TObjString*)fTriggerClasses->At(itrig))->GetString(); | |
840 | if ( ! firedTrigClasses.Contains(trigName.Data()) ) | |
841 | continue; | |
842 | containerInput[kHvarTrigClass] = (Double_t)(itrig+1); | |
843 | fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructed); | |
4ab8d5a6 | 844 | // if ( fCFManager->CheckParticleCuts(kStepAcceptance,track) ) fCFManager->GetParticleContainer()->Fill(containerInput,kStepAcceptance); |
55065f3f | 845 | ((TH2F*)fHistoList->At(histoIndex))->Fill(Form("%u",fVarUInt[kVarRunNumber]), containerInput[kHvarTrigClass], 1.); |
846 | } // loop on trigger classes | |
589e3f71 | 847 | |
4ab8d5a6 | 848 | if ( fillCurrentEventTree ) fTreeSingleMu->Fill(); |
9728bcfd | 849 | } // loop on tracks |
b201705a | 850 | |
589e3f71 | 851 | if ( fillCurrentEventTree && fKeepAll && ( ( nMuons + nGhosts ) == 0 ) ) { |
b201705a | 852 | // Fill event also if there is not muon (when explicitely required) |
4ab8d5a6 | 853 | fTreeSingleMu->Fill(); |
b201705a | 854 | } |
855 | ||
55065f3f | 856 | for ( Int_t itrig=0; itrig<fTriggerClasses->GetEntries(); itrig++ ) { |
857 | TString trigName = ((TObjString*)fTriggerClasses->At(itrig))->GetString(); | |
858 | if ( ! firedTrigClasses.Contains(trigName.Data()) ) | |
859 | continue; | |
860 | Double_t trigClassBin = (Double_t)(itrig+1); | |
861 | histoIndex = GetHistoIndex(kHistoNeventsPerTrig); | |
862 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin, 1., 1.); // All events | |
863 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin, 4., (Double_t)(fVarInt[kVarIsPileup]+1)); // All vertices | |
864 | if ( isGoodVtxBin == 1 ) | |
865 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin, 2., 1.); // Good vtx events | |
866 | else if ( isGoodVtxBin == 2 ) { | |
867 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin, 3., 1.); // Pileup events | |
868 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin, 5., 1.); // Pileup vertices | |
869 | } | |
589e3f71 | 870 | |
55065f3f | 871 | histoIndex = GetHistoIndex(kHistoMuonMultiplicity); |
872 | ((TH1F*)fHistoList->At(histoIndex))->Fill(nMuons, trigClassBin); | |
589e3f71 | 873 | |
4ab8d5a6 | 874 | if ( isGoodVtxBin == 1 ) { |
55065f3f | 875 | histoIndex = GetHistoIndex(kHistoEventVz); |
4ab8d5a6 | 876 | ((TH2F*)fHistoList->At(histoIndex))->Fill(trigClassBin,fVarFloat[kVarIPVz]); |
55065f3f | 877 | } |
878 | ||
879 | histoIndex = GetHistoIndex(kHistoNeventsPerRun); | |
880 | ((TH2F*)fHistoList->At(histoIndex))->Fill(Form("%u",fVarUInt[kVarRunNumber]), trigClassBin, 1.); | |
881 | } // loop on trigger classes | |
589e3f71 | 882 | |
589e3f71 | 883 | |
884 | // Post final data. It will be written to a file with option "RECREATE" | |
885 | PostData(1, fCFManager->GetParticleContainer()); | |
886 | PostData(2, fHistoList); | |
55065f3f | 887 | PostData(3, fHistoListQA); |
4ab8d5a6 | 888 | PostData(4, fHistoListMC); |
589e3f71 | 889 | if ( fFillTreeScaleDown > 0 ) |
4ab8d5a6 | 890 | PostData(5, fTreeSingleMu); |
aad6618e | 891 | } |
892 | ||
893 | //________________________________________________________________________ | |
894 | void AliAnalysisTaskSingleMu::Terminate(Option_t *) { | |
895 | // | |
896 | /// Draw some histogram at the end. | |
897 | // | |
589e3f71 | 898 | |
899 | AliCFContainer* container = dynamic_cast<AliCFContainer*> (GetOutputData(1)); | |
900 | if ( ! container ) { | |
901 | AliError("Cannot find container in file"); | |
902 | return; | |
903 | } | |
904 | ||
905 | //Int_t histoIndex = -1; | |
906 | ||
907 | if ( ! gROOT->IsBatch() ) { | |
4ab8d5a6 | 908 | TString currName = GetName(); |
909 | currName.Prepend("c1_"); | |
910 | TCanvas *c1_SingleMu = new TCanvas(currName.Data(),"Vz vs Pt",10,10,310,310); | |
93fd3322 | 911 | c1_SingleMu->SetFillColor(10); c1_SingleMu->SetHighLightColor(10); |
912 | c1_SingleMu->SetLeftMargin(0.15); c1_SingleMu->SetBottomMargin(0.15); | |
91ff2fb3 | 913 | TH2* histo = static_cast<TH2*>(container->Project(kStepReconstructed,kHvarPt,kHvarVz)); |
4ab8d5a6 | 914 | currName = GetName(); |
915 | currName.Prepend("hPtVz_"); | |
916 | histo->SetName(currName.Data()); | |
917 | histo->Draw("COLZ"); | |
aad6618e | 918 | } |
589e3f71 | 919 | |
aad6618e | 920 | } |
921 | ||
922 | //________________________________________________________________________ | |
9728bcfd | 923 | void AliAnalysisTaskSingleMu::FillTriggerHistos(Int_t histoIndex, Int_t matchTrig, Int_t motherType, |
924 | Float_t var1, Float_t var2, Float_t var3) | |
aad6618e | 925 | { |
926 | // | |
9728bcfd | 927 | /// Fill all histograms passing the trigger cuts |
aad6618e | 928 | // |
662e37fe | 929 | |
9728bcfd | 930 | Int_t nTrigs = TMath::Max(1, matchTrig); |
931 | TArrayI trigToFill(nTrigs); | |
932 | trigToFill[0] = matchTrig; | |
933 | for(Int_t itrig = 1; itrig < matchTrig; itrig++){ | |
934 | trigToFill[itrig] = itrig; | |
935 | } | |
662e37fe | 936 | |
9728bcfd | 937 | TList* histoList = (motherType < 0 ) ? fHistoList : fHistoListMC; |
938 | ||
939 | TString className; | |
940 | for(Int_t itrig = 0; itrig < nTrigs; itrig++){ | |
941 | Int_t currIndex = GetHistoIndex(histoIndex, trigToFill[itrig], motherType); | |
942 | className = histoList->At(currIndex)->ClassName(); | |
93d6def1 | 943 | if ( fDebug >= 3 ) printf("AliAnalysisTaskSingleMu: matchTrig %i Fill %s\n", matchTrig, histoList->At(currIndex)->GetName()); |
9728bcfd | 944 | if (className.Contains("1")) |
945 | ((TH1F*)histoList->At(currIndex))->Fill(var1); | |
946 | else if (className.Contains("2")) | |
947 | ((TH2F*)histoList->At(currIndex))->Fill(var1, var2); | |
948 | else if (className.Contains("3")) | |
949 | ((TH3F*)histoList->At(currIndex))->Fill(var1, var2, var3); | |
950 | else | |
951 | AliWarning("Histogram not filled"); | |
952 | } | |
aad6618e | 953 | } |
954 | ||
aad6618e | 955 | //________________________________________________________________________ |
589e3f71 | 956 | Int_t AliAnalysisTaskSingleMu::RecoTrackMother(AliMCParticle* mcParticle) |
aad6618e | 957 | { |
958 | // | |
9728bcfd | 959 | /// Find track mother from kinematics |
aad6618e | 960 | // |
961 | ||
589e3f71 | 962 | Int_t recoPdg = mcParticle->PdgCode(); |
aad6618e | 963 | |
93d6def1 | 964 | fDebugString = Form("History: %i", recoPdg); |
965 | ||
9728bcfd | 966 | // Track is not a muon |
589e3f71 | 967 | if ( TMath::Abs(recoPdg) != 13 ) return kRecoHadron; |
aad6618e | 968 | |
589e3f71 | 969 | Int_t imother = mcParticle->GetMother(); |
aad6618e | 970 | |
93d6def1 | 971 | //Int_t baseFlv[2] = {4,5}; |
972 | //Int_t mType[2] = {kCharmMu, kBeautyMu}; | |
973 | Int_t den[3] = {100, 1000, 1}; | |
aad6618e | 974 | |
93d6def1 | 975 | //Bool_t isFirstMotherHF = kFALSE; |
976 | //Int_t step = 0; | |
977 | Int_t motherType = kPrimaryMu; | |
589e3f71 | 978 | while ( imother >= 0 ) { |
979 | TParticle* part = ((AliMCParticle*)fMCEvent->GetTrack(imother))->Particle(); | |
662e37fe | 980 | |
93d6def1 | 981 | fDebugString += Form(" <- %s (%s)", part->GetName(), TMCProcessName[part->GetUniqueID()]); |
662e37fe | 982 | |
589e3f71 | 983 | Int_t absPdg = TMath::Abs(part->GetPdgCode()); |
93d6def1 | 984 | //step++; |
985 | ||
986 | if ( imother < fMCEvent->GetNumberOfPrimaries() ) { | |
987 | /* | |
988 | // Hadronic processes are not possible for "primary" => | |
989 | // either is decay or HF | |
990 | if ( absPdg > 100 && absPdg < 400 ) { | |
991 | // it is decay mu | |
992 | motherType = kPrimaryMu; | |
993 | break; // particle loop | |
994 | } | |
995 | else if ( step == 1 || isFirstMotherHF ){ | |
996 | // Check if it is HF muon | |
997 | // avoid the case when the HF was not the first mother | |
998 | // (the mu is produced by a decain chain => decay mu) | |
999 | Bool_t foundHF = kFALSE; | |
1000 | for ( Int_t idec=0; idec<3; idec++ ) { | |
1001 | for ( Int_t ihf=0; ihf<2; ihf++ ) { | |
1002 | if ( ( absPdg/den[idec] ) != baseFlv[ihf] ) continue; | |
1003 | motherType = mType[ihf]; | |
1004 | foundHF = kTRUE; | |
1005 | break; | |
1006 | } // loop on hf | |
1007 | if ( foundHF ) { | |
1008 | if ( step == 1 ) isFirstMotherHF = kTRUE; | |
1009 | break; // break loop on pdg code | |
1010 | // but continue the global loop to find higher mass HF | |
1011 | } | |
1012 | } // loop on pdg codes | |
1013 | if ( ! foundHF ) { | |
1014 | motherType = kPrimaryMu; | |
1015 | break; | |
1016 | } | |
1017 | else if ( absPdg < 10 ) { | |
1018 | // found HF quark: break particle loop | |
1019 | break; | |
1020 | } | |
1021 | } // potential HF code | |
1022 | */ | |
1023 | for ( Int_t idec=0; idec<3; idec++ ) { | |
1024 | Int_t flv = absPdg/den[idec]; | |
1025 | if ( flv > 0 && flv < 4 ) return kPrimaryMu; | |
1026 | else if ( flv == 0 || flv > 5 ) continue; | |
1027 | else { | |
1028 | motherType = ( flv == 4 ) ? kCharmMu : kBeautyMu; | |
1029 | break; // break loop on pdg code | |
1030 | // but continue the global loop to find higher mass HF | |
1031 | } | |
1032 | } // loop on pdg code | |
1033 | if ( absPdg < 10 ) break; // particle loop | |
1034 | } // is primary | |
1035 | else { | |
1036 | // If hadronic process => secondary | |
1037 | if ( part->GetUniqueID() == kPHadronic ) { | |
1038 | //motherType = kSecondaryMu; | |
1039 | //break; // particle loop | |
1040 | return kSecondaryMu; | |
1041 | } | |
1042 | } // is secondary | |
9728bcfd | 1043 | |
589e3f71 | 1044 | imother = part->GetFirstMother(); |
9728bcfd | 1045 | |
93d6def1 | 1046 | } // loop on mothers |
1047 | ||
1048 | return motherType; | |
589e3f71 | 1049 | } |
662e37fe | 1050 | |
589e3f71 | 1051 | //________________________________________________________________________ |
1052 | Int_t AliAnalysisTaskSingleMu::GetHistoIndex(Int_t histoTypeIndex, Int_t trigIndex, Int_t srcIndex) | |
1053 | { | |
1054 | // | |
1055 | /// Get histogram index in the list | |
1056 | // | |
1057 | ||
1058 | if ( srcIndex < 0 ) { | |
1059 | return histoTypeIndex; | |
9728bcfd | 1060 | } |
589e3f71 | 1061 | |
1062 | return | |
1063 | kNsummaryHistosMC + | |
1064 | kNtrackSources * kNtrigCuts * histoTypeIndex + | |
1065 | kNtrackSources * trigIndex + | |
1066 | srcIndex; | |
9728bcfd | 1067 | } |
662e37fe | 1068 | |
9728bcfd | 1069 | //________________________________________________________________________ |
589e3f71 | 1070 | Float_t AliAnalysisTaskSingleMu::GetBinThetaAbsEnd(Float_t RAtAbsEnd, Bool_t isTheta) |
1071 | { | |
1072 | // | |
1073 | /// Get bin of theta at absorber end region | |
1074 | // | |
1075 | Float_t thetaDeg = ( isTheta ) ? RAtAbsEnd : TMath::ATan( RAtAbsEnd / 505. ); | |
1076 | thetaDeg *= TMath::RadToDeg(); | |
1077 | if ( thetaDeg < 2. ) | |
1078 | return 0.; | |
1079 | else if ( thetaDeg < 3. ) | |
1080 | return 1.; | |
1081 | else if ( thetaDeg < 9. ) | |
1082 | return 2.; | |
1083 | ||
1084 | return 3.; | |
1085 | } | |
1086 | ||
b201705a | 1087 | |
1088 | //________________________________________________________________________ | |
1089 | void AliAnalysisTaskSingleMu::Reset(Bool_t keepGlobal) | |
1090 | { | |
1091 | // | |
1092 | /// Reset variables | |
1093 | // | |
1094 | Int_t lastVarFloat = ( keepGlobal ) ? kVarIPVx : kNvarFloat; | |
1095 | for(Int_t ivar=0; ivar<lastVarFloat; ivar++){ | |
1096 | fVarFloat[ivar] = 0.; | |
1097 | } | |
1098 | Int_t lastVarInt = ( keepGlobal ) ? kVarPassPhysicsSelection : kNvarInt; | |
1099 | for(Int_t ivar=0; ivar<lastVarInt; ivar++){ | |
589e3f71 | 1100 | fVarInt[ivar] = 0; |
b201705a | 1101 | } |
589e3f71 | 1102 | fVarInt[kVarMatchTrig] = -1; |
b201705a | 1103 | |
1104 | if ( ! keepGlobal ){ | |
1105 | for(Int_t ivar=0; ivar<kNvarChar; ivar++){ | |
4ab8d5a6 | 1106 | strncpy(fVarChar[ivar]," ",255); |
b201705a | 1107 | } |
1108 | for(Int_t ivar=0; ivar<kNvarUInt; ivar++){ | |
1109 | fVarUInt[ivar] = 0; | |
1110 | } | |
1111 | } | |
589e3f71 | 1112 | if ( fMCEvent ){ |
93d6def1 | 1113 | lastVarFloat = ( keepGlobal ) ? kVarIPVxMC : kNvarFloatMC; |
1114 | for(Int_t ivar=0; ivar<lastVarFloat; ivar++){ | |
b201705a | 1115 | fVarFloatMC[ivar] = 0.; |
1116 | } | |
1117 | for(Int_t ivar=0; ivar<kNvarIntMC; ivar++){ | |
93d6def1 | 1118 | fVarIntMC[ivar] = 0; |
b201705a | 1119 | } |
93d6def1 | 1120 | fVarIntMC[kVarMotherType] = -1; |
1121 | } | |
b201705a | 1122 | } |
589e3f71 | 1123 | |
1124 | //________________________________________________________________________ | |
55065f3f | 1125 | void AliAnalysisTaskSingleMu::SetTriggerClasses(TString triggerClasses) |
589e3f71 | 1126 | { |
55065f3f | 1127 | /// Set trigger classes |
1128 | if ( fTriggerClasses ) | |
1129 | delete fTriggerClasses; | |
1130 | ||
1131 | fTriggerClasses = triggerClasses.Tokenize(" "); | |
1132 | fTriggerClasses->SetOwner(); | |
589e3f71 | 1133 | |
55065f3f | 1134 | } |
589e3f71 | 1135 | |
1136 | //________________________________________________________________________ | |
1137 | void AliAnalysisTaskSingleMu::SetAxisLabel(TAxis* axis) | |
1138 | { | |
1139 | // | |
1140 | /// Set the labels of trigger class axis | |
1141 | // | |
55065f3f | 1142 | for ( Int_t itrig=0; itrig<fTriggerClasses->GetEntries(); itrig++ ) { |
1143 | TString trigName = ((TObjString*)fTriggerClasses->At(itrig))->GetString(); | |
1144 | axis->SetBinLabel(itrig+1,trigName.Data()); | |
1145 | } | |
1146 | axis->SetTitle("Fired class"); | |
589e3f71 | 1147 | } |