]>
Commit | Line | Data |
---|---|---|
a25935a9 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2009, 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 | * Permission to use, copy, modify and distribute this software and its * | |
7 | * documentation strictly for non-commercial purposes is hereby granted * | |
8 | * without fee, provided that the above copyright notice appears in all * | |
9 | * copies and that both the copyright notice and this permission notice * | |
10 | * appear in the supporting documentation. The authors make no claims * | |
11 | * about the suitability of this software for any purpose. It is * | |
12 | * provided "as is" without express or implied warranty. * | |
13 | **************************************************************************/ | |
14 | //************************************************************************* | |
15 | // Class AliAnalysisTaskMEVertexingHF | |
16 | // AliAnalysisTaskME for event mixing, building the background for | |
17 | // heavy-flavour decay candidates | |
18 | // Author: R.Romita, r.romita@gsi.de | |
19 | //************************************************************************* | |
20 | ||
21 | ||
22 | ||
23 | #include "TH1F.h" | |
24 | #include "TObjArray.h" | |
25 | #include "TList.h" | |
26 | #include "TROOT.h" | |
27 | #include "TSystem.h" | |
28 | #include "TCanvas.h" | |
29 | ||
30 | #include "AliVEvent.h" | |
31 | #include "AliVVertex.h" | |
32 | #include "AliAODEvent.h" | |
33 | #include "AliESDEvent.h" | |
34 | #include "AliAnalysisVertexingHF.h" | |
35 | #include "AliMixedEvent.h" | |
36 | #include "AliAnalysisTaskMEVertexingHF.h" | |
37 | #include "AliAnalysisManager.h" | |
38 | #include "AliMultiEventInputHandler.h" | |
39 | ||
40 | ClassImp(AliAnalysisTaskMEVertexingHF) | |
41 | ||
42 | //________________________________________________________________________ | |
43 | AliAnalysisTaskMEVertexingHF::AliAnalysisTaskMEVertexingHF(const char *name) : | |
44 | AliAnalysisTaskME(name), | |
45 | fvHF(0), | |
46 | fMixedEvent(), | |
47 | fVerticesHFTClArr(0), | |
48 | fD0toKpiTClArr(0), | |
49 | fJPSItoEleTClArr(0), | |
50 | fCharm3ProngTClArr(0), | |
51 | fCharm4ProngTClArr(0), | |
52 | fDstarTClArr(0), | |
a07ad8e0 | 53 | fCascadesTClArr(0), |
a25935a9 | 54 | fLikeSign2ProngTClArr(0), |
55 | fLikeSign3ProngTClArr(0) | |
56 | { | |
57 | // Constructor | |
58 | } | |
59 | //________________________________________________________________________ | |
60 | void AliAnalysisTaskMEVertexingHF::Init() | |
61 | { | |
62 | // Initialization | |
63 | // Instanciates vHF and loads its parameters | |
64 | // Some parameters are changed | |
65 | ||
66 | if(gROOT->LoadMacro("ConfigVertexingHF.C")) { | |
67 | printf("AnalysisTaskMEVertexingHF::Init() \n Using $ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C\n"); | |
68 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C"); | |
69 | } | |
70 | fvHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); | |
71 | fvHF->SetMixEventOn(); | |
72 | fvHF->SetInputAOD(); | |
73 | fvHF->PrintStatus(); | |
74 | if(fvHF->GetLikeSign()) { | |
75 | printf("WARNING: fLikeSign will be switched off!"); | |
76 | fvHF->SetLikeSignOff(); | |
77 | } | |
78 | if(fvHF->GetRecoPrimVtxSkippingTrks() || fvHF->GetRmTrksFromPrimVtx()){ | |
79 | fvHF->UnsetRecoPrimVtxSkippingTrks(); | |
80 | printf("WARNING: if on, fRecoPrimVtxSkippingTrks and fRmTrksFromPrimVtx will be switched off!\n"); | |
81 | } | |
82 | ||
83 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile("AliAOD.VertexingHF.root"); | |
84 | ||
85 | return; | |
86 | } | |
87 | //________________________________________________________________________ | |
88 | void AliAnalysisTaskMEVertexingHF::UserCreateOutputObjects() | |
89 | { | |
90 | // Create the output container | |
91 | ||
92 | ||
93 | if (!AODEvent()) { | |
94 | Fatal("UserCreateOutputObjects", "This task needs an AOD handler"); | |
95 | return; | |
96 | } | |
97 | ||
98 | if(!fvHF) { | |
99 | printf("AnalysisTaskMEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n"); | |
100 | return; | |
101 | } | |
102 | fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0); | |
103 | fVerticesHFTClArr->SetName("VerticesHF"); | |
104 | AddAODBranch("TClonesArray", &fVerticesHFTClArr); | |
105 | if(fvHF->GetD0toKpi()) { | |
106 | fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
107 | fD0toKpiTClArr->SetName("D0toKpi"); | |
108 | AddAODBranch("TClonesArray", &fD0toKpiTClArr); | |
109 | } | |
110 | if(fvHF->GetJPSItoEle()) { | |
111 | fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
112 | fJPSItoEleTClArr->SetName("JPSItoEle"); | |
113 | AddAODBranch("TClonesArray", &fJPSItoEleTClArr); | |
114 | } | |
115 | if(fvHF->Get3Prong()) { | |
116 | fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0); | |
117 | fCharm3ProngTClArr->SetName("Charm3Prong"); | |
118 | AddAODBranch("TClonesArray", &fCharm3ProngTClArr); | |
119 | } | |
120 | if(fvHF->Get4Prong()) { | |
121 | fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0); | |
122 | fCharm4ProngTClArr->SetName("Charm4Prong"); | |
123 | AddAODBranch("TClonesArray", &fCharm4ProngTClArr); | |
124 | } | |
125 | ||
126 | if(fvHF->GetDstar()) { | |
127 | fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0); | |
128 | fDstarTClArr->SetName("Dstar"); | |
129 | AddAODBranch("TClonesArray", &fDstarTClArr); | |
130 | } | |
131 | ||
a07ad8e0 | 132 | if(fvHF->GetCascades()){ |
133 | fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0); | |
134 | fCascadesTClArr->SetName("CascadesHF"); | |
135 | AddAODBranch("TClonesArray", &fCascadesTClArr); | |
136 | } | |
137 | ||
a25935a9 | 138 | if(fvHF->GetLikeSign()) { |
139 | fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
140 | fLikeSign2ProngTClArr->SetName("LikeSign2Prong"); | |
141 | AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr); | |
142 | } | |
143 | ||
144 | if(fvHF->GetLikeSign() && fvHF->Get3Prong()) { | |
145 | fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0); | |
146 | fLikeSign3ProngTClArr->SetName("LikeSign3Prong"); | |
147 | AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr); | |
148 | } | |
149 | ||
150 | return; | |
151 | } | |
152 | ||
153 | //________________________________________________________________________ | |
154 | void AliAnalysisTaskMEVertexingHF::UserExec(Option_t *) | |
155 | { | |
156 | // Execute analysis for current event: | |
157 | // first build the mixed event, compute the new primary vtx | |
158 | // then heavy flavor vertexing | |
159 | ||
160 | Int_t nev = fInputHandler->GetBufferSize(); | |
161 | fMixedEvent = new AliMixedEvent(); | |
162 | fMixedEvent->Reset(); | |
163 | TString primTitle; | |
164 | TString primTitleFirst; | |
461c10a0 | 165 | AliAODVertex *vtxCopy=0; |
a25935a9 | 166 | |
167 | TObjArray *vertices=new TObjArray(nev); | |
168 | for (Int_t iev = 0; iev < nev; iev++) { | |
169 | AliAODEvent *evt = (AliAODEvent*)GetEvent(iev); | |
170 | if(!evt) {delete vertices;return;} | |
171 | AliAODVertex *evtVtx=(AliAODVertex*)evt->GetPrimaryVertex(); | |
172 | if(!evtVtx) {delete vertices;return;} | |
173 | primTitle = evtVtx->GetTitle(); | |
174 | Int_t nContrib=evtVtx->GetNContributors(); | |
175 | if(!primTitle.Contains("VertexerTracks") || nContrib<=0) { | |
176 | delete vertices; | |
177 | return; | |
178 | } | |
179 | ||
461c10a0 | 180 | vtxCopy=new AliAODVertex(*evtVtx); |
a25935a9 | 181 | primTitleFirst=evtVtx->GetTitle(); |
182 | ||
183 | ||
184 | fMixedEvent->AddEvent(evt); | |
185 | ||
186 | vertices->AddLast(vtxCopy); | |
187 | } | |
188 | ||
189 | ||
190 | fMixedEvent->Init(); | |
191 | Double_t vtxPos[3]={0.,0.,0.},vtxSigma[3]={0.,0.,0.}; | |
192 | Int_t nContributors[1]={0}; | |
193 | Double_t chi2=0; | |
194 | Bool_t primaryOk=fMixedEvent->ComputeVtx(vertices,vtxPos,vtxSigma,nContributors); | |
461c10a0 | 195 | if(!primaryOk) { |
196 | delete vertices; | |
197 | delete vtxCopy; | |
198 | vtxCopy=NULL; | |
199 | return; | |
200 | } | |
a25935a9 | 201 | Int_t contribCopy=nContributors[0]; |
202 | AliVVertex* newVertex=new AliESDVertex(vtxPos,vtxSigma,chi2,contribCopy); | |
203 | newVertex->SetTitle(primTitleFirst.Data()); | |
204 | fMixedEvent->SetPrimaryVertex(newVertex); | |
205 | ||
206 | delete vertices; | |
461c10a0 | 207 | delete vtxCopy; |
208 | vtxCopy=NULL; | |
a25935a9 | 209 | |
210 | fvHF->FindCandidates(fMixedEvent, | |
211 | fVerticesHFTClArr, | |
212 | fD0toKpiTClArr, | |
213 | fJPSItoEleTClArr, | |
214 | fCharm3ProngTClArr, | |
215 | fCharm4ProngTClArr, | |
216 | fDstarTClArr, | |
a07ad8e0 | 217 | fCascadesTClArr, |
a25935a9 | 218 | fLikeSign2ProngTClArr, |
219 | fLikeSign3ProngTClArr); | |
220 | ||
461c10a0 | 221 | delete newVertex; |
a25935a9 | 222 | return; |
223 | } | |
224 | ||
225 | //________________________________________________________________________ | |
226 | void AliAnalysisTaskMEVertexingHF::Terminate(Option_t *) | |
227 | { | |
228 | // Terminate analysis | |
229 | } |