example macros to run on proof
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnInputHandler.cxx
CommitLineData
b63357a0 1//
2// Class AliRsnInputHandler
3//
4// AliRsnInputHandler
5// TODO example
6// author:
7// Martin Vala (martin.vala@cern.ch)
8//
9
f34f960b 10#include <Riostream.h>
c865cb1d 11#include "AliLog.h"
12
13#include "AliRsnEvent.h"
14#include "AliMultiInputEventHandler.h"
15#include "AliMixInputEventHandler.h"
16#include "AliMCEventHandler.h"
17
b63357a0 18#include "AliRsnCutSet.h"
c865cb1d 19#include "AliRsnInputHandler.h"
20ClassImp(AliRsnInputHandler)
21
22//_____________________________________________________________________________
23AliRsnInputHandler::AliRsnInputHandler(const char *name) :
24 AliInputEventHandler(name, name),
25 fRsnEvent(0),
b63357a0 26 fRsnSelector(),
27 fRsnEventCuts(0)
28{
29//
30// Default constructor.
31//
32 AliDebug(AliLog::kDebug + 10, "<-");
33 AliDebug(AliLog::kDebug + 10, "->");
34}
35
36//_____________________________________________________________________________
37AliRsnInputHandler::AliRsnInputHandler(const AliRsnInputHandler &copy) :
38 AliInputEventHandler(),
39 fRsnEvent(0),
40 fRsnSelector(),
41 fRsnEventCuts(copy.fRsnEventCuts)
c865cb1d 42{
43//
44// Default constructor.
45//
46 AliDebug(AliLog::kDebug + 10, "<-");
47 AliDebug(AliLog::kDebug + 10, "->");
48}
49
50//_____________________________________________________________________________
b63357a0 51AliRsnInputHandler& AliRsnInputHandler::operator=(const AliRsnInputHandler &copy)
52{
53//
54// Default constructor.
55//
56 fRsnEventCuts = copy.fRsnEventCuts;
57 return *this;
58}
59
60
61//_____________________________________________________________________________
c865cb1d 62AliRsnInputHandler::~AliRsnInputHandler()
63{
64//
65// Destructor
66//
67 AliDebug(AliLog::kDebug + 10, "<-");
68 delete fRsnEvent;
69 AliDebug(AliLog::kDebug + 10, "->");
70}
71
72//_____________________________________________________________________________
73Bool_t AliRsnInputHandler::Init(Option_t *opt)
74{
75//
76// Init() is called for all mix input handlers.
77//
78 AliDebug(AliLog::kDebug + 5, Form("<- opt=%s", opt));
79
80 AliDebug(AliLog::kDebug + 5, Form("->"));
81 return kTRUE;
82}
83//_____________________________________________________________________________
84Bool_t AliRsnInputHandler::Init(TTree *tree, Option_t *opt)
85{
86//
87// Init(const char*path) is called for all mix input handlers.
88// Create event pool if needed
89//
90 AliDebug(AliLog::kDebug + 5, Form("<- %p %s opt=%s", (void *) tree, tree->GetName(), opt));
91 AliDebug(AliLog::kDebug + 5, Form("->"));
92 return kTRUE;
93}
94//_____________________________________________________________________________
95Bool_t AliRsnInputHandler::Notify()
96{
97//
98// Notify() is called for all mix input handlers
99//
100 AliDebug(AliLog::kDebug + 5, Form("<-"));
101 AliDebug(AliLog::kDebug + 5, Form("->"));
102 return kTRUE;
103}
104
105//_____________________________________________________________________________
106Bool_t AliRsnInputHandler::Notify(const char *path)
107{
108//
109// Notify(const char*path) is called for all mix input handlers
110//
111 AliDebug(AliLog::kDebug + 5, Form("<- %s", path));
112 AliDebug(AliLog::kDebug + 5, "->");
113 return kTRUE;
114}
115//_____________________________________________________________________________
116Bool_t AliRsnInputHandler::BeginEvent(Long64_t entry)
117{
118//
119// BeginEvent(Long64_t entry) is called for all mix input handlers
120//
121 AliDebug(AliLog::kDebug + 5, Form("<- %lld", entry));
122
123 if (fParentHandler) {
124 TString tmp = "";
125 AliInputEventHandler *ih = 0;
126 AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler*>(fParentHandler);
127 if (multiIH) {
128 ih = multiIH->GetFirstInputEventHandler();
129 if (ih) {
130 if (!fRsnEvent) fRsnEvent = new AliRsnEvent();
131 fRsnEvent->SetRef(ih->GetEvent());
132 fRsnEvent->SetPIDResponse(ih->GetPIDResponse());
133 if (fRsnEvent->GetRefESD()) {
134 AliMCEventHandler *mcH = multiIH->GetFirstMCEventHandler();
135 if (mcH) fRsnEvent->SetRefMC(mcH->MCEvent());
136 } else if (fRsnEvent->GetRefAOD()) {
f34f960b 137 AliAODEvent *aod = fRsnEvent->GetRefAOD();
138 TClonesArray *listAOD = (TClonesArray*)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()));
139 if (listAOD) fRsnEvent->SetRefMC(fRsnEvent->GetRefAOD());
c865cb1d 140 }
141 if (fParentHandler->ParentHandler()) tmp = "MIX";
142 // applying pid cuts
143 //fRsnPIDManager.Reset();
144
145 //fRsnPIDManager.ApplyCuts(fRsnEvent);
146 fRsnSelector.Reset();
b63357a0 147
148 // reject event if needed
149 if (fRsnEventCuts) if (!fRsnEventCuts->IsSelected(fRsnEvent)) return kTRUE;
c865cb1d 150 fRsnSelector.ScanEvent(fRsnEvent);
151 }
152 }
153 }
154 AliDebug(AliLog::kDebug + 5, "->");
155 return kTRUE;
156}
157
158Bool_t AliRsnInputHandler::GetEntry()
159{
160 AliDebug(AliLog::kDebug + 5, "<-");
161 AliDebug(AliLog::kDebug + 5, "->");
162 return kTRUE;
163}
164
165//_____________________________________________________________________________
166Bool_t AliRsnInputHandler::FinishEvent()
167{
168 //
169 // FinishEvent() is called for all mix input handlers
170 //
171 AliDebug(AliLog::kDebug + 5, Form("<-"));
172 AliDebug(AliLog::kDebug + 5, Form("->"));
173 return kTRUE;
174}