Restored call to CreateDigitizer (F.Prino)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / test / ConfigTaskRsn2010.C
CommitLineData
2dab9030 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//
16Bool_t RsnConfigTask(AliRsnAnalysisSE* &task, const char *dataLabel)
17{
18 // for safety, return if no task is passed
19 if (!task)
20 {
21 Error("ConfigTaskRsn", "Task not found");
22 return kFALSE;
23 }
24
25 // interpret the useful information from second argument
26 TString strDataLabel(dataLabel);
27 Bool_t isESD = strDataLabel.Contains("ESD");
28 Bool_t isAOD = strDataLabel.Contains("AOD");
29 Bool_t isSim = strDataLabel.Contains("sim");
30 Bool_t isData = strDataLabel.Contains("data");
31 Bool_t isPass1 = strDataLabel.Contains("pass1");
32 Bool_t isPass2 = strDataLabel.Contains("pass2");
0d73200d 33 Bool_t isPID = strDataLabel.Contains("PID");
2dab9030 34
35 //
36 // -- Set cuts for events (applied to all analyses) -----------------------------------------------
37 //
38
39 // primary vertex range
0d73200d 40 AliRsnCutPrimaryVertex *cutVertex = new AliRsnCutPrimaryVertex("cutVertex", 10.0, 0, kFALSE);
2dab9030 41 AliRsnCutSet *cutSetEvent = new AliRsnCutSet("eventCuts", AliRsnCut::kEvent);
42 cutSetEvent->AddCut(cutVertex);
43 cutSetEvent->SetCutScheme("cutVertex");
44 task->SetEventCuts(cutSetEvent);
45
46 //
47 // -- Setup pairs ---------------------------------------------------------------------------------
48 //
49
50 // decay channels
51 AliRsnPairDef *pairDefPM = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '-', 333, 1.019455);
52 AliRsnPairDef *pairDefPP = new AliRsnPairDef(AliPID::kKaon, '+', AliPID::kKaon, '+', 333, 1.019455);
53 AliRsnPairDef *pairDefMM = new AliRsnPairDef(AliPID::kKaon, '-', AliPID::kKaon, '-', 333, 1.019455);
54
55 // computation objects
02e8aa99 56 //AliRsnPairNtuple *pairPM = new AliRsnPairNtuple("PairPM" , pairDefPM);
57 //AliRsnPairNtuple *truePM = new AliRsnPairNtuple("TruePM" , pairDefPM);
58 //AliRsnPairNtuple *pairPP = new AliRsnPairNtuple("PairPP" , pairDefPP);
59 //AliRsnPairNtuple *pairMM = new AliRsnPairNtuple("PairMM" , pairDefMM);
0d73200d 60 AliRsnPairFunctions *pairPM = new AliRsnPairFunctions(Form("PairPM%s", (isPID ? "pid" : "nopid")), pairDefPM);
61 AliRsnPairFunctions *truePM = new AliRsnPairFunctions(Form("TruePM%s", (isPID ? "pid" : "nopid")), pairDefPM);
62 AliRsnPairFunctions *pairPP = new AliRsnPairFunctions(Form("PairPP%s", (isPID ? "pid" : "nopid")), pairDefPP);
63 AliRsnPairFunctions *pairMM = new AliRsnPairFunctions(Form("PairMM%s", (isPID ? "pid" : "nopid")), pairDefMM);
2dab9030 64
65 //
66 // -- Setup cuts ----------------------------------------------------------------------------------
67 //
68
69 // track cut -----------------------
70 // --> global cuts for 2010 analysis
0d73200d 71 AliRsnCutESD2010 *cuts2010 = new AliRsnCutESD2010(Form("cutESD2010%s", (isPID ? "pid" : "nopid")));
2dab9030 72 // ----> set the flag for sim/data management
73 cuts2010->SetMC(isSim);
0d73200d 74 // ----> require to check PID or not, depending on the label
75 cuts2010->SetCheckITS(isPID);
76 cuts2010->SetCheckTPC(isPID);
77 cuts2010->SetCheckTOF(isPID);
78 // ----> set TPC rangeisPID and calibration
2dab9030 79 cuts2010->SetTPCrange(5.0, 3.0);
80 cuts2010->SetTPCpLimit(0.35);
81 cuts2010->SetITSband(4.0);
82 if (isSim) cuts2010->SetTPCpar(2.15898 / 50.0, 1.75295E1, 3.40030E-9, 1.96178, 3.91720);
83 else cuts2010->SetTPCpar(1.41543 / 50.0, 2.63394E1, 5.0411E-11, 2.12543, 4.88663);
84 // ----> set standard quality cuts for TPC global tracks
85 cuts2010->GetCutsTPC()->SetRequireTPCStandAlone(kTRUE); // require to have the projection at inner TPC wall
86 cuts2010->GetCutsTPC()->SetMinNClustersTPC(70);
87 cuts2010->GetCutsTPC()->SetMaxChi2PerClusterTPC(4);
88 cuts2010->GetCutsTPC()->SetAcceptKinkDaughters(kFALSE);
89 cuts2010->GetCutsTPC()->SetRequireTPCRefit(kTRUE);
90 cuts2010->GetCutsTPC()->SetRequireITSRefit(kTRUE);
91 cuts2010->GetCutsTPC()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
92 cuts2010->GetCutsTPC()->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9"); // DCA pt dependent: 7*(0.0050+0.0060/pt0.9)
93 cuts2010->GetCutsTPC()->SetMaxDCAToVertexZ(1e6); // disabled
94 cuts2010->GetCutsTPC()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
95 cuts2010->GetCutsTPC()->SetRequireSigmaToVertex(kFALSE);
96 // ----> set standard quality cuts for ITS standalone tracks
97 cuts2010->GetCutsITS()->SetRequireITSStandAlone(kTRUE, kTRUE);
98 cuts2010->GetCutsITS()->SetRequireITSRefit(kTRUE);
99 cuts2010->GetCutsITS()->SetMinNClustersITS(4);
100 cuts2010->GetCutsITS()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
101 cuts2010->GetCutsITS()->SetMaxChi2PerClusterITS(1.);
102 cuts2010->GetCutsITS()->SetMaxDCAToVertexXYPtDep("0.0595+0.0182/pt^1.55"); // DCA pt dependent
103 cuts2010->GetCutsITS()->SetMaxDCAToVertexZ(1e6); // disabled
104 cuts2010->GetCutsITS()->SetDCAToVertex2D(kFALSE); // each DCA is checked separately
105 // ----> set the configuration for TOF PID checks
106 if (isData && (isPass1 || isPass2))
107 {
108 cuts2010->SetTOFcalibrateESD(kTRUE);
109 //if (isPass2) cuts2010->SetTOFcalibrateESD(kFALSE); // potrebbe anche essere kFALSE
110 cuts2010->SetTOFcorrectTExp(kTRUE);
111 cuts2010->SetTOFuseT0(kTRUE);
112 cuts2010->SetTOFtuneMC(kFALSE);
113 cuts2010->SetTOFresolution(100.0);
114 }
115 else if (isSim)
116 {
117 cuts2010->SetTOFcalibrateESD(kFALSE);
118 cuts2010->SetTOFcorrectTExp(kTRUE);
119 cuts2010->SetTOFuseT0(kTRUE);
120 cuts2010->SetTOFtuneMC(kTRUE);
121 cuts2010->SetTOFresolution(100.0);
122 }
123 // ----> initialize cut (creates the AliESDpid, AliTOFcalib and AliTOFT0maker inside)
124 cuts2010->Initialize();
125
126 // cut sets ---------------------------------
127 // --> only common cuts for tracks are needed
128 AliRsnCutSet *cutSetDaughterCommon = new AliRsnCutSet("commonDaughterCuts", AliRsnCut::kDaughter);
129 cutSetDaughterCommon->AddCut(cuts2010);
0d73200d 130 cutSetDaughterCommon->SetCutScheme(cuts2010->GetName());
2dab9030 131
132 // configure cut managers -------------------
133 pairPM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
134 truePM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
135 pairPP->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
136 pairMM->GetCutManager()->SetCommonDaughterCuts(cutSetDaughterCommon);
137
138 // set additional option for true pairs when needed
139 truePM->SetOnlyTrue();
140
141 //
142 // -- Setup functions -----------------------------------------------------------------------------
143 //
144
145 // function axes
0d73200d 146 AliRsnValue *axisIM = new AliRsnValue("IM", AliRsnValue::kPairInvMass, 4000, 0.9, 4.9);
147 AliRsnValue *axisPt = new AliRsnValue("PT", AliRsnValue::kPairPt, 100, 0.0, 10.0);
148 AliRsnValue *axisY[4];
149 axisY[0] = new AliRsnValue("Y1", AliRsnValue::kPairY, 1, -0.5, 0.5);
150 axisY[1] = new AliRsnValue("Y2", AliRsnValue::kPairY, 1, -0.6, 0.6);
151 axisY[2] = new AliRsnValue("Y3", AliRsnValue::kPairY, 1, -0.7, 0.7);
152 axisY[3] = new AliRsnValue("Y4", AliRsnValue::kPairY, 1, -0.8, 0.8);
2dab9030 153
154 // the ntuple output requires to get directly the values
02e8aa99 155 //pairPM->AddValue(axisIM);
156 //pairPM->AddValue(axisPt);
157 //pairPM->AddValue(axisEta);
158 //truePM->AddValue(axisIM);
159 //truePM->AddValue(axisPt);
160 //truePM->AddValue(axisEta);
161 //pairPP->AddValue(axisIM);
162 //pairPP->AddValue(axisPt);
163 //pairPP->AddValue(axisEta);
164 //pairMM->AddValue(axisIM);
165 //pairMM->AddValue(axisPt);
166 //pairMM->AddValue(axisEta);
167
168 // functions
0d73200d 169 AliRsnFunction *fcnImPtY[4];
170 for (Int_t i = 0; i < 4; i++)
171 {
172 fcnImPtY[i] = new AliRsnFunction;
173 //fcnImPtY->UseSparse();
174 // --> add axes
175 fcnImPtY[i]->AddAxis(axisIM);
176 fcnImPtY[i]->AddAxis(axisPt);
177 fcnImPtY[i]->AddAxis(axisY[i]);
02e8aa99 178
0d73200d 179 // add functions to pairs
180 pairPM->AddFunction(fcnImPtY[i]);
181 truePM->AddFunction(fcnImPtY[i]);
182 pairPP->AddFunction(fcnImPtY[i]);
183 pairMM->AddFunction(fcnImPtY[i]);
184 }
02e8aa99 185
2dab9030 186 //
187 // -- Conclusion ----------------------------------------------------------------------------------
188 //
189
190 // add all created AliRsnPair objects to the AliRsnAnalysisManager in the task
191 task->GetAnalysisManager()->Add(pairPM);
192 task->GetAnalysisManager()->Add(truePM);
193 task->GetAnalysisManager()->Add(pairPP);
194 task->GetAnalysisManager()->Add(pairMM);
195
196 return kTRUE;
197}