]>
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), | |
53 | fLikeSign2ProngTClArr(0), | |
54 | fLikeSign3ProngTClArr(0) | |
55 | { | |
56 | // Constructor | |
57 | } | |
58 | //________________________________________________________________________ | |
59 | void AliAnalysisTaskMEVertexingHF::Init() | |
60 | { | |
61 | // Initialization | |
62 | // Instanciates vHF and loads its parameters | |
63 | // Some parameters are changed | |
64 | ||
65 | if(gROOT->LoadMacro("ConfigVertexingHF.C")) { | |
66 | printf("AnalysisTaskMEVertexingHF::Init() \n Using $ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C\n"); | |
67 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C"); | |
68 | } | |
69 | fvHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); | |
70 | fvHF->SetMixEventOn(); | |
71 | fvHF->SetInputAOD(); | |
72 | fvHF->PrintStatus(); | |
73 | if(fvHF->GetLikeSign()) { | |
74 | printf("WARNING: fLikeSign will be switched off!"); | |
75 | fvHF->SetLikeSignOff(); | |
76 | } | |
77 | if(fvHF->GetRecoPrimVtxSkippingTrks() || fvHF->GetRmTrksFromPrimVtx()){ | |
78 | fvHF->UnsetRecoPrimVtxSkippingTrks(); | |
79 | printf("WARNING: if on, fRecoPrimVtxSkippingTrks and fRmTrksFromPrimVtx will be switched off!\n"); | |
80 | } | |
81 | ||
82 | AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile("AliAOD.VertexingHF.root"); | |
83 | ||
84 | return; | |
85 | } | |
86 | //________________________________________________________________________ | |
87 | void AliAnalysisTaskMEVertexingHF::UserCreateOutputObjects() | |
88 | { | |
89 | // Create the output container | |
90 | ||
91 | ||
92 | if (!AODEvent()) { | |
93 | Fatal("UserCreateOutputObjects", "This task needs an AOD handler"); | |
94 | return; | |
95 | } | |
96 | ||
97 | if(!fvHF) { | |
98 | printf("AnalysisTaskMEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n"); | |
99 | return; | |
100 | } | |
101 | fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0); | |
102 | fVerticesHFTClArr->SetName("VerticesHF"); | |
103 | AddAODBranch("TClonesArray", &fVerticesHFTClArr); | |
104 | if(fvHF->GetD0toKpi()) { | |
105 | fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
106 | fD0toKpiTClArr->SetName("D0toKpi"); | |
107 | AddAODBranch("TClonesArray", &fD0toKpiTClArr); | |
108 | } | |
109 | if(fvHF->GetJPSItoEle()) { | |
110 | fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
111 | fJPSItoEleTClArr->SetName("JPSItoEle"); | |
112 | AddAODBranch("TClonesArray", &fJPSItoEleTClArr); | |
113 | } | |
114 | if(fvHF->Get3Prong()) { | |
115 | fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0); | |
116 | fCharm3ProngTClArr->SetName("Charm3Prong"); | |
117 | AddAODBranch("TClonesArray", &fCharm3ProngTClArr); | |
118 | } | |
119 | if(fvHF->Get4Prong()) { | |
120 | fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0); | |
121 | fCharm4ProngTClArr->SetName("Charm4Prong"); | |
122 | AddAODBranch("TClonesArray", &fCharm4ProngTClArr); | |
123 | } | |
124 | ||
125 | if(fvHF->GetDstar()) { | |
126 | fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0); | |
127 | fDstarTClArr->SetName("Dstar"); | |
128 | AddAODBranch("TClonesArray", &fDstarTClArr); | |
129 | } | |
130 | ||
131 | if(fvHF->GetLikeSign()) { | |
132 | fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); | |
133 | fLikeSign2ProngTClArr->SetName("LikeSign2Prong"); | |
134 | AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr); | |
135 | } | |
136 | ||
137 | if(fvHF->GetLikeSign() && fvHF->Get3Prong()) { | |
138 | fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0); | |
139 | fLikeSign3ProngTClArr->SetName("LikeSign3Prong"); | |
140 | AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr); | |
141 | } | |
142 | ||
143 | return; | |
144 | } | |
145 | ||
146 | //________________________________________________________________________ | |
147 | void AliAnalysisTaskMEVertexingHF::UserExec(Option_t *) | |
148 | { | |
149 | // Execute analysis for current event: | |
150 | // first build the mixed event, compute the new primary vtx | |
151 | // then heavy flavor vertexing | |
152 | ||
153 | Int_t nev = fInputHandler->GetBufferSize(); | |
154 | fMixedEvent = new AliMixedEvent(); | |
155 | fMixedEvent->Reset(); | |
156 | TString primTitle; | |
157 | TString primTitleFirst; | |
158 | ||
159 | ||
160 | TObjArray *vertices=new TObjArray(nev); | |
161 | for (Int_t iev = 0; iev < nev; iev++) { | |
162 | AliAODEvent *evt = (AliAODEvent*)GetEvent(iev); | |
163 | if(!evt) {delete vertices;return;} | |
164 | AliAODVertex *evtVtx=(AliAODVertex*)evt->GetPrimaryVertex(); | |
165 | if(!evtVtx) {delete vertices;return;} | |
166 | primTitle = evtVtx->GetTitle(); | |
167 | Int_t nContrib=evtVtx->GetNContributors(); | |
168 | if(!primTitle.Contains("VertexerTracks") || nContrib<=0) { | |
169 | delete vertices; | |
170 | return; | |
171 | } | |
172 | ||
173 | AliAODVertex *vtxCopy=new AliAODVertex(*evtVtx); | |
174 | primTitleFirst=evtVtx->GetTitle(); | |
175 | ||
176 | ||
177 | fMixedEvent->AddEvent(evt); | |
178 | ||
179 | vertices->AddLast(vtxCopy); | |
180 | } | |
181 | ||
182 | ||
183 | fMixedEvent->Init(); | |
184 | Double_t vtxPos[3]={0.,0.,0.},vtxSigma[3]={0.,0.,0.}; | |
185 | Int_t nContributors[1]={0}; | |
186 | Double_t chi2=0; | |
187 | Bool_t primaryOk=fMixedEvent->ComputeVtx(vertices,vtxPos,vtxSigma,nContributors); | |
188 | if(!primaryOk) {delete vertices;return;} | |
189 | Int_t contribCopy=nContributors[0]; | |
190 | AliVVertex* newVertex=new AliESDVertex(vtxPos,vtxSigma,chi2,contribCopy); | |
191 | newVertex->SetTitle(primTitleFirst.Data()); | |
192 | fMixedEvent->SetPrimaryVertex(newVertex); | |
193 | ||
194 | delete vertices; | |
195 | ||
196 | fvHF->FindCandidates(fMixedEvent, | |
197 | fVerticesHFTClArr, | |
198 | fD0toKpiTClArr, | |
199 | fJPSItoEleTClArr, | |
200 | fCharm3ProngTClArr, | |
201 | fCharm4ProngTClArr, | |
202 | fDstarTClArr, | |
203 | fLikeSign2ProngTClArr, | |
204 | fLikeSign3ProngTClArr); | |
205 | ||
206 | return; | |
207 | } | |
208 | ||
209 | //________________________________________________________________________ | |
210 | void AliAnalysisTaskMEVertexingHF::Terminate(Option_t *) | |
211 | { | |
212 | // Terminate analysis | |
213 | } |