source: trunk/MagicSoft/Mars/melectronics/MDigitalSignal.h@ 9260

Last change on this file since 9260 was 9242, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#ifndef MARS_MDigitalSignal
2#define MARS_MDigitalSignal
3
4#ifndef ROOT_TObject
5#include <TObject.h>
6#endif
7
8//#include <climits>
9
10class MDigitalSignal : public TObject
11{
12 Double_t fStart;
13 Double_t fLength;
14
15public:
16 MDigitalSignal(Double_t start=0, Double_t len=1e12/*FLT_MAX*/) : fStart(start), fLength(len)
17 {
18 }
19
20 MDigitalSignal(const MDigitalSignal &ttl) : TObject(ttl), fStart(ttl.fStart), fLength(ttl.fLength)
21 {
22 }
23
24 MDigitalSignal(const MDigitalSignal &ttl1, const MDigitalSignal &ttl2);
25
26 // Getter
27 Bool_t IsValid() const { return fLength>0; }
28
29 Double_t GetStart() const { return fStart; }
30 Double_t GetEnd() const { return fStart+fLength; }
31 Double_t GetLength() const { return fLength; }
32
33 // TObject
34 Bool_t IsSortable() const { return kTRUE; }
35 Int_t Compare(const TObject *obj) const;
36 void Print(Option_t *o="") const;
37
38 // MDigitalSignal
39 Bool_t Overlap(const TObject &obj) const;
40 Bool_t Combine(const TObject &obj);
41
42 MDigitalSignal GetCoincidence(const MDigitalSignal &ttl) const
43 {
44 return MDigitalSignal(*this, ttl);
45 }
46
47 const MDigitalSignal operator&&(const MDigitalSignal &ttl) const
48 {
49 return GetCoincidence(ttl);
50 }
51 const MDigitalSignal operator||(const MDigitalSignal &ttl) const
52 {
53 MDigitalSignal cpy(ttl);
54 return !cpy.Combine(*this) ? MDigitalSignal(0, -1) : cpy;
55 }
56
57 ClassDef(MDigitalSignal, 1) // A digital signal with a start time and a length
58};
59
60#endif
Note: See TracBrowser for help on using the repository browser.