]>
Commit | Line | Data |
---|---|---|
ec4af4c1 | 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 | // Implementation of the Virtual Event Handler Interface for AOD | |
20 | // Author: Andreas Morsch, CERN | |
21 | //------------------------------------------------------------------------- | |
22 | ||
052994fb | 23 | |
ec4af4c1 | 24 | #include <TTree.h> |
25 | #include "AliAODHandler.h" | |
26 | #include "AliAODEvent.h" | |
27 | ||
28 | ClassImp(AliAODHandler) | |
29 | ||
30 | //______________________________________________________________________________ | |
31 | AliAODHandler::AliAODHandler() : | |
32 | AliVirtualEventHandler(), | |
33 | fAODEvent(NULL), | |
052994fb | 34 | fTreeA(NULL) |
ec4af4c1 | 35 | { |
36 | // default constructor | |
37 | } | |
38 | ||
39 | //______________________________________________________________________________ | |
40 | AliAODHandler::AliAODHandler(const char* name, const char* title): | |
41 | AliVirtualEventHandler(name, title), | |
42 | fAODEvent(NULL), | |
052994fb | 43 | fTreeA(NULL) |
ec4af4c1 | 44 | { |
45 | } | |
46 | ||
47 | //______________________________________________________________________________ | |
48 | AliAODHandler::~AliAODHandler() | |
49 | { | |
50 | // destructor | |
51 | } | |
52 | ||
53 | ||
54 | Bool_t AliAODHandler::InitIO() | |
55 | { | |
56 | // Initialize IO | |
57 | fAODEvent = new AliAODEvent(); | |
58 | fAODEvent->CreateStdContent(); | |
ec4af4c1 | 59 | CreateTree(); |
60 | ||
61 | return kTRUE; | |
62 | } | |
63 | ||
64 | Bool_t AliAODHandler::Fill() | |
65 | { | |
66 | // Fill data structures | |
ec4af4c1 | 67 | FillTree(); |
68 | fAODEvent->ClearStd(); | |
69 | ||
70 | return kTRUE; | |
71 | } | |
72 | ||
73 | Bool_t AliAODHandler::Terminate() | |
74 | { | |
75 | // Terminate | |
76 | AddAODtoTreeUserInfo(); | |
77 | return kTRUE; | |
78 | } | |
79 | ||
80 | Bool_t AliAODHandler::TerminateIO() | |
81 | { | |
82 | // Terminate IO | |
83 | ||
ec4af4c1 | 84 | return kTRUE; |
85 | } | |
86 | ||
87 | ||
88 | void AliAODHandler::CreateTree() | |
89 | { | |
90 | // Creates the AOD Tree | |
91 | fTreeA = new TTree("AOD", "AliAOD tree"); | |
92 | fTreeA->Branch(fAODEvent->GetList()); | |
93 | } | |
94 | ||
95 | void AliAODHandler::FillTree() | |
96 | { | |
97 | // Fill the AOD Tree | |
98 | fTreeA->Fill(); | |
99 | } | |
100 | ||
101 | ||
102 | void AliAODHandler::AddAODtoTreeUserInfo() | |
103 | { | |
104 | // Add aod event to tree user info | |
105 | fTreeA->GetUserInfo()->Add(fAODEvent); | |
106 | } |