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>
12 #include "AliESDEvent.h"
13 #include "AliMCEvent.h"
14 #include "AliAODEvent.h"
16 #include "AliRsnCutSet.h"
17 #include "AliRsnVATProcessInfo.h"
18 #include "AliRsnAnalysisSE.h"
20 ClassImp(AliRsnAnalysisSE)
22 //_____________________________________________________________________________
23 AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name,Int_t numOfOutputs,Bool_t useKine) :
24 AliRsnVAnalysisTaskSE(name,numOfOutputs,useKine),
25 fRsnAnalysisManager(),
27 fZeroEventPercentWarning(50),
28 fUseZeroEventWarning(kTRUE)
31 // Default constructor.
34 AliDebug(AliLog::kDebug+2,"<-");
35 for (Int_t i=0;i<fNumberOfOutputs;i++) {
36 DefineOutput(i+2, TList::Class());
38 AliDebug(AliLog::kDebug+2,"->");
41 //_____________________________________________________________________________
42 AliRsnAnalysisSE::AliRsnAnalysisSE(const AliRsnAnalysisSE& copy) :
43 AliRsnVAnalysisTaskSE(copy),
44 fRsnAnalysisManager(copy.fRsnAnalysisManager),
45 fEventCuts(copy.fEventCuts),
46 fZeroEventPercentWarning(copy.fZeroEventPercentWarning),
47 fUseZeroEventWarning(copy.fUseZeroEventWarning)
53 AliDebug(AliLog::kDebug+2,"<-");
54 AliDebug(AliLog::kDebug+2,"->");
57 //_____________________________________________________________________________
58 void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
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.
67 AliDebug(AliLog::kDebug+2,"<-");
70 for (i = 1; i < kMaxNumberOfOutputs + 1; i++)
72 if (i <= fNumberOfOutputs + 1) OpenFile(i);
73 fOutList[i] = new TList();
74 fOutList[i]->SetOwner();
77 for (i = 0; i < fNumberOfOutputs; i++)
79 fRsnAnalysisManager[i].InitAllPairMgrs(fOutList[i+1]);
82 AliDebug(AliLog::kDebug+2,"->");
85 //_____________________________________________________________________________
86 void AliRsnAnalysisSE::RsnUserExec(Option_t*)
89 // Execution of the analysis task.
90 // Recovers the input event and processes it with all included pair objects.
93 AliDebug(AliLog::kDebug+2,"<-");
95 fTaskInfo.SetEventUsed(kFALSE);
98 AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
99 AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
102 AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
103 AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
106 AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
107 AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
110 AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
111 AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
114 // Removing empty events
115 if (fRsnEvent.GetMultiplicity()<=0) {
116 AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
117 fTaskInfo.SetEventUsed(kFALSE);
118 if (fUseZeroEventWarning)
120 TH1I *hist = (TH1I*)fOutList[0]->FindObject(fTaskInfo.GetEventHistogramName());
122 Double_t zeroEventPercent = 0.0;
123 if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100;
124 if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100))
125 AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry));
130 // if general event cuts are added to the task (recommended)
131 // they are checked here on the RSN event interface and,
132 // if the event does not pass them, it is skipped and ProcessInfo
133 // is updated accordingly
135 if (!fEventCuts->IsSelected(AliRsnCut::kEvent, &fRsnEvent)) {
136 fTaskInfo.SetEventUsed(kFALSE);
141 // if cuts are passed or not cuts were defined,
142 // update the task info...
143 fTaskInfo.SetEventUsed(kTRUE);
145 // the virtual class has already sorted tracks in the PID index
146 // so we need here just to call the execution of analysis
147 for (Int_t i = 0; i < fNumberOfOutputs; i++)
149 fRsnAnalysisManager[i].ProcessAllPairMgrs(&fRsnPIDIndex, &fRsnEvent);
150 PostData(i+2, fOutList[i+1]);
152 AliDebug(AliLog::kDebug+2,"->");
156 //_____________________________________________________________________________
157 void AliRsnAnalysisSE::RsnTerminate(Option_t*)
161 // Could be added some monitor histograms here.
164 AliDebug(AliLog::kDebug+2,"<-");
165 AliDebug(AliLog::kDebug+2,"->");
168 //_____________________________________________________________________________
169 AliRsnAnalysisManager* AliRsnAnalysisSE::GetAnalysisManager(Int_t index, TString name)
172 // Recovery the analysis manager
177 SetAnalysisManagerName(name.Data(), index);
180 return &fRsnAnalysisManager[index];