]>
Commit | Line | Data |
---|---|---|
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> |
12 | #include "AliESDEvent.h" | |
13 | #include "AliMCEvent.h" | |
14 | #include "AliAODEvent.h" | |
15 | ||
6f4a992c | 16 | #include "AliRsnCutSet.h" |
17 | #include "AliRsnVATProcessInfo.h" | |
aec0ec32 | 18 | #include "AliRsnAnalysisSE.h" |
19 | ||
20 | ClassImp(AliRsnAnalysisSE) | |
21 | ||
5eb970a4 | 22 | //_____________________________________________________________________________ |
bd6bf3ee | 23 | AliRsnAnalysisSE::AliRsnAnalysisSE(const char *name,Int_t numOfOutputs,Bool_t useKine) : |
24 | AliRsnVAnalysisTaskSE(name,numOfOutputs,useKine), | |
5eb970a4 | 25 | fRsnAnalysisManager(), |
6f4a992c | 26 | fEventCuts(0x0), |
4fbb2459 | 27 | fZeroEventPercentWarning(50), |
28 | fUseZeroEventWarning(kTRUE) | |
aec0ec32 | 29 | { |
15d5fd02 | 30 | // |
4fbb2459 | 31 | // Default constructor. |
15d5fd02 | 32 | // |
4fbb2459 | 33 | |
5eb970a4 | 34 | AliDebug(AliLog::kDebug+2,"<-"); |
4fbb2459 | 35 | for (Int_t i=0;i<fNumberOfOutputs;i++) { |
36 | DefineOutput(i+2, TList::Class()); | |
37 | } | |
5eb970a4 | 38 | AliDebug(AliLog::kDebug+2,"->"); |
aec0ec32 | 39 | } |
40 | ||
4fbb2459 | 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) | |
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 | //_____________________________________________________________________________ |
58 | void 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 | |
4fbb2459 | 69 | Int_t i; |
70 | for (i = 1; i < kMaxNumberOfOutputs + 1; i++) | |
71 | { | |
413bbf44 | 72 | // this line makes trouble with PROOF ---> if (i <= fNumberOfOutputs + 1) OpenFile(i); |
4fbb2459 | 73 | fOutList[i] = new TList(); |
74 | fOutList[i]->SetOwner(); | |
75 | } | |
76 | ||
77 | for (i = 0; i < fNumberOfOutputs; i++) | |
78 | { | |
79 | fRsnAnalysisManager[i].InitAllPairMgrs(fOutList[i+1]); | |
80 | } | |
aec0ec32 | 81 | |
5eb970a4 | 82 | AliDebug(AliLog::kDebug+2,"->"); |
aec0ec32 | 83 | } |
84 | ||
4fbb2459 | 85 | //_____________________________________________________________________________ |
86 | void AliRsnAnalysisSE::RsnUserExec(Option_t*) | |
aec0ec32 | 87 | { |
4fbb2459 | 88 | // |
89 | // Execution of the analysis task. | |
90 | // Recovers the input event and processes it with all included pair objects. | |
91 | // | |
92 | ||
5eb970a4 | 93 | AliDebug(AliLog::kDebug+2,"<-"); |
4fbb2459 | 94 | |
95 | fTaskInfo.SetEventUsed(kFALSE); | |
96 | ||
5eb970a4 | 97 | if (fESDEvent) { |
4fbb2459 | 98 | AliDebug(AliLog::kDebug+1, Form("fESDEvent is %p", fESDEvent)); |
99 | AliDebug(AliLog::kDebug, Form("ESD tracks %d", fESDEvent->GetNumberOfTracks())); | |
5eb970a4 | 100 | } |
101 | if (fMCEvent) { | |
4fbb2459 | 102 | AliDebug(AliLog::kDebug+1, Form("fMCEvent is %p", fMCEvent)); |
103 | AliDebug(AliLog::kDebug, Form("MC tracks %d", fMCEvent->GetNumberOfTracks())); | |
5eb970a4 | 104 | } |
105 | if (fAODEventIn) { | |
4fbb2459 | 106 | AliDebug(AliLog::kDebug+1, Form("fAODEventIn is %p", fAODEventIn)); |
107 | AliDebug(AliLog::kDebug, Form("AOD(in) tracks %d", fAODEventIn->GetNumberOfTracks())); | |
aec0ec32 | 108 | } |
5eb970a4 | 109 | if (fAODEventOut) { |
4fbb2459 | 110 | AliDebug(AliLog::kDebug+1, Form("fAODEventOut if %p", fAODEventOut)); |
111 | AliDebug(AliLog::kDebug, Form("AOD(out) tracks %d", fAODEventOut->GetNumberOfTracks())); | |
5eb970a4 | 112 | } |
aec0ec32 | 113 | |
4fbb2459 | 114 | // Removing empty events |
115 | if (fRsnEvent.GetMultiplicity()<=0) { | |
116 | AliDebug(AliLog::kDebug, "Zero event!!! Skipping ..."); | |
117 | fTaskInfo.SetEventUsed(kFALSE); | |
118 | if (fUseZeroEventWarning) | |
119 | { | |
120 | TH1I *hist = (TH1I*)fOutList[0]->FindObject(fTaskInfo.GetEventHistogramName()); | |
121 | if (!hist) return; | |
102dd8c7 | 122 | Double_t zeroEventPercent = 0.0; |
123 | if (hist->Integral() > 1) zeroEventPercent = (Double_t)hist->GetBinContent(1) / hist->Integral() * 100; | |
4fbb2459 | 124 | if ((zeroEventPercent>fZeroEventPercentWarning)&&(fEntry>100)) |
125 | AliWarning(Form("%3.2f%% Events are with zero tracks (CurrentEvent=%d)!!!",zeroEventPercent,fEntry)); | |
126 | } | |
5eb970a4 | 127 | return; |
4fbb2459 | 128 | } |
129 | ||
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 | |
6f4a992c | 134 | if (fEventCuts) { |
4fbb2459 | 135 | if (!fEventCuts->IsSelected(AliRsnCut::kEvent, &fRsnEvent)) { |
136 | fTaskInfo.SetEventUsed(kFALSE); | |
6f4a992c | 137 | return; |
138 | } | |
6f4a992c | 139 | } |
aec0ec32 | 140 | |
4fbb2459 | 141 | // if cuts are passed or not cuts were defined, |
142 | // update the task info... | |
143 | fTaskInfo.SetEventUsed(kTRUE); | |
aec0ec32 | 144 | |
4fbb2459 | 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++) | |
148 | { | |
149 | fRsnAnalysisManager[i].ProcessAllPairMgrs(&fRsnPIDIndex, &fRsnEvent); | |
150 | PostData(i+2, fOutList[i+1]); | |
151 | } | |
5eb970a4 | 152 | AliDebug(AliLog::kDebug+2,"->"); |
aec0ec32 | 153 | } |
154 | ||
aec0ec32 | 155 | |
5eb970a4 | 156 | //_____________________________________________________________________________ |
4fbb2459 | 157 | void AliRsnAnalysisSE::RsnTerminate(Option_t*) |
5eb970a4 | 158 | { |
4fbb2459 | 159 | // |
160 | // Termination. | |
161 | // Could be added some monitor histograms here. | |
162 | // | |
163 | ||
5eb970a4 | 164 | AliDebug(AliLog::kDebug+2,"<-"); |
165 | AliDebug(AliLog::kDebug+2,"->"); | |
aec0ec32 | 166 | } |
167 | ||
5eb970a4 | 168 | //_____________________________________________________________________________ |
4fbb2459 | 169 | AliRsnAnalysisManager* AliRsnAnalysisSE::GetAnalysisManager(Int_t index, TString name) |
922688c0 | 170 | { |
4fbb2459 | 171 | // |
172 | // Recovery the analysis manager | |
173 | // | |
922688c0 | 174 | |
4fbb2459 | 175 | if (!name.IsNull()) |
176 | { | |
177 | SetAnalysisManagerName(name.Data(), index); | |
5eb970a4 | 178 | } |
15d5fd02 | 179 | |
4fbb2459 | 180 | return &fRsnAnalysisManager[index]; |
15d5fd02 | 181 | } |