]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAnalysisStatistics.cxx
Some fixes for the mode w/o auto branch loading
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisStatistics.cxx
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 ClassImp(AliAnalysisStatistics)
32
33 //______________________________________________________________________________
34 AliAnalysisStatistics::AliAnalysisStatistics(const AliAnalysisStatistics &other)
35       :TNamed(other),
36        fNinput(other.fNinput),
37        fNprocessed(other.fNprocessed),
38        fNfailed(other.fNfailed),
39        fNaccepted(other.fNaccepted)
40 {
41 // Copy constructor.
42 }
43
44 //______________________________________________________________________________
45 AliAnalysisStatistics &AliAnalysisStatistics::operator=(const AliAnalysisStatistics &other)
46 {
47 // Assignment.
48   if (&other == this) return *this;
49   fNinput     = other.fNinput;
50   fNprocessed = other.fNprocessed;
51   fNfailed    = other.fNfailed;
52   fNaccepted  = other.fNaccepted;
53   return *this;
54 }
55
56 //______________________________________________________________________________
57 Long64_t AliAnalysisStatistics::Merge(TCollection* list)
58 {
59 // Merge statistics objets from list on top of this.
60   TIter next(list);
61   AliAnalysisStatistics *current;
62   Long64_t count = 1;
63   while ((current = (AliAnalysisStatistics*)next())) {
64     fNinput     += current->GetNinput();
65     fNprocessed += current->GetNprocessed();
66     fNfailed    += current->GetNfailed();
67     fNaccepted  += current->GetNaccepted();
68     current++;
69   }
70   return count;
71 }
72
73 //______________________________________________________________________________
74 void AliAnalysisStatistics::Print(const Option_t *) const
75 {
76 // Print info about the processed statistics.
77   cout << "### Input events                 : " << fNinput << endl;
78   cout << "### Processed events w/o errors  : " << fNprocessed << endl;
79   cout << "### Failed events                : " << fNfailed << endl;
80   cout << "### Accepted events              : " << fNaccepted << endl;
81 }