PandaRoot
PndSdsHit.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndSdsHit header file -----
3 // ----- Created by T.Stockmanns -----
4 // -------------------------------------------------------------------------
5 
15 #ifndef PNDSDSHIT_H
16 #define PNDSDSHIT_H
17 
18 #include "TVector3.h"
19 #include "TString.h"
20 #include "FairHit.h"
21 #include "PndDetectorList.h"
22 #include "TMatrixD.h"
23 //#include "PndSingleLinkedData.h"
24 
25 #include <stdio.h>
26 #include <iostream>
27 
28 #ifndef __CINT__ // for BOOST serialization
29 #include <boost/serialization/serialization.hpp>
30 #include <boost/serialization/vector.hpp>
31 #endif
32 
33 class PndSdsHit : public FairHit {
34  friend std::ostream &operator<<(std::ostream &out, const PndSdsHit &hit)
35  {
36  out << "PndSdsHit in " << hit.GetSensorID() << " at" << std::endl;
37  out << "(" << hit.GetX() << ", " << hit.GetY() << ", " << hit.GetZ() << ") cm "
38  << " with " << hit.GetCharge() << " e"
39  << " at Time: " << hit.GetTimeStamp() << " +/- " << hit.GetTimeStampError() << " , Cluster No. " << hit.GetClusterIndex();
40  if (hit.GetBotIndex() > -1)
41  out << " and bottom " << hit.GetBotIndex();
42  if (hit.GetRefIndex() > -1)
43  out << ", mc point id = " << hit.GetRefIndex();
44  else
45  out << ", noise hit without mc poit";
46  out << std::endl;
47 
48  out << "hit.GetClusterIndex() " << hit.GetClusterIndex() << std::endl;
49  out << "hit.GetBotIndex() " << hit.GetBotIndex() << std::endl;
50  out << "hit.GetRefIndex() " << hit.GetRefIndex() << std::endl;
51  out << "hit.GetNDigiHits() " << hit.GetNDigiHits() << std::endl;
52  out << "hit.GetCharge() " << hit.GetCharge() << "(" << hit.GetEloss() << " GeV)" << std::endl;
53  out << "hit.GetSensorID() " << hit.GetSensorID() << std::endl;
54  out << "Error values in FairHit part: (dx,dy,dz) = (" << hit.GetDx() << "," << hit.GetDy() << "," << hit.GetDz() << ")" << std::endl;
55  return out;
56  }
57 
58  public:
60  PndSdsHit();
61 
71  PndSdsHit(Int_t detID, Int_t sensorID, TVector3 &pos, TVector3 &dpos, Int_t clindex, Double_t charge, Int_t NDigiHits, Int_t mcindex);
72 
73  // PndSdsHit(PndSdsHit& c);
75  virtual ~PndSdsHit();
76 
79  void SetSensorID(Int_t sensorID) { fSensorID = sensorID; }
80  void SetCharge(Double_t charge) { fCharge = charge; }
81  void SetNDigiHits(Int_t pixel) { fNDigiHits = pixel; }
82  void SetClusterIndex(Int_t datasource, Int_t id, Int_t fileId = -1, Int_t evtId = -1)
83  {
84  fClusterIndex = id;
85  SetLink(FairLink(fileId, evtId, datasource, id));
86  }
87  void SetBotIndex(Int_t id) { fBotIndex = id; }
88  void SetCov(TMatrixD cov);
89 
90  // TString GetDetName() const { return fDetName;}
91  Int_t GetSensorID() const { return fSensorID; }
92  Double_t GetCharge() const { return fCharge; }
93  Int_t GetNDigiHits() const { return fNDigiHits; }
94  TVector3 GetPosition() const { return TVector3(fX, fY, fZ); }
95  Int_t GetClusterIndex() const { return fClusterIndex; }
96  Int_t GetTopIndex() const { return GetClusterIndex(); }
97  Int_t GetBotIndex() const { return fBotIndex; }
98  Double_t GetEloss() const { return (fCharge * 3.61e-9); } // 3.6 eV/Electron in Silicon
99  TMatrixD GetCov() const { return fCov; }
100 
101  // FIXME: CAUTION The errors in the SsdHit are LOCAL, but the coordinates are in the LAB
102  //
103  // Double_t GetDxLocal() const { return fDx;};
104  // Double_t GetDyLocal() const { return fDy;};
105  // Double_t GetDzLocal() const { return fDz;};
106  // void PositionErrorLocal(TVector3& dpos) const;
107 
108  // /** overloaded accessors **/
109  // Double_t GetDx() {return GetD(0);};
110  // Double_t GetDy() {return GetD(1);};
111  // Double_t GetDz() {return GetD(2);};
112  // void PositionError(TVector3& dpos);
113 
114 #ifndef __CINT__ // for BOOST serialization
115  template <class Archive>
116  void serialize(Archive &ar, const unsigned int version)
117  {
118  ar &boost::serialization::base_object<FairHit>(*this);
119  ar &fSensorID;
120  ar &fCharge;
121  ar &fNDigiHits;
122  ar &fClusterIndex;
123  ar &fBotIndex;
124  // ar & fCov;
125  }
126 #endif // for BOOST serialization
127 
129  virtual void Print(const Option_t *opt = nullptr) const;
130 
131  private:
132 // Double_t GetD(Int_t i);
133 #ifndef __CINT__ // for BOOST serialization
135 
136 #endif // for BOOST serialization
137 
138  // TString fDetName; // Detector name
139  Int_t fSensorID;
140  Double_t fCharge;
141  Int_t fNDigiHits;
142  Int_t fClusterIndex;
143  Int_t fBotIndex;
144  TMatrixD fCov;
145  ClassDef(PndSdsHit, 8);
146 };
147 
148 // inline void PndSdsHit::PositionErrorLocal(TVector3& dpos) const {
149 // dpos.SetXYZ(fDx, fDy, fDz);
150 // }
151 //
152 // inline void PndSdsHit::PositionError(TVector3& dpos) {
153 // dpos.SetXYZ(GetDx(), GetDy(), GetDz());
154 // }
155 
156 #endif
void SetCharge(Double_t charge)
Definition: PndSdsHit.h:80
virtual void Print(const Option_t *opt=nullptr) const
Int_t GetSensorID() const
Definition: PndSdsHit.h:91
Int_t GetNDigiHits() const
Definition: PndSdsHit.h:93
Int_t GetClusterIndex() const
Definition: PndSdsHit.h:95
void SetClusterIndex(Int_t datasource, Int_t id, Int_t fileId=-1, Int_t evtId=-1)
Definition: PndSdsHit.h:82
Int_t GetBotIndex() const
Definition: PndSdsHit.h:97
friend std::ostream & operator<<(std::ostream &out, const PndSdsHit &hit)
Definition: PndSdsHit.h:34
Double_t GetEloss() const
Definition: PndSdsHit.h:98
virtual ~PndSdsHit()
friend class boost::serialization::access
Definition: PndSdsHit.h:134
Int_t GetTopIndex() const
Definition: PndSdsHit.h:96
Double_t GetCharge() const
Definition: PndSdsHit.h:92
void SetNDigiHits(Int_t pixel)
Definition: PndSdsHit.h:81
void SetBotIndex(Int_t id)
Definition: PndSdsHit.h:87
TMatrixD GetCov() const
Definition: PndSdsHit.h:99
void serialize(Archive &ar, const unsigned int version)
Definition: PndSdsHit.h:116
TVector3 GetPosition() const
Definition: PndSdsHit.h:94
void SetSensorID(Int_t sensorID)
Definition: PndSdsHit.h:79
void SetCov(TMatrixD cov)
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52