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