AliRoot Core  3dc7879 (3dc7879)
AliTimeStamp.h
Go to the documentation of this file.
1 #ifndef ALITIMESTAMP_H
2 #define ALITIMESTAMP_H
3 
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice */
6 
7 /* $Id: AliTimeStamp.h 22322 2007-11-22 11:43:14Z cvetan $ */
8 
10 //
11 // Class to define Event Timestamp from :
12 //
13 // Orbit
14 // Period counter
15 // Seconds |
16 // + | ===> Bunch cross
17 // Microsecs |
18 //
20 #include <cmath>
21 
22 class TObject;
23 
24 class AliTimeStamp : public TObject {
25 
26 public:
27  AliTimeStamp();
28  AliTimeStamp( UInt_t orbit, UInt_t period, ULong64_t bunchCross );
29  AliTimeStamp( UInt_t orbit, UInt_t period,
30  UInt_t seconds, UInt_t microsecs );
31  virtual ~AliTimeStamp() {}
32  AliTimeStamp( const AliTimeStamp &timestamp );
33  AliTimeStamp& operator=(const AliTimeStamp& timestamp);
34 
35  // Getters
36  UInt_t GetOrbit() const { return fOrbit; }
37  UInt_t GetPeriod() const { return fPeriod; }
38  ULong64_t GetBunchCross() const { return fBunchCross; }
39  UInt_t GetSeconds() const { return (UInt_t)(fBunchCross/1000000000.*fNanosecPerBC); }
40  UInt_t GetMicroSecs() const { return (UInt_t)(fmod(fBunchCross *fNanosecPerBC, 1000000000.)/1000 ); }
41  virtual Bool_t IsSortable() const { return kTRUE; }
42  // Setters
43  void SetTimeStamp( UInt_t orbit, UInt_t period, ULong64_t bunchcross );
44  void SetTimeStamp( UInt_t orbit, UInt_t period,
45  UInt_t seconds, UInt_t microsecs );
46 
47 
48  virtual Int_t Compare( const TObject* obj ) const;
49  virtual void Print( const Option_t* opt ="" ) const;
50 
51  static const Int_t fNanosecPerBC;
52 
53 protected:
54  UInt_t fOrbit; // Orbit
55  UInt_t fPeriod; // Period counter
56  ULong64_t fBunchCross; // Bunch Cross
57 // UInt_t fSeconds; // Seconds
58 // UInt_t fMicroSecs; // Microsecs
59 
60 private:
61 
62  ClassDef( AliTimeStamp, 1 ) // Define a timestamp
63 };
64 
65 
66 #endif
ULong64_t GetBunchCross() const
Definition: AliTimeStamp.h:38
UInt_t GetMicroSecs() const
Definition: AliTimeStamp.h:40
UInt_t GetSeconds() const
Definition: AliTimeStamp.h:39
AliTimeStamp & operator=(const AliTimeStamp &timestamp)
static const Int_t fNanosecPerBC
Definition: AliTimeStamp.h:51
void SetTimeStamp(UInt_t orbit, UInt_t period, ULong64_t bunchcross)
ULong64_t fBunchCross
Definition: AliTimeStamp.h:56
virtual Int_t Compare(const TObject *obj) const
virtual void Print(const Option_t *opt="") const
UInt_t fOrbit
nanosecs per bunch cross
Definition: AliTimeStamp.h:54
UInt_t GetPeriod() const
Definition: AliTimeStamp.h:37
virtual Bool_t IsSortable() const
Definition: AliTimeStamp.h:41
UInt_t fPeriod
Definition: AliTimeStamp.h:55
UInt_t GetOrbit() const
Definition: AliTimeStamp.h:36
virtual ~AliTimeStamp()
Definition: AliTimeStamp.h:31