Line data Source code
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 : #include "AliHLTRunStatistics.h"
32 : #include <iostream>
33 : #include <cerrno>
34 :
35 : using std::cout;
36 :
37 126 : ClassImp(AliHLTRunStatistics)
38 :
39 : AliHLTRunStatistics::AliHLTRunStatistics()
40 0 : : TNamed("HLT", "HLT Run Statistics")
41 0 : , fNEvents(0)
42 0 : , fMyObjects()
43 0 : {
44 : // see header file for class documentation
45 : // or
46 : // refer to README to build package
47 : // or
48 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
49 0 : }
50 :
51 : AliHLTRunStatistics::AliHLTRunStatistics (const AliHLTRunStatistics& src)
52 0 : : TNamed(src)
53 0 : , fNEvents(src.fNEvents)
54 0 : , fMyObjects()
55 0 : {
56 : // see header file for class documentation
57 0 : for (int i=0; i<src.fMyObjects.GetEntriesFast(); i++) {
58 0 : fMyObjects.Add(src.fMyObjects.Clone());
59 : }
60 0 : fMyObjects.SetOwner(kTRUE);
61 0 : }
62 :
63 : AliHLTRunStatistics& AliHLTRunStatistics::operator= (const AliHLTRunStatistics& src)
64 : {
65 : // see header file for class documentation
66 0 : this->~AliHLTRunStatistics();
67 0 : new (this) AliHLTRunStatistics(src);
68 0 : return *this;
69 0 : }
70 :
71 : AliHLTRunStatistics::~AliHLTRunStatistics()
72 0 : {
73 : // see header file for class documentation
74 0 : fMyObjects.Delete();
75 0 : }
76 :
77 : void AliHLTRunStatistics::Print(Option_t* option) const
78 : {
79 : // see header file for class documentation
80 0 : cout << "============ " << GetTitle() << " ============" << endl;
81 0 : cout << "\t" << GetNEvents() << " event(s)" << endl;
82 0 : for (int i=0; i<fMyObjects.GetEntriesFast(); i++) {
83 0 : fMyObjects.Print(option);
84 : }
85 0 : cout << "==============================================" << endl;
86 0 : }
87 :
88 : void AliHLTRunStatistics::Copy(TObject &object) const
89 : {
90 : // copy this to the specified object
91 :
92 0 : AliHLTRunStatistics* pStatistics=dynamic_cast<AliHLTRunStatistics*>(&object);
93 0 : if (pStatistics) {
94 : // copy members if target is a AliHLTTriggerDecision
95 0 : *pStatistics=*this;
96 0 : }
97 :
98 : // copy the base class
99 0 : TObject::Copy(object);
100 0 : }
101 :
102 : TObject *AliHLTRunStatistics::Clone(const char */*newname*/) const
103 : {
104 : // create a new clone, classname is ignored
105 :
106 0 : return new AliHLTRunStatistics(*this);
107 0 : }
108 :
109 : void AliHLTRunStatistics::Clear(Option_t * /*option*/)
110 : {
111 : // clear the content
112 0 : fNEvents=0;
113 0 : fMyObjects.Clear();
114 0 : }
115 :
116 : int AliHLTRunStatistics::Add(const TObject* pObject)
117 : {
118 : // Add clone of object
119 :
120 0 : if (!pObject) return -EINVAL;
121 0 : fMyObjects.Add(pObject->Clone());
122 0 : return 0;
123 0 : }
|