2 // *** Class AliRsnVATProcessInfo ***
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.
9 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
10 // M. Vala (email: martin.vala@cern.ch)
18 #include "AliRsnVATProcessInfo.h"
20 ClassImp(AliRsnVATProcessInfo)
22 //______________________________________________________________________________
23 AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) :
27 fPrintInfoNumber(1000)
31 // Does nothing more than initialization of data members.
34 AliDebug(AliLog::kDebug+2, "Entering");
35 AliDebug(AliLog::kDebug+2, "Exiting");
38 //______________________________________________________________________________
39 AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) :
42 fEventUsed(copy.fEventUsed),
43 fPrintInfoNumber(copy.fPrintInfoNumber)
47 // Clones the histogram and copies the values of other data members
50 AliDebug(AliLog::kDebug+2, "Entering");
52 fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone();
54 AliDebug(AliLog::kDebug+2, "Exiting");
57 //______________________________________________________________________________
58 AliRsnVATProcessInfo& AliRsnVATProcessInfo::operator=
59 (const AliRsnVATProcessInfo& copy)
62 // Assignment operator.
63 // Clones the histogram and copies the values of other data members.
66 AliDebug(AliLog::kDebug+2, "Entering");
68 fHistUsedEvents = (TH1I*)copy.fHistUsedEvents->Clone();
69 fEventUsed = copy.fEventUsed;
70 fPrintInfoNumber = copy.fPrintInfoNumber;
72 AliDebug(AliLog::kDebug+2, "Exiting");
77 //______________________________________________________________________________
78 AliRsnVATProcessInfo::~AliRsnVATProcessInfo()
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.
87 AliDebug(AliLog::kDebug+2, "Entering");
89 fHistUsedEvents = 0x0;
93 AliDebug(AliLog::kDebug+2, "Exiting");
96 //______________________________________________________________________________
97 void AliRsnVATProcessInfo::GenerateInfoList(TList *list)
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.
106 AliDebug(AliLog::kDebug+2, "Entering");
108 // delete existing allocation of stored objects
109 if (fHistUsedEvents) delete fHistUsedEvents;
111 // create stored objects
112 fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 2, 0, 2);
114 // ad objects to list
115 list->Add(fHistUsedEvents);
117 AliDebug(AliLog::kDebug+2, "Exiting");
120 //______________________________________________________________________________
121 void AliRsnVATProcessInfo::FillInfo()
124 // This method defines how the information histograms must be filled.
125 // The structure of this class is auto-consistent, but in case of inheritance
126 // this method must be modified accordingly.
127 // Current implementation uses the 'fEventUsed' flag to choose if the event
128 // has been used or not, and increments the corresponding bin in the related
129 // histogram (bin '0' = skipped, bin '1' = used).
133 fHistUsedEvents->Fill(1);
135 fHistUsedEvents->Fill(0);
138 //______________________________________________________________________________
139 void AliRsnVATProcessInfo::PrintInfo(const Long64_t &num)
142 // This method is used in some cases
143 // to inform about number of events processed
146 if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %lld", num+1));
149 //______________________________________________________________________________
150 Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed()
153 // returns number of events from histogram
156 if (fHistUsedEvents) return fHistUsedEvents->Integral();