FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairHit.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef FAIRHIT_H
9 #define FAIRHIT_H
10 
11 #include "FairTimeStamp.h" // for FairTimeStamp
12 
13 #include <Rtypes.h> // for Double_t, Int_t, Double32_t, etc
14 #include <TVector3.h> // for TVector3
15 
16 namespace boost {
17 namespace serialization {
18 class access;
19 }
20 } // namespace boost
21 #include <boost/serialization/base_object.hpp>
22 
29 class FairHit : public FairTimeStamp
30 {
31  public:
33  FairHit();
34 
36  FairHit(Int_t detID, const TVector3& pos, const TVector3& dpos, Int_t index);
37 
39  virtual ~FairHit();
40 
42  Double_t GetDx() const { return fDx; };
43  Double_t GetDy() const { return fDy; };
44  Double_t GetDz() const { return fDz; };
45  Int_t GetRefIndex() const { return fRefIndex; };
46  void PositionError(TVector3& dpos) const;
47  Int_t GetDetectorID() const { return fDetectorID; };
48  Double_t GetX() const { return fX; };
49  Double_t GetY() const { return fY; };
50  Double_t GetZ() const { return fZ; };
51  void Position(TVector3& pos) const;
52 
54  void SetDx(Double_t dx) { fDx = dx; }
55  void SetDy(Double_t dy) { fDy = dy; }
56  void SetDz(Double_t dz) { fDz = dz; }
57  void SetDxyz(Double_t dx, Double_t dy, Double_t dz);
58  void SetPositionError(const TVector3& dpos);
59  void SetRefIndex(Int_t index) { fRefIndex = index; }
60  void SetDetectorID(Int_t detID) { fDetectorID = detID; }
61  void SetX(Double_t x) { fX = x; }
62  void SetY(Double_t y) { fY = y; }
63  void SetZ(Double_t z) { fZ = z; }
64  void SetXYZ(Double_t x, Double_t y, Double_t z);
65  void SetPosition(const TVector3& pos);
66 
67  /*** Output to screen */
68  virtual void Print(const Option_t*) const { ; }
69 
70  template<class Archive>
71  void serialize(Archive& ar, const unsigned int)
72  {
73  ar& boost::serialization::base_object<FairTimeStamp>(*this);
74  ar& fDetectorID;
75  ar& fRefIndex;
76  ar& fX;
77  ar& fY;
78  ar& fZ;
79  ar& fDx;
80  ar& fDy;
81  ar& fDz;
82  }
83 
84  protected:
86 
87  Double32_t fDx, fDy, fDz;
88  Int_t fRefIndex;
89  Int_t fDetectorID;
90  Double32_t fX, fY, fZ;
91 
92  ClassDef(FairHit, 3);
93 };
94 
95 inline void FairHit::PositionError(TVector3& dpos) const { dpos.SetXYZ(fDx, fDy, fDz); }
96 
97 inline void FairHit::SetDxyz(Double_t dx, Double_t dy, Double_t dz)
98 {
99  fDx = dx;
100  fDy = dy;
101  fDz = dz;
102 }
103 
104 inline void FairHit::SetPositionError(const TVector3& dpos)
105 {
106  fDx = dpos.X();
107  fDy = dpos.Y();
108  fDz = dpos.Z();
109 }
110 
111 inline void FairHit::Position(TVector3& pos) const { pos.SetXYZ(fX, fY, fZ); }
112 
113 inline void FairHit::SetXYZ(Double_t x, Double_t y, Double_t z)
114 {
115  fX = x;
116  fY = y;
117  fZ = z;
118 }
119 
120 inline void FairHit::SetPosition(const TVector3& pos)
121 {
122  fX = pos.X();
123  fY = pos.Y();
124  fZ = pos.Z();
125 }
126 
127 #endif
void SetDy(Double_t dy)
Definition: FairHit.h:55
Double_t GetDz() const
Definition: FairHit.h:44
Double_t GetZ() const
Definition: FairHit.h:50
void SetX(Double_t x)
Definition: FairHit.h:61
void SetRefIndex(Int_t index)
Definition: FairHit.h:59
Double_t GetX() const
Definition: FairHit.h:48
void SetZ(Double_t z)
Definition: FairHit.h:63
void SetDz(Double_t dz)
Definition: FairHit.h:56
Double32_t fY
Definition: FairHit.h:90
Int_t GetRefIndex() const
Definition: FairHit.h:45
void Position(TVector3 &pos) const
Definition: FairHit.h:111
Double32_t fX
Definition: FairHit.h:90
Int_t GetDetectorID() const
Definition: FairHit.h:47
void SetPositionError(const TVector3 &dpos)
Definition: FairHit.h:104
Double32_t fDy
Definition: FairHit.h:87
void SetPosition(const TVector3 &pos)
Definition: FairHit.h:120
void SetY(Double_t y)
Definition: FairHit.h:62
Double32_t fZ
Position of hit [cm].
Definition: FairHit.h:90
void SetDetectorID(Int_t detID)
Definition: FairHit.h:60
Int_t fDetectorID
Detector unique identifier.
Definition: FairHit.h:89
Double32_t fDz
Errors of position [cm].
Definition: FairHit.h:87
virtual ~FairHit()
Definition: FairHit.cxx:34
Double_t GetDy() const
Definition: FairHit.h:43
friend class boost::serialization::access
Definition: FairHit.h:85
Double32_t fDx
Definition: FairHit.h:87
Double_t GetY() const
Definition: FairHit.h:49
virtual void Print(const Option_t *) const
Definition: FairHit.h:68
void SetDxyz(Double_t dx, Double_t dy, Double_t dz)
Definition: FairHit.h:97
void PositionError(TVector3 &dpos) const
Definition: FairHit.h:95
void serialize(Archive &ar, const unsigned int)
Definition: FairHit.h:71
Int_t fRefIndex
Index of FairMCPoint for this hit.
Definition: FairHit.h:88
void SetDx(Double_t dx)
Definition: FairHit.h:54
FairHit()
Definition: FairHit.cxx:10
Double_t GetDx() const
Definition: FairHit.h:42
ClassDef(FairHit, 3)
void SetXYZ(Double_t x, Double_t y, Double_t z)
Definition: FairHit.h:113