EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairTimeStamp.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairTimeStamp.h
1 #ifndef FAIRTIMESTAMP_H
2 #define FAIRTIMESTAMP_H
3 #include "FairMultiLinkedData.h"
10 {
11  public:
13  FairTimeStamp();
15  FairTimeStamp(Double_t time);
17  FairTimeStamp(Double_t time, Double_t timeerror);
18 
20  virtual ~FairTimeStamp();
22  virtual Double_t GetTimeStamp() const { return fTimeStamp; };
23  virtual Double_t GetTimeStampError() const { return fTimeStampError;};
24  virtual FairLink GetEntryNr() const {return fEntryNr;}
26  virtual void SetTimeStamp(Double_t t) { fTimeStamp = t; }
27  virtual void SetTimeStampError(Double_t t) {fTimeStampError = t;}
28  virtual void SetEntryNr(FairLink entry) {fEntryNr = entry;}
29  virtual Int_t Compare(const TObject* obj) const {
30  if (this == obj) { return 0; }
31  FairTimeStamp* tsobj = (FairTimeStamp*)obj;
32  Double_t ts = tsobj->GetTimeStamp();
33  Double_t tserror = tsobj->GetTimeStampError();
34  if (fTimeStamp < ts) { return -1; }
35  else if (fTimeStamp == ts && fTimeStampError < tserror) { return -1; }
36  else if (fTimeStamp == ts && fTimeStampError == tserror) { return 0; }
37  else { return 1; }
38  }
39 
40 
41  void Print(std::ostream& out = std::cout) const;
42  virtual Bool_t IsSortable() const { return kTRUE;};
43 
44 
45  virtual bool equal(FairTimeStamp* data) {
46  return (fTimeStamp == data->GetTimeStamp() && fTimeStampError == data->GetTimeStampError());
47  }
48 
49  friend std::ostream& operator<< (std::ostream& out, const FairTimeStamp& link) {
50  link.Print(out);
51  return out;
52  }
53 
54 
55  protected:
56  Double_t fTimeStamp;
57  Double_t fTimeStampError;
59 
61 };
62 
63 #endif