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),
54 fLikeSign2ProngTClArr(0),
55 fLikeSign3ProngTClArr(0)
57 // Default constructor
60 //________________________________________________________________________
61 AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF(const char *name):
62 AliAnalysisTaskSE(name),
65 fDeltaAODFileName("AliAOD.VertexingHF.root"),
69 fCharm3ProngTClArr(0),
70 fCharm4ProngTClArr(0),
73 fLikeSign2ProngTClArr(0),
74 fLikeSign3ProngTClArr(0)
76 // Standard constructor
78 DefineOutput(1,TList::Class()); // analysis cuts
81 //________________________________________________________________________
82 AliAnalysisTaskSEVertexingHF::~AliAnalysisTaskSEVertexingHF()
93 //________________________________________________________________________
94 void AliAnalysisTaskSEVertexingHF::Init()
97 // Instanciates vHF and loads its parameters
99 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::Init() \n");
101 if(gROOT->LoadMacro("ConfigVertexingHF.C")) {
102 printf("AnalysisTaskSEVertexingHF::Init() \n Using $ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C\n");
103 gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/ConfigVertexingHF.C");
106 fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
110 // write the objects AliRDHFCuts to a list to store in the output
112 fListOfCuts = fVHF->FillListOfCuts();
114 PostData(1,fListOfCuts);
116 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(fDeltaAODFileName.Data());
121 //________________________________________________________________________
122 void AliAnalysisTaskSEVertexingHF::UserCreateOutputObjects()
124 // Create the output container
126 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n");
127 // Support both the case when the AOD + deltaAOD are produced in an ESD
128 // analysis or if the deltaAOD is produced on an analysis on AOD's. (A.G. 27/04/09)
129 if(!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
130 Fatal("UserCreateOutputObjects", "This task needs an AOD handler");
133 TString filename = fDeltaAODFileName;
134 // When running on standard AOD to produce deltas, IsStandardAOD is never set,
135 // If AODEvent is NULL, new branches have to be added to the new file(s) (A.G. 15/01/10)
136 if(!IsStandardAOD() && AODEvent()) filename = "";
138 printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n");
142 fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0);
143 fVerticesHFTClArr->SetName("VerticesHF");
144 AddAODBranch("TClonesArray", &fVerticesHFTClArr, filename);
146 if(fVHF->GetD0toKpi()) {
147 fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
148 fD0toKpiTClArr->SetName("D0toKpi");
149 AddAODBranch("TClonesArray", &fD0toKpiTClArr, filename);
152 if(fVHF->GetJPSItoEle()) {
153 fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
154 fJPSItoEleTClArr->SetName("JPSItoEle");
155 AddAODBranch("TClonesArray", &fJPSItoEleTClArr, filename);
158 if(fVHF->Get3Prong()) {
159 fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
160 fCharm3ProngTClArr->SetName("Charm3Prong");
161 AddAODBranch("TClonesArray", &fCharm3ProngTClArr, filename);
164 if(fVHF->Get4Prong()) {
165 fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0);
166 fCharm4ProngTClArr->SetName("Charm4Prong");
167 AddAODBranch("TClonesArray", &fCharm4ProngTClArr, filename);
170 if(fVHF->GetDstar()) {
171 fDstarTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
172 fDstarTClArr->SetName("Dstar");
173 AddAODBranch("TClonesArray", &fDstarTClArr, filename);
176 if(fVHF->GetCascades()){
177 fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
178 fCascadesTClArr->SetName("CascadesHF");
179 AddAODBranch("TClonesArray", &fCascadesTClArr, filename);
182 if(fVHF->GetLikeSign()) {
183 fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
184 fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
185 AddAODBranch("TClonesArray", &fLikeSign2ProngTClArr, filename);
188 if(fVHF->GetLikeSign() && fVHF->Get3Prong()) {
189 fLikeSign3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
190 fLikeSign3ProngTClArr->SetName("LikeSign3Prong");
191 AddAODBranch("TClonesArray", &fLikeSign3ProngTClArr, filename);
197 //________________________________________________________________________
198 void AliAnalysisTaskSEVertexingHF::UserExec(Option_t */*option*/)
200 // Execute analysis for current event:
201 // heavy flavor vertexing
203 AliVEvent *event = dynamic_cast<AliVEvent*> (InputEvent());
204 // In case there is an AOD handler writing a standard AOD, use the AOD
205 // event in memory rather than the input (ESD) event. (A.G. 27/04/09)
206 if (AODEvent() && IsStandardAOD()) event = dynamic_cast<AliVEvent*> (AODEvent());
208 // heavy flavor vertexing
209 fVHF->FindCandidates(event,
217 fLikeSign2ProngTClArr,
218 fLikeSign3ProngTClArr);
223 //________________________________________________________________________
224 void AliAnalysisTaskSEVertexingHF::Terminate(Option_t */*option*/)
226 // Terminate analysis
228 if(fDebug > 1) printf("AnalysisTaskSEVertexingHF: Terminate() \n");