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
HcalElectronicsSim Class Reference

#include <HcalElectronicsSim.h>

Public Member Functions

void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HBHEDataFrame &result)
 
void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HODataFrame &result)
 
void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HFDataFrame &result)
 
void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, ZDCDataFrame &result)
 
void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HcalUpgradeDataFrame &result)
 
void analogToDigital (CLHEP::HepRandomEngine *, CaloSamples &linearFrame, QIE10DataFrame &result)
 
 HcalElectronicsSim (HcalAmplifier *amplifier, const HcalCoderFactory *coderFactory, bool PreMix)
 
void newEvent (CLHEP::HepRandomEngine *)
 
void setDbService (const HcalDbService *service)
 
void setStartingCapId (int startingCapId)
 
 ~HcalElectronicsSim ()
 

Private Member Functions

template<>
void convert (CaloSamples &frame, QIE10DataFrame &result, CLHEP::HepRandomEngine *engine)
 
template<class Digi >
void convert (CaloSamples &frame, Digi &result, CLHEP::HepRandomEngine *)
 

Private Attributes

bool PreMixDigis
 
HcalAmplifiertheAmplifier
 
const HcalCoderFactorytheCoderFactory
 
int theStartingCapId
 
bool theStartingCapIdIsRandom
 
HcalTDC theTDC
 

Detailed Description

Definition at line 25 of file HcalElectronicsSim.h.

Constructor & Destructor Documentation

HcalElectronicsSim::HcalElectronicsSim ( HcalAmplifier amplifier,
const HcalCoderFactory coderFactory,
bool  PreMix 
)

Definition at line 13 of file HcalElectronicsSim.cc.

14  : theAmplifier(amplifier),
15  theCoderFactory(coderFactory),
18  PreMixDigis(PreMixing)
19 {
20 }
HcalAmplifier * theAmplifier
const HcalCoderFactory * theCoderFactory
HcalElectronicsSim::~HcalElectronicsSim ( )

Definition at line 23 of file HcalElectronicsSim.cc.

23  {
24 }

Member Function Documentation

void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
HBHEDataFrame result 
)

Definition at line 45 of file HcalElectronicsSim.cc.

References PreMixDigis, and mps_fire::result.

45  {
46  convert<HBHEDataFrame>(lf, result, engine);
47  if(PreMixDigis) {
48  for(int isample = 0; isample !=lf.size(); ++isample) {
49  uint16_t theADC = round(10.0*lf[isample]);
50  unsigned capId = result[isample].capid();
51 
52  if(theADC > 126) {
53  uint16_t keepADC = result[isample].adc();
54  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true); // set error bit as a flag
55  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
56  }
57  else {
58  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
59  HcalQIESample mysamp(theADC, capId, 0, 0);
60  }
61  }
62  }
63 }
tuple result
Definition: mps_fire.py:95
void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
HODataFrame result 
)

Definition at line 66 of file HcalElectronicsSim.cc.

References PreMixDigis, and mps_fire::result.

66  {
67  convert<HODataFrame>(lf, result, engine);
68  if(PreMixDigis) {
69  for(int isample = 0; isample !=lf.size(); ++isample) {
70  uint16_t theADC = round(10.0*lf[isample]);
71  unsigned capId = result[isample].capid();
72 
73  if(theADC > 126) {
74  uint16_t keepADC = result[isample].adc();
75  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);// set error bit as a flag
76  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
77  }
78  else {
79  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
80  HcalQIESample mysamp(theADC, capId, 0, 0);
81  }
82  }
83  }
84 }
tuple result
Definition: mps_fire.py:95
void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
HFDataFrame result 
)

Definition at line 87 of file HcalElectronicsSim.cc.

References PreMixDigis, and mps_fire::result.

87  {
88  convert<HFDataFrame>(lf, result, engine);
89  if(PreMixDigis) {
90  for(int isample = 0; isample !=lf.size(); ++isample) {
91  uint16_t theADC = round(10.0*lf[isample]);
92  unsigned capId = result[isample].capid();
93 
94  if(theADC > 126) {
95  uint16_t keepADC = result[isample].adc();
96  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);// set error bit as a flag
97  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
98  }
99  else {
100  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
101  HcalQIESample mysamp(theADC, capId, 0, 0);
102  }
103  }
104  }
105 }
tuple result
Definition: mps_fire.py:95
void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
ZDCDataFrame result 
)

Definition at line 107 of file HcalElectronicsSim.cc.

References PreMixDigis, and mps_fire::result.

107  {
108  convert<ZDCDataFrame>(lf, result, engine);
109  if(PreMixDigis) {
110  for(int isample = 0; isample !=lf.size(); ++isample) {
111  uint16_t theADC = round(10.0*lf[isample]);
112  unsigned capId = result[isample].capid();
113 
114  if(theADC > 126) {
115  uint16_t keepADC = result[isample].adc();
116  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);//set error bit as a flag
117  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
118  }
119  else {
120  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
121  HcalQIESample mysamp(theADC, capId, 0, 0);
122  }
123  }
124  }
125 }
tuple result
Definition: mps_fire.py:95
void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
HcalUpgradeDataFrame result 
)

Definition at line 128 of file HcalElectronicsSim.cc.

References mps_fire::result, theTDC, and HcalTDC::timing().

129  {
130  convert<HcalUpgradeDataFrame>(lf, result, engine);
131 // std::cout << HcalDetId(lf.id()) << ' ' << lf;
132  theTDC.timing(lf, result, engine);
133 }
tuple result
Definition: mps_fire.py:95
void timing(const CaloSamples &lf, HcalUpgradeDataFrame &digi, CLHEP::HepRandomEngine *) const
adds timing information to the digi
Definition: HcalTDC.cc:16
void HcalElectronicsSim::analogToDigital ( CLHEP::HepRandomEngine *  engine,
CaloSamples linearFrame,
QIE10DataFrame result 
)

Definition at line 135 of file HcalElectronicsSim.cc.

References mps_fire::result.

136  {
137  convert<QIE10DataFrame>(lf, result, engine);
138  //TODO:
139  //HcalTDC extension for QIE10?
140  //PreMixDigis for QIE10?
141 }
tuple result
Definition: mps_fire.py:95
template<>
void HcalElectronicsSim::convert ( CaloSamples frame,
QIE10DataFrame result,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 40 of file HcalElectronicsSim.cc.

References mps_fire::result.

40  {
41  theAmplifier->amplify(frame, engine);
42  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
43 }
HcalAmplifier * theAmplifier
const HcalCoderFactory * theCoderFactory
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer
template<class Digi >
void HcalElectronicsSim::convert ( CaloSamples frame,
Digi &  result,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 33 of file HcalElectronicsSim.cc.

References HcalAmplifier::amplify(), HcalCoderFactory::coder(), CaloSamples::id(), CaloSamples::size(), theAmplifier, theCoderFactory, and theStartingCapId.

33  {
34  result.setSize(frame.size());
35  theAmplifier->amplify(frame, engine);
36  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
37 }
HcalAmplifier * theAmplifier
tuple result
Definition: mps_fire.py:95
const HcalCoderFactory * theCoderFactory
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
int size() const
get the size
Definition: CaloSamples.h:24
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer
void HcalElectronicsSim::newEvent ( CLHEP::HepRandomEngine *  engine)

Things that need to be initialized every event sets starting CapID randomly

Definition at line 143 of file HcalElectronicsSim.cc.

References HcalAmplifier::setStartingCapId(), theAmplifier, theStartingCapId, and theStartingCapIdIsRandom.

143  {
144  // pick a new starting Capacitor ID
146  {
147  theStartingCapId = CLHEP::RandFlat::shootInt(engine, 4);
149  }
150 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:44
void HcalElectronicsSim::setDbService ( const HcalDbService service)

Definition at line 27 of file HcalElectronicsSim.cc.

References HcalTDC::setDbService(), and theTDC.

Referenced by HcalDigitizer::initializeEvent().

27  {
28  // theAmplifier->setDbService(service);
29  theTDC.setDbService(service);
30 }
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
Definition: HcalTDC.cc:132
void HcalElectronicsSim::setStartingCapId ( int  startingCapId)

Definition at line 153 of file HcalElectronicsSim.cc.

References HcalAmplifier::setStartingCapId(), theAmplifier, theStartingCapId, and theStartingCapIdIsRandom.

Referenced by HcalSignalGenerator< HBHEDigitizerTraits >::fill().

154 {
155  theStartingCapId = startingCapId;
157  // turns off random capIDs forever for this instance
158  theStartingCapIdIsRandom = false;
159 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:44

Member Data Documentation

bool HcalElectronicsSim::PreMixDigis
private

Definition at line 53 of file HcalElectronicsSim.h.

Referenced by analogToDigital().

HcalAmplifier* HcalElectronicsSim::theAmplifier
private

Definition at line 47 of file HcalElectronicsSim.h.

Referenced by convert(), newEvent(), and setStartingCapId().

const HcalCoderFactory* HcalElectronicsSim::theCoderFactory
private

Definition at line 48 of file HcalElectronicsSim.h.

Referenced by convert().

int HcalElectronicsSim::theStartingCapId
private

Definition at line 51 of file HcalElectronicsSim.h.

Referenced by convert(), newEvent(), and setStartingCapId().

bool HcalElectronicsSim::theStartingCapIdIsRandom
private

Definition at line 52 of file HcalElectronicsSim.h.

Referenced by newEvent(), and setStartingCapId().

HcalTDC HcalElectronicsSim::theTDC
private

Definition at line 49 of file HcalElectronicsSim.h.

Referenced by analogToDigital(), and setDbService().