]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliStats.cxx
Updated comments (Raffaele)
[u/mrichter/AliRoot.git] / RAW / AliStats.cxx
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
28 #include "AliStats.h"
29
30
31 ClassImp(AliStats)
32
33
34 //______________________________________________________________________________
35 AliStats::AliStats(const char *filename, Int_t compmode, Bool_t filter):
36 fEvents(0),
37 fFirstRun(0),
38 fFirstEvent(0),
39 fLastRun(0),
40 fLastEvent(0),
41 fBegin(),
42 fEnd(),
43 fFileName(filename),
44 fFileSize(0),
45 fCompFactor(0),
46 fCompMode(compmode),
47 fFilter(filter),
48 fRTHist(NULL),
49 fChunk(-0.5)
50 {
51    // Create statistics object.
52
53 }
54
55 //______________________________________________________________________________
56 AliStats::AliStats(const AliStats &rhs):
57 TObject(rhs),
58 fEvents(rhs.fEvents),
59 fFirstRun(rhs.fFirstRun),
60 fFirstEvent(rhs.fFirstEvent),
61 fLastRun(rhs.fLastRun),
62 fLastEvent(rhs.fLastEvent),
63 fBegin(rhs.fBegin),
64 fEnd(rhs.fEnd),
65 fFileName(rhs.fFileName),
66 fFileSize(rhs.fFileSize),
67 fCompFactor(rhs.fCompFactor),
68 fCompMode(rhs.fCompMode),
69 fFilter(rhs.fFilter),
70 fRTHist(rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0),
71 fChunk(rhs.fChunk)
72 {
73   // AliStats copy constructor.
74
75 }
76
77 //______________________________________________________________________________
78 AliStats::~AliStats()
79 {
80    // Cleanup stats object.
81
82    delete fRTHist;
83 }
84
85 //______________________________________________________________________________
86 AliStats &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 //______________________________________________________________________________
111 void 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 }