Line data Source code
1 : // @(#) $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 :
28 : #include "AliStats.h"
29 :
30 :
31 128 : ClassImp(AliStats)
32 :
33 :
34 : //______________________________________________________________________________
35 0 : AliStats::AliStats(const char *filename, Int_t compmode, Bool_t filter):
36 0 : fEvents(0),
37 0 : fRun(0),
38 0 : fFirstEvent(0),
39 0 : fLastEvent(0),
40 0 : fBegin(),
41 0 : fEnd(),
42 0 : fFileName(filename),
43 0 : fFileSize(0),
44 0 : fCompFactor(0),
45 0 : fCompMode(compmode),
46 0 : fFilter(filter),
47 0 : fRTHist(NULL),
48 0 : fChunk(-0.5)
49 0 : {
50 : // Create statistics object.
51 :
52 0 : }
53 :
54 : //______________________________________________________________________________
55 : AliStats::AliStats(const AliStats &rhs):
56 0 : TObject(rhs),
57 0 : fEvents(rhs.fEvents),
58 0 : fRun(rhs.fRun),
59 0 : fFirstEvent(rhs.fFirstEvent),
60 0 : fLastEvent(rhs.fLastEvent),
61 0 : fBegin(rhs.fBegin),
62 0 : fEnd(rhs.fEnd),
63 0 : fFileName(rhs.fFileName),
64 0 : fFileSize(rhs.fFileSize),
65 0 : fCompFactor(rhs.fCompFactor),
66 0 : fCompMode(rhs.fCompMode),
67 0 : fFilter(rhs.fFilter),
68 0 : fRTHist(rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0),
69 0 : fChunk(rhs.fChunk)
70 0 : {
71 : // AliStats copy constructor.
72 :
73 0 : }
74 :
75 : //______________________________________________________________________________
76 : AliStats::~AliStats()
77 0 : {
78 : // Cleanup stats object.
79 :
80 0 : delete fRTHist;
81 0 : }
82 :
83 : //______________________________________________________________________________
84 : AliStats &AliStats::operator=(const AliStats &rhs)
85 : {
86 : // AliStats assignment operator.
87 :
88 0 : if (this != &rhs) {
89 0 : TObject::operator=(rhs);
90 0 : fEvents = rhs.fEvents;
91 0 : fRun = rhs.fRun;
92 0 : fFirstEvent = rhs.fFirstEvent;
93 0 : fLastEvent = rhs.fLastEvent;
94 0 : fBegin = rhs.fBegin;
95 0 : fEnd = rhs.fEnd;
96 0 : fFileName = rhs.fFileName;
97 0 : fFileSize = rhs.fFileSize;
98 0 : fCompFactor = rhs.fCompFactor;
99 0 : fCompMode = rhs.fCompMode;
100 0 : fFilter = rhs.fFilter;
101 0 : fRTHist = rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0;
102 0 : fChunk = rhs.fChunk;
103 0 : }
104 0 : return *this;
105 : }
106 :
107 : //______________________________________________________________________________
108 : void 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 0 : if (!fRTHist) {
115 0 : fRTHist = new TH1F("rtime","Real-time to write data chunk", 100, 0, 100);
116 0 : fRTHist->SetDirectory(0);
117 0 : }
118 :
119 0 : fRTHist->Fill(fChunk, time);
120 0 : fChunk += 1.0;
121 0 : }
|