HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
horaslowchanraw.cc
Go to the documentation of this file.
1 //*-- AUTHOR : Ilse Koenig
2 //*-- Created : 09/09/2004 by Ilse Koenig
3 //*-- Modified : 21/03/2005 by Ilse Koenig
4 
5 //_HADES_CLASS_DESCRIPTION
6 //////////////////////////////////////////////////////////////////////////////
7 //
8 // HOraSlowChanRaw
9 //
10 // Class for the raw data for a non-waveform slowcontrol channel
11 //
12 //////////////////////////////////////////////////////////////////////////////
13 
14 #include "horaslowchanraw.h"
15 #include "TDatime.h"
16 
18 
20  // Default constructor
21  nanoSeconds=0;
22  value=0.;
23  status=0;
24 }
25 
26 void HOraSlowChanRaw::fill(const Char_t* t,Int_t nano,Double_t val,Int_t stat) {
27  // Fills the timestamp, the nanoseconds, the value and the status
28  // (channel data type float)
29  timestamp=t;
30  nanoSeconds=nano;
31  value=val;
32  status=stat;
33 }
34 
35 void HOraSlowChanRaw::fill(const Char_t* t,Int_t nano,Int_t val,Int_t stat) {
36  // Fills the timestamp, the nanoseconds, the value and the status
37  // (channel data type int)
38  timestamp=t;
39  nanoSeconds=nano;
40  value=(Double_t)val;
41  status=stat;
42 }
43 
44 Int_t HOraSlowChanRaw::getTimeDiff(const Char_t* t) {
45  // Returns the time difference (in seconds) relative to time t
46  TDatime t1(t);
47  TDatime t2(timestamp);
48  return (t2.Convert()-t1.Convert());
49 }
50 
51 void HOraSlowChanRaw::print(Int_t valPrec) {
52  // Prints the data to stdout with data precision valPrec
53  cout.setf(ios::fixed,ios::floatfield);
54  cout.setf(ios::right,ios::adjustfield);
55  cout<<timestamp<<" "<<nanoSeconds<<" "
56  <<setprecision(valPrec)<<setw(valPrec+10)<<value
57  <<" "<<status<<'\n';
58 }
59 
60 void HOraSlowChanRaw::write(fstream& fout,Int_t valPrec) {
61  // Streams the data with data precision valPrec
62  fout.setf(ios::fixed,ios::floatfield);
63  fout.setf(ios::right,ios::adjustfield);
64  fout<<timestamp<<" "<<nanoSeconds<<" "
65  <<setprecision(valPrec)<<setw(valPrec+10)<<value
66  <<setw(3)<<status<<'\n';
67 }
68 
Int_t getTimeDiff(const Char_t *)
void print(Int_t valPrec=3)
void write(fstream &fout, Int_t valPrec=3)
void fill(const Char_t *, Int_t, Double_t, Int_t)
ClassImp(HOraSlowChanRaw) HOraSlowChanRaw