AliRsnReader:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / AddRsnAnalysisTask.C
CommitLineData
eae5d3bb 1//=============================================================================
2//
3// *** AliRsnAnalysisTask.C ***
4//
5// This macro initialize a complete AnalysisTask object for resonances.
6// All the possibilities are made available through enumerations,
7// with the same style of the Config.C file used for simulation.
8//
9//=============================================================================
10
11
12
cc781f3d 13static AliRsnAnalysisTaskSEBase::EInputType inputType = AliRsnAnalysisTaskSEBase::kESDMC;
14static const char* outputFileName = "rsn.root";
15
16static Bool_t useAutoHandler = kTRUE;
17static Int_t bufferSize = 3000;
18static Int_t pidArraySize = 2000;
19static Int_t nMixedEvents = 5;
20
21static Bool_t useRsnTrackCuts = kFALSE;
22static Double_t etaRange = 10.0;
23static Double_t rsnImpactParam = 3.0;
24static Double_t ptMin = 0.0;
25
26static Bool_t useESDTrackCuts = kFALSE;
27static Double_t cov11 = 2;
28static Double_t cov22 = 2;
29static Double_t cov33 = 0.5;
30static Double_t cov44 = 0.5;
31static Double_t cov55 = 2;
32static Double_t nSigmaToVertex = 4;
33static Double_t dcaToVertex = 3.0;
34static Double_t maxChi2PerClusterTPC = 3.5;
35static Bool_t requireTPCRefit = kTRUE;
36static Bool_t requireSigmaToVertex = kTRUE;
37static Bool_t acceptKinkDaughters = kFALSE;
38static Int_t minNClustersTPC = 50;
eae5d3bb 39
40Int_t AddRsnAnalysisTask(AliAnalysisManager *mgr)
41{
42//
43// Core method of the macro.
44// Creates and initialized the analysis task object and inserts it
45// into the AnalysisManager object passed as argument.
46//
47
48 // initialize task objects and retrieve managers for PID and reading
49 AliRsnAnalysisSE *task = new AliRsnAnalysisSE("RsnAnalysisTask", bufferSize);
50 AliRsnReader *reader = task->GetReader();
51 AliRsnPID *pid = task->GetPID();
52
53 // set the input type
54 task->SetInputType(inputType, mgr, useAutoHandler);
55
56 // define event-mixing cuts
57 AliRsnCut *cutVz = new AliRsnCut("cutVz" , "", AliRsnCut::kVzDifference, 0.0, 0.5);
58 AliRsnCut *cutMult = new AliRsnCut("cutMult", "", AliRsnCut::kMultiplicityDifference, 0, 10);
59 AliRsnCutSet *cutMixing = new AliRsnCutSet("cutMixing");
60 cutMixing->AddCut(cutVz);
61 cutMixing->AddCut(cutMult);
62 cutMixing->SetCutScheme("cutVz&cutMult");
63 task->SetMixingCut(cutMixing);
64 task->SetMixingNum(nMixedEvents);
65
66 // ESD settings
67 reader->SetCheckSplit(kTRUE);
68 pid->SetPIDArraysSize(pidArraySize);
69 pid->SetPriorProbability(AliRsnPID::kElectron, 0.02);
70 pid->SetPriorProbability(AliRsnPID::kMuon, 0.02);
71 pid->SetPriorProbability(AliRsnPID::kPion, 0.83);
72 pid->SetPriorProbability(AliRsnPID::kKaon, 0.07);
73 pid->SetPriorProbability(AliRsnPID::kProton, 0.06);
74 pid->SetMaxPt(100.0);
75 pid->SetMinProb(0.0);
76
77 // default cuts for ITS+TPC
78 AliESDtrackCuts *esdCuts = reader->GetESDTrackCuts();
79 esdCuts->SetMaxCovDiagonalElements(cov11, cov22, cov33, cov44, cov55);
80 esdCuts->SetRequireSigmaToVertex(requireSigmaToVertex);
81 if (requireSigmaToVertex) esdCuts->SetMaxNsigmaToVertex(nSigmaToVertex);
82 else
83 {
84 esdCuts->SetDCAToVertexZ(dcaToVertex);
85 esdCuts->SetDCAToVertexXY(dcaToVertex);
86 }
87 esdCuts->SetRequireTPCRefit(requireTPCRefit);
88 esdCuts->SetAcceptKingDaughters(acceptKinkDaughters);
89 esdCuts->SetMinNClustersTPC(minNClustersTPC);
90 esdCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
91 reader->SetUseESDTrackCuts(useESDTrackCuts);
92
93 // default cuts from package for tracks
94 AliRsnCut *cutPt = new AliRsnCut("cutPt", "", AliRsnCut::kTransMomentumMC, ptMin, 1000000.0);
95 AliRsnCut *cutEta = new AliRsnCut("cutEtaMC", "", AliRsnCut::kEtaMC, -etaRange, etaRange);
96 AliRsnCut *cutDr = new AliRsnCut("cutDr", "", AliRsnCut::kRadialImpactParam, 0.0, rsnImpactParam);
97 AliRsnCutSet *rsnCuts = reader->GetRsnTrackCuts();
98 rsnCuts->AddCut(cutPt);
99 rsnCuts->AddCut(cutEta);
100 rsnCuts->AddCut(cutDr);
101 rsnCuts->SetCutScheme("cutPt&cutEta&cutDr");
102 reader->SetUseRsnTrackCuts(useRsnTrackCuts);
103
104 // add configs for all impact parameters
cc781f3d 105 task->AddPairMgrFromConfig("CreatePairsPhi.C");
eae5d3bb 106
107 // initialize containers
108 AliAnalysisDataContainer *input = mgr->CreateContainer("in", TChain::Class(), AliAnalysisManager::kInputContainer);
109 AliAnalysisDataContainer *dummy = mgr->CreateContainer("dummy1", TTree::Class(), AliAnalysisManager::kOutputContainer, "default");
110 AliAnalysisDataContainer *out = mgr->CreateContainer("RSN", TList::Class(), AliAnalysisManager::kOutputContainer, outputFileName);
111
112 // connect containers to AnalysisManager
113 mgr->AddTask(task);
114 mgr->ConnectInput(task, 0, input);
115 mgr->ConnectOutput(task, 0, dummy);
116 mgr->ConnectOutput(task, 1, out);
117}