Restored call to CreateDigitizer (F.Prino)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / AddAnalysisTaskRsnEff.C
CommitLineData
69fbb331 1//
2// This macro add an analysis task for computing efficiency.
3// It will have as output an AliCFContainer with several steps:
4//
5// 0) all resonances in MC which decay in the pair specified
6// 1) all resonances in ESD (i.e.: reconstruction/acceptance effect)
7// 2) subset of (1) whose daughters satisfy quality track cuts (covariance, chi square && nTPCclusters, DCA)
8// 3) subset of (2) whose daughters satisty the PID cuts
9//
10Bool_t AddAnalysisTaskRsnEff(const char *dataLabel)
11{
12 // retrieve analysis manager
13 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
14
15 // create task
16 AliRsnAnalysisEffSE *task = new AliRsnAnalysisEffSE("phiEff");
17
18 // pair definitions:
19 // phi --> K+ K-
20 AliRsnPairDef *pairPhi = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
21 task->AddPairDef(pairPhi);
22
23 // axis definition
24 // 0) transverse momentum (fixed bins of 100 MeV/c)
25 // 1) rapidity (variable bins)
26 // 2) invariant mass (fixed bins of 1 MeV/c^2)
27 Double_t y[] = {-0.8, -0.7, -0.6, -0.5, 0.5, 0.6, 0.7, 0.8};
28 Int_t ny = sizeof(y) / sizeof(y[0]);
29 AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass, 500, 0.9, 1.4);
30 AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt , 100, 0.0, 10.0);
31 AliRsnValue *axisY = new AliRsnValue("Y" , AliRsnValue::kPairY , ny, y);
32 task->AddAxis(axisIM);
33 task->AddAxis(axisPt);
34 task->AddAxis(axisY);
35
36 // define cuts for event selection:
37 // this will determine the filling of bins in the "info" histograms
38 // and should be computed as additional correction factor in efficiency
39 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
40 task->GetEventCuts()->AddCut(cutVertex);
41 task->GetEventCuts()->SetCutScheme("cutVertex");
42
43 //
44 // *** STEP 0 - All resonances which decay in the specified pairs
45 //
46 // This step does not need any kind of definition, since
47 // its requirement is automatically checked during execution,
48 // but a cut manager needs to be defined at each step, even if empty.
49 //
50 AliRsnCutManager *mgr_step0 = new AliRsnCutManager("mc_step0", "");
51
52 // add this as a step on MonteCarlo
53 task->AddStepMC (mgr_step0);
54
55 //
56 // *** STEP 1 - All resonances which decay into tracked particles
57 //
58 // This step does not need any kind of definition, since
59 // its requirement is automatically checked during execution,
60 // but a cut manager needs to be defined at each step, even if empty.
61 //
62 AliRsnCutManager *mgr_step1 = new AliRsnCutManager("mc_step0", "");
63
64 // add this as a step on reconstructed tracks
65 task->AddStepESD(mgr_step1);
66
67 //
68 // *** STEP 2 - Track quality
69 //
70
71 // track cut -----------------------
72 // --> global cuts for 2010 analysis
73 AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010("cutESD2010");
74 // ----> set the flag for sim management
75 cuts2010->SetMC(kTRUE);
76 // ----> disable checking of PID, but include also ITS stand-alone
77 cuts2010->SetCheckITS (kFALSE);
78 cuts2010->SetCheckTPC (kFALSE);
79 cuts2010->SetCheckTOF (kFALSE);
80 cuts2010->SetUseGlobal(kTRUE);
81 cuts2010->SetUseITSSA (kTRUE);
82 // ----> set defaults for the rest
83 cuts2010->InitializeToDefaults(kTRUE);
84
85 // cut sets ---------------------------------
86 // --> only common cuts for tracks are needed
87 // --> standard 2010 cuts are applied only when working on ESD
88 AliRsnCutSet *cutSetDaughterCommon_step2 = new AliRsnCutSet("commonDaughterCuts_step2", AliRsnCut::kDaughter);
89 cutSetDaughterCommon_step2->AddCut(cuts2010);
90 cutSetDaughterCommon_step2->SetCutScheme(cuts2010->GetName());
91 AliRsnCutManager *mgr_step2 = new AliRsnCutManager("esd_step2", "");
92 mgr_step2->SetCommonDaughterCuts(cutSetDaughterCommon_step2);
93
94 // add this as a step on reconstructed tracks
95 task->AddStepESD(mgr_step2);
96
97 //
98 // *** STEP 3 - PID
99 //
100
101 // track cut -----------------------
102 // --> global cuts for 2010 analysis
103 AliRsnCutESD2010 *cuts2010_pid = new AliRsnCutESD2010("cutESD2010_pid");
104 // ----> set the flag for sim/data management
105 cuts2010_pid->SetMC(kTRUE);
106 // ----> enable PID checking
107 cuts2010_pid->SetCheckITS (kTRUE);
108 cuts2010_pid->SetCheckTPC (kTRUE);
109 cuts2010_pid->SetCheckTOF (kTRUE);
110 cuts2010_pid->SetUseGlobal(kTRUE);
111 cuts2010_pid->SetUseITSSA (kTRUE);
112 // ----> set defaults for the rest
113 cuts2010_pid->InitializeToDefaults(kTRUE);
114
115 // cut sets ---------------------------------
116 // --> only common cuts for tracks are needed
117 // --> standard 2010 cuts are applied only when working on ESD
118 AliRsnCutSet *cutSetDaughterCommon_step3 = new AliRsnCutSet("commonDaughterCuts_step3", AliRsnCut::kDaughter);
119 cutSetDaughterCommon_step3->AddCut(cuts2010_pid);
120 cutSetDaughterCommon_step3->SetCutScheme(cuts2010_pid->GetName());
121 AliRsnCutManager *mgr_step3 = new AliRsnCutManager("esd_step3", "");
122 mgr_step3->SetCommonDaughterCuts(cutSetDaughterCommon_step3);
123
124 // add this as a step on reconstructed tracks
125 task->AddStepESD(mgr_step3);
126
127 // add task to manager and setup containers
128 mgr->AddTask(task);
129 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
130
131 // create paths for the output in the common file
132 Char_t commonPath[500];
133 sprintf(commonPath, "%s", AliAnalysisManager::GetCommonFileName());
134
135 // create paths for the output in the common file
136 AliAnalysisDataContainer *outputInfo = mgr->CreateContainer("RsnInfoEff", TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
137 AliAnalysisDataContainer *outputHist = mgr->CreateContainer("RsnEff" , TList::Class(), AliAnalysisManager::kOutputContainer, commonPath);
138 mgr->ConnectOutput(task, 1, outputInfo);
139 mgr->ConnectOutput(task, 2, outputHist);
140
141 return kTRUE;
142}