PandaRoot
PndSdsDigi.h
Go to the documentation of this file.
1 // --------------------------------------------------------
2 // ---- PndSdsDigi header file ---
3 // ---- Created 19.10.07 by T.Stockmanns ---
4 // --------------------------------------------------------
5 
14 #ifndef PNDSDSDIGI_H
15 #define PNDSDSDIGI_H
16 
17 #include "FairTimeStamp.h"
18 
19 #include "TObject.h"
20 #include "TString.h"
21 #include "PndDetectorList.h"
22 #include <iostream>
23 #include <vector>
24 
25 #ifndef __CINT__ // for BOOST serialization
26 #include <boost/serialization/void_cast.hpp>
27 #endif // for BOOST serialization
28 
29 class PndSdsDigi : public FairTimeStamp {
30  friend std::ostream &operator<<(std::ostream &out, PndSdsDigi &digi)
31  {
32  out << "PndSds Digi in sensor: " << digi.GetSensorID() << " FE: " << digi.GetFE() << " "
33  << " charge: " << digi.GetCharge() << " e"
34  << " timestamp: " << digi.GetTimeStamp() << ", from Point(s): ";
35  std::vector<Int_t> indices = digi.GetIndices();
36  for (unsigned int i = 0; i < indices.size(); i++) {
37  std::cout << digi.GetIndex(i) << " " << std::endl;
38  }
39  return out;
40  }
41 
42  public:
43  PndSdsDigi();
44  PndSdsDigi(std::vector<Int_t> index, Int_t detID, Int_t sensorID, Int_t fe, Double_t charge, Double_t timestamp = -1);
45  PndSdsDigi(Int_t index, Int_t detID, Int_t fSensorID, Int_t fe, Double_t charge, Double_t timestamp = -1);
53  virtual ~PndSdsDigi(){};
54 
55  Int_t GetFE() const { return fFE; }
56  // TString GetDetName() const { return fDetName; }
57  Int_t GetSensorID() const { return fSensorID; }
58  Double_t GetCharge() const { return fCharge; }
59  Int_t GetDetID() const { return fDetID; }
60  std::vector<Int_t> GetIndices() const { return fIndex; }
61  Int_t GetIndex(int i = 0) const { return fIndex[i]; }
62  Int_t GetNIndices() const { return fIndex.size(); }
63 
64  virtual void AddIndex(int index)
65  {
66  fIndex.push_back(index);
67  AddLink(FairLink(fDetID, index));
68  }
69 
70  virtual void AddIndex(std::vector<Int_t> index)
71  {
72  fIndex = index;
73  AddLinks(FairMultiLinkedData(fDetID, index));
74  }
75  void SetCharge(double charge) { fCharge = charge; }
76  void AddCharge(double charge) { fCharge += charge; }
77 
78  virtual bool operator<(const PndSdsDigi &myDigi) const
79  {
80  if (fDetID < myDigi.GetDetID())
81  return true;
82  else if (fDetID > myDigi.GetDetID())
83  return false;
84  if (fSensorID < myDigi.GetSensorID())
85  return true;
86  else if (fSensorID > myDigi.GetSensorID())
87  return false;
88  if (fFE < myDigi.GetFE())
89  return true;
90  else if (fFE > myDigi.GetFE())
91  return false;
92  return false;
93  }
94 
95  virtual void Print() { std::cout << *this; }
96 
97 #ifndef __CINT__ // for BOOST serialization
98  template <class Archive>
99  void serialize(Archive &ar, const unsigned int version)
100  {
101  boost::serialization::void_cast_register<PndSdsDigi, FairTimeStamp>();
102 
103  ar &boost::serialization::base_object<FairTimeStamp>(*this);
104  ar &fDetID;
105  ar &fSensorID;
106  ar &fFE;
107  ar &fCharge;
108  }
109 #endif // for BOOST serialization
110 
111  protected:
112 #ifndef __CINT__ // for BOOST serialization
114 
115 #endif // for BOOST serialization
116  std::vector<Int_t> fIndex; // indice of mc points contributing to this digi
117  Int_t fDetID; // branch ID of mc point array
118  Int_t fSensorID; // Geometry ID for sensor volume
119  Int_t fFE; // Frontend number
120  Double_t fCharge; // collected charge
121 
122  ClassDef(PndSdsDigi, 4);
123 };
124 
125 #endif
friend std::ostream & operator<<(std::ostream &out, PndSdsDigi &digi)
Definition: PndSdsDigi.h:30
virtual void AddIndex(int index)
Definition: PndSdsDigi.h:64
Base class for Digi information.
Definition: PndSdsDigi.h:29
Int_t fSensorID
Definition: PndSdsDigi.h:118
friend class boost::serialization::access
Definition: PndSdsDigi.h:113
virtual void AddIndex(std::vector< Int_t > index)
Definition: PndSdsDigi.h:70
void AddCharge(double charge)
Definition: PndSdsDigi.h:76
std::vector< Int_t > GetIndices() const
Definition: PndSdsDigi.h:60
Double_t GetCharge() const
Definition: PndSdsDigi.h:58
Int_t GetIndex(int i=0) const
Definition: PndSdsDigi.h:61
unsigned int i
Definition: P4_F32vec4.h:21
virtual void Print()
Definition: PndSdsDigi.h:95
Int_t fDetID
Definition: PndSdsDigi.h:117
ClassDef(PndSdsDigi, 4)
Int_t GetNIndices() const
Definition: PndSdsDigi.h:62
virtual bool operator<(const PndSdsDigi &myDigi) const
Definition: PndSdsDigi.h:78
std::vector< Int_t > fIndex
Definition: PndSdsDigi.h:116
void SetCharge(double charge)
Definition: PndSdsDigi.h:75
Int_t GetDetID() const
Definition: PndSdsDigi.h:59
Int_t fFE
Definition: PndSdsDigi.h:119
Int_t GetSensorID() const
Definition: PndSdsDigi.h:57
Double_t fCharge
Definition: PndSdsDigi.h:120
void serialize(Archive &ar, const unsigned int version)
Definition: PndSdsDigi.h:99
virtual ~PndSdsDigi()
Definition: PndSdsDigi.h:53
Int_t GetFE() const
Definition: PndSdsDigi.h:55