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)
 
 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<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 24 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 40 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 61 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 82 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 102 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 123 of file HcalElectronicsSim.cc.

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

124  {
125  convert<HcalUpgradeDataFrame>(lf, result, engine);
126 // std::cout << HcalDetId(lf.id()) << ' ' << lf;
127  theTDC.timing(lf, result, engine);
128 }
tuple result
Definition: query.py:137
void timing(const CaloSamples &lf, HcalUpgradeDataFrame &digi, CLHEP::HepRandomEngine *) const
adds timing information to the digi
Definition: HcalTDC.cc:16
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: query.py:137
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 130 of file HcalElectronicsSim.cc.

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

130  {
131  // pick a new starting Capacitor ID
133  {
134  theStartingCapId = CLHEP::RandFlat::shootInt(engine, 4);
136  }
137 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:43
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 140 of file HcalElectronicsSim.cc.

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

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

141 {
142  theStartingCapId = startingCapId;
144  // turns off random capIDs forever for this instance
145  theStartingCapIdIsRandom = false;
146 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:43

Member Data Documentation

bool HcalElectronicsSim::PreMixDigis
private

Definition at line 51 of file HcalElectronicsSim.h.

Referenced by analogToDigital().

HcalAmplifier* HcalElectronicsSim::theAmplifier
private

Definition at line 45 of file HcalElectronicsSim.h.

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

const HcalCoderFactory* HcalElectronicsSim::theCoderFactory
private

Definition at line 46 of file HcalElectronicsSim.h.

Referenced by convert().

int HcalElectronicsSim::theStartingCapId
private

Definition at line 49 of file HcalElectronicsSim.h.

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

bool HcalElectronicsSim::theStartingCapIdIsRandom
private

Definition at line 50 of file HcalElectronicsSim.h.

Referenced by newEvent(), and setStartingCapId().

HcalTDC HcalElectronicsSim::theTDC
private

Definition at line 47 of file HcalElectronicsSim.h.

Referenced by analogToDigital(), and setDbService().