]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/AliAODInputHandler.cxx
Removed (unnecessary) AliTPCTrack dependence.
[u/mrichter/AliRoot.git] / STEER / AliAODInputHandler.cxx
... / ...
CommitLineData
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
23#include <TTree.h>
24#include <TList.h>
25#include <TNamed.h>
26
27#include "AliAODInputHandler.h"
28#include "AliAODEvent.h"
29
30ClassImp(AliAODInputHandler)
31
32//______________________________________________________________________________
33AliAODInputHandler::AliAODInputHandler() :
34 AliInputEventHandler(),
35 fEvent(0),
36 fFriends(new TList())
37{
38 // Default constructor
39}
40
41//______________________________________________________________________________
42AliAODInputHandler::AliAODInputHandler(const char* name, const char* title):
43 AliInputEventHandler(name, title),
44 fEvent(0),
45 fFriends(new TList())
46{
47 // Constructor
48}
49
50//______________________________________________________________________________
51AliAODInputHandler::~AliAODInputHandler()
52{
53// Destructor
54 fFriends->Delete();
55}
56
57
58Bool_t AliAODInputHandler::Init(TTree* tree, Option_t* /*opt*/)
59{
60 // Initialisation necessary for each new tree
61 fTree = tree;
62 TIter next(fFriends);
63 TNamed* obj;
64
65 while((obj = (TNamed*)next())) {
66 if (fTree->GetTree()) {
67 (fTree->GetTree())->AddFriend("aodTree", obj->GetName());
68 } else {
69 fTree->AddFriend("aodTree", obj->GetName());
70 }
71 }
72
73 if (!fTree) return kFALSE;
74 // Get pointer to AOD event
75 if (fEvent) {
76 delete fEvent;
77 fEvent = 0;
78 }
79 fEvent = new AliAODEvent();
80
81 fEvent->ReadFromTree(fTree);
82 return kTRUE;
83}
84
85Bool_t AliAODInputHandler::BeginEvent(Long64_t /*entry*/)
86{
87 //
88 //if (fTree) fTree->BranchRef();
89 return kTRUE;
90}
91
92void AliAODInputHandler::AddFriend(char* filename)
93{
94 // Add a friend tree
95 TNamed* obj = new TNamed(filename, filename);
96 fFriends->Add(obj);
97}