CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
DigitalRawVecType convertRaw (const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid)
 
 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
< SiStripRawDigi
DigitalRawVecType
 
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 
)
virtual

Implements SiDigitalConverter.

Definition at line 12 of file SiTrivialDigitalConverter.cc.

References _temp, ecalMGPA::adc(), i, and edm::ESHandleBase::isValid().

Referenced by DigiSimLinkAlgorithm::run().

12  {
13 
14  _temp.clear();
15 
16  if(gainHandle.isValid()) {
17  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
18  for ( size_t i=0; i<analogSignal.size(); i++) {
19  if (analogSignal[i]<=0) continue;
20  // convert analog amplitude to digital
21  int adc = convert( (gainHandle->getStripGain(i, detGainRange))*(analogSignal[i]) );
22  if ( adc > 0) _temp.push_back(SiStripDigi(i, adc));
23  }
24  } else {
25  for ( size_t i=0; i<analogSignal.size(); i++) {
26  if (analogSignal[i]<=0) continue;
27  // convert analog amplitude to digital
28  int adc = convert( analogSignal[i] );
29  if ( adc > 0) _temp.push_back(SiStripDigi(i, adc));
30  }
31  }
32  return _temp;
33 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
DigitalVecType convert(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid)
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
bool isValid() const
Definition: ESHandle.h:47
SiDigitalConverter::DigitalVecType _temp
int SiTrivialDigitalConverter::convert ( float  in)
inlineprivate

Definition at line 18 of file SiTrivialDigitalConverter.h.

References electronperADC, and truncate().

SiDigitalConverter::DigitalRawVecType SiTrivialDigitalConverter::convertRaw ( const std::vector< float > &  analogSignal,
edm::ESHandle< SiStripGain > &  gainHandle,
unsigned int  detid 
)
virtual

Implements SiDigitalConverter.

Definition at line 36 of file SiTrivialDigitalConverter.cc.

References _tempRaw, ecalMGPA::adc(), i, and edm::ESHandleBase::isValid().

Referenced by DigiSimLinkAlgorithm::run().

36  {
37 
38  _tempRaw.clear();
39 
40  if(gainHandle.isValid()) {
41  SiStripApvGain::Range detGainRange = gainHandle->getRange(detid);
42  for ( size_t i=0; i<analogSignal.size(); i++) {
43  if (analogSignal[i]<=0) { _tempRaw.push_back(SiStripRawDigi(0)); continue; }
44  // convert analog amplitude to digital
45  int adc = convertRaw( (gainHandle->getStripGain(i, detGainRange))*(analogSignal[i]));
46  _tempRaw.push_back(SiStripRawDigi(adc));
47  }
48  } else {
49  for ( size_t i=0; i<analogSignal.size(); i++) {
50  if (analogSignal[i]<=0) { _tempRaw.push_back(SiStripRawDigi(0)); continue; }
51  // convert analog amplitude to digital
52  int adc = convertRaw( analogSignal[i] );
53  _tempRaw.push_back(SiStripRawDigi(adc));
54  }
55  }
56  return _tempRaw;
57 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
DigitalRawVecType convertRaw(const std::vector< float > &, edm::ESHandle< SiStripGain > &, unsigned int detid)
std::pair< ContainerIterator, ContainerIterator > Range
SiDigitalConverter::DigitalRawVecType _tempRaw
bool isValid() const
Definition: ESHandle.h:47
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
int SiTrivialDigitalConverter::convertRaw ( float  in)
inlineprivate
int SiTrivialDigitalConverter::truncate ( float  in_adc) const
private

Definition at line 59 of file SiTrivialDigitalConverter.cc.

References ecalMGPA::adc(), and PreMixing_.

Referenced by convert().

59  {
60  //Rounding the ADC number instead of truncating it
61  int adc = int(in_adc+0.5);
62  /*
63  254 ADC: 254 <= raw charge < 1023
64  255 ADC: raw charge >= 1023
65  */
66  if(PreMixing_) {
67  if (adc > 2047 ) return 1023;
68  if (adc > 1022 ) return 1022;
69  }
70  else {
71  if (adc > 1022 ) return 255;
72  if (adc > 253) return 254;
73  }
74  //Protection
75  if (adc < 0) return 0;
76  return adc;
77 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int SiTrivialDigitalConverter::truncateRaw ( float  in_adc) const
private

Definition at line 79 of file SiTrivialDigitalConverter.cc.

References ecalMGPA::adc().

Referenced by convertRaw().

79  {
80  //Rounding the ADC number
81  int adc = int(in_adc+0.5);
82  if (adc > 1023 ) return 1023;
83  //Protection
84  if (adc < 0) return 0;
85  return adc;
86 }
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 truncate().