ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TileSampleGenerator Class Reference

#include <TileSampleGenerator.h>

Inheritance diagram for TileSampleGenerator:
Collaboration diagram for TileSampleGenerator:

Public Member Functions

 TileSampleGenerator ()
 
 TileSampleGenerator (TilePulseShape *ps, TileSampleBuffer *buf, bool dd_DEBUG=false)
 
virtual ~TileSampleGenerator ()
 
void setPulseShape (TilePulseShape *ps)
 
void fillSamples (double t0, double pedestal, double amplitude1, double amplitude2, TF1 *pdf, bool addNoise, double itOffset=0, double otOffset=50)
 
void fillNSamples (double t0, double pedestal, double amp_it, const std::vector< float > &amp_pu, TF1 *pdf, bool addNoise, double itOffset=0, int nSamples=7, int nPul=21)
 
void fill7SamplesQIE (float amp_it, float *amp_pu)
 

Private Attributes

TilePulseShapem_ps
 
TileSampleBufferm_buf
 
bool m_DEBUG
 
TRandom3 * m_rndm
 

Detailed Description

Definition at line 16 of file TileSampleGenerator.h.

Constructor & Destructor Documentation

◆ TileSampleGenerator() [1/2]

TileSampleGenerator::TileSampleGenerator ( )

Definition at line 21 of file TileSampleGenerator.cxx.

21  :
22  m_ps(0), m_buf(0), m_DEBUG(false), m_rndm(nullptr) {
23 
24 }

◆ TileSampleGenerator() [2/2]

TileSampleGenerator::TileSampleGenerator ( TilePulseShape ps,
TileSampleBuffer buf,
bool  dd_DEBUG = false 
)

Definition at line 28 of file TileSampleGenerator.cxx.

28  :
29  m_ps(ps), m_buf(buf), m_DEBUG(dd_DEBUG) {
30  m_rndm = new TRandom3();
31 }

◆ ~TileSampleGenerator()

TileSampleGenerator::~TileSampleGenerator ( )
virtual

Definition at line 35 of file TileSampleGenerator.cxx.

35  {
36  delete m_rndm;
37 }

Member Function Documentation

◆ fill7SamplesQIE()

void TileSampleGenerator::fill7SamplesQIE ( float  amp_it,
float *  amp_pu 
)

Definition at line 135 of file TileSampleGenerator.cxx.

135  { //float t0, addNoise
136 
137  //amp_it = energy/charge of the in-time pulse in fC
138 
139  //amp_pu charge deposited by out-of-time interactions assuming the interactions are every 25 ns
140  //the amplitudes are in fC
141 
142  //The in-time signal produces charges in amp_total[3] and amp_total[4]; ~80% of charge is added to amp_total[3]
143 
144  float amp_total[7] = { 0, 0, 0, 0, 0, 0, 0 };
145  float tail_Q = 0;
146  const float Q_1pe = 17.; //Average charge per a photo-electron
147  const float tail_prob = 0.18; //Probability for a photo-electron to have 25<t<75 ns
148 
149  for (int i = 0; i < 7; i++) { //Loop over output samples
150 
151  //if (m_DEBUG)
152  // std::cout << "sample to compute: " << i << " " << amp_total << std::endl;
153 
154  if (i != 3) { //out-of-time pileup
155  tail_Q = Q_1pe * m_rndm->Binomial((int) (amp_pu[i] / Q_1pe), tail_prob);
156 
157  amp_total[i] += amp_pu[i] - tail_Q;
158  if (i < 6)
159  amp_total[i + 1] += tail_Q;
160 
161  } else { //in-time pulse
162 
163  tail_Q = Q_1pe * m_rndm->Binomial((int) amp_it / Q_1pe, tail_prob);
164 
165  amp_total[3] += amp_it - tail_Q;
166  amp_total[4] += tail_Q;
167  }
168 
169  /*
170  double noise(0), val(amp_total);
171  if (addNoise) {
172  noise = pdf->GetRandom();
173  amp_total[i] += noise;
174  }
175 
176  if (m_DEBUG)
177  std::cout << " FINAL " << amp_total << std::endl;
178  */
179  }
180 
181  for (unsigned int i = 0; i < 7; i++) { //Loop over output samples
182  m_buf->setValueNoise(i, 0);
183  m_buf->setValue(i, amp_total[i]);
184  }
185 
186  return;
187 }

◆ fillNSamples()

void TileSampleGenerator::fillNSamples ( double  t0,
double  pedestal,
double  amp_it,
const std::vector< float > &  amp_pu,
TF1 *  pdf,
bool  addNoise,
double  itOffset = 0,
int  nSamples = 7,
int  nPul = 21 
)

Definition at line 64 of file TileSampleGenerator.cxx.

64  {
65 
66  std::unique_ptr<TileSampleBuffer> bufall(new TileSampleBuffer(nPul, -25*((nPul-1)/2), 25.));
67 
68  if(m_DEBUG){
69  cout << "Pileup pulses:" << std::endl;
70  for (std::vector<float>::const_iterator i = amp_pu.begin(); i != amp_pu.end(); ++i)
71  std::cout << *i << ' ';
72  std::cout << std::endl;
73  }
74 
75 
76  for (int i = 0; i < nSamples; i++) { //Loop over output samples
77  double tin, amp_it_out;
78  int nPul = amp_pu.size();
79  vector<int> t(nPul);
80  vector<float> amp_pu_out(nPul);
81  int x = (nPul-1)/2 + nSamples;
82  double amp_total = pedestal;
83 
84  if (m_DEBUG)
85  cout << "sample to compute: " << i << " " << amp_total << std::endl;
86 
87  for (int j = 0; j < nPul ; j++) { //Loop over PU pulses
88 
89  t[j] = bufall->getTime(x + i - j) - t0;
90 
91  if (m_DEBUG)
92  cout << "pileupsample to compute " << j << std::endl;
93  if (m_DEBUG)
94  cout << " time in " << i << " " << j << " " << (x + i - j) << " " << " buf " << bufall->getTime(x + i - j) << " time_out " << t[j] << std::endl;
95 
96  if (t[j] < -((nSamples-1)/2)*25. || t[j] > ((nSamples+1)/2)*25.)
97  continue; //Limits of the PulseShape
98  amp_pu_out[j] = m_ps->eval(t[j]) * amp_pu.at(j); // PU Contribution
99  amp_total += amp_pu_out[j];
100 
101  if (m_DEBUG)
102  cout << " amp_pu " << amp_pu.at(j) << " ps " << m_ps->eval(t[j]) << " amp_out " << amp_pu_out[j] << std::endl;
103  if (m_DEBUG)
104  cout << " amp_total " << amp_total << std::endl;
105  }
106 
107  tin = m_buf->getTime(i) - t0 + itOffset;
108  amp_it_out = m_ps->eval(tin) * amp_it; //Contribution from In-time Pulse
109  amp_total += amp_it_out;
110 
111  if (m_DEBUG)
112  cout << " INTIME amp_it " << amp_it << " ps " << m_ps->eval(tin) << " amp_it_out " << amp_it_out << std::endl;
113  if (m_DEBUG)
114  std::cout << " amp_total " << amp_total << std::endl;
115 
116  double noise(0), val(amp_total);
117  if (addNoise) {
118  noise = pdf->GetRandom();
119  val += noise;
120  }
121  if (m_DEBUG)
122  cout << " FINAL " << amp_total << std::endl;
123  m_buf->setValueNoise(i, (noise));
124  m_buf->setValue(i, val);
125  }
126 
127  return;
128 }

◆ fillSamples()

void TileSampleGenerator::fillSamples ( double  t0,
double  pedestal,
double  amplitude1,
double  amplitude2,
TF1 *  pdf,
bool  addNoise,
double  itOffset = 0,
double  otOffset = 50 
)

Definition at line 41 of file TileSampleGenerator.cxx.

41  {
42  for (unsigned int i = 0; i < m_buf->size(); ++i) {
43  double x1 = m_buf->getTime(i) - t0 + itOffset;
44  double y1 = m_ps->eval(x1) * amplitude1;
45  double x2 = m_buf->getTime(i) - t0 + otOffset;
46  double y2 = m_ps->eval(x2) * amplitude2;
47  double y = y1 + y2 + pedestal;
48 
49  double noise(0), val(y);
50  if (addNoise) {
51  noise = pdf->GetRandom();
52  val += noise;
53  }
54 
56  m_buf->setValue(i, val);
57  }
58 
59  return;
60 }

◆ setPulseShape()

void TileSampleGenerator::setPulseShape ( TilePulseShape ps)
inline

Definition at line 22 of file TileSampleGenerator.h.

22  {
23  m_ps = ps;
24  }

Member Data Documentation

◆ m_buf

TileSampleBuffer* TileSampleGenerator::m_buf
private

Definition at line 31 of file TileSampleGenerator.h.

◆ m_DEBUG

bool TileSampleGenerator::m_DEBUG
private

Definition at line 32 of file TileSampleGenerator.h.

◆ m_ps

TilePulseShape* TileSampleGenerator::m_ps
private

Definition at line 30 of file TileSampleGenerator.h.

◆ m_rndm

TRandom3* TileSampleGenerator::m_rndm
private

Definition at line 33 of file TileSampleGenerator.h.


The documentation for this class was generated from the following files:
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
TilePulseShape::eval
double eval(double x, bool useSpline=true, bool useUndershoot=false)
Definition: TilePulseShape.cxx:75
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
TileSampleBuffer
Definition: TileSampleBuffer.h:14
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
TileSampleGenerator::m_ps
TilePulseShape * m_ps
Definition: TileSampleGenerator.h:30
TileSampleGenerator::m_DEBUG
bool m_DEBUG
Definition: TileSampleGenerator.h:32
TileSampleBuffer::setValueNoise
void setValueNoise(unsigned int i, double val)
Definition: TileSampleBuffer.h:27
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
lumiFormat.i
int i
Definition: lumiFormat.py:85
TileSampleBuffer::size
unsigned int size()
Definition: TileSampleBuffer.h:24
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
TileSampleBuffer::setValue
void setValue(unsigned int i, double val)
Definition: TileSampleBuffer.h:21
TileSampleBuffer::getTime
double getTime(unsigned int i)
Definition: TileSampleBuffer.h:44
y
#define y
Trk::addNoise
@ addNoise
Definition: MaterialUpdateMode.h:19
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
PowhegPythia8EvtGen_jetjet.pdf
pdf
Definition: PowhegPythia8EvtGen_jetjet.py:4
TileSampleGenerator::m_rndm
TRandom3 * m_rndm
Definition: TileSampleGenerator.h:33
TileSampleGenerator::m_buf
TileSampleBuffer * m_buf
Definition: TileSampleGenerator.h:31
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380