]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTRunStatistics.cxx
forgot to commit change in header file in r52974
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTRunStatistics.cxx
CommitLineData
2ff24e4c 1//-*- Mode: C++ -*-
2// $Id$
3/**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 * for The ALICE HLT Project. *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19/** @file AliHLTRunStatistics.cxx
20 @author Jochen Thaeder
21 @date
22 @brief Base class for run statistics, for all detectors
23*/
24
25// see header file for class documentation
26// or
27// refer to README to build package
28// or
29// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30
31#if __GNUC__ >= 3
32using namespace std;
33#endif
34
35#include "AliHLTRunStatistics.h"
408bd64a 36#include <iostream>
37#include <cerrno>
2ff24e4c 38
39ClassImp(AliHLTRunStatistics)
40
408bd64a 41AliHLTRunStatistics::AliHLTRunStatistics()
42 : TNamed("HLT", "HLT Run Statistics")
43 , fNEvents(0)
44 , fMyObjects()
45{
2ff24e4c 46 // see header file for class documentation
47 // or
48 // refer to README to build package
49 // or
50 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
51}
52
408bd64a 53AliHLTRunStatistics::AliHLTRunStatistics (const AliHLTRunStatistics& src)
54 : TNamed(src)
55 , fNEvents(src.fNEvents)
56 , fMyObjects()
57{
2ff24e4c 58 // see header file for class documentation
408bd64a 59 for (int i=0; i<src.fMyObjects.GetEntriesFast(); i++) {
60 fMyObjects.Add(src.fMyObjects.Clone());
61 }
62 fMyObjects.SetOwner(kTRUE);
63}
64
65AliHLTRunStatistics& AliHLTRunStatistics::operator= (const AliHLTRunStatistics& src)
66{
67 // see header file for class documentation
68 this->~AliHLTRunStatistics();
69 new (this) AliHLTRunStatistics(src);
70 return *this;
71}
72
73AliHLTRunStatistics::~AliHLTRunStatistics()
74{
75 // see header file for class documentation
76 fMyObjects.Delete();
77}
78
79void AliHLTRunStatistics::Print(Option_t* option) const
80{
81 // see header file for class documentation
82 cout << "============ " << GetTitle() << " ============" << endl;
83 cout << "\t" << GetNEvents() << " event(s)" << endl;
84 for (int i=0; i<fMyObjects.GetEntriesFast(); i++) {
85 fMyObjects.Print(option);
86 }
87 cout << "==============================================" << endl;
88}
89
90void AliHLTRunStatistics::Copy(TObject &object) const
91{
92 // copy this to the specified object
93
94 AliHLTRunStatistics* pStatistics=dynamic_cast<AliHLTRunStatistics*>(&object);
95 if (pStatistics) {
96 // copy members if target is a AliHLTTriggerDecision
97 *pStatistics=*this;
98 }
99
100 // copy the base class
101 TObject::Copy(object);
102}
103
104TObject *AliHLTRunStatistics::Clone(const char */*newname*/) const
105{
106 // create a new clone, classname is ignored
107
108 return new AliHLTRunStatistics(*this);
109}
110
111void AliHLTRunStatistics::Clear(Option_t * /*option*/)
112{
113 // clear the content
114 fNEvents=0;
115 fMyObjects.Clear();
116}
117
118int AliHLTRunStatistics::Add(const TObject* pObject)
119{
120 // Add clone of object
121
122 if (!pObject) return -EINVAL;
123 fMyObjects.Add(pObject->Clone());
124 return 0;
2ff24e4c 125}