]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnAnalysisSE.cxx
Update to the analysis on MC data only.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnAnalysisSE.cxx
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
21 ClassImp(AliRsnAnalysisSE)
22
23 //_____________________________________________________________________________
24 AliRsnAnalysisSE::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)
31 {
32 //
33 // Default constructor.
34 //
35
36   DefineOutput(2, TList::Class());
37   AliDebug(AliLog::kDebug+2,"->");
38 }
39
40 //_____________________________________________________________________________
41 AliRsnAnalysisSE::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   AliDebug(AliLog::kDebug+2,"<-");
54   AliDebug(AliLog::kDebug+2,"->");
55 }
56
57 //_____________________________________________________________________________
58 AliRsnAnalysisSE::~AliRsnAnalysisSE()
59 {
60 //
61 // Destructor
62 //
63
64   fOutList->Clear();
65 }
66
67 //_____________________________________________________________________________
68 void AliRsnAnalysisSE::RsnUserCreateOutputObjects()
69 {
70 //
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.
75 //
76
77   AliDebug(AliLog::kDebug+2,"<-");
78
79   fOutList = new TList;
80   fRsnAnalysisManager.InitAllPairs(fOutList);
81
82   PostData(2, fOutList);
83
84   AliDebug(AliLog::kDebug+2,"->");
85 }
86
87 //_____________________________________________________________________________
88 void AliRsnAnalysisSE::RsnUserExec(Option_t*)
89 {
90 //
91 // Execution of the analysis task.
92 // Recovers the input event and processes it with all included pair objects.
93 //
94
95   AliDebug(AliLog::kDebug+2,"<-");
96   
97   fTaskInfo.SetEventUsed(kFALSE);
98
99   if (fESDEvent) {
100     AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent));
101     AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks()));
102   }
103   if (fMCEvent) {
104     AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent));
105     AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks()));
106   }
107   if (fAODEventIn) {
108     AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn));
109     AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks()));
110   }
111   if (fAODEventOut) {
112     AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut));
113     AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks()));
114   }
115
116   // Removing empty events
117   if (fRsnEvent.GetMultiplicity()<=0) {
118     AliDebug(AliLog::kDebug, "Zero event!!! Skipping ...");
119     fTaskInfo.SetEventUsed(kFALSE);
120     if (fUseZeroEventWarning)
121     {
122       TH1I *hist = (TH1I*)fInfoList->FindObject(fTaskInfo.GetEventHistogramName());
123       if (!hist) return;
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));
128     }
129     //return;
130   }
131
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
136   if (fEventCuts) {
137     if (!fEventCuts->IsSelected(&fRsnEvent)) {
138       fTaskInfo.SetEventUsed(kFALSE);
139       return;
140     }
141   }
142
143   // if cuts are passed or not cuts were defined,
144   // update the task info...
145   fTaskInfo.SetEventUsed(kTRUE);
146
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);
152
153   AliDebug(AliLog::kDebug+2,"->");
154 }
155
156
157 //_____________________________________________________________________________
158 void AliRsnAnalysisSE::RsnTerminate(Option_t*)
159 {
160 //
161 // Termination.
162 // Could be added some monitor histograms here.
163 //
164
165   AliDebug(AliLog::kDebug+2,"<-");
166   AliDebug(AliLog::kDebug+2,"->");
167 }
168