2 // Class AliRsnInputHandler
7 // Martin Vala (martin.vala@cern.ch)
10 #include <Riostream.h>
13 #include "AliRsnEvent.h"
14 #include "AliMultiInputEventHandler.h"
15 #include "AliMixInputEventHandler.h"
16 #include "AliMCEventHandler.h"
18 #include "AliRsnCutSet.h"
19 #include "AliRsnInputHandler.h"
20 ClassImp(AliRsnInputHandler)
22 //_____________________________________________________________________________
23 AliRsnInputHandler::AliRsnInputHandler(const char *name) :
24 AliInputEventHandler(name, name),
30 // Default constructor.
32 AliDebug(AliLog::kDebug + 10, "<-");
33 AliDebug(AliLog::kDebug + 10, "->");
36 //_____________________________________________________________________________
37 AliRsnInputHandler::AliRsnInputHandler(const AliRsnInputHandler ©) :
38 AliInputEventHandler(),
41 fRsnEventCuts(copy.fRsnEventCuts)
44 // Default constructor.
46 AliDebug(AliLog::kDebug + 10, "<-");
47 AliDebug(AliLog::kDebug + 10, "->");
50 //_____________________________________________________________________________
51 AliRsnInputHandler &AliRsnInputHandler::operator=(const AliRsnInputHandler ©)
54 // Default constructor.
58 fRsnEventCuts = copy.fRsnEventCuts;
63 //_____________________________________________________________________________
64 AliRsnInputHandler::~AliRsnInputHandler()
69 AliDebug(AliLog::kDebug + 10, "<-");
71 AliDebug(AliLog::kDebug + 10, "->");
74 //_____________________________________________________________________________
75 Bool_t AliRsnInputHandler::Init(Option_t *opt)
78 // Init() is called for all mix input handlers.
80 AliDebug(AliLog::kDebug + 5, Form("<- opt=%s", opt));
82 AliDebug(AliLog::kDebug + 5, Form("->"));
85 //_____________________________________________________________________________
86 Bool_t AliRsnInputHandler::Init(TTree *tree, Option_t *opt)
89 // Init(const char*path) is called for all mix input handlers.
90 // Create event pool if needed
92 AliDebug(AliLog::kDebug + 5, Form("<- %p %s opt=%s", (void *) tree, tree->GetName(), opt));
93 AliDebug(AliLog::kDebug + 5, Form("->"));
96 //_____________________________________________________________________________
97 Bool_t AliRsnInputHandler::Notify()
100 // Notify() is called for all mix input handlers
102 AliDebug(AliLog::kDebug + 5, Form("<-"));
103 AliDebug(AliLog::kDebug + 5, Form("->"));
107 //_____________________________________________________________________________
108 Bool_t AliRsnInputHandler::Notify(const char *path)
111 // Notify(const char*path) is called for all mix input handlers
113 AliDebug(AliLog::kDebug + 5, Form("<- %s", path));
114 AliDebug(AliLog::kDebug + 5, "->");
117 //_____________________________________________________________________________
118 Bool_t AliRsnInputHandler::BeginEvent(Long64_t entry)
121 // BeginEvent(Long64_t entry) is called for all mix input handlers
123 AliDebug(AliLog::kDebug + 5, Form("<- %lld", entry));
125 if (fParentHandler) {
127 AliInputEventHandler *ih = 0;
128 AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler *>(fParentHandler);
130 ih = multiIH->GetFirstInputEventHandler();
132 if (!fRsnEvent) fRsnEvent = new AliRsnEvent();
133 fRsnEvent->SetRef(ih->GetEvent());
134 fRsnEvent->SetPIDResponse(ih->GetPIDResponse());
135 if (fRsnEvent->GetRefESD()) {
136 AliMCEventHandler *mcH = multiIH->GetFirstMCEventHandler();
137 if (mcH) fRsnEvent->SetRefMC(mcH->MCEvent());
138 } else if (fRsnEvent->GetRefAOD()) {
139 AliAODEvent *aod = fRsnEvent->GetRefAOD();
140 TClonesArray *listAOD = (TClonesArray *)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()));
141 if (listAOD) fRsnEvent->SetRefMC(fRsnEvent->GetRefAOD());
143 if (fParentHandler->ParentHandler()) tmp = "MIX";
145 //fRsnPIDManager.Reset();
147 //fRsnPIDManager.ApplyCuts(fRsnEvent);
148 fRsnSelector.Reset();
150 // reject event if needed
151 if (fRsnEventCuts) if (!fRsnEventCuts->IsSelected(fRsnEvent)) return kTRUE;
152 fRsnSelector.ScanEvent(fRsnEvent);
153 fRsnSelector.ExecActions(fRsnEvent);
157 AliDebug(AliLog::kDebug + 5, "->");
161 Bool_t AliRsnInputHandler::GetEntry()
163 AliDebug(AliLog::kDebug + 5, "<-");
164 AliDebug(AliLog::kDebug + 5, "->");
168 //_____________________________________________________________________________
169 Bool_t AliRsnInputHandler::FinishEvent()
172 // FinishEvent() is called for all mix input handlers
174 AliDebug(AliLog::kDebug + 5, Form("<-"));
175 AliDebug(AliLog::kDebug + 5, Form("->"));