2 // Class AliRsnAnalysisSE
4 // Virtual Class derivated from AliRsnVAnalysisTaskSE which will be base class
5 // for all RSN SE tasks
7 // authors: Martin Vala (martin.vala@cern.ch)
8 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
11 #include <Riostream.h>
13 #include "AliESDEvent.h"
14 #include "AliMCEvent.h"
15 #include "AliAODEvent.h"
17 #include "AliRsnCutSet.h"
18 #include "AliRsnVATProcessInfo.h"
19 #include "AliRsnAnalysisSE.h"
21 ClassImp(AliRsnAnalysisSE)
23 //_____________________________________________________________________________
24 AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name, Bool_t useKine) :
25 AliRsnVAnalysisTaskSE(name, useKine),
26 fRsnAnalysisManager(),
27 fEventCuts("eventCuts", AliRsnCut::kEvent),
29 fZeroEventPercentWarning(100),
30 fUseZeroEventWarning(kTRUE)
33 // Default constructor.
35 AliDebug(AliLog::kDebug+2, "<-");
36 DefineOutput(2, TList::Class());
37 AliDebug(AliLog::kDebug+2,"->");
40 //_____________________________________________________________________________
41 AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) :
42 AliRsnVAnalysisTaskSE(copy),
43 fRsnAnalysisManager(copy.fRsnAnalysisManager),
44 fEventCuts(copy.fEventCuts),
46 fZeroEventPercentWarning(copy.fZeroEventPercentWarning),
47 fUseZeroEventWarning(copy.fUseZeroEventWarning)
53 AliDebug(AliLog::kDebug+2,"<-");
54 AliDebug(AliLog::kDebug+2,"->");
57 // //_____________________________________________________________________________
58 // AliRsnAnalysisSE::~AliRsnAnalysisSE()
68 //_____________________________________________________________________________
69 void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
72 // Creation of output objects.
73 // These are created through the utility methods in the analysis manager,
74 // which produces a list of histograms for each specified set of pairs.
75 // Each of these lists is added to the main list of this task.
78 AliDebug(AliLog::kDebug+2,"<-");
81 fRsnAnalysisManager.InitAllPairs(fOutList);
83 PostData(2, fOutList);
85 AliDebug(AliLog::kDebug+2,"->");
88 //_____________________________________________________________________________
89 void AliRsnAnalysisSE::RsnUserExec(Option_t*)
92 // Execution of the analysis task.
93 // Recovers the input event and processes it with all included pair objects.
96 AliDebug(AliLog::kDebug+2,"<-");
98 fTaskInfo.SetEventUsed(kFALSE);
101 AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
102 AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
105 AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
106 AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
109 AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
110 AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
113 AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
114 AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
117 // Removing empty events
118 if (fRsnEvent.GetMultiplicity()<=0) {
119 AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
120 fTaskInfo.SetEventUsed(kFALSE);
121 if (fUseZeroEventWarning)
123 TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
125 Double_t zeroEventPercent = 0.0;
126 if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
127 if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100))
128 AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry));
133 // if general event cuts are added to the task (recommended)
134 // they are checked here on the RSN event interface and,
135 // if the event does not pass them, it is skipped and ProcessInfo
136 // is updated accordingly
138 if (!fEventCuts.IsSelected(&fRsnEvent)) {
139 fTaskInfo.SetEventUsed(kFALSE);
144 // if cuts are passed or not cuts were defined,
145 // update the task info...
146 fTaskInfo.SetEventUsed(kTRUE);
148 // the virtual class has already sorted tracks in the PID index
149 // so we need here just to call the execution of analysis
150 if (!fMCOnly) fRsnAnalysisManager.ProcessAllPairs(&fRsnEvent, &fRsnEvent);
151 else fRsnAnalysisManager.ProcessAllPairsMC(&fRsnEvent, &fRsnEvent);
152 PostData(2, fOutList);
154 AliDebug(AliLog::kDebug+2,"->");
158 //_____________________________________________________________________________
159 void AliRsnAnalysisSE::RsnTerminate(Option_t*)
163 // Could be added some monitor histograms here.
166 AliDebug(AliLog::kDebug+2,"<-");
167 AliDebug(AliLog::kDebug+2,"->");