Effective C++ mods
[u/mrichter/AliRoot.git] / RAW / AliStats.cxx
CommitLineData
a197a4ce 1// @(#)alimdc:$Name$:$Id$
2// Author: Fons Rademakers 26/11/99
3
4/**************************************************************************
5 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
6 * *
7 * Author: The ALICE Off-line Project. *
8 * Contributors are mentioned in the code where appropriate. *
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//////////////////////////////////////////////////////////////////////////
20// //
21// AliStats //
22// //
23//////////////////////////////////////////////////////////////////////////
24
25#include <TH1.h>
26#include <TFile.h>
27
a197a4ce 28#include "AliStats.h"
29
30
31ClassImp(AliStats)
32
33
34//______________________________________________________________________________
f3c1e83c 35AliStats::AliStats(const char *filename, Int_t compmode, Bool_t filter):
36fEvents(0),
37fFirstRun(0),
38fFirstEvent(0),
39fLastRun(0),
40fLastEvent(0),
41fBegin(),
42fEnd(),
43fFileName(filename),
44fFileSize(0),
45fCompFactor(0),
46fCompMode(compmode),
47fFilter(filter),
48fRTHist(NULL),
49fChunk(-0.5)
a197a4ce 50{
51 // Create statistics object.
52
a197a4ce 53}
54
55//______________________________________________________________________________
f3c1e83c 56AliStats::AliStats(const AliStats &rhs):
57TObject(rhs),
58fEvents(rhs.fEvents),
59fFirstRun(rhs.fFirstRun),
60fFirstEvent(rhs.fFirstEvent),
61fLastRun(rhs.fLastRun),
62fLastEvent(rhs.fLastEvent),
63fBegin(rhs.fBegin),
64fEnd(rhs.fEnd),
65fFileName(rhs.fFileName),
66fFileSize(rhs.fFileSize),
67fCompFactor(rhs.fCompFactor),
68fCompMode(rhs.fCompMode),
69fFilter(rhs.fFilter),
70fRTHist(rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0),
71fChunk(rhs.fChunk)
a197a4ce 72{
f3c1e83c 73 // AliStats copy constructor.
a197a4ce 74
a197a4ce 75}
76
77//______________________________________________________________________________
78AliStats::~AliStats()
79{
80 // Cleanup stats object.
81
82 delete fRTHist;
83}
84
85//______________________________________________________________________________
86AliStats &AliStats::operator=(const AliStats &rhs)
87{
88 // AliStats assignment operator.
89
90 if (this != &rhs) {
91 TObject::operator=(rhs);
92 fEvents = rhs.fEvents;
93 fFirstRun = rhs.fFirstRun;
94 fFirstEvent = rhs.fFirstEvent;
95 fLastRun = rhs.fLastRun;
96 fLastEvent = rhs.fLastEvent;
97 fBegin = rhs.fBegin;
98 fEnd = rhs.fEnd;
99 fFileName = rhs.fFileName;
100 fFileSize = rhs.fFileSize;
101 fCompFactor = rhs.fCompFactor;
102 fCompMode = rhs.fCompMode;
103 fFilter = rhs.fFilter;
104 fRTHist = rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0;
105 fChunk = rhs.fChunk;
106 }
107 return *this;
108}
109
110//______________________________________________________________________________
111void AliStats::Fill(Float_t time)
112{
113 // Fill histogram. This histogram shows the (hopefully constant) time
114 // it takes to fill the ROOT DB.
115 // Expects to be called 100 times for each file.
116
117 if (!fRTHist) {
118 fRTHist = new TH1F("rtime","Real-time to write data chunk", 100, 0, 100);
119 fRTHist->SetDirectory(0);
120 }
121
122 fRTHist->Fill(fChunk, time);
123 fChunk += 1.0;
124}