]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG2/RESONANCES/AliRsnAnalysisSE.cxx
PWG2rsnextra:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisSE.cxx
... / ...
CommitLineData
1//
2// Class AliRsnAnalysisSE
3//
4// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class
5// for all RSN SE tasks
6//
7// authors: Martin Vala (martin.vala@cern.ch)
8// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
9//
10
11#include <Riostream.h>
12#include <TList.h>
13#include "AliESDEvent.h"
14#include "AliMCEvent.h"
15#include "AliAODEvent.h"
16
17#include "AliRsnCutSet.h"
18#include "AliRsnVATProcessInfo.h"
19#include "AliRsnAnalysisSE.h"
20
21ClassImp(AliRsnAnalysisSE)
22
23//_____________________________________________________________________________
24AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) :
25 AliRsnVAnalysisTaskSE(name, useKine),
26 fRsnAnalysisManager(),
27 fEventCuts("eventCuts", AliRsnCut::kEvent),
28 fOutList(0x0),
29 fZeroEventPercentWarning(100),
30 fUseZeroEventWarning(kTRUE)
31{
32//
33// Default constructor.
34// Defines another output slot for histograms/ntuples
35//
36
37 DefineOutput(2, TList::Class());
38}
39
40//_____________________________________________________________________________
41AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) :
42 AliRsnVAnalysisTaskSE(copy),
43 fRsnAnalysisManager(copy.fRsnAnalysisManager),
44 fEventCuts(copy.fEventCuts),
45 fOutList(0x0),
46 fZeroEventPercentWarning(copy.fZeroEventPercentWarning),
47 fUseZeroEventWarning(copy.fUseZeroEventWarning)
48{
49//
50// Copy constructor.
51//
52}
53
54//_____________________________________________________________________________
55AliRsnAnalysisSE& AliRsnAnalysisSE::operator=(const AliRsnAnalysisSE& copy)
56{
57//
58// Assigment operator.
59//
60
61 AliRsnVAnalysisTaskSE::operator=(copy);
62
63 fRsnAnalysisManager = copy.fRsnAnalysisManager;
64 fEventCuts = copy.fEventCuts;
65 if (fOutList) fOutList->Clear();
66 fZeroEventPercentWarning = copy.fZeroEventPercentWarning;
67 fUseZeroEventWarning = copy.fUseZeroEventWarning;
68
69 return (*this);
70}
71
72//_____________________________________________________________________________
73void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
74{
75//
76// Creation of output objects.
77// These are created through the utility methods in the analysis manager,
78// which asks all the AliRsnPair objects to initialize their output which
79// is then linked to the TList data member of this, which will contain all the output.
80//
81
82 if (!fOutList) fOutList = new TList;
83 fOutList->Clear();
84
85 fRsnAnalysisManager.InitAllPairs(fOutList);
86
87 PostData(2, fOutList);
88}
89
90//_____________________________________________________________________________
91void AliRsnAnalysisSE::RsnUserExec(Option_t*)
92{
93//
94// Execution of the analysis task.
95// Recovers the input event and processes it with all included pair objects,
96// using 'reconstructed' or 'MonteCarlo' functions depending on MC-only flag.
97//
98
99 fRsnAnalysisManager.ProcessAll(fMCOnly);
100
101 PostData(2, fOutList);
102}
103
104//_____________________________________________________________________________
105void AliRsnAnalysisSE::RsnTerminate(Option_t*)
106{
107//
108// Termination.
109// Could be added some monitor histograms here.
110//
111}
112
113//______________________________________________________________________________
114Bool_t AliRsnAnalysisSE::EventProcess()
115{
116//
117// Customized event pre-processing.
118// First checks if the current event passes all cuts,
119// and if it does, updates the informations and then
120// call the operations which are already defined in the
121// omonyme function in mother class
122//
123
124 // initially, an event is expected to be bad
125 fTaskInfo.SetEventUsed(kFALSE);
126
127 // check #1: number of tracks in event (reject empty events)
128 Int_t ntracks = fRsnEvent.GetMultiplicity();
129 Double_t zeroEventPercent = 0.0;
130 if (ntracks < 1) {
131 // if using the checker for amount of empty events, update it
132 if (fUseZeroEventWarning) {
133 TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
134 if (hist) {
135 if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
136 if ((zeroEventPercent > fZeroEventPercentWarning) && (fEntry > 100))
137 AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!", zeroEventPercent, fEntry));
138 }
139 }
140
141 // empty events are rejected by default
142 fTaskInfo.SetEventUsed(kFALSE);
143 AliDebug(AliLog::kDebug, "Empty event. Skipping...");
144 return kFALSE;
145 }
146
147 // check the event cuts and update the info data accordingly
148 // events not passing the cuts must be rejected
149 if (!fEventCuts.IsSelected(&fRsnEvent)) {
150 fTaskInfo.SetEventUsed(kFALSE);
151 return kFALSE;
152 }
153
154 // if we reach this point, cuts were passed;
155 // then additional operations can be done
156
157 // find leading particle (without any PID/momentum restriction)
158 fRsnEvent.SelectLeadingParticle(0);
159
160 // final return value is positive
161 // but call the mother class method which updates info object
162 fTaskInfo.SetEventUsed(kTRUE);
163 return AliRsnVAnalysisTaskSE::EventProcess();
164}