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 //-------------------------------------------------------------------------
27 #include "AliAODHandler.h"
28 #include "AliAODEvent.h"
30 ClassImp(AliAODHandler)
32 //______________________________________________________________________________
33 AliAODHandler::AliAODHandler() :
41 // default constructor
44 //______________________________________________________________________________
45 AliAODHandler::AliAODHandler(const char* name, const char* title):
46 AliVEventHandler(name, title),
55 //______________________________________________________________________________
56 AliAODHandler::~AliAODHandler()
60 // is already handled in TerminateIO
70 Bool_t AliAODHandler::Init(Option_t* opt)
74 // Create the AODevent object
76 fAODEvent = new AliAODEvent();
77 if (fIsStandard) fAODEvent->CreateStdContent();
80 // File opening according to execution mode
82 if (!(strcmp(opt, "proof"))) {
87 TDirectory *owd = gDirectory;
88 fFileA = new TFile(fName, "RECREATE");
95 Bool_t AliAODHandler::FinishEvent()
97 // Fill data structures
98 fAODEvent->MakeEntriesReferencable();
100 if (fIsStandard) fAODEvent->ResetStd();
104 Bool_t AliAODHandler::Terminate()
107 AddAODtoTreeUserInfo();
111 Bool_t AliAODHandler::TerminateIO()
122 void AliAODHandler::CreateTree(Int_t flag)
124 // Creates the AOD Tree
125 fTreeA = new TTree("aodTree", "AliAOD tree");
126 fTreeA->Branch(fAODEvent->GetList());
127 if (flag == 0) fTreeA->SetDirectory(0);
130 void AliAODHandler::FillTree()
137 void AliAODHandler::AddAODtoTreeUserInfo()
139 // Add aod event to tree user info
140 fTreeA->GetUserInfo()->Add(fAODEvent);
143 void AliAODHandler::AddBranch(const char* cname, TObject* addobj)
145 // Add a new branch to the aod
146 TDirectory *owd = gDirectory;
150 fTreeA->Branch(addobj->GetName(), cname, &addobj);
151 fAODEvent->AddObject(addobj);