]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnAnalysisSE.cxx
Major upgrade to the package, in order to speed-up the execution and remove some...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisSE.cxx
CommitLineData
aec0ec32 1//
9477aa42 2// Class AliRsnAnalysisSE
aec0ec32 3//
9477aa42 4// Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class
5// for all RSN SE tasks
aec0ec32 6//
9477aa42 7// authors: Martin Vala (martin.vala@cern.ch)
8// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
aec0ec32 9//
9477aa42 10
4fbb2459 11#include <Riostream.h>
2dab9030 12#include <TList.h>
4fbb2459 13#include "AliESDEvent.h"
14#include "AliMCEvent.h"
15#include "AliAODEvent.h"
16
6f4a992c 17#include "AliRsnCutSet.h"
18#include "AliRsnVATProcessInfo.h"
aec0ec32 19#include "AliRsnAnalysisSE.h"
20
21ClassImp(AliRsnAnalysisSE)
22
5eb970a4 23//_____________________________________________________________________________
2dab9030 24AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) :
25 AliRsnVAnalysisTaskSE(name, useKine),
26 fRsnAnalysisManager(),
27 fEventCuts(0x0),
28 fOutList(0x0),
29 fZeroEventPercentWarning(50),
30 fUseZeroEventWarning(kTRUE)
aec0ec32 31{
15d5fd02 32//
4fbb2459 33// Default constructor.
15d5fd02 34//
4fbb2459 35
2dab9030 36 DefineOutput(2, TList::Class());
5eb970a4 37 AliDebug(AliLog::kDebug+2,"->");
aec0ec32 38}
39
4fbb2459 40//_____________________________________________________________________________
41AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) :
42 AliRsnVAnalysisTaskSE(copy),
43 fRsnAnalysisManager(copy.fRsnAnalysisManager),
44 fEventCuts(copy.fEventCuts),
2dab9030 45 fOutList(0x0),
4fbb2459 46 fZeroEventPercentWarning(copy.fZeroEventPercentWarning),
47 fUseZeroEventWarning(copy.fUseZeroEventWarning)
aec0ec32 48{
4fbb2459 49//
50// Copy constructor.
51//
52
5eb970a4 53 AliDebug(AliLog::kDebug+2,"<-");
54 AliDebug(AliLog::kDebug+2,"->");
aec0ec32 55}
56
5eb970a4 57//_____________________________________________________________________________
58void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
aec0ec32 59{
4fbb2459 60//
61// Creation of output objects.
62// These are created through the utility methods in the analysis manager,
63// which produces a list of histograms for each specified set of pairs.
64// Each of these lists is added to the main list of this task.
65//
66
5eb970a4 67 AliDebug(AliLog::kDebug+2,"<-");
aec0ec32 68
2dab9030 69 fOutList = new TList;
70 fRsnAnalysisManager.InitAllPairs(fOutList);
71
72 AliError("\n\n***LIST***\n\n");
73 fOutList->Print();
4fbb2459 74
2dab9030 75 PostData(2, fOutList);
aec0ec32 76
5eb970a4 77 AliDebug(AliLog::kDebug+2,"->");
aec0ec32 78}
79
4fbb2459 80//_____________________________________________________________________________
81void AliRsnAnalysisSE::RsnUserExec(Option_t*)
aec0ec32 82{
4fbb2459 83//
84// Execution of the analysis task.
85// Recovers the input event and processes it with all included pair objects.
86//
87
5eb970a4 88 AliDebug(AliLog::kDebug+2,"<-");
4fbb2459 89
90 fTaskInfo.SetEventUsed(kFALSE);
91
5eb970a4 92 if (fESDEvent) {
4fbb2459 93 AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
94 AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
5eb970a4 95 }
96 if (fMCEvent) {
4fbb2459 97 AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
98 AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
5eb970a4 99 }
100 if (fAODEventIn) {
4fbb2459 101 AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
102 AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
aec0ec32 103 }
5eb970a4 104 if (fAODEventOut) {
4fbb2459 105 AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
106 AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
5eb970a4 107 }
aec0ec32 108
4fbb2459 109 // Removing empty events
110 if (fRsnEvent.GetMultiplicity()<=0) {
111 AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
112 fTaskInfo.SetEventUsed(kFALSE);
113 if (fUseZeroEventWarning)
114 {
2dab9030 115 TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
4fbb2459 116 if (!hist) return;
102dd8c7 117 Double_t zeroEventPercent = 0.0;
118 if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
4fbb2459 119 if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100))
120 AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry));
121 }
5eb970a4 122 return;
4fbb2459 123 }
124
125 // if general event cuts are added to the task (recommended)
126 // they are checked here on the RSN event interface and,
127 // if the event does not pass them, it is skipped and ProcessInfo
128 // is updated accordingly
6f4a992c 129 if (fEventCuts) {
2dab9030 130 if (!fEventCuts->IsSelected(&fRsnEvent)) {
4fbb2459 131 fTaskInfo.SetEventUsed(kFALSE);
6f4a992c 132 return;
133 }
6f4a992c 134 }
aec0ec32 135
4fbb2459 136 // if cuts are passed or not cuts were defined,
137 // update the task info...
138 fTaskInfo.SetEventUsed(kTRUE);
aec0ec32 139
4fbb2459 140 // the virtual class has already sorted tracks in the PID index
141 // so we need here just to call the execution of analysis
2dab9030 142 fRsnAnalysisManager.ProcessAllPairs(&fRsnEvent, &fRsnEvent);
143 PostData(2, fOutList);
144
5eb970a4 145 AliDebug(AliLog::kDebug+2,"->");
aec0ec32 146}
147
aec0ec32 148
5eb970a4 149//_____________________________________________________________________________
4fbb2459 150void AliRsnAnalysisSE::RsnTerminate(Option_t*)
5eb970a4 151{
4fbb2459 152//
153// Termination.
154// Could be added some monitor histograms here.
155//
156
5eb970a4 157 AliDebug(AliLog::kDebug+2,"<-");
158 AliDebug(AliLog::kDebug+2,"->");
aec0ec32 159}
160