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