PandaRoot
PndSdsPixel.h
Go to the documentation of this file.
1 #ifndef PndSdsPixel_HH
2 #define PndSdsPixel_HH
3 
4 #include <iostream>
5 #include <string>
6 #include <vector>
7 #include "Rtypes.h"
8 
9 class PndSdsPixel {
10  public:
11  PndSdsPixel() : fFe(-1), fCol(-1), fRow(-1), fCharge(-1.0), fSensorID(-1), fMCIndex(), fAddNoise(0.){};
12 
13  PndSdsPixel(Int_t sensorID, Int_t fe, Int_t col, Int_t row, Double_t charge, int index = -1)
14  : fFe(fe), fCol(col), fRow(row), fCharge(charge), fSensorID(sensorID), fMCIndex(), fAddNoise(0.)
15  {
16  if (index >= 0)
17  fMCIndex.push_back(index);
18  };
19 
20  void SetCol(Int_t col) { fCol = col; };
21  void SetRow(Int_t row) { fRow = row; };
22  void SetCharge(Double_t charge) { fCharge = charge; };
23  void SetSensorID(Int_t sensorID) { fSensorID = sensorID; };
24  void SetFE(Int_t fe) { fFe = fe; };
25  void SetAddNoise(Double_t addnoise) { fAddNoise = addnoise; };
26 
27  Int_t GetCol() const { return fCol; };
28  Int_t GetRow() const { return fRow; };
29  Double_t GetCharge() const { return fCharge; };
30  Int_t GetSensorID() const { return fSensorID; };
31  Int_t GetFE() const { return fFe; };
32  std::vector<int> GetMCIndex() { return fMCIndex; };
34  {
35  if (fMCIndex.size() > 0)
36  return fMCIndex[0];
37  return -2;
38  };
39  Double_t GetAddNoise() const { return fAddNoise; };
40 
41  void AddCharge(Double_t charge) { fCharge += charge; };
42  void AddMCIndex(int i) { fMCIndex.push_back(i); };
43 
44  friend std::ostream &operator<<(std::ostream &out, PndSdsPixel pixel)
45  {
46  out << "Detector: " << pixel.GetSensorID() << " FE: " << pixel.GetFE() << " Pixel (C/R): " << pixel.GetCol() << " " << pixel.GetRow() << " Charge: " << pixel.GetCharge()
47  << " from MCHit: " << pixel.GetFirstMCIndex();
48  return out;
49  };
50 
51  private:
52  Int_t fFe;
53  Int_t fCol;
54  Int_t fRow;
55  Double_t fCharge;
56  Int_t fSensorID;
57  std::vector<int> fMCIndex;
58  Double_t fAddNoise; // Variable for testing
59 };
60 
61 #endif
friend std::ostream & operator<<(std::ostream &out, PndSdsPixel pixel)
Definition: PndSdsPixel.h:44
std::vector< int > GetMCIndex()
Definition: PndSdsPixel.h:32
Double_t GetCharge() const
Definition: PndSdsPixel.h:29
Int_t GetRow() const
Definition: PndSdsPixel.h:28
unsigned int i
Definition: P4_F32vec4.h:21
int GetFirstMCIndex()
Definition: PndSdsPixel.h:33
void SetCol(Int_t col)
Definition: PndSdsPixel.h:20
Int_t GetFE() const
Definition: PndSdsPixel.h:31
void SetCharge(Double_t charge)
Definition: PndSdsPixel.h:22
Int_t GetCol() const
Definition: PndSdsPixel.h:27
void SetRow(Int_t row)
Definition: PndSdsPixel.h:21
void AddMCIndex(int i)
Definition: PndSdsPixel.h:42
void SetSensorID(Int_t sensorID)
Definition: PndSdsPixel.h:23
void SetFE(Int_t fe)
Definition: PndSdsPixel.h:24
void SetAddNoise(Double_t addnoise)
Definition: PndSdsPixel.h:25
PndSdsPixel(Int_t sensorID, Int_t fe, Int_t col, Int_t row, Double_t charge, int index=-1)
Definition: PndSdsPixel.h:13
void AddCharge(Double_t charge)
Definition: PndSdsPixel.h:41
Int_t GetSensorID() const
Definition: PndSdsPixel.h:30
Double_t GetAddNoise() const
Definition: PndSdsPixel.h:39