]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDInputHandler.cxx
86ce0ae6b890b0df690542087e9f400646a85134
[u/mrichter/AliRoot.git] / STEER / AliESDInputHandler.cxx
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 ESD input 
20 //     Author: Andreas Morsch, CERN
21 //-------------------------------------------------------------------------
22
23 #include <TTree.h>
24
25 #include "AliESDInputHandler.h"
26 #include "AliESDEvent.h"
27 #include "AliESD.h"
28
29 ClassImp(AliESDInputHandler)
30
31 //______________________________________________________________________________
32 AliESDInputHandler::AliESDInputHandler() :
33   AliInputEventHandler(),
34   fEvent(0x0)
35 {
36   // default constructor
37 }
38
39 //______________________________________________________________________________
40 AliESDInputHandler::~AliESDInputHandler() 
41 {
42   // destructor
43   //  delete fEvent;
44 }
45
46 //______________________________________________________________________________
47 AliESDInputHandler::AliESDInputHandler(const char* name, const char* title):
48   AliInputEventHandler(name, title), fEvent(0x0)
49 {
50 }
51
52 Bool_t AliESDInputHandler::InitIO(Option_t* /*opt*/)
53 {
54     if (!fTree) return kFALSE;
55     // Get pointer to ESD event
56     if (fEvent) {
57       delete fEvent;
58       fEvent = 0;
59     }
60     fEvent = new AliESDEvent();
61
62     fEvent->ReadFromTree(fTree);
63     return kTRUE;
64 }
65
66 Bool_t AliESDInputHandler::BeginEvent(Long64_t /*entry*/)
67 {
68     // Copy from old to new format if necessary
69     AliESD* old = ((AliESDEvent*) fEvent)->GetAliESDOld();
70     if (old) {
71         ((AliESDEvent*)fEvent)->CopyFromOldESD();
72         old->Reset();
73     }
74     return kTRUE;
75 }
76
77 Bool_t  AliESDInputHandler::FinishEvent(){
78   //  if(fEvent)fEvent->Reset();
79   return kTRUE;
80
81