]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | // Author: Andrei Gheata, 20/12/2010 | |
18 | ||
19 | //============================================================================== | |
20 | // AliAnalysisStatistics - basic class for storing statistics for the processed | |
21 | // events. The object is mergeable and can be used for general purpose. In case | |
22 | // a AliAnalysisTaskStat is used, this will set the global statistics object | |
23 | // to the analysis manager and will update it for the accepted events. | |
24 | //============================================================================== | |
25 | ||
26 | #include "AliAnalysisStatistics.h" | |
27 | ||
28 | #include "Riostream.h" | |
29 | #include "TCollection.h" | |
30 | ||
31 | #include "AliVEvent.h" | |
32 | ||
33 | using std::cout; | |
34 | using std::endl; | |
35 | ClassImp(AliAnalysisStatistics) | |
36 | ||
37 | //______________________________________________________________________________ | |
38 | AliAnalysisStatistics::AliAnalysisStatistics(const AliAnalysisStatistics &other) | |
39 | :TNamed(other), | |
40 | fNinput(other.fNinput), | |
41 | fNprocessed(other.fNprocessed), | |
42 | fNfailed(other.fNfailed), | |
43 | fNaccepted(other.fNaccepted), | |
44 | fOfflineMask(other.fOfflineMask) | |
45 | { | |
46 | // Copy constructor. | |
47 | } | |
48 | ||
49 | //______________________________________________________________________________ | |
50 | AliAnalysisStatistics &AliAnalysisStatistics::operator=(const AliAnalysisStatistics &other) | |
51 | { | |
52 | // Assignment. | |
53 | if (&other == this) return *this; | |
54 | fNinput = other.fNinput; | |
55 | fNprocessed = other.fNprocessed; | |
56 | fNfailed = other.fNfailed; | |
57 | fNaccepted = other.fNaccepted; | |
58 | fOfflineMask = other.fOfflineMask; | |
59 | return *this; | |
60 | } | |
61 | ||
62 | //______________________________________________________________________________ | |
63 | Long64_t AliAnalysisStatistics::Merge(TCollection* list) | |
64 | { | |
65 | // Merge statistics objets from list on top of this. | |
66 | TIter next(list); | |
67 | AliAnalysisStatistics *current; | |
68 | Long64_t count = 1; | |
69 | while ((current = (AliAnalysisStatistics*)next())) { | |
70 | fNinput += current->GetNinput(); | |
71 | fNprocessed += current->GetNprocessed(); | |
72 | fNfailed += current->GetNfailed(); | |
73 | fNaccepted += current->GetNaccepted(); | |
74 | current++; | |
75 | } | |
76 | return count; | |
77 | } | |
78 | ||
79 | //______________________________________________________________________________ | |
80 | void AliAnalysisStatistics::Print(const Option_t *) const | |
81 | { | |
82 | // Print info about the processed statistics. | |
83 | cout << "### Input events : " << fNinput << endl; | |
84 | cout << "### Processed events w/o errors : " << fNprocessed << endl; | |
85 | cout << "### Failed events : " << fNfailed << endl; | |
86 | cout << "### Accepted events for mask: " << GetMaskAsString(fOfflineMask) << ": " << fNaccepted << endl; | |
87 | } | |
88 | ||
89 | //______________________________________________________________________________ | |
90 | const char *AliAnalysisStatistics::GetMaskAsString(UInt_t mask) | |
91 | { | |
92 | // Returns a string corresponding to the offline mask. | |
93 | static TString smask; | |
94 | smask = "ALL EVT."; | |
95 | if (!mask) return smask.Data(); | |
96 | smask.Clear(); | |
97 | if (mask & AliVEvent::kMB) smask = "MB"; | |
98 | if (mask & AliVEvent::kMUON) { | |
99 | if (!smask.IsNull()) smask += " | "; | |
100 | smask += "MUON"; | |
101 | } | |
102 | if (mask & AliVEvent::kHighMult) { | |
103 | if (!smask.IsNull()) smask += " | "; | |
104 | smask += "HighMult"; | |
105 | } | |
106 | if (mask & AliVEvent::kUserDefined) { | |
107 | if (!smask.IsNull()) smask += " | "; | |
108 | smask += "UserDefined"; | |
109 | } | |
110 | if (mask == AliVEvent::kAny) smask = "ANY"; | |
111 | return smask.Data(); | |
112 | } | |
113 |