1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
18 //-------------------------------------------------------------------------
19 // Implementation of the Virtual Event Handler Interface for AOD
20 // Author: Andreas Morsch, CERN
21 //-------------------------------------------------------------------------
28 #include "AliAODHandler.h"
29 #include "AliAODEvent.h"
31 ClassImp(AliAODHandler)
33 //______________________________________________________________________________
34 AliAODHandler::AliAODHandler() :
37 fNeedsHeaderReplication(kFALSE),
38 fNeedsTracksBranchReplication(kFALSE),
39 fNeedsVerticesBranchReplication(kFALSE),
40 fNeedsV0sBranchReplication(kFALSE),
41 fNeedsTrackletsBranchReplication(kFALSE),
42 fNeedsPMDClustersBranchReplication(kFALSE),
43 fNeedsJetsBranchReplication(kFALSE),
44 fNeedsFMDClustersBranchReplication(kFALSE),
45 fNeedsCaloClustersBranchReplication(kFALSE),
46 fAODIsReplicated(kFALSE),
52 // default constructor
55 //______________________________________________________________________________
56 AliAODHandler::AliAODHandler(const char* name, const char* title):
57 AliVEventHandler(name, title),
59 fNeedsHeaderReplication(kFALSE),
60 fNeedsTracksBranchReplication(kFALSE),
61 fNeedsVerticesBranchReplication(kFALSE),
62 fNeedsV0sBranchReplication(kFALSE),
63 fNeedsTrackletsBranchReplication(kFALSE),
64 fNeedsPMDClustersBranchReplication(kFALSE),
65 fNeedsJetsBranchReplication(kFALSE),
66 fNeedsFMDClustersBranchReplication(kFALSE),
67 fNeedsCaloClustersBranchReplication(kFALSE),
68 fAODIsReplicated(kFALSE),
76 //______________________________________________________________________________
77 AliAODHandler::~AliAODHandler()
81 // is already handled in TerminateIO
89 //______________________________________________________________________________
90 Bool_t AliAODHandler::Init(Option_t* opt)
94 // Create the AODevent object
96 fAODEvent = new AliAODEvent();
97 if (fIsStandard) fAODEvent->CreateStdContent();
100 // File opening according to execution mode
103 if (option.Contains("proof")) {
105 if (option.Contains("special")) {
106 // File for tree already opened on slave -> merging via files
115 TDirectory *owd = gDirectory;
116 fFileA = new TFile(fFileName.Data(), "RECREATE");
123 Bool_t AliAODHandler::FinishEvent()
125 // Fill data structures
126 fAODEvent->MakeEntriesReferencable();
128 if (fIsStandard) fAODEvent->ResetStd();
129 // Reset AOD replication flag
130 fAODIsReplicated = kFALSE;
135 //______________________________________________________________________________
136 Bool_t AliAODHandler::Terminate()
139 AddAODtoTreeUserInfo();
143 //______________________________________________________________________________
144 Bool_t AliAODHandler::TerminateIO()
154 //______________________________________________________________________________
155 void AliAODHandler::CreateTree(Int_t flag)
157 // Creates the AOD Tree
158 fTreeA = new TTree("aodTree", "AliAOD tree");
159 fTreeA->Branch(fAODEvent->GetList());
160 if (flag == 0) fTreeA->SetDirectory(0);
163 //______________________________________________________________________________
164 void AliAODHandler::FillTree()
170 //______________________________________________________________________________
171 void AliAODHandler::AddAODtoTreeUserInfo()
173 // Add aod event to tree user info
174 fTreeA->GetUserInfo()->Add(fAODEvent);
177 //______________________________________________________________________________
178 void AliAODHandler::AddBranch(const char* cname, void* addobj)
180 // Add a new branch to the aod
181 TDirectory *owd = gDirectory;
185 char** apointer = (char**) addobj;
186 TObject* obj = (TObject*) *apointer;
187 fTreeA->Branch(obj->GetName(), cname, addobj);
188 fAODEvent->AddObject(obj);
192 //______________________________________________________________________________
193 void AliAODHandler::SetOutputFileName(const char* fname)
199 //______________________________________________________________________________
200 const char *AliAODHandler::GetOutputFileName()
203 return fFileName.Data();