]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnVATProcessInfo.cxx
Major upgrade to the package, in order to speed-up the execution and remove some...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnVATProcessInfo.cxx
1 //
2 // *** Class AliRsnVATProcessInfo ***
3 //
4 //  TODO
5 //  TODO
6 //
7 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
8 //          M. Vala (email: martin.vala@cern.ch)
9 //
10
11 #include <TList.h>
12 #include <TH1.h>
13
14 #include "AliLog.h"
15
16 #include "AliRsnVATProcessInfo.h"
17
18 ClassImp(AliRsnVATProcessInfo)
19
20 //_____________________________________________________________________________
21 AliRsnVATProcessInfo::AliRsnVATProcessInfo(const char *name) :
22     TNamed(name,name),
23     fHistUsedEvents(0x0),
24     fEventUsed(kFALSE),
25     fPrintInfoNumber(1000)
26 {
27 //
28 // Constructor.
29 //
30
31   AliDebug(AliLog::kDebug+2,"<-");
32   AliDebug(AliLog::kDebug+2,"->");
33 }
34
35 //_____________________________________________________________________________
36 AliRsnVATProcessInfo::AliRsnVATProcessInfo(const AliRsnVATProcessInfo& copy) :
37     TNamed(copy),
38     fHistUsedEvents(copy.fHistUsedEvents),
39     fEventUsed(copy.fEventUsed),
40     fPrintInfoNumber(copy.fPrintInfoNumber)
41 {
42 //
43 // Copy constructor.
44 //
45
46   AliDebug(AliLog::kDebug+2,"<-");
47   AliDebug(AliLog::kDebug+2,"->");
48 }
49
50 //_____________________________________________________________________________
51 AliRsnVATProcessInfo::~AliRsnVATProcessInfo()
52 {
53 //
54 // Destructor.
55 //
56
57   AliDebug(AliLog::kDebug+2,"<-");
58   AliDebug(AliLog::kDebug+2,"->");
59 }
60
61 //_____________________________________________________________________________
62 void AliRsnVATProcessInfo::GenerateInfoList(TList *list)
63 {
64 //
65 // Creates a TList containing all objects created in this class.
66 // This list will be passe to the AnalysisTask object and will generate
67 // a separate directory in the output file, with these informations.
68 // This TList will have the same name of this object and will own its content.
69 //
70
71   AliDebug(AliLog::kDebug+2,"<-");
72
73   // create list
74   AliDebug(AliLog::kWarning,"Doing new TList(), so make sure you delete this list ... ");
75 //   TList* list = new TList();
76 //   list->SetName(GetName());
77 //   list->SetOwner();
78
79   // initialize contained objects
80   fHistUsedEvents = new TH1I(GetEventHistogramName(), "Skipped/used events", 2, 0, 2);
81
82   // ad objects to list
83   list->Add(fHistUsedEvents);
84
85   AliDebug(AliLog::kDebug+2,"->");
86 }
87
88 //_____________________________________________________________________________
89 void AliRsnVATProcessInfo::FillInfo()
90 {
91 //
92 // This method defines how the information histograms must be filled.
93 // The structure of this class is auto-consistend, but in case of inheritance
94 // this method must be modified accordingly.
95 // Current implementation uses the 'fEventUsed' flag to choose if the event
96 // has been used or not, and increments the corrisponding bin in the related
97 // histogram (bin '0' = skipped, bin '1' = used).
98 //
99
100   if (fEventUsed)
101     fHistUsedEvents->Fill(1);
102   else
103     fHistUsedEvents->Fill(0);
104 }
105
106 //_____________________________________________________________________________
107 void AliRsnVATProcessInfo::PrintInfo(const Long64_t &num)
108 {
109 //
110 // This method is used in some cases
111 // to inform about number of events processed
112 //
113
114   if ((num+1) % fPrintInfoNumber == 0) AliInfo(Form("Events processed %d",num+1));
115 }
116
117
118 Long64_t AliRsnVATProcessInfo::GetNumerOfEventsProcessed()
119 {
120 //
121 // returns number of events from histogram
122 //
123   if (fHistUsedEvents)
124     return fHistUsedEvents->Integral();
125   return 0;
126 }
127