CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiTrivialDigitalConverter Class Referencefinal

#include <SiTrivialDigitalConverter.h>

Inheritance diagram for SiTrivialDigitalConverter:
SiDigitalConverter

Public Member Functions

DigitalVecType const & convert (const std::vector< float > &, const SiStripGain *, unsigned int detid) override
 
DigitalRawVecType const & convertRaw (const std::vector< float > &, const SiStripGain *, unsigned int detid) override
 
 SiTrivialDigitalConverter (float in, bool PreMix)
 
- Public Member Functions inherited from SiDigitalConverter
virtual ~SiDigitalConverter ()
 

Private Member Functions

int convert (float in) const
 
int convertRaw (float in) const
 
int truncate (float in_adc) const
 
int truncateRaw (float in_adc) const
 

Private Attributes

SiDigitalConverter::DigitalVecType _temp
 
SiDigitalConverter::DigitalRawVecType _tempRaw
 
const float ADCperElectron
 
bool PreMixing_
 

Additional Inherited Members

- Public Types inherited from SiDigitalConverter
typedef std::vector< SiStripRawDigiDigitalRawVecType
 
typedef std::vector< SiStripDigiDigitalVecType
 

Detailed Description

Concrete implementation of SiDigitalConverter.

Definition at line 8 of file SiTrivialDigitalConverter.h.

Constructor & Destructor Documentation

◆ SiTrivialDigitalConverter()

SiTrivialDigitalConverter::SiTrivialDigitalConverter ( float  in,
bool  PreMix 
)

Definition at line 5 of file SiTrivialDigitalConverter.cc.

References _temp, and _tempRaw.

6  : ADCperElectron(1.f / in), PreMixing_(PreMix) {
7  _temp.reserve(800);
8  _tempRaw.reserve(800);
9 }
double f[11][100]
SiDigitalConverter::DigitalRawVecType _tempRaw
SiDigitalConverter::DigitalVecType _temp

Member Function Documentation

◆ convert() [1/2]

SiDigitalConverter::DigitalVecType const & SiTrivialDigitalConverter::convert ( const std::vector< float > &  analogSignal,
const SiStripGain gain,
unsigned int  detid 
)
overridevirtual

Implements SiDigitalConverter.

Definition at line 11 of file SiTrivialDigitalConverter.cc.

References _temp, gpuClustering::adc, f, PedestalClient_cfi::gain, mps_fire::i, PreMixing_, mathSSE::sqrt(), and truncate().

Referenced by DigiSimLinkAlgorithm::run().

13  {
14  _temp.clear();
15 
16  if (PreMixing_) {
17  for (size_t i = 0; i < analogSignal.size(); i++) {
18  if (analogSignal[i] <= 0)
19  continue;
20  // convert analog amplitude to digital - special algorithm for PreMixing.
21  // Need to keep all hits, including those at very low pulse heights.
22  int adc = truncate(std::sqrt(9.0f * analogSignal[i]));
23  if (adc > 0)
24  _temp.push_back(SiStripDigi(i, adc));
25  }
26  } else if (gain) {
27  SiStripApvGain::Range detGainRange = gain->getRange(detid);
28  for (size_t i = 0; i < analogSignal.size(); i++) {
29  if (analogSignal[i] <= 0)
30  continue;
31  // convert analog amplitude to digital
32  int adc = convert((gain->getStripGain(i, detGainRange)) * (analogSignal[i]));
33  if (adc > 0)
34  _temp.push_back(SiStripDigi(i, adc));
35  }
36  } else {
37  for (size_t i = 0; i < analogSignal.size(); i++) {
38  if (analogSignal[i] <= 0)
39  continue;
40  // convert analog amplitude to digital
41  int adc = convert(analogSignal[i]);
42  if (adc > 0)
43  _temp.push_back(SiStripDigi(i, adc));
44  }
45  }
46  return _temp;
47 }
T sqrt(T t)
Definition: SSEVec.h:19
std::pair< ContainerIterator, ContainerIterator > Range
double f[11][100]
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
int truncate(float in_adc) const
DigitalVecType const & convert(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
SiDigitalConverter::DigitalVecType _temp
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ convert() [2/2]

int SiTrivialDigitalConverter::convert ( float  in) const
inlineprivate

◆ convertRaw() [1/2]

SiDigitalConverter::DigitalRawVecType const & SiTrivialDigitalConverter::convertRaw ( const std::vector< float > &  analogSignal,
const SiStripGain gain,
unsigned int  detid 
)
overridevirtual

Implements SiDigitalConverter.

Definition at line 49 of file SiTrivialDigitalConverter.cc.

References _tempRaw, gpuClustering::adc, PedestalClient_cfi::gain, and mps_fire::i.

Referenced by DigiSimLinkAlgorithm::run().

50  {
51  _tempRaw.clear();
52 
53  if (gain) {
54  SiStripApvGain::Range detGainRange = gain->getRange(detid);
55  for (size_t i = 0; i < analogSignal.size(); i++) {
56  if (analogSignal[i] <= 0) {
57  _tempRaw.push_back(SiStripRawDigi(0));
58  continue;
59  }
60  // convert analog amplitude to digital
61  int adc = convertRaw((gain->getStripGain(i, detGainRange)) * (analogSignal[i]));
62  _tempRaw.push_back(SiStripRawDigi(adc));
63  }
64  } else {
65  for (size_t i = 0; i < analogSignal.size(); i++) {
66  if (analogSignal[i] <= 0) {
67  _tempRaw.push_back(SiStripRawDigi(0));
68  continue;
69  }
70  // convert analog amplitude to digital
71  int adc = convertRaw(analogSignal[i]);
72  _tempRaw.push_back(SiStripRawDigi(adc));
73  }
74  }
75  return _tempRaw;
76 }
DigitalRawVecType const & convertRaw(const std::vector< float > &, const SiStripGain *, unsigned int detid) override
std::pair< ContainerIterator, ContainerIterator > Range
SiDigitalConverter::DigitalRawVecType _tempRaw
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ convertRaw() [2/2]

int SiTrivialDigitalConverter::convertRaw ( float  in) const
inlineprivate

◆ truncate()

int SiTrivialDigitalConverter::truncate ( float  in_adc) const
private

Definition at line 78 of file SiTrivialDigitalConverter.cc.

References gpuClustering::adc, f, createfilelist::int, and PreMixing_.

Referenced by convert().

78  {
79  //Rounding the ADC number instead of truncating it
80  int adc = int(in_adc + 0.5f);
81  /*
82  254 ADC: 254 <= raw charge < 1023
83  255 ADC: raw charge >= 1023
84  */
85  if (PreMixing_) {
86  if (adc > 2047)
87  return 1023;
88  if (adc > 1022)
89  return 1022;
90  } else {
91  if (adc > 1022)
92  return 255;
93  if (adc > 253)
94  return 254;
95  }
96  //Protection
97  if (adc < 0)
98  return 0;
99  return adc;
100 }
double f[11][100]
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ truncateRaw()

int SiTrivialDigitalConverter::truncateRaw ( float  in_adc) const
private

Definition at line 102 of file SiTrivialDigitalConverter.cc.

References gpuClustering::adc, f, and createfilelist::int.

Referenced by convertRaw().

102  {
103  //Rounding the ADC number
104  int adc = int(in_adc + 0.5f);
105  if (adc > 1023)
106  return 1023;
107  //Protection
108  if (adc < 0)
109  return 0;
110  return adc;
111 }
double f[11][100]
uint16_t *__restrict__ uint16_t const *__restrict__ adc

Member Data Documentation

◆ _temp

SiDigitalConverter::DigitalVecType SiTrivialDigitalConverter::_temp
private

Definition at line 22 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and SiTrivialDigitalConverter().

◆ _tempRaw

SiDigitalConverter::DigitalRawVecType SiTrivialDigitalConverter::_tempRaw
private

Definition at line 23 of file SiTrivialDigitalConverter.h.

Referenced by convertRaw(), and SiTrivialDigitalConverter().

◆ ADCperElectron

const float SiTrivialDigitalConverter::ADCperElectron
private

Definition at line 21 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and convertRaw().

◆ PreMixing_

bool SiTrivialDigitalConverter::PreMixing_
private

Definition at line 24 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and truncate().