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()
123 void AliAODHandler::CreateTree(Int_t flag)
125 // Creates the AOD Tree
126 fTreeA = new TTree("aodTree", "AliAOD tree");
127 fTreeA->Branch(fAODEvent->GetList());
128 if (flag == 0) fTreeA->SetDirectory(0);
131 void AliAODHandler::FillTree()
138 void AliAODHandler::AddAODtoTreeUserInfo()
140 // Add aod event to tree user info
141 fTreeA->GetUserInfo()->Add(fAODEvent);
144 void AliAODHandler::AddBranch(const char* cname, TObject* addobj)
146 // Add a new branch to the aod
147 TDirectory *owd = gDirectory;
151 fTreeA->Branch(addobj->GetName(), cname, &addobj);
152 fAODEvent->AddObject(addobj);