FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndSdsCalcPixelDif Class Reference

#include <PndSdsCalcPixelDif.h>

Public Member Functions

 PndSdsCalcPixelDif ()
 Default constructor. More...
 
 PndSdsCalcPixelDif (Double_t w, Double_t l, Double_t qspread=0, Double_t threshold=0, Double_t noise=0, Double_t nrows=10, Double_t ncols=10)
 
 PndSdsCalcPixelDif (const PndSdsPixelDigiPar &digi_par)
 
std::vector< PndSdsPixelGetPixels (Double_t inx, Double_t iny, Double_t outx, Double_t outy, Double_t energy)
 Main function to calculate the vector<PndSdsPixel> of fired pixel. More...
 
Int_t GetPixelsAlternative (Double_t inx, Double_t iny, Double_t outx, Double_t outy, Double_t energy, std::vector< Int_t > &cols, std::vector< Int_t > &rows, std::vector< Double_t > &charges)
 
void SetVerboseLevel (Int_t level)
 
std::ostreamoperator<< (std::ostream &out)
 

Private Member Functions

Double_t ChargeFromEloss (Double_t eloss) const
 
void InjectPixelCharge (Int_t col, Int_t row, Double_t charge)
 

Private Attributes

std::vector< PndSdsPixelfPixels
 
PndSdsPixel fActivePixel
 
Double_t fPixelSizeX
 
Double_t fPixelSizeY
 
Double_t fRows
 
Double_t fCols
 
Double_t fThreshold
 
Double_t fNoise
 
Double_t fQspread
 
Double_t fEnergy
 
Int_t fVerboseLevel
 

Detailed Description

Definition at line 27 of file PndSdsCalcPixelDif.h.

Constructor & Destructor Documentation

PndSdsCalcPixelDif::PndSdsCalcPixelDif ( )

Default constructor.

Definition at line 8 of file PndSdsCalcPixelDif.cxx.

PndSdsCalcPixelDif::PndSdsCalcPixelDif ( Double_t  w,
Double_t  l,
Double_t  qspread = 0,
Double_t  threshold = 0,
Double_t  noise = 0,
Double_t  nrows = 10,
Double_t  ncols = 10 
)

Main constructor

Parameters
wwidth of sensor pixel [cm]
llength of sensor pixel [cm]
qspreadcharge cloud gaussian width
thresholddiscriminator threshold of pixel [e]
noisetotal noise of pixel [e]

Definition at line 20 of file PndSdsCalcPixelDif.cxx.

20  :
21  fPixels(),
22  fActivePixel(),
23  fPixelSizeX(lx),
24  fPixelSizeY(ly),
25  fRows(nrows),
26  fCols(ncols),
28  fNoise(noise),
29  fQspread(qspread),
30  fEnergy(0.),
31  fVerboseLevel(0)
32 {}
Double_t lx
double threshold
Double_t ly
double noise
std::vector< PndSdsPixel > fPixels
PndSdsCalcPixelDif::PndSdsCalcPixelDif ( const PndSdsPixelDigiPar digi_par)

Definition at line 13 of file PndSdsCalcPixelDif.cxx.

13  :
14  fPixels(), fActivePixel(), fPixelSizeX(digi_par.GetXPitch()), fPixelSizeY(digi_par.GetYPitch()), fRows(
15  digi_par.GetFERows() * digi_par.GetMaxFEperRow()), fCols(
16  digi_par.GetFECols() * digi_par.GetMaxFEperCol()), fThreshold(digi_par.GetThreshold()), fNoise(
17  digi_par.GetNoise()), fQspread(digi_par.GetQCloudSigma()), fEnergy(0.), fVerboseLevel(0) {
18 }
Double_t GetXPitch() const
Double_t GetQCloudSigma() const
Double_t GetNoise() const
Int_t GetFERows() const
Int_t GetFECols() const
Double_t GetYPitch() const
Int_t GetMaxFEperCol() const
Int_t GetMaxFEperRow() const
Double_t GetThreshold() const
std::vector< PndSdsPixel > fPixels

Member Function Documentation

Double_t PndSdsCalcPixelDif::ChargeFromEloss ( Double_t  eloss) const
inlineprivate

Definition at line 56 of file PndSdsCalcPixelDif.h.

Referenced by GetPixels().

56 {return eloss/(3.61e-9);}
double eloss
Definition: anaLmdSim.C:34
std::vector< PndSdsPixel > PndSdsCalcPixelDif::GetPixels ( Double_t  inx,
Double_t  iny,
Double_t  outx,
Double_t  outy,
Double_t  energy 
)

Main function to calculate the vector<PndSdsPixel> of fired pixel.

Definition at line 50 of file PndSdsCalcPixelDif.cxx.

References ChargeFromEloss(), col, cols, fabs(), fPixels, fPixelSizeX, fPixelSizeY, fQspread, i, InjectPixelCharge(), row, and t.

Referenced by PndSdsHybridHitProducer::Exec(), and GetPixelsAlternative().

51  {
52  fPixels.clear();
53  if (0 >= fPixelSizeX || 0 >= fPixelSizeY) {
54  Error("PndSdsCalcPixelDif::GetPixels()", "Invalid Pixel sizes: fPixelSizeX=%g,fPixelSizeY=%g",
56  return fPixels;
57  }
58 
59  // determine box digis which can get charge
60  double max_charge_diffusion_distance(3.0 * fQspread);
61  double min_x(inx);
62  double max_x(outx);
63  if (outx < inx) {
64  min_x = outx;
65  max_x = inx;
66  }
67  double min_y(iny);
68  double max_y(outy);
69  if (outy < iny) {
70  min_y = outy;
71  max_y = iny;
72  }
73  min_x -= max_charge_diffusion_distance;
74  min_y -= max_charge_diffusion_distance;
75  max_x += max_charge_diffusion_distance;
76  max_y += max_charge_diffusion_distance;
77 
78  double track_dx = outx - inx;
79  double track_dy = outy - iny;
80  unsigned int cols(
81  ((unsigned int) std::fabs(max_x / fPixelSizeX)) - ((unsigned int) std::fabs(min_x / fPixelSizeX))
82  + 1);
83  unsigned int rows(
84  ((unsigned int) std::fabs(max_y / fPixelSizeX)) - ((unsigned int) std::fabs(min_y / fPixelSizeY))
85  + 1);
86  // we gain a lot of speed by using a fixed vector
87  // and using a fixed mapping between row+col and vector index
88  int start_col(min_x / fPixelSizeX);
89  int start_row(min_y / fPixelSizeY);
90  double difx = 0, dify = 0;
91  int row = 0, col = 0;
92  double t = 0;
93  std::vector<int> hitstorage(cols * rows, 0);
94  double Q = ChargeFromEloss(dE); // in electrons
95  unsigned int samples(Q); // sample amount (can be chosen independent of charge electrons Q)
96  // do hit&miss mc sampling, if we have more than 1 possible cell
97  if (hitstorage.size() == 1) {
98  InjectPixelCharge(start_col, start_row, Q);
99  }
100  else {
101  for (unsigned int i = 0; i < samples; ++i) {
102  t = gRandom->Rndm();
103  difx = gRandom->Gaus(0, fQspread);
104  dify = gRandom->Gaus(0, fQspread);
105  // if the electron diffused outside of the boundary just ignore it
106  if (std::abs(difx) > max_charge_diffusion_distance
107  || std::abs(dify) > max_charge_diffusion_distance) continue;
108  col = (inx + t * track_dx + difx) / fPixelSizeX;
109  row = (iny + t * track_dy + dify) / fPixelSizeY;
110  hitstorage[(row - start_row) * cols + (col - start_col)]++;
111  }
112  // distribute electrons based on the distribution from the hit&miss
113  for (unsigned int i = 0; i < hitstorage.size(); ++i) {
114  if (hitstorage[i] > 0) {
115  row = i / cols + start_row;
116  col = i % cols + start_col;
117  InjectPixelCharge(col, row, Q * hitstorage[i] / samples);
118  }
119  }
120  }
121  return fPixels;
122 }
int row
Definition: anaLmdDigi.C:67
Int_t i
Definition: run_full.C:25
int col
Definition: anaLmdDigi.C:67
Double_t dE
Definition: anasim.C:58
Double_t ChargeFromEloss(Double_t eloss) const
int cols[10]
Definition: evaltrig.C:69
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TTree * t
Definition: bump_analys.C:13
void InjectPixelCharge(Int_t col, Int_t row, Double_t charge)
std::vector< PndSdsPixel > fPixels
Int_t PndSdsCalcPixelDif::GetPixelsAlternative ( Double_t  inx,
Double_t  iny,
Double_t  outx,
Double_t  outy,
Double_t  energy,
std::vector< Int_t > &  cols,
std::vector< Int_t > &  rows,
std::vector< Double_t > &  charges 
)

Definition at line 34 of file PndSdsCalcPixelDif.cxx.

References fVerboseLevel, GetPixels(), and i.

36  {
37  std::vector<PndSdsPixel> pixels = GetPixels(inx, iny, outx, outy, energy);
38  Int_t npix = pixels.size();
39  for (Int_t i = 0; i < npix; i++) {
40  if (fVerboseLevel > 2) Info("PndSdsCalcPixelDif::GetPixelsAlternative()",
41  "pass this pixel: i=%i, c=%i, r=%i, q=%f", i, pixels[i].GetCol(), pixels[i].GetRow(),
42  pixels[i].GetCharge());
43  cols.push_back(pixels[i].GetCol());
44  rows.push_back(pixels[i].GetRow());
45  charges.push_back(pixels[i].GetCharge());
46  }
47  return npix;
48 }
std::vector< PndSdsPixel > GetPixels(Double_t inx, Double_t iny, Double_t outx, Double_t outy, Double_t energy)
Main function to calculate the vector&lt;PndSdsPixel&gt; of fired pixel.
Int_t i
Definition: run_full.C:25
int cols[10]
Definition: evaltrig.C:69
Double_t energy
Definition: plot_dirc.C:15
void PndSdsCalcPixelDif::InjectPixelCharge ( Int_t  col,
Int_t  row,
Double_t  charge 
)
private

Definition at line 125 of file PndSdsCalcPixelDif.cxx.

References Double_t, fActivePixel, fCols, fNoise, fPixels, fRows, fThreshold, fVerboseLevel, PndSdsPixel::SetCharge(), PndSdsPixel::SetCol(), and PndSdsPixel::SetRow().

Referenced by GetPixels().

125  {
126  // cut if out of range
127  if (col < 0 || row < 0 || col > fCols || row > fRows) {
128  if (fVerboseLevel > 2) {
129  std::stringstream ss;
130  ss << " (col=" << col << ",row=" << row << " values exceed sensor boundaries: cols=[0-" << fCols
131  << "] rows=[0-" << fRows << "]";
132  Info("PndSdsCalcPixelDif::PndSdsCalcPixelDif::InjectPixelCharge:", ss.str().c_str());
133  }
134  }
135  Double_t smearedCharge = gRandom->Gaus(charge, fNoise);
136  if (fVerboseLevel > 3) std::cout << " charge = " << charge << ", smeared = " << smearedCharge
137  << std::endl;
138  if (smearedCharge > fThreshold) {
139  if (fVerboseLevel > 3) Info("PndSdsCalcPixelDif::InjectPixelCharge", "col=%i, row=%i,charge=%f", col,
140  row, charge);
141  fActivePixel.SetCol(col); // x axis
142  fActivePixel.SetRow(row); // y axis
143  fActivePixel.SetCharge(smearedCharge);
144  fPixels.push_back(fActivePixel); // fActivePixel content will be copied
145  }
146  return;
147 }
int row
Definition: anaLmdDigi.C:67
int col
Definition: anaLmdDigi.C:67
void SetCol(Int_t col)
Definition: PndSdsPixel.h:34
void SetCharge(Double_t charge)
Definition: PndSdsPixel.h:36
Double_t
void SetRow(Int_t row)
Definition: PndSdsPixel.h:35
std::vector< PndSdsPixel > fPixels
std::ostream & PndSdsCalcPixelDif::operator<< ( std::ostream out)

Definition at line 150 of file PndSdsCalcPixelDif.cxx.

References fPixelSizeX, fPixelSizeY, and out.

150  {
151  out << "fPixelSizeX: " << fPixelSizeX << " fPixelSizeY: " << fPixelSizeY << std::endl;
152 
153  return out;
154 }
TFile * out
Definition: reco_muo.C:20
void PndSdsCalcPixelDif::SetVerboseLevel ( Int_t  level)
inline

Definition at line 52 of file PndSdsCalcPixelDif.h.

References fVerboseLevel.

52 { fVerboseLevel = level;};

Member Data Documentation

PndSdsPixel PndSdsCalcPixelDif::fActivePixel
private

Definition at line 60 of file PndSdsCalcPixelDif.h.

Referenced by InjectPixelCharge().

Double_t PndSdsCalcPixelDif::fCols
private

Definition at line 65 of file PndSdsCalcPixelDif.h.

Referenced by InjectPixelCharge().

Double_t PndSdsCalcPixelDif::fEnergy
private

Definition at line 69 of file PndSdsCalcPixelDif.h.

Double_t PndSdsCalcPixelDif::fNoise
private

Definition at line 67 of file PndSdsCalcPixelDif.h.

Referenced by InjectPixelCharge().

std::vector<PndSdsPixel> PndSdsCalcPixelDif::fPixels
private

Definition at line 59 of file PndSdsCalcPixelDif.h.

Referenced by GetPixels(), and InjectPixelCharge().

Double_t PndSdsCalcPixelDif::fPixelSizeX
private

Definition at line 62 of file PndSdsCalcPixelDif.h.

Referenced by GetPixels(), and operator<<().

Double_t PndSdsCalcPixelDif::fPixelSizeY
private

Definition at line 63 of file PndSdsCalcPixelDif.h.

Referenced by GetPixels(), and operator<<().

Double_t PndSdsCalcPixelDif::fQspread
private

Definition at line 68 of file PndSdsCalcPixelDif.h.

Referenced by GetPixels().

Double_t PndSdsCalcPixelDif::fRows
private

Definition at line 64 of file PndSdsCalcPixelDif.h.

Referenced by InjectPixelCharge().

Double_t PndSdsCalcPixelDif::fThreshold
private

Definition at line 66 of file PndSdsCalcPixelDif.h.

Referenced by InjectPixelCharge().

Int_t PndSdsCalcPixelDif::fVerboseLevel
private

Definition at line 71 of file PndSdsCalcPixelDif.h.

Referenced by GetPixelsAlternative(), InjectPixelCharge(), and SetVerboseLevel().


The documentation for this class was generated from the following files: