CMS 3D CMS Logo

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

#include <SiTrivialDigitalConverter.h>

Inheritance diagram for SiTrivialDigitalConverter:
SiDigitalConverter

Public Member Functions

DigitalVecType convert (const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid) override
 
DigitalRawVecType convertRaw (const std::vector< float > &, edm::ESHandle< 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)
 
int convertRaw (float in)
 
int truncate (float in_adc) const
 
int truncateRaw (float in_adc) const
 

Private Attributes

SiDigitalConverter::DigitalVecType _temp
 
SiDigitalConverter::DigitalRawVecType _tempRaw
 
const float electronperADC
 
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 ( float  in,
bool  PreMix 
)

Definition at line 5 of file SiTrivialDigitalConverter.cc.

References _temp, and _tempRaw.

5  :
6  electronperADC(in), PreMixing_(PreMix) {
7  _temp.reserve(800);
8  _tempRaw.reserve(800);
9 }
SiDigitalConverter::DigitalRawVecType _tempRaw
SiDigitalConverter::DigitalVecType _temp

Member Function Documentation

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

Implements SiDigitalConverter.

Definition at line 12 of file SiTrivialDigitalConverter.cc.

References _temp, ecalMGPA::adc(), SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, edm::ESHandleBase::isValid(), PreMixing_, mathSSE::sqrt(), and truncate().

Referenced by DigiSimLinkAlgorithm::run().

12  {
13 
14  _temp.clear();
15 
16  if(PreMixing_) {
17  for ( size_t i=0; i<analogSignal.size(); i++) {
18  if (analogSignal[i]<=0) continue;
19  // convert analog amplitude to digital - special algorithm for PreMixing.
20  // Need to keep all hits, including those at very low pulse heights.
21  int adc = truncate( sqrt(9.0*analogSignal[i]) );
22  if ( adc > 0) _temp.push_back(SiStripDigi(i, adc));
23  }
24  }
25  else if(gainHandle.isValid()) {
26  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
27  for ( size_t i=0; i<analogSignal.size(); i++) {
28  if (analogSignal[i]<=0) continue;
29  // convert analog amplitude to digital
30  int adc = convert( (gainHandle->getStripGain(i, detGainRange))*(analogSignal[i]) );
31  if ( adc > 0) _temp.push_back(SiStripDigi(i, adc));
32  }
33  } else {
34  for ( size_t i=0; i<analogSignal.size(); i++) {
35  if (analogSignal[i]<=0) continue;
36  // convert analog amplitude to digital
37  int adc = convert( analogSignal[i] );
38  if ( adc > 0) _temp.push_back(SiStripDigi(i, adc));
39  }
40  }
41  return _temp;
42 }
int adc(sample_type sample)
get the ADC sample (12 bits)
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
int truncate(float in_adc) const
T sqrt(T t)
Definition: SSEVec.h:18
std::pair< ContainerIterator, ContainerIterator > Range
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
DigitalVecType convert(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid) override
bool isValid() const
Definition: ESHandle.h:47
SiDigitalConverter::DigitalVecType _temp
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70
int SiTrivialDigitalConverter::convert ( float  in)
inlineprivate
SiDigitalConverter::DigitalRawVecType SiTrivialDigitalConverter::convertRaw ( const std::vector< float > &  analogSignal,
edm::ESHandle< SiStripGain > &  gainHandle,
unsigned int  detid 
)
overridevirtual

Implements SiDigitalConverter.

Definition at line 45 of file SiTrivialDigitalConverter.cc.

References _tempRaw, ecalMGPA::adc(), SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, and edm::ESHandleBase::isValid().

Referenced by DigiSimLinkAlgorithm::run().

45  {
46 
47  _tempRaw.clear();
48 
49  if(gainHandle.isValid()) {
50  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
51  for ( size_t i=0; i<analogSignal.size(); i++) {
52  if (analogSignal[i]<=0) { _tempRaw.push_back(SiStripRawDigi(0)); continue; }
53  // convert analog amplitude to digital
54  int adc = convertRaw( (gainHandle->getStripGain(i, detGainRange))*(analogSignal[i]));
55  _tempRaw.push_back(SiStripRawDigi(adc));
56  }
57  } else {
58  for ( size_t i=0; i<analogSignal.size(); i++) {
59  if (analogSignal[i]<=0) { _tempRaw.push_back(SiStripRawDigi(0)); continue; }
60  // convert analog amplitude to digital
61  int adc = convertRaw( analogSignal[i] );
62  _tempRaw.push_back(SiStripRawDigi(adc));
63  }
64  }
65  return _tempRaw;
66 }
int adc(sample_type sample)
get the ADC sample (12 bits)
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:72
std::pair< ContainerIterator, ContainerIterator > Range
SiDigitalConverter::DigitalRawVecType _tempRaw
DigitalRawVecType convertRaw(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid) override
bool isValid() const
Definition: ESHandle.h:47
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:70
int SiTrivialDigitalConverter::convertRaw ( float  in)
inlineprivate
int SiTrivialDigitalConverter::truncate ( float  in_adc) const
private

Definition at line 68 of file SiTrivialDigitalConverter.cc.

References ecalMGPA::adc(), createfilelist::int, and PreMixing_.

Referenced by convert(), and convertRaw().

68  {
69  //Rounding the ADC number instead of truncating it
70  int adc = int(in_adc+0.5);
71  /*
72  254 ADC: 254 <= raw charge < 1023
73  255 ADC: raw charge >= 1023
74  */
75  if(PreMixing_) {
76  if (adc > 2047 ) return 1023;
77  if (adc > 1022 ) return 1022;
78  }
79  else {
80  if (adc > 1022 ) return 255;
81  if (adc > 253) return 254;
82  }
83  //Protection
84  if (adc < 0) return 0;
85  return adc;
86 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int SiTrivialDigitalConverter::truncateRaw ( float  in_adc) const
private

Definition at line 88 of file SiTrivialDigitalConverter.cc.

References ecalMGPA::adc(), and createfilelist::int.

Referenced by convertRaw().

88  {
89  //Rounding the ADC number
90  int adc = int(in_adc+0.5);
91  if (adc > 1023 ) return 1023;
92  //Protection
93  if (adc < 0) return 0;
94  return adc;
95 }
int adc(sample_type sample)
get the ADC sample (12 bits)

Member Data Documentation

SiDigitalConverter::DigitalVecType SiTrivialDigitalConverter::_temp
private

Definition at line 24 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and SiTrivialDigitalConverter().

SiDigitalConverter::DigitalRawVecType SiTrivialDigitalConverter::_tempRaw
private

Definition at line 25 of file SiTrivialDigitalConverter.h.

Referenced by convertRaw(), and SiTrivialDigitalConverter().

const float SiTrivialDigitalConverter::electronperADC
private

Definition at line 23 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and convertRaw().

bool SiTrivialDigitalConverter::PreMixing_
private

Definition at line 26 of file SiTrivialDigitalConverter.h.

Referenced by convert(), and truncate().