1 /**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // AliAnalysisTaskSE for the reconstruction of heavy flavor
19 // decays, using the class AliAnalysisVertexingHF.
21 // Author: A.Dainese, andrea.dainese@lnl.infn.it
22 /////////////////////////////////////////////////////////////
26 #include <TClonesArray.h>
30 #include "AliVEvent.h"
31 #include "AliAODEvent.h"
32 #include "AliESDEvent.h"
33 #include "AliAnalysisVertexingHF.h"
34 #include "AliAnalysisTaskSE.h"
35 #include "AliAnalysisManager.h"
36 #include "AliAnalysisTaskSEVertexingHF.h"
38 ClassImp(AliAnalysisTaskSEVertexingHF)
41 //________________________________________________________________________
42 AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF():
46 fDeltaAODFileName("AliAOD.VertexingHF.root"),
50 fCharm3ProngTClArr(0),
51 fCharm4ProngTClArr(0),
53 fLikeSign2ProngTClArr(0),
54 fLikeSign3ProngTClArr(0)
56 // Default constructor
59 //________________________________________________________________________
60 AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF(const char *name):
61 AliAnalysisTaskSE(name),
64 fDeltaAODFileName("AliAOD.VertexingHF.root"),
68 fCharm3ProngTClArr(0),
69 fCharm4ProngTClArr(0),
71 fLikeSign2ProngTClArr(0),
72 fLikeSign3ProngTClArr(0)
74 // Standard constructor
76 DefineOutput(1,TList::Class()); // analysis cuts
79 //________________________________________________________________________
80 AliAnalysisTaskSEVertexingHF::~AliAnalysisTaskSEVertexingHF()
91 //________________________________________________________________________
92 void AliAnalysisTaskSEVertexingHF::Init()
95 // Instanciates vHF and loads its parameters
97 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::Init() \n");
99 if(gROOT->LoadMacro("ConfigVertexingHF.C")) {
100 printf("AnalysisTaskSEVertexingHF::Init() \n Using $ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C\n");
101 gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C");
104 fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
108 // write the objects AliRDHFCuts to a list to store in the output
110 fListOfCuts = fVHF->FillListOfCuts();
112 PostData(1,fListOfCuts);
114 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFileName.Data());
119 //________________________________________________________________________
120 void AliAnalysisTaskSEVertexingHF::UserCreateOutputObjects()
122 // Create the output container
124 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n");
125 // Support both the case when the AOD + deltaAOD are produced in an ESD
126 // analysis or if the deltaAOD is produced on an analysis on AOD's. (A.G. 27/04/09)
127 if(!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
128 Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
131 TString filename = fDeltaAODFileName;
132 // When running on standard AOD to produce deltas, IsStandardAOD is never set,
133 // If AODEvent is NULL, new branches have to be added to the new file(s) (A.G. 15/01/10)
134 if(!IsStandardAOD() && AODEvent()) filename = "";
136 printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n");
140 fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0);
141 fVerticesHFTClArr->SetName("VerticesHF");
142 AddAODBranch("TClonesArray", &fVerticesHFTClArr, filename);
144 if(fVHF->GetD0toKpi()) {
145 fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
146 fD0toKpiTClArr->SetName("D0toKpi");
147 AddAODBranch("TClonesArray", &fD0toKpiTClArr, filename);
150 if(fVHF->GetJPSItoEle()) {
151 fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
152 fJPSItoEleTClArr->SetName("JPSItoEle");
153 AddAODBranch("TClonesArray", &fJPSItoEleTClArr, filename);
156 if(fVHF->Get3Prong()) {
157 fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
158 fCharm3ProngTClArr->SetName("Charm3Prong");
159 AddAODBranch("TClonesArray", &fCharm3ProngTClArr, filename);
162 if(fVHF->Get4Prong()) {
163 fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0);
164 fCharm4ProngTClArr->SetName("Charm4Prong");
165 AddAODBranch("TClonesArray", &fCharm4ProngTClArr, filename);
168 if(fVHF->GetDstar()) {
169 fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
170 fDstarTClArr->SetName("Dstar");
171 AddAODBranch("TClonesArray", &fDstarTClArr, filename);
174 if(fVHF->GetLikeSign()) {
175 fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
176 fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
177 AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr, filename);
180 if(fVHF->GetLikeSign() && fVHF->Get3Prong()) {
181 fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
182 fLikeSign3ProngTClArr->SetName("LikeSign3Prong");
183 AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr, filename);
189 //________________________________________________________________________
190 void AliAnalysisTaskSEVertexingHF::UserExec(Option_t */*option*/)
192 // Execute analysis for current event:
193 // heavy flavor vertexing
195 AliVEvent *event = dynamic_cast<AliVEvent*> (InputEvent());
196 // In case there is an AOD handler writing a standard AOD, use the AOD
197 // event in memory rather than the input (ESD) event. (A.G. 27/04/09)
198 if (AODEvent() && IsStandardAOD()) event = dynamic_cast<AliVEvent*> (AODEvent());
200 // heavy flavor vertexing
201 fVHF->FindCandidates(event,
208 fLikeSign2ProngTClArr,
209 fLikeSign3ProngTClArr);
214 //________________________________________________________________________
215 void AliAnalysisTaskSEVertexingHF::Terminate(Option_t */*option*/)
217 // Terminate analysis
219 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF: Terminate() \n");