AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEVertexingHF.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2008, 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  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
19 //
20 // AliAnalysisTaskSE for the reconstruction of heavy flavor
21 // decays, using the class AliAnalysisVertexingHF.
22 //
23 // Author: A.Dainese, andrea.dainese@lnl.infn.it
25 
26 #include <TROOT.h>
27 #include <TSystem.h>
28 #include <TClonesArray.h>
29 #include <TList.h>
30 #include <TString.h>
31 
32 #include "AliVEvent.h"
33 #include "AliAODEvent.h"
34 #include "AliAODHandler.h"
35 #include "AliESDEvent.h"
36 #include "AliAnalysisVertexingHF.h"
37 #include "AliAnalysisTaskSE.h"
38 #include "AliAnalysisManager.h"
40 
41 #include "AliESDUtils.h"
42 #include "AliAODHFUtil.h"
43 
44 #include "AliInputEventHandler.h"
45 #include "AliPIDResponse.h"
46 
50 
51 //________________________________________________________________________
54 fVHF(0),
55 fListOfCuts(0),
56 fDeltaAODFileName("AliAOD.VertexingHF.root"),
57 fVerticesHFTClArr(0),
58 fD0toKpiTClArr(0),
59 fJPSItoEleTClArr(0),
60 fCharm3ProngTClArr(0),
61 fCharm4ProngTClArr(0),
62 fDstarTClArr(0),
63 fCascadesTClArr(0),
64 fLikeSign2ProngTClArr(0),
65 fLikeSign3ProngTClArr(0),
66 fHFUtilInfo(0)
67 {
68  // Default constructor
69 }
70 
71 //________________________________________________________________________
73 AliAnalysisTaskSE(name),
74 fVHF(0),
75 fListOfCuts(0),
76 fDeltaAODFileName("AliAOD.VertexingHF.root"),
77 fVerticesHFTClArr(0),
78 fD0toKpiTClArr(0),
79 fJPSItoEleTClArr(0),
80 fCharm3ProngTClArr(0),
81 fCharm4ProngTClArr(0),
82 fDstarTClArr(0),
83 fCascadesTClArr(0),
84 fLikeSign2ProngTClArr(0),
85 fLikeSign3ProngTClArr(0),
86 fHFUtilInfo(0)
87 {
88  // Standard constructor
89 
90  DefineOutput(1,TList::Class()); // analysis cuts
91 }
92 
93 //________________________________________________________________________
95 {
96  // Destructor
97 
98  if(fListOfCuts) {
99  delete fListOfCuts;
100  fListOfCuts=NULL;
101  }
102 
103 }
104 
105 //________________________________________________________________________
107 {
108  // Initialization
109  // Instanciates vHF and loads its parameters
110 
111  if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::Init() \n");
112 
113  if(gROOT->LoadMacro("ConfigVertexingHF.C")) {
114  printf("AnalysisTaskSEVertexingHF::Init() \n Using $ALICE_PHYSICS/PWGHF/vertexingHF/ConfigVertexingHF.C\n");
115  gROOT->LoadMacro("$ALICE_PHYSICS/PWGHF/vertexingHF/ConfigVertexingHF.C");
116  }
117 
118  fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
119  fVHF->PrintStatus();
120 
121 
122  // write the objects AliRDHFCuts to a list to store in the output
123 
125 
126  PostData(1,fListOfCuts);
127 
128  AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFileName.Data());
129 
130  return;
131 }
132 
133 //________________________________________________________________________
135 {
136  // Create the output container
137  //
138  if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n");
139  // Support both the case when the AOD + deltaAOD are produced in an ESD
140  // analysis or if the deltaAOD is produced on an analysis on AOD's. (A.G. 27/04/09)
141  if(!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
142  Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
143  return;
144  }
146  // When running on standard AOD to produce deltas, IsStandardAOD is never set,
147  // If AODEvent is NULL, new branches have to be added to the new file(s) (A.G. 15/01/10)
148  if(!IsStandardAOD() && AODEvent()) filename = "";
149  if(!fVHF) {
150  printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n");
151  return;
152  }
153 
154  fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0);
155  fVerticesHFTClArr->SetName("VerticesHF");
156  AddAODBranch("TClonesArray", &fVerticesHFTClArr, filename);
157 
158  if(fVHF->GetD0toKpi()) {
159  fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
160  fD0toKpiTClArr->SetName("D0toKpi");
161  AddAODBranch("TClonesArray", &fD0toKpiTClArr, filename);
162  }
163 
164  if(fVHF->GetJPSItoEle()) {
165  fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
166  fJPSItoEleTClArr->SetName("JPSItoEle");
167  AddAODBranch("TClonesArray", &fJPSItoEleTClArr, filename);
168  }
169 
170  if(fVHF->Get3Prong()) {
171  fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
172  fCharm3ProngTClArr->SetName("Charm3Prong");
173  AddAODBranch("TClonesArray", &fCharm3ProngTClArr, filename);
174  }
175 
176  if(fVHF->Get4Prong()) {
177  fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0);
178  fCharm4ProngTClArr->SetName("Charm4Prong");
179  AddAODBranch("TClonesArray", &fCharm4ProngTClArr, filename);
180  }
181 
182  if(fVHF->GetDstar()) {
183  fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
184  fDstarTClArr->SetName("Dstar");
185  AddAODBranch("TClonesArray", &fDstarTClArr, filename);
186  }
187 
188  if(fVHF->GetCascades()){
189  fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
190  fCascadesTClArr->SetName("CascadesHF");
191  AddAODBranch("TClonesArray", &fCascadesTClArr, filename);
192  }
193 
194  if(fVHF->GetLikeSign()) {
195  fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
196  fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
197  AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr, filename);
198  }
199 
200  if(fVHF->GetLikeSign() && fVHF->Get3Prong()) {
201  fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
202  fLikeSign3ProngTClArr->SetName("LikeSign3Prong");
203  AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr, filename);
204  }
205 
206  //---Way to pass information temporarily not available in AOD---
207  // no if() {
208  fHFUtilInfo = new AliAODHFUtil("fHFUtilInfoC");
209  fHFUtilInfo->SetName("fHFUtilInfo");
210  AddAODBranch( "AliAODHFUtil", &fHFUtilInfo, filename);
211  // }
212  //--------------------------------------------------------------
213 
214  return;
215 }
216 
217 //________________________________________________________________________
219 {
220  // Execute analysis for current event:
221  // heavy flavor vertexing
222 
223  AliVEvent *event = dynamic_cast<AliVEvent*> (InputEvent());
224  // In case there is an AOD handler writing a standard AOD, use the AOD
225  // event in memory rather than the input (ESD) event. (A.G. 27/04/09)
226  if (AODEvent() && IsStandardAOD()) event = dynamic_cast<AliVEvent*> (AODEvent());
227 
228  if (dynamic_cast<AliAODEvent*>(event)) {
229  AliAODHandler *aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
230  if (aodhandler) aodhandler->SetFillExtension(kTRUE);
231  }
232 
233  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
234  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
235  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
236  fVHF->SetPidResponse(pidResp);
237 
238  // heavy flavor vertexing
239  fVHF->FindCandidates(event,
245  fDstarTClArr,
249 
250  //---Way to pass information temporarily not available in AOD---
251  AliESDEvent *eventE = dynamic_cast<AliESDEvent*> (InputEvent());
252  if(eventE) {
253  Float_t *vChCorr = new Float_t[64];
254  Float_t dummy;
255  AliESDUtils::GetCorrV0(eventE,dummy,NULL,vChCorr);
256  fHFUtilInfo->SetVZERO( vChCorr );
257  delete [] vChCorr;
258  }
259  //--------------------------------------------------------------
260 
261  return;
262 }
263 
264 //________________________________________________________________________
266 {
267  // Terminate analysis
268  //
269  if(fDebug > 1) printf("AnalysisTaskSEVertexingHF: Terminate() \n");
270 }
const char * filename
Definition: TestFCM.C:1
TClonesArray * fCascadesTClArr
Array of D*->D0pi.
void SetPidResponse(AliPIDResponse *p)
TList * fListOfCuts
Vertexer heavy flavour.
virtual void UserExec(Option_t *option)
TClonesArray * fDstarTClArr
Array of D0->Kpipipi.
void SetVZERO(Float_t *pVzero)
TClonesArray * fLikeSign2ProngTClArr
Array of Cascades : V0 + track (lambda_c)
TClonesArray * fCharm4ProngTClArr
Array of D+,Ds,Lc.
TClonesArray * fD0toKpiTClArr
Array of heavy-flavour vertices.
TClonesArray * fJPSItoEleTClArr
Array of D0->Kpi.
virtual void Terminate(Option_t *option)
float Float_t
Definition: External.C:68
void FindCandidates(AliVEvent *event, TClonesArray *aodVerticesHFTClArr, TClonesArray *aodD0toKpiTClArr, TClonesArray *aodJPSItoEleTClArr, TClonesArray *aodCharm3ProngTClArr, TClonesArray *aodCharm4ProngTClArr, TClonesArray *aodDstarTClArr, TClonesArray *aodCascadesTClArr, TClonesArray *aodLikeSign2ProngTClArr, TClonesArray *aodLikeSign3ProngTClArr)
AliAODHFUtil * fHFUtilInfo
Array of LikeSign3Prong.
TClonesArray * fCharm3ProngTClArr
Array of Jpsi->ee.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TClonesArray * fLikeSign3ProngTClArr
Array of LikeSign2Prong.
const char Option_t
Definition: External.C:48
TClonesArray * fVerticesHFTClArr
Name of output file.
virtual void UserCreateOutputObjects()
Implementation of interface methods.