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