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