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.
56 fRsnEventCuts = copy.fRsnEventCuts;
61 //_____________________________________________________________________________
62 AliRsnInputHandler::~AliRsnInputHandler()
67 AliDebug(AliLog::kDebug + 10, "<-");
69 AliDebug(AliLog::kDebug + 10, "->");
72 //_____________________________________________________________________________
73 Bool_t AliRsnInputHandler::Init(Option_t *opt)
76 // Init() is called for all mix input handlers.
78 AliDebug(AliLog::kDebug + 5, Form("<- opt=%s", opt));
80 AliDebug(AliLog::kDebug + 5, Form("->"));
83 //_____________________________________________________________________________
84 Bool_t AliRsnInputHandler::Init(TTree *tree, Option_t *opt)
87 // Init(const char*path) is called for all mix input handlers.
88 // Create event pool if needed
90 AliDebug(AliLog::kDebug + 5, Form("<- %p %s opt=%s", (void *) tree, tree->GetName(), opt));
91 AliDebug(AliLog::kDebug + 5, Form("->"));
94 //_____________________________________________________________________________
95 Bool_t AliRsnInputHandler::Notify()
98 // Notify() is called for all mix input handlers
100 AliDebug(AliLog::kDebug + 5, Form("<-"));
101 AliDebug(AliLog::kDebug + 5, Form("->"));
105 //_____________________________________________________________________________
106 Bool_t AliRsnInputHandler::Notify(const char *path)
109 // Notify(const char*path) is called for all mix input handlers
111 AliDebug(AliLog::kDebug + 5, Form("<- %s", path));
112 AliDebug(AliLog::kDebug + 5, "->");
115 //_____________________________________________________________________________
116 Bool_t AliRsnInputHandler::BeginEvent(Long64_t entry)
119 // BeginEvent(Long64_t entry) is called for all mix input handlers
121 AliDebug(AliLog::kDebug + 5, Form("<- %lld", entry));
123 if (fParentHandler) {
125 AliInputEventHandler *ih = 0;
126 AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler*>(fParentHandler);
128 ih = multiIH->GetFirstInputEventHandler();
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()) {
137 AliAODEvent *aod = fRsnEvent->GetRefAOD();
138 TClonesArray *listAOD = (TClonesArray*)(aod->GetList()->FindObject(AliAODMCParticle::StdBranchName()));
139 if (listAOD) fRsnEvent->SetRefMC(fRsnEvent->GetRefAOD());
141 if (fParentHandler->ParentHandler()) tmp = "MIX";
143 //fRsnPIDManager.Reset();
145 //fRsnPIDManager.ApplyCuts(fRsnEvent);
146 fRsnSelector.Reset();
148 // reject event if needed
149 if (fRsnEventCuts) if (!fRsnEventCuts->IsSelected(fRsnEvent)) return kTRUE;
150 fRsnSelector.ScanEvent(fRsnEvent);
154 AliDebug(AliLog::kDebug + 5, "->");
158 Bool_t AliRsnInputHandler::GetEntry()
160 AliDebug(AliLog::kDebug + 5, "<-");
161 AliDebug(AliLog::kDebug + 5, "->");
165 //_____________________________________________________________________________
166 Bool_t AliRsnInputHandler::FinishEvent()
169 // FinishEvent() is called for all mix input handlers
171 AliDebug(AliLog::kDebug + 5, Form("<-"));
172 AliDebug(AliLog::kDebug + 5, Form("->"));