1 // @(#)alimdc:$Name$:$Id$
2 // Author: Fons Rademakers 26/11/99
4 /**************************************************************************
5 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
7 * Author: The ALICE Off-line Project. *
8 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 //////////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////
28 #include "AliRawEvent.h"
29 #include "AliRawEventHeader.h"
39 //______________________________________________________________________________
40 AliStats::AliStats(const char *filename, Int_t compmode, Bool_t filter)
42 // Create statistics object.
56 //______________________________________________________________________________
57 AliStats::AliStats(const AliStats &rhs): TObject(rhs)
59 // AliStats copy constructor.
64 //______________________________________________________________________________
67 // Cleanup stats object.
72 //______________________________________________________________________________
73 AliStats &AliStats::operator=(const AliStats &rhs)
75 // AliStats assignment operator.
78 TObject::operator=(rhs);
79 fEvents = rhs.fEvents;
80 fFirstRun = rhs.fFirstRun;
81 fFirstEvent = rhs.fFirstEvent;
82 fLastRun = rhs.fLastRun;
83 fLastEvent = rhs.fLastEvent;
86 fFileName = rhs.fFileName;
87 fFileSize = rhs.fFileSize;
88 fCompFactor = rhs.fCompFactor;
89 fCompMode = rhs.fCompMode;
90 fFilter = rhs.fFilter;
91 fRTHist = rhs.fRTHist ? (TH1F*) rhs.fRTHist->Clone() : 0;
97 //______________________________________________________________________________
98 void AliStats::Fill(Float_t time)
100 // Fill histogram. This histogram shows the (hopefully constant) time
101 // it takes to fill the ROOT DB.
102 // Expects to be called 100 times for each file.
105 fRTHist = new TH1F("rtime","Real-time to write data chunk", 100, 0, 100);
106 fRTHist->SetDirectory(0);
109 fRTHist->Fill(fChunk, time);
113 //______________________________________________________________________________
114 void AliStats::WriteToDB(AliRawDB *rawdb)
116 // Write stats to raw DB, local run DB and global MySQL DB.
118 AliRawEventHeader &header = *rawdb->GetEvent()->GetHeader();
120 // Write stats into RawDB
121 TDirectory *ds = gDirectory;
122 rawdb->GetDB()->cd();
123 SetEvents(rawdb->GetEvents());
124 SetLastId(header.GetRunNumber(), header.GetEventInRun());
125 SetFileSize(rawdb->GetBytesWritten());
126 SetCompressionFactor(rawdb->GetCompressionFactor());
131 // Write stats also in the bookkeeping RunDB
132 AliRunDB *rundb = new AliRunDB(kTRUE);
134 rundb->UpdateRDBMS(this);
135 rundb->UpdateAliEn(this);