Restored call to CreateDigitizer (F.Prino)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / train / LHC2010-pp7TeV / RsnConfigPhiRes.C
CommitLineData
d2ba49cb 1//
2// This function configures the entire task for all resonances the user is interested in.
3// This is done by creating all configuration objects which are defined in the package.
4//
5// Generally speaking, one has to define the following objects for each resonance:
6//
7// 1 - an AliRsnPairDef to define the resonance decay channel to be studied
8// 2 - an AliRsnPair{Ntuple|Functions} where the output is stored
9// 3 - one or more AliRsnCut objects to define track selections
10// which will have then to be organized into AliRsnCutSet objects
11// 4 - an AliRsnCutManager to include all cuts to be applied (see point 3)
12// 5 - definitions to build the TNtuple or histograms which are returned
13//
14// The return value is used to know if the configuration was successful
15//
6aff5015 16Bool_t RsnConfigPhiRes
d2ba49cb 17(
18 const char *taskName,
19 const char *options,
d2ba49cb 20 const char *path
21)
22{
6aff5015 23 // retrieve analysis manager & task and exit in case of failure
24 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
25 AliRsnAnalysisSE *task = (AliRsnAnalysisSE*)mgr->GetTask(taskName);
26 if (!task)
27 {
28 Error("RsnConfigPhi", "Task not found");
29 return kFALSE;
30 }
31
d2ba49cb 32 // load useful macros
33 gROOT->LoadMacro(Form("%s/QualityCutsITS.C", path));
34 gROOT->LoadMacro(Form("%s/QualityCutsTPC.C", path));
35
36 // interpret the useful information from second argument
37 TString opt(options);
6aff5015 38 TString suffix("_pid");
39 Bool_t isSim = opt.Contains("sim");
40 Bool_t isData = opt.Contains("data");
41 Bool_t addITSSA = opt.Contains("its");
42 if (!isSim && !isData)
d2ba49cb 43 {
6aff5015 44 Error("RsnConfigPhi", "Required to know if working on data or MC");
d2ba49cb 45 return kFALSE;
46 }
6aff5015 47 if (addITSSA) suffix += "_its";
d2ba49cb 48
6aff5015 49 // define some names using a standard part plus the above suffix
50 TString truePMname(suffix);
51 TString esdCutName(suffix);
52
53 truePMname.Prepend("TruePM");
54 esdCutName.Prepend("cutESD2010");
d2ba49cb 55
d2ba49cb 56 //
6aff5015 57 // -- Setup pair definition (phi decay trees) and pairs ------------------------------------------
d2ba49cb 58 //
59
60 // decay channels
61 AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
62
63 // computation objects
6aff5015 64 AliRsnPairFunctions *truePM = new AliRsnPairFunctions(truePMname.Data(), pairDefPM);
65
66 // set additional option for true pairs
67 truePM->SetOnlyTrue (kTRUE);
68 truePM->SetCheckDecay(kTRUE);
69
70 //
71 // -- Setup event cuts ----------------------------------------------------------------------------
72 //
73
74 // cut on primary vertex:
75 // - 2nd argument = 10.0 --> require |Vz| <= 10 cm
76 // - 3rd argument = 0 --> disable check on number of contributors
77 // - 4th argument = 'kFALSE' --> reject TPC stand-alone primary vertex
78 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
79
80 // check pile-up with SPD
81 cutVertex->SetCheckPileUp(kTRUE);
d2ba49cb 82
83 //
6aff5015 84 // -- Setup single track cuts ---------------------------------------------------------------------
d2ba49cb 85 //
86
6aff5015 87 // cut on track quality/PID:
88 // 2nd argument (variable) --> 'kTRUE' for MonteCarlo, 'kFALSE' for data
89 AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010(esdCutName.Data(), isSim);
90
91 // specify that PID is for kaons
d2ba49cb 92 cuts2010->SetPID(AliPID::kKaon);
6aff5015 93
94 // TPC+ITS tracks are always added, ITS-SA depends on options
d2ba49cb 95 cuts2010->SetUseITSTPC(kTRUE);
96 cuts2010->SetUseITSSA (addITSSA);
6aff5015 97
98 // set quality cuts according to standard macro (defined outside)
d2ba49cb 99 cuts2010->CopyCutsTPC(QualityCutsTPC());
100 cuts2010->CopyCutsITS(QualityCutsITS());
6aff5015 101
102 // add always the PID check
103 cuts2010->SetCheckITS(kTRUE);
104 cuts2010->SetCheckTPC(kTRUE);
105 cuts2010->SetCheckTOF(kTRUE);
106
107 // set the ITS PID-related variables
d2ba49cb 108 cuts2010->SetITSband(3.0);
6aff5015 109
110 // set the TPC PID-related variables
d2ba49cb 111 Double_t bbPar[5];
6aff5015 112 if (isSim)
113 {
114 bbPar[0] = 2.15898 / 50.0;
115 bbPar[1] = 1.75295E1;
116 bbPar[2] = 3.40030E-9;
117 bbPar[3] = 1.96178;
118 bbPar[4] = 3.91720;
119 }
120 else
121 {
122 bbPar[0] = 1.41543 / 50.0;
123 bbPar[1] = 2.63394E1;
124 bbPar[2] = 5.0411E-11;
125 bbPar[3] = 2.12543;
126 bbPar[4] = 4.88663;
127 }
d2ba49cb 128 cuts2010->SetTPCrange(3.0, 5.0);
129 cuts2010->SetTPCpLimit(0.35);
130 cuts2010->GetESDpid()->GetTPCResponse().SetBetheBlochParameters(bbPar[0], bbPar[1], bbPar[2], bbPar[3], bbPar[4]);
6aff5015 131
132 // set the TOF PID-related variables
d2ba49cb 133 cuts2010->SetTOFrange(-3.0, 3.0);
134
6aff5015 135 //
136 // -- Setup track pair cuts -----------------------------------------------------------------------
137 //
138
139 // rapidity window
140 AliRsnCutValue *cutY = new AliRsnCutValue("cutY", AliRsnValue::kPairY, -0.5, 0.5);
141
142 // this cut requires a support object to retrieve default mass
d2ba49cb 143 cutY->GetValueObj()->SetSupportObject(pairDefPM);
6aff5015 144
145 //
146 // -- Add cuts to cut collections -----------------------------------------------------------------
147 //
148
149 // event cuts are added directly to task, and only the first time
150 if (task->GetEventCuts()->GetCuts()->FindObject("cutVertex") == 0x0)
151 {
152 task->GetEventCuts()->AddCut(cutVertex);
153 task->GetEventCuts()->SetCutScheme("cutVertex");
154 }
155
156 // single track cuts are added to each pair as common ones for both daughters
d2ba49cb 157 truePM->GetCutManager()->GetCommonDaughterCuts()->AddCut(cuts2010);
158 truePM->GetCutManager()->GetCommonDaughterCuts()->SetCutScheme(cuts2010->GetName());
159
6aff5015 160 // pair cuts are added to each pair
d2ba49cb 161 truePM->GetCutManager()->GetMotherCuts()->AddCut(cutY);
162 truePM->GetCutManager()->GetMotherCuts()->SetCutScheme(cutY->GetName());
d2ba49cb 163
164 //
165 // -- Setup functions -----------------------------------------------------------------------------
166 //
167
168 // axis definition
169 // 0) invariant mass
170 // 1) transverse momentum
6aff5015 171 // 2) multiplicity (variable binning)
172 Double_t mult[] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., 22., 23., 24., 25., 30., 35., 40., 50., 60., 70., 80., 90., 100., 120., 140., 160., 180., 200., 1E+8};
173 Int_t nmult = sizeof(mult) / sizeof(mult[0]);
174 AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMassRes , -10.0, 10.0, 0.01);
175 AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt , 0.0, 5.0, 0.10);
d2ba49cb 176 AliRsnValue *axisMult = new AliRsnValue("M" , AliRsnValue::kEventMultESDCuts, nmult, mult);
177
6aff5015 178 // multiplicity axis needs a support object
179 // of type AliESDtrackCuts, correctly configured
d2ba49cb 180 AliESDtrackCuts *cuts = new AliESDtrackCuts(QualityCutsTPC());
181 axisMult->SetSupportObject(cuts);
182
183 // create function and add axes
184 AliRsnFunction *fcn = new AliRsnFunction;
185 if ( !fcn->AddAxis(axisIM ) ) return kFALSE;
186 if ( !fcn->AddAxis(axisPt ) ) return kFALSE;
187 if ( !fcn->AddAxis(axisMult) ) return kFALSE;
188
189 // add functions to pairs
190 truePM->AddFunction(fcn);
191
192 //
193 // -- Conclusion ----------------------------------------------------------------------------------
194 //
195
196 // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task
197 task->GetAnalysisManager()->Add(truePM);
198
199 return kTRUE;
200}