PandaRoot
PndDrcDigi.h
Go to the documentation of this file.
1 // --------------------------------------------------------
2 // ---- PndDrcDigi header file ---
3 // ---- Created 30.5.13 by M.Patsyuk ---
4 // --------------------------------------------------------
5 
13 #ifndef PNDDRCDIGI_H
14 #define PNDDRCDIGI_H
15 
16 #include "PndDrcDigi.h"
17 #include "PndDetectorList.h"
18 #include "FairTimeStamp.h"
19 #include "TObject.h"
20 #include "TString.h"
21 #include <iostream>
22 #include <vector>
23 #include "TVector3.h"
24 #include <fstream>
25 #include <iostream>
26 #include "stdio.h"
27 #include "TMath.h"
28 using std::cout;
29 using std::endl;
30 
31 class PndDrcDigi : public FairTimeStamp {
32  public:
33  friend std::ostream &operator<<(std::ostream &out, PndDrcDigi &digi)
34  {
35  out << "PndDrcDigi in: " << digi.GetDetectorId() << " charge " << digi.GetCharge() << " e"
36  << " time " << digi.GetTime() << " ns"
37  << " timestamp " << digi.GetTimeStamp() << " charge sharing flag " << digi.GetChargeSharingFlag() << " sensorid " << digi.GetSensorId() << ", from Point(s) ";
38  std::vector<Int_t> indices = digi.GetIndices();
39  for (unsigned int i = 0; i < indices.size(); i++) {
40  out << indices[i] << " ";
41  }
42  out << std::endl;
43 
44  return out;
45  }
46 
47  public:
48  PndDrcDigi();
49  PndDrcDigi(std::vector<Int_t> index, Int_t detectorId, Int_t sensorId, Double_t charge, Double_t time, Int_t CSflag, Double_t timeStamp);
50  PndDrcDigi(Int_t index, Int_t detectorId, Int_t sensorId, Double_t charge, Double_t time, Int_t CSflag, Double_t timeStamp);
51 
53 
54  void Print() { std::cout << *this; }
55 
56  void SetBarID(Int_t BarID);
57  void SetBoxID(Int_t BoxID);
58  void SetTrackID(Int_t TrackID);
59  void SetTrackIniVertex(TVector3 TrackIniVertex);
60  void SetMotherID(Int_t MrID);
61  void SetPdgCode(Int_t Pdg);
62  void SetTrackMom(TVector3 TrackMom);
63  void SetMotherIDPho(Int_t MrIDPho);
64  void SetTimeAtBar(Double_t TimeAtBar);
65  void SetEvtTim(Double_t EvtTim);
66  void SetEventTim(Double_t EventTim);
67  void SetPileUp(Double_t pileup);
68  void SetEventNo(Double_t EventNo);
69 
70  Int_t GetBarID() const { return fBarID; }
71  Int_t GetBoxID() const { return fBoxID; }
72  Int_t GetTrackID() const { return fTrackID; }
73  TVector3 GetTrackIniVertex() { return fTrackIniVertex; }
74  Int_t GetMotherID() const { return fMrID; }
75  Int_t GetPdgCode() const { return fPdg; }
76  TVector3 GetTrackMom() { return fTrackMom; }
77  Int_t GetMotherIDPho() const { return fMrIDPho; }
78  Double_t GetTimeAtBar() const { return fTimeAtBar; }
79  Double_t GetEvtTim() const { return fEvtTim; }
80  Double_t GetEventTim() const { return fEventTim; }
81  Double_t GetPileUp() const { return fPileUp; }
82  Double_t GetEventNo() const { return fEventNo; }
83 
84  Int_t GetDetectorId() const { return fDetectorId; }
85  Int_t GetSensorId() const { return fSensorId; }
86  Double_t GetCharge() const { return fCharge; }
87  std::vector<Int_t> GetIndices() const { return fIndex; }
88  Int_t GetIndex(int i = 0) const { return fIndex[i]; }
89  Int_t GetNIndices() const { return fIndex.size(); }
90  Double_t GetTime() const { return fTime; }
91  Int_t GetChargeSharingFlag() const { return fCSflag; }
92 
93  void AddIndex(int index)
94  {
95  fIndex.push_back(index);
96  AddLink(FairLink("DrcPDPoint", index));
97  }
98 
99  void AddIndex(std::vector<Int_t> index)
100  {
101  fIndex = index;
102  AddLinks(FairMultiLinkedData("DrcPDPoint", index));
103  }
104 
105  virtual bool equal(FairTimeStamp *data)
106  {
107  PndDrcDigi *myDigi = dynamic_cast<PndDrcDigi *>(data);
108  if (myDigi != nullptr) {
109  if (fSensorId == myDigi->GetSensorId())
110  return true;
111  }
112  return false;
113  }
114 
115  virtual bool operator<(const PndDrcDigi &myDigi) const
116  {
117  if (fSensorId < myDigi.GetSensorId())
118  return true;
119  return false;
120  }
121  virtual bool operator>(const PndDrcDigi &myDigi) const
122  {
123  if (fSensorId > myDigi.GetSensorId())
124  return true;
125  return false;
126  }
127  virtual bool operator==(const PndDrcDigi &myDigi) const
128  {
129  if (fSensorId == myDigi.GetSensorId())
130  return true;
131  return false;
132  }
133 
134  protected:
135  std::vector<Int_t> fIndex; // indice of mc points contributing to this digi
136  Int_t fDetectorId; // uniq detector ID
137  Int_t fSensorId; // Geometry ID for sensor volume
138  Double_t fCharge; // collected charge
139  Double_t fTime; // hit time
140  Int_t fCSflag; // flag indicating is the hit was produced directly by the MC point or if it is a result of the charge sharing: 1 - charge sharing hit, 0 - initial hit
141  Int_t fBarID;
142  Int_t fBoxID;
143  Int_t fTrackID;
144  TVector3 fTrackIniVertex;
145  Int_t fMrID;
146  Int_t fMrIDPho;
147  Int_t fPdg;
148  TVector3 fTrackMom;
149  Double_t fTimeAtBar;
150  Double_t fEvtTim;
151  Double_t fEventTim;
152  Double_t fPileUp;
153  Double_t fEventNo;
154 
155  ClassDef(PndDrcDigi, 2);
156 };
157 
158 #endif
Int_t GetNIndices() const
Definition: PndDrcDigi.h:89
Int_t fMrIDPho
Definition: PndDrcDigi.h:146
Int_t GetMotherID() const
Definition: PndDrcDigi.h:74
Int_t GetPdgCode() const
Definition: PndDrcDigi.h:75
Int_t GetTrackID() const
Definition: PndDrcDigi.h:72
Int_t fBoxID
Definition: PndDrcDigi.h:142
Int_t GetBoxID() const
Definition: PndDrcDigi.h:71
Int_t fTrackID
Definition: PndDrcDigi.h:143
void SetTimeAtBar(Double_t TimeAtBar)
Int_t fPdg
Definition: PndDrcDigi.h:147
virtual bool equal(FairTimeStamp *data)
Definition: PndDrcDigi.h:105
void Print()
Definition: PndDrcDigi.h:54
Double_t GetPileUp() const
Definition: PndDrcDigi.h:81
Int_t fBarID
Definition: PndDrcDigi.h:141
void SetEventNo(Double_t EventNo)
std::vector< Int_t > fIndex
Definition: PndDrcDigi.h:135
Double_t GetEvtTim() const
Definition: PndDrcDigi.h:79
Double_t GetCharge() const
Definition: PndDrcDigi.h:86
unsigned int i
Definition: P4_F32vec4.h:21
Int_t fCSflag
Definition: PndDrcDigi.h:140
TVector3 fTrackMom
Definition: PndDrcDigi.h:148
void SetBarID(Int_t BarID)
std::vector< Int_t > GetIndices() const
Definition: PndDrcDigi.h:87
Double_t fPileUp
Definition: PndDrcDigi.h:152
Int_t fSensorId
Definition: PndDrcDigi.h:137
void AddIndex(int index)
Definition: PndDrcDigi.h:93
ClassDef(PndDrcDigi, 2)
Int_t fMrID
Definition: PndDrcDigi.h:145
void SetBoxID(Int_t BoxID)
Double_t fEventTim
Definition: PndDrcDigi.h:151
void SetPileUp(Double_t pileup)
void SetMotherID(Int_t MrID)
virtual bool operator<(const PndDrcDigi &myDigi) const
Definition: PndDrcDigi.h:115
Int_t GetChargeSharingFlag() const
Definition: PndDrcDigi.h:91
Int_t GetDetectorId() const
Definition: PndDrcDigi.h:84
void SetTrackMom(TVector3 TrackMom)
Int_t GetSensorId() const
Definition: PndDrcDigi.h:85
void SetTrackID(Int_t TrackID)
Double_t fCharge
Definition: PndDrcDigi.h:138
friend std::ostream & operator<<(std::ostream &out, PndDrcDigi &digi)
Definition: PndDrcDigi.h:33
Int_t GetIndex(int i=0) const
Definition: PndDrcDigi.h:88
void SetEvtTim(Double_t EvtTim)
Double_t fTimeAtBar
Definition: PndDrcDigi.h:149
void SetTrackIniVertex(TVector3 TrackIniVertex)
Double_t GetTime() const
Definition: PndDrcDigi.h:90
Double_t fEvtTim
Definition: PndDrcDigi.h:150
virtual bool operator==(const PndDrcDigi &myDigi) const
Definition: PndDrcDigi.h:127
Double_t fEventNo
Definition: PndDrcDigi.h:153
Double_t GetEventNo() const
Definition: PndDrcDigi.h:82
void AddIndex(std::vector< Int_t > index)
Definition: PndDrcDigi.h:99
Int_t GetMotherIDPho() const
Definition: PndDrcDigi.h:77
Double_t GetTimeAtBar() const
Definition: PndDrcDigi.h:78
Int_t GetBarID() const
Definition: PndDrcDigi.h:70
TVector3 GetTrackIniVertex()
Definition: PndDrcDigi.h:73
Double_t fTime
Definition: PndDrcDigi.h:139
Double_t GetEventTim() const
Definition: PndDrcDigi.h:80
void SetPdgCode(Int_t Pdg)
TVector3 GetTrackMom()
Definition: PndDrcDigi.h:76
void SetEventTim(Double_t EventTim)
TVector3 fTrackIniVertex
Definition: PndDrcDigi.h:144
Int_t fDetectorId
Definition: PndDrcDigi.h:136
virtual bool operator>(const PndDrcDigi &myDigi) const
Definition: PndDrcDigi.h:121
void SetMotherIDPho(Int_t MrIDPho)