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