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