New methods to read and write trailers. New method to read whole altro channel
[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//______________________________________________________________________________
35AliStats::AliStats(const char *filename, Int_t compmode, Bool_t filter)
36{
37 // Create statistics object.
38
39 fEvents = 0;
40 fFirstRun = 0;
41 fFirstEvent = 0;
42 fLastRun = 0;
43 fLastEvent = 0;
44 fChunk = -0.5;
45 fFileName = filename;
46 fCompMode = compmode;
47 fFilter = filter;
48 fRTHist = 0;
49}
50
51//______________________________________________________________________________
52AliStats::AliStats(const AliStats &rhs): TObject(rhs)
53{
54 // AliStats copy constructor.
55
56 operator=(rhs);
57}
58
59//______________________________________________________________________________
60AliStats::~AliStats()
61{
62 // Cleanup stats object.
63
64 delete fRTHist;
65}
66
67//______________________________________________________________________________
68AliStats &AliStats::operator=(const AliStats &rhs)
69{
70 // AliStats assignment operator.
71
72 if (this != &rhs) {
73 TObject::operator=(rhs);
74 fEvents = rhs.fEvents;
75 fFirstRun = rhs.fFirstRun;
76 fFirstEvent = rhs.fFirstEvent;
77 fLastRun = rhs.fLastRun;
78 fLastEvent = rhs.fLastEvent;
79 fBegin = rhs.fBegin;
80 fEnd = rhs.fEnd;
81 fFileName = rhs.fFileName;
82 fFileSize = rhs.fFileSize;
83 fCompFactor = rhs.fCompFactor;
84 fCompMode = rhs.fCompMode;
85 fFilter = rhs.fFilter;
86 fRTHist = rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0;
87 fChunk = rhs.fChunk;
88 }
89 return *this;
90}
91
92//______________________________________________________________________________
93void AliStats::Fill(Float_t time)
94{
95 // Fill histogram. This histogram shows the (hopefully constant) time
96 // it takes to fill the ROOT DB.
97 // Expects to be called 100 times for each file.
98
99 if (!fRTHist) {
100 fRTHist = new TH1F("rtime","Real-time to write data chunk", 100, 0, 100);
101 fRTHist->SetDirectory(0);
102 }
103
104 fRTHist->Fill(fChunk, time);
105 fChunk += 1.0;
106}