AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AliAnalysisTaskMEVertexingHF.cxx
Go to the documentation of this file.
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 /* $Id$ */
16 
17 //*************************************************************************
18 // Class AliAnalysisTaskMEVertexingHF
19 // AliAnalysisTaskME for event mixing, building the background for
20 // heavy-flavour decay candidates
21 // Author: R.Romita, r.romita@gsi.de
22 //*************************************************************************
23 
24 
25 
26 #include "TH1F.h"
27 #include "TObjArray.h"
28 #include "TList.h"
29 #include "TROOT.h"
30 #include "TSystem.h"
31 #include "TCanvas.h"
32 
33 #include "AliVEvent.h"
34 #include "AliVVertex.h"
35 #include "AliAODEvent.h"
36 #include "AliESDEvent.h"
37 #include "AliAnalysisVertexingHF.h"
38 #include "AliMixedEvent.h"
40 #include "AliAnalysisManager.h"
41 #include "AliMultiEventInputHandler.h"
42 
43 
47 
48 //________________________________________________________________________
50 AliAnalysisTaskME(name),
51 fvHF(0),
52 fMixedEvent(),
53 fVerticesHFTClArr(0),
54 fD0toKpiTClArr(0),
55 fJPSItoEleTClArr(0),
56 fCharm3ProngTClArr(0),
57 fCharm4ProngTClArr(0),
58 fDstarTClArr(0),
59 fCascadesTClArr(0),
60 fLikeSign2ProngTClArr(0),
61 fLikeSign3ProngTClArr(0)
62 {
64 }
65 //________________________________________________________________________
67 {
71 
72  if(gROOT->LoadMacro("ConfigVertexingHF.C")) {
73  printf("AnalysisTaskMEVertexingHF::Init() \n Using $ALICE_PHYSICS/PWG3/vertexingHF/ConfigVertexingHF.C\n");
74  gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/ConfigVertexingHF.C");
75  }
76  fvHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
78  fvHF->SetInputAOD();
79  fvHF->PrintStatus();
80  if(fvHF->GetLikeSign()) {
81  printf("WARNING: fLikeSign will be switched off!");
83  }
86  printf("WARNING: if on, fRecoPrimVtxSkippingTrks and fRmTrksFromPrimVtx will be switched off!\n");
87  }
88 
89  AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile("AliAOD.VertexingHF.root");
90 
91  return;
92 }
93 //________________________________________________________________________
95 {
97 
98 
99  if (!AODEvent()) {
100  Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
101  return;
102  }
103 
104  if(!fvHF) {
105  printf("AnalysisTaskMEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n");
106  return;
107  }
108  fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0);
109  fVerticesHFTClArr->SetName("VerticesHF");
110  AddAODBranch("TClonesArray", &fVerticesHFTClArr);
111  if(fvHF->GetD0toKpi()) {
112  fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
113  fD0toKpiTClArr->SetName("D0toKpi");
114  AddAODBranch("TClonesArray", &fD0toKpiTClArr);
115  }
116  if(fvHF->GetJPSItoEle()) {
117  fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
118  fJPSItoEleTClArr->SetName("JPSItoEle");
119  AddAODBranch("TClonesArray", &fJPSItoEleTClArr);
120  }
121  if(fvHF->Get3Prong()) {
122  fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
123  fCharm3ProngTClArr->SetName("Charm3Prong");
124  AddAODBranch("TClonesArray", &fCharm3ProngTClArr);
125  }
126  if(fvHF->Get4Prong()) {
127  fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0);
128  fCharm4ProngTClArr->SetName("Charm4Prong");
129  AddAODBranch("TClonesArray", &fCharm4ProngTClArr);
130  }
131 
132  if(fvHF->GetDstar()) {
133  fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
134  fDstarTClArr->SetName("Dstar");
135  AddAODBranch("TClonesArray", &fDstarTClArr);
136  }
137 
138  if(fvHF->GetCascades()){
139  fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
140  fCascadesTClArr->SetName("CascadesHF");
141  AddAODBranch("TClonesArray", &fCascadesTClArr);
142  }
143 
144  if(fvHF->GetLikeSign()) {
145  fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
146  fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
147  AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr);
148  }
149 
150  if(fvHF->GetLikeSign() && fvHF->Get3Prong()) {
151  fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
152  fLikeSign3ProngTClArr->SetName("LikeSign3Prong");
153  AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr);
154  }
155 
156  return;
157 }
158 
159 //________________________________________________________________________
161 {
165 
166  Int_t nev = fInputHandler->GetBufferSize();
167  fMixedEvent = new AliMixedEvent();
168  fMixedEvent->Reset();
169  TString primTitle;
170  TString primTitleFirst;
171  AliAODVertex *vtxCopy=0;
172 
173  TObjArray *vertices=new TObjArray(nev);
174  for (Int_t iev = 0; iev < nev; iev++) {
175  AliAODEvent *evt = (AliAODEvent*)GetEvent(iev);
176  if(!evt) {delete vertices;return;}
177  AliAODVertex *evtVtx=(AliAODVertex*)evt->GetPrimaryVertex();
178  if(!evtVtx) {delete vertices;return;}
179  primTitle = evtVtx->GetTitle();
180  Int_t nContrib=evtVtx->GetNContributors();
181  if(!primTitle.Contains("VertexerTracks") || nContrib<=0) {
182  delete vertices;
183  return;
184  }
185 
186  vtxCopy=new AliAODVertex(*evtVtx);
187  primTitleFirst=evtVtx->GetTitle();
188 
189 
190  fMixedEvent->AddEvent(evt);
191 
192  vertices->AddLast(vtxCopy);
193  }
194 
195 
196  fMixedEvent->Init();
197  Double_t vtxPos[3]={0.,0.,0.},vtxSigma[3]={0.,0.,0.};
198  Int_t nContributors[1]={0};
199  Double_t chi2=0;
200  Bool_t primaryOk=fMixedEvent->ComputeVtx(vertices,vtxPos,vtxSigma,nContributors);
201  if(!primaryOk) {
202  delete vertices;
203  delete vtxCopy;
204  vtxCopy=NULL;
205  return;
206  }
207  Int_t contribCopy=nContributors[0];
208  Double_t vtxCov[6]={vtxSigma[0]*vtxSigma[0],0,vtxSigma[1]*vtxSigma[1],0,0,vtxSigma[2]*vtxSigma[2]};
209  AliVVertex* newVertex=new AliESDVertex(vtxPos,vtxCov,chi2,contribCopy);
210  newVertex->SetTitle(primTitleFirst.Data());
211  fMixedEvent->SetPrimaryVertex(newVertex);
212 
213  delete vertices;
214  delete vtxCopy;
215  vtxCopy=NULL;
216 
223  fDstarTClArr,
227 
228  delete newVertex;
229  return;
230 }
231 
232 //________________________________________________________________________
234 {
236 }
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TClonesArray * fCascadesTClArr
Array of D*->D0pi.
TClonesArray * fD0toKpiTClArr
Array of heavy-flavour vertices.
TClonesArray * fLikeSign2ProngTClArr
Array of Cascades : V0 + track (lambda_c)
virtual void UserExec(Option_t *option)
AliMixedEvent * fMixedEvent
Vertexer heavy flavour.
TClonesArray * fCharm3ProngTClArr
Array of Jpsi->ee.
AliAnalysisTaskMEVertexingHF(const char *name="AliAnalysisTaskMEVertexingHF")
TClonesArray * fDstarTClArr
Array of D0->Kpipipi.
TClonesArray * fCharm4ProngTClArr
Array of D+,Ds,Lc.
TClonesArray * fLikeSign3ProngTClArr
Array of LikeSign2Prong.
void FindCandidates(AliVEvent *event, TClonesArray *aodVerticesHFTClArr, TClonesArray *aodD0toKpiTClArr, TClonesArray *aodJPSItoEleTClArr, TClonesArray *aodCharm3ProngTClArr, TClonesArray *aodCharm4ProngTClArr, TClonesArray *aodDstarTClArr, TClonesArray *aodCascadesTClArr, TClonesArray *aodLikeSign2ProngTClArr, TClonesArray *aodLikeSign3ProngTClArr)
Bool_t GetRmTrksFromPrimVtx() const
Bool_t GetRecoPrimVtxSkippingTrks() const
TClonesArray * fVerticesHFTClArr
Mixed event.
TClonesArray * fJPSItoEleTClArr
Array of D0->Kpi.