PandaRoot
PndSdsDigiPixel.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 // ---- PndSdsDigiPixel header file ---
15 // ---- Created 19.6.06 by T.Stockmanns ---
16 // --------------------------------------------------------
17 
25 #ifndef PNDSDSDIGIPIXEL_H
26 #define PNDSDSDIGIPIXEL_H
27 
28 #include "PndSdsDigi.h"
29 #include "PndDetectorList.h"
30 
31 #include "TObject.h"
32 #include "TString.h"
33 #include <iostream>
34 #include <vector>
35 
36 class PndSdsDigiPixel : public PndSdsDigi {
37  friend std::ostream &operator<<(std::ostream &out, PndSdsDigiPixel &digi)
38  {
39  out << "PndSdsDigiPixel in: " << digi.GetSensorID() << " FE: " << digi.GetFE() << " Col/Row " << digi.GetPixelColumn() << "/" << digi.GetPixelRow() << " charge "
40  << digi.GetCharge() << " e"
41  << " timestamp " << digi.GetTimeStamp() << ", from Point(s) ";
42  std::vector<Int_t> indices = digi.GetIndices();
43  for (unsigned int i = 0; i < indices.size(); i++) {
44  out << indices[i] << " ";
45  }
46  out << std::endl;
47 
48  return out;
49  }
50 
51  public:
53  PndSdsDigiPixel(std::vector<Int_t> index, Int_t detID, Int_t sensorID, Int_t fe, Int_t col, Int_t row, Double_t charge, Double_t timeStamp);
54 
55  virtual ~PndSdsDigiPixel(){};
56 
57  void Print() { std::cout << *this; }
58 
59  Int_t GetPixelColumn() const { return fCol; }
60  Int_t GetPixelRow() const { return fRow; }
61 
62  void SetPixelColumn(Int_t col) { fCol = col; }
63  void SetPixelRow(Int_t row) { fRow = row; }
64 
66  {
67  if (fSensorID == myDigi.GetSensorID())
68  if (fFE == myDigi.GetFE())
69  if (fCol == myDigi.GetPixelColumn())
70  if (fRow == myDigi.GetPixelRow())
71  return true;
72  return false;
73  }
74 
75  virtual bool equal(FairTimeStamp *data)
76  {
77  PndSdsDigiPixel *myDigi = dynamic_cast<PndSdsDigiPixel *>(data);
78  if (myDigi != nullptr) {
79  if (fSensorID == myDigi->GetSensorID())
80  if (fFE == myDigi->GetFE())
81  if (fCol == myDigi->GetPixelColumn())
82  if (fRow == myDigi->GetPixelRow())
83  return true;
84  }
85  return false;
86  }
87 
88  virtual bool operator<(const PndSdsDigiPixel &myDigi) const
89  {
90  if (fDetID < myDigi.GetDetID())
91  return true;
92  else if (fDetID > myDigi.GetDetID())
93  return false;
94  if (fSensorID < myDigi.GetSensorID())
95  return true;
96  else if (fSensorID > myDigi.GetSensorID())
97  return false;
98  if (fFE < myDigi.GetFE())
99  return true;
100  else if (fFE > myDigi.GetFE())
101  return false;
102  if (fCol < myDigi.GetPixelColumn())
103  return true;
104  else if (fCol > myDigi.GetPixelColumn())
105  return false;
106  if (fRow < myDigi.GetPixelRow())
107  return true;
108  else if (fRow > myDigi.GetPixelRow())
109  return false;
110  return false;
111  }
112 
113  virtual bool operator>(const PndSdsDigiPixel &myDigi) const
114  {
115  if (fDetID > myDigi.GetDetID())
116  return true;
117  else if (fDetID < myDigi.GetDetID())
118  return false;
119  if (fSensorID > myDigi.GetSensorID())
120  return true;
121  else if (fSensorID < myDigi.GetSensorID())
122  return false;
123  if (fFE > myDigi.GetFE())
124  return true;
125  else if (fFE < myDigi.GetFE())
126  return false;
127  if (fCol > myDigi.GetPixelColumn())
128  return true;
129  else if (fCol < myDigi.GetPixelColumn())
130  return false;
131  if (fRow > myDigi.GetPixelRow())
132  return true;
133  else if (fRow < myDigi.GetPixelRow())
134  return false;
135  return false;
136  }
137 
139  {
140  if (this != &pix) {
141  this->PndSdsDigi::operator=(pix);
142  fCol = pix.GetPixelColumn();
143  fRow = pix.GetPixelRow();
144  }
145  return *this;
146  }
147 
148 #ifndef __CINT__ // for BOOST serialization
149  template <class Archive>
150  void serialize(Archive &ar, const unsigned int version)
151  {
152  boost::serialization::void_cast_register<PndSdsDigiPixel, PndSdsDigi>();
153  ar &boost::serialization::base_object<PndSdsDigi>(*this);
154  ar &fCol;
155  ar &fRow;
156  }
157 #endif // for BOOST serialization
158 
159  private:
160 #ifndef __CINT__ // for BOOST serialization
162 
163 #endif // for BOOST serialization
164  Int_t fCol, fRow;
165 
166  ClassDef(PndSdsDigiPixel, 8);
167 };
168 
169 #endif
Int_t GetPixelColumn() const
Base class for Digi information.
Definition: PndSdsDigi.h:43
Int_t fSensorID
Definition: PndSdsDigi.h:132
PndSdsDigiPixel & operator=(const PndSdsDigiPixel &pix)
void serialize(Archive &ar, const unsigned int version)
virtual bool equal(FairTimeStamp *data)
std::vector< Int_t > GetIndices() const
Definition: PndSdsDigi.h:74
Double_t GetCharge() const
Definition: PndSdsDigi.h:72
unsigned int i
Definition: P4_F32vec4.h:33
Int_t fDetID
Definition: PndSdsDigi.h:131
virtual bool operator>(const PndSdsDigiPixel &myDigi) const
virtual bool operator<(const PndSdsDigiPixel &myDigi) const
bool operator==(PndSdsDigiPixel &myDigi)
Int_t GetPixelRow() const
Int_t GetDetID() const
Definition: PndSdsDigi.h:73
friend std::ostream & operator<<(std::ostream &out, PndSdsDigiPixel &digi)
Int_t fFE
Definition: PndSdsDigi.h:133
void SetPixelRow(Int_t row)
void SetPixelColumn(Int_t col)
Data class to store the digi output of a pixel module.
Int_t GetSensorID() const
Definition: PndSdsDigi.h:71
friend class boost::serialization::access
virtual ~PndSdsDigiPixel()
Int_t GetFE() const
Definition: PndSdsDigi.h:69