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(),
29 fZeroEventPercentWarning(50),
30 fUseZeroEventWarning(kTRUE)
33 // Default constructor.
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()
67 //_____________________________________________________________________________
68 void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
71 // Creation of output objects.
72 // These are created through the utility methods in the analysis manager,
73 // which produces a list of histograms for each specified set of pairs.
74 // Each of these lists is added to the main list of this task.
77 AliDebug(AliLog::kDebug+2,"<-");
80 fRsnAnalysisManager.InitAllPairs(fOutList);
82 PostData(2, fOutList);
84 AliDebug(AliLog::kDebug+2,"->");
87 //_____________________________________________________________________________
88 void AliRsnAnalysisSE::RsnUserExec(Option_t*)
91 // Execution of the analysis task.
92 // Recovers the input event and processes it with all included pair objects.
95 AliDebug(AliLog::kDebug+2,"<-");
97 fTaskInfo.SetEventUsed(kFALSE);
100 AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
101 AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
104 AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
105 AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
108 AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
109 AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
112 AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
113 AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
116 // Removing empty events
117 if (fRsnEvent.GetMultiplicity()<=0) {
118 AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
119 fTaskInfo.SetEventUsed(kFALSE);
120 if (fUseZeroEventWarning)
122 TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
124 Double_t zeroEventPercent = 0.0;
125 if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
126 if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100))
127 AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry));
132 // if general event cuts are added to the task (recommended)
133 // they are checked here on the RSN event interface and,
134 // if the event does not pass them, it is skipped and ProcessInfo
135 // is updated accordingly
137 if (!fEventCuts->IsSelected(&fRsnEvent)) {
138 fTaskInfo.SetEventUsed(kFALSE);
143 // if cuts are passed or not cuts were defined,
144 // update the task info...
145 fTaskInfo.SetEventUsed(kTRUE);
147 // the virtual class has already sorted tracks in the PID index
148 // so we need here just to call the execution of analysis
149 if (!fMCOnly) fRsnAnalysisManager.ProcessAllPairs(&fRsnEvent, &fRsnEvent);
150 else fRsnAnalysisManager.ProcessAllPairsMC(&fRsnEvent, &fRsnEvent);
151 PostData(2, fOutList);
153 AliDebug(AliLog::kDebug+2,"->");
157 //_____________________________________________________________________________
158 void AliRsnAnalysisSE::RsnTerminate(Option_t*)
162 // Could be added some monitor histograms here.
165 AliDebug(AliLog::kDebug+2,"<-");
166 AliDebug(AliLog::kDebug+2,"->");