]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODInputHandler.cxx
Added include for libANALYSISalice (Mihaela)
[u/mrichter/AliRoot.git] / STEER / AliAODInputHandler.cxx
CommitLineData
397596ed 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//-------------------------------------------------------------------------
19// Event handler for AOD input
20// Author: Andreas Morsch, CERN
21//-------------------------------------------------------------------------
22
933fd60f 23#include <TTree.h>
26772015 24#include <TList.h>
25#include <TNamed.h>
397596ed 26
27#include "AliAODInputHandler.h"
28#include "AliAODEvent.h"
29
30ClassImp(AliAODInputHandler)
31
32//______________________________________________________________________________
33AliAODInputHandler::AliAODInputHandler() :
90e04a88 34 AliInputEventHandler(),
4195c9c9 35 fEvent(0),
26772015 36 fFriends(new TList())
397596ed 37{
26772015 38 // Default constructor
397596ed 39}
40
41//______________________________________________________________________________
26772015 42AliAODInputHandler::AliAODInputHandler(const char* name, const char* title):
43 AliInputEventHandler(name, title),
44 fEvent(0),
45 fFriends(new TList())
397596ed 46{
26772015 47 // Constructor
397596ed 48}
49
50//______________________________________________________________________________
26772015 51AliAODInputHandler::~AliAODInputHandler()
397596ed 52{
26772015 53// Destructor
54 fFriends->Delete();
397596ed 55}
56
26772015 57
300d5701 58Bool_t AliAODInputHandler::Init(TTree* tree, Option_t* /*opt*/)
397596ed 59{
300d5701 60 // Initialisation necessary for each new tree
61 fTree = tree;
26772015 62 TIter next(fFriends);
63 TNamed* obj;
64 while(obj = (TNamed*)next()) {
65 fTree->AddFriend("aodTree", obj->GetName());
4195c9c9 66 }
67
300d5701 68 if (!fTree) return kFALSE;
397596ed 69 // Get pointer to AOD event
300d5701 70 if (fEvent) {
71 delete fEvent;
72 fEvent = 0;
73 }
397596ed 74 fEvent = new AliAODEvent();
300d5701 75
933fd60f 76 fEvent->ReadFromTree(fTree);
397596ed 77 return kTRUE;
78}
79
fbb264e0 80Bool_t AliAODInputHandler::BeginEvent(Long64_t /*entry*/)
81{
82 //
83 if (fTree) fTree->BranchRef();
84 return kTRUE;
85}
86
26772015 87void AliAODInputHandler::AddFriend(char* filename)
88{
89 // Add a friend tree
90 TNamed* obj = new TNamed(filename, filename);
91 fFriends->Add(obj);
92}