]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliStats.cxx
Removal of the last sprintf. Using TString instead
[u/mrichter/AliRoot.git] / RAW / AliStats.cxx
CommitLineData
d04aea32 1// @(#) $Id$
a197a4ce 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),
ad594815 37fRun(0),
f3c1e83c 38fFirstEvent(0),
f3c1e83c 39fLastEvent(0),
40fBegin(),
41fEnd(),
42fFileName(filename),
43fFileSize(0),
44fCompFactor(0),
45fCompMode(compmode),
46fFilter(filter),
47fRTHist(NULL),
48fChunk(-0.5)
a197a4ce 49{
50 // Create statistics object.
51
a197a4ce 52}
53
54//______________________________________________________________________________
f3c1e83c 55AliStats::AliStats(const AliStats &rhs):
56TObject(rhs),
57fEvents(rhs.fEvents),
ad594815 58fRun(rhs.fRun),
f3c1e83c 59fFirstEvent(rhs.fFirstEvent),
f3c1e83c 60fLastEvent(rhs.fLastEvent),
61fBegin(rhs.fBegin),
62fEnd(rhs.fEnd),
63fFileName(rhs.fFileName),
64fFileSize(rhs.fFileSize),
65fCompFactor(rhs.fCompFactor),
66fCompMode(rhs.fCompMode),
67fFilter(rhs.fFilter),
68fRTHist(rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0),
69fChunk(rhs.fChunk)
a197a4ce 70{
f3c1e83c 71 // AliStats copy constructor.
a197a4ce 72
a197a4ce 73}
74
75//______________________________________________________________________________
76AliStats::~AliStats()
77{
78 // Cleanup stats object.
79
80 delete fRTHist;
81}
82
83//______________________________________________________________________________
84AliStats &AliStats::operator=(const AliStats &rhs)
85{
86 // AliStats assignment operator.
87
88 if (this != &rhs) {
89 TObject::operator=(rhs);
90 fEvents = rhs.fEvents;
ad594815 91 fRun = rhs.fRun;
a197a4ce 92 fFirstEvent = rhs.fFirstEvent;
a197a4ce 93 fLastEvent = rhs.fLastEvent;
94 fBegin = rhs.fBegin;
95 fEnd = rhs.fEnd;
96 fFileName = rhs.fFileName;
97 fFileSize = rhs.fFileSize;
98 fCompFactor = rhs.fCompFactor;
99 fCompMode = rhs.fCompMode;
100 fFilter = rhs.fFilter;
101 fRTHist = rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0;
102 fChunk = rhs.fChunk;
103 }
104 return *this;
105}
106
107//______________________________________________________________________________
108void AliStats::Fill(Float_t time)
109{
110 // Fill histogram. This histogram shows the (hopefully constant) time
111 // it takes to fill the ROOT DB.
112 // Expects to be called 100 times for each file.
113
114 if (!fRTHist) {
115 fRTHist = new TH1F("rtime","Real-time to write data chunk", 100, 0, 100);
116 fRTHist->SetDirectory(0);
117 }
118
119 fRTHist->Fill(fChunk, time);
120 fChunk += 1.0;
121}