]>
Commit | Line | Data |
---|---|---|
5eb970a4 | 1 | // |
2 | // *** Class AliRsnVATProcessInfo *** | |
3 | // | |
32992791 | 4 | // Virtual class which makes computations at the event level, |
5 | // in order to return a list of histograms useful to have a look | |
6 | // of the characteristics of used events. | |
7 | // If can be inherited and customized for the needs of the analysis. | |
5eb970a4 | 8 | // |
9 | // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) | |
10 | // M. Vala (email: martin.vala@cern.ch) | |
11 | // | |
12 | ||
13 | #include <TList.h> | |
14 | #include <TH1.h> | |
15 | ||
16 | #include "AliLog.h" | |
17 | ||
18 | #include "AliRsnVATProcessInfo.h" | |
19 | ||
20 | ClassImp(AliRsnVATProcessInfo) | |
21 | ||
32992791 | 22 | //______________________________________________________________________________ |
4fbb2459 | 23 | AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) : |
32992791 | 24 | TNamed(name,name), |
25 | fHistUsedEvents(0x0), | |
26 | fEventUsed(kFALSE), | |
27 | fPrintInfoNumber(1000) | |
5eb970a4 | 28 | { |
4fbb2459 | 29 | // |
30 | // Constructor. | |
32992791 | 31 | // Does nothing more than initialization of data members. |
4fbb2459 | 32 | // |
33 | ||
32992791 | 34 | AliDebug(AliLog::kDebug+2, "Entering"); |
35 | AliDebug(AliLog::kDebug+2, "Exiting"); | |
5eb970a4 | 36 | } |
37 | ||
32992791 | 38 | //______________________________________________________________________________ |
4fbb2459 | 39 | AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) : |
32992791 | 40 | TNamed(copy), |
41 | fHistUsedEvents(0x0), | |
42 | fEventUsed(copy.fEventUsed), | |
43 | fPrintInfoNumber(copy.fPrintInfoNumber) | |
5eb970a4 | 44 | { |
4fbb2459 | 45 | // |
46 | // Copy constructor. | |
32992791 | 47 | // Clones the histogram and copies the values of other data members |
4fbb2459 | 48 | // |
49 | ||
32992791 | 50 | AliDebug(AliLog::kDebug+2, "Entering"); |
51 | ||
52 | fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); | |
53 | ||
54 | AliDebug(AliLog::kDebug+2, "Exiting"); | |
5eb970a4 | 55 | } |
56 | ||
32992791 | 57 | //______________________________________________________________________________ |
58 | AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator= | |
59 | (const AliRsnVATProcessInfo& copy) | |
5eb970a4 | 60 | { |
4fbb2459 | 61 | // |
32992791 | 62 | // Assignment operator. |
63 | // Clones the histogram and copies the values of other data members. | |
4fbb2459 | 64 | // |
65 | ||
32992791 | 66 | AliDebug(AliLog::kDebug+2, "Entering"); |
67 | ||
68 | fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone(); | |
69 | fEventUsed = copy.fEventUsed; | |
70 | fPrintInfoNumber = copy.fPrintInfoNumber; | |
71 | ||
72 | AliDebug(AliLog::kDebug+2, "Exiting"); | |
73 | ||
74 | return (*this); | |
5eb970a4 | 75 | } |
76 | ||
32992791 | 77 | //______________________________________________________________________________ |
78 | AliRsnVATProcessInfo::~AliRsnVATProcessInfo() | |
79 | { | |
80 | // | |
81 | // Destructor. | |
82 | // Does nothing, since the histogram it creates is usually owned | |
83 | // by another object (TList output of AnalysisTask's), but sets | |
84 | // the data member pointers to NULL. | |
85 | // | |
86 | ||
87 | AliDebug(AliLog::kDebug+2, "Entering"); | |
88 | ||
89 | fHistUsedEvents = 0x0; | |
90 | fEventUsed = 0; | |
91 | fPrintInfoNumber = 0; | |
92 | ||
93 | AliDebug(AliLog::kDebug+2, "Exiting"); | |
94 | } | |
95 | ||
96 | //______________________________________________________________________________ | |
4fbb2459 | 97 | void AliRsnVATProcessInfo::GenerateInfoList(TList *list) |
98 | { | |
99 | // | |
32992791 | 100 | // Allocate in memory the histograms created in this class and store them |
101 | // inside the TList object passed as argument, which usually belongs to | |
102 | // an AnalysisTask object, and represents one of its outputs. | |
103 | // If the histogram was already initialized, it is deleted and recreated. | |
4fbb2459 | 104 | // |
105 | ||
32992791 | 106 | AliDebug(AliLog::kDebug+2, "Entering"); |
5eb970a4 | 107 | |
32992791 | 108 | // delete existing allocation of stored objects |
109 | if (fHistUsedEvents) delete fHistUsedEvents; | |
110 | ||
111 | // create stored objects | |
28399a41 | 112 | fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 3, 0, 3); |
5eb970a4 | 113 | |
4fbb2459 | 114 | // ad objects to list |
115 | list->Add(fHistUsedEvents); | |
5eb970a4 | 116 | |
32992791 | 117 | AliDebug(AliLog::kDebug+2, "Exiting"); |
5eb970a4 | 118 | } |
119 | ||
32992791 | 120 | //______________________________________________________________________________ |
4fbb2459 | 121 | void AliRsnVATProcessInfo::FillInfo() |
122 | { | |
123 | // | |
124 | // This method defines how the information histograms must be filled. | |
32992791 | 125 | // The structure of this class is auto-consistent, but in case of inheritance |
4fbb2459 | 126 | // this method must be modified accordingly. |
127 | // Current implementation uses the 'fEventUsed' flag to choose if the event | |
32992791 | 128 | // has been used or not, and increments the corresponding bin in the related |
4fbb2459 | 129 | // histogram (bin '0' = skipped, bin '1' = used). |
130 | // | |
131 | ||
28399a41 | 132 | fHistUsedEvents->Fill(fEventUsed); |
4fbb2459 | 133 | } |
134 | ||
32992791 | 135 | //______________________________________________________________________________ |
4fbb2459 | 136 | void AliRsnVATProcessInfo::PrintInfo(const Long64_t &num) |
137 | { | |
138 | // | |
139 | // This method is used in some cases | |
140 | // to inform about number of events processed | |
141 | // | |
142 | ||
32992791 | 143 | if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld", num+1)); |
5eb970a4 | 144 | } |
145 | ||
32992791 | 146 | //______________________________________________________________________________ |
4fbb2459 | 147 | Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed() |
148 | { | |
149 | // | |
150 | // returns number of events from histogram | |
151 | // | |
32992791 | 152 | |
153 | if (fHistUsedEvents) return fHistUsedEvents->Integral(); | |
4fbb2459 | 154 | return 0; |
5eb970a4 | 155 | } |