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 (CaloSamples &linearFrame, HBHEDataFrame &result)
 
void analogToDigital (CaloSamples &linearFrame, HODataFrame &result)
 
void analogToDigital (CaloSamples &linearFrame, HFDataFrame &result)
 
void analogToDigital (CaloSamples &linearFrame, ZDCDataFrame &result)
 
void analogToDigital (CaloSamples &linearFrame, HcalUpgradeDataFrame &result)
 
 HcalElectronicsSim (HcalAmplifier *amplifier, const HcalCoderFactory *coderFactory, bool PreMix)
 
void newEvent ()
 
void setDbService (const HcalDbService *service)
 
void setRandomEngine (CLHEP::HepRandomEngine &engine)
 
void setStartingCapId (int startingCapId)
 
 ~HcalElectronicsSim ()
 

Private Member Functions

template<class Digi >
void convert (CaloSamples &frame, Digi &result)
 

Private Attributes

bool PreMixDigis
 
HcalAmplifiertheAmplifier
 
const HcalCoderFactorytheCoderFactory
 
CLHEP::RandFlat * theRandFlat
 
int theStartingCapId
 
bool theStartingCapIdIsRandom
 
HcalTDC theTDC
 

Detailed Description

Definition at line 21 of file HcalElectronicsSim.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file HcalElectronicsSim.cc.

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

Definition at line 23 of file HcalElectronicsSim.cc.

References theRandFlat.

23  {
24  if (theRandFlat) delete theRandFlat;
25 }
CLHEP::RandFlat * theRandFlat

Member Function Documentation

void HcalElectronicsSim::analogToDigital ( CaloSamples linearFrame,
HBHEDataFrame result 
)

Definition at line 49 of file HcalElectronicsSim.cc.

References PreMixDigis, query::result, and HBHEDataFrame::setSample().

49  {
50  convert<HBHEDataFrame>(lf, result);
51  if(PreMixDigis) {
52  for(int isample = 0; isample !=lf.size(); ++isample) {
53  uint16_t theADC = round(10.0*lf[isample]);
54  unsigned capId = result[isample].capid();
55 
56  if(theADC > 126) {
57  uint16_t keepADC = result[isample].adc();
58  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true); // set error bit as a flag
59  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
60  }
61  else {
62  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
63  HcalQIESample mysamp(theADC, capId, 0, 0);
64  }
65  }
66  }
67 }
void setSample(int i, const HcalQIESample &sam)
Definition: HBHEDataFrame.h:50
tuple result
Definition: query.py:137
void HcalElectronicsSim::analogToDigital ( CaloSamples linearFrame,
HODataFrame result 
)

Definition at line 70 of file HcalElectronicsSim.cc.

References PreMixDigis, query::result, and HODataFrame::setSample().

70  {
71  convert<HODataFrame>(lf, result);
72  if(PreMixDigis) {
73  for(int isample = 0; isample !=lf.size(); ++isample) {
74  uint16_t theADC = round(10.0*lf[isample]);
75  unsigned capId = result[isample].capid();
76 
77  if(theADC > 126) {
78  uint16_t keepADC = result[isample].adc();
79  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);// set error bit as a flag
80  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
81  }
82  else {
83  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
84  HcalQIESample mysamp(theADC, capId, 0, 0);
85  }
86  }
87  }
88 }
void setSample(int i, const HcalQIESample &sam)
Definition: HODataFrame.h:51
tuple result
Definition: query.py:137
void HcalElectronicsSim::analogToDigital ( CaloSamples linearFrame,
HFDataFrame result 
)

Definition at line 91 of file HcalElectronicsSim.cc.

References PreMixDigis, query::result, and HFDataFrame::setSample().

91  {
92  convert<HFDataFrame>(lf, result); //not enough dynamic range with simple multiplication
93  if(PreMixDigis) {
94  for(int isample = 0; isample !=lf.size(); ++isample) {
95  uint16_t theADC = round(10.0*lf[isample]);
96  unsigned capId = result[isample].capid();
97 
98  if(theADC > 126) {
99  uint16_t keepADC = result[isample].adc();
100  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);// set error bit as a flag
101  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
102  }
103  else {
104  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
105  HcalQIESample mysamp(theADC, capId, 0, 0);
106  }
107  }
108  }
109 }
tuple result
Definition: query.py:137
void setSample(int i, const HcalQIESample &sam)
Definition: HFDataFrame.h:50
void HcalElectronicsSim::analogToDigital ( CaloSamples linearFrame,
ZDCDataFrame result 
)

Definition at line 111 of file HcalElectronicsSim.cc.

References PreMixDigis, query::result, and ZDCDataFrame::setSample().

111  {
112  convert<ZDCDataFrame>(lf, result);
113  if(PreMixDigis) {
114  for(int isample = 0; isample !=lf.size(); ++isample) {
115  uint16_t theADC = round(10.0*lf[isample]);
116  unsigned capId = result[isample].capid();
117 
118  if(theADC > 126) {
119  uint16_t keepADC = result[isample].adc();
120  HcalQIESample mysamp(keepADC, capId, 0, 0, true, true);//set error bit as a flag
121  result.setSample(isample, HcalQIESample(keepADC, capId, 0, 0, true, true) );
122  }
123  else {
124  result.setSample(isample, HcalQIESample(theADC, capId, 0, 0) ); // preserve fC, no noise
125  HcalQIESample mysamp(theADC, capId, 0, 0);
126  }
127  }
128  }
129 }
tuple result
Definition: query.py:137
void setSample(int i, const HcalQIESample &sam)
Definition: ZDCDataFrame.h:50
void HcalElectronicsSim::analogToDigital ( CaloSamples linearFrame,
HcalUpgradeDataFrame result 
)

Definition at line 132 of file HcalElectronicsSim.cc.

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

133  {
134  convert<HcalUpgradeDataFrame>(lf, result);
135 // std::cout << HcalDetId(lf.id()) << ' ' << lf;
136  theTDC.timing(lf, result);
137 }
tuple result
Definition: query.py:137
void timing(const CaloSamples &lf, HcalUpgradeDataFrame &digi) const
adds timing information to the digi
Definition: HcalTDC.cc:16
template<class Digi >
void HcalElectronicsSim::convert ( CaloSamples frame,
Digi &  result 
)
private

Definition at line 41 of file HcalElectronicsSim.cc.

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

41  {
42  result.setSize(frame.size());
43  theAmplifier->amplify(frame);
44 
45  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
46 }
HcalAmplifier * theAmplifier
tuple result
Definition: query.py:137
const HcalCoderFactory * theCoderFactory
int size() const
get the size
Definition: CaloSamples.h:24
virtual void amplify(CaloSamples &linearFrame) 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
void HcalElectronicsSim::newEvent ( )

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

Definition at line 139 of file HcalElectronicsSim.cc.

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

139  {
140  // pick a new starting Capacitor ID
142  {
143  theStartingCapId = theRandFlat->fireInt(4);
145  }
146 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:42
CLHEP::RandFlat * theRandFlat
void HcalElectronicsSim::setDbService ( const HcalDbService service)

Definition at line 35 of file HcalElectronicsSim.cc.

References HcalTDC::setDbService(), and theTDC.

Referenced by HcalDigitizer::initializeEvent().

35  {
36  // theAmplifier->setDbService(service);
37  theTDC.setDbService(service);
38 }
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
Definition: HcalTDC.cc:136
void HcalElectronicsSim::setRandomEngine ( CLHEP::HepRandomEngine &  engine)

Definition at line 28 of file HcalElectronicsSim.cc.

References HcalTDC::setRandomEngine(), HcalAmplifier::setRandomEngine(), theAmplifier, theRandFlat, and theTDC.

28  {
29  theRandFlat = new CLHEP::RandFlat(engine);
31  theTDC.setRandomEngine(engine);
32 }
HcalAmplifier * theAmplifier
void setRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: HcalTDC.cc:132
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CLHEP::RandFlat * theRandFlat
void HcalElectronicsSim::setStartingCapId ( int  startingCapId)

Definition at line 149 of file HcalElectronicsSim.cc.

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

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

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

Member Data Documentation

bool HcalElectronicsSim::PreMixDigis
private

Definition at line 50 of file HcalElectronicsSim.h.

Referenced by analogToDigital().

HcalAmplifier* HcalElectronicsSim::theAmplifier
private

Definition at line 43 of file HcalElectronicsSim.h.

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

const HcalCoderFactory* HcalElectronicsSim::theCoderFactory
private

Definition at line 44 of file HcalElectronicsSim.h.

Referenced by convert().

CLHEP::RandFlat* HcalElectronicsSim::theRandFlat
private

Definition at line 46 of file HcalElectronicsSim.h.

Referenced by newEvent(), setRandomEngine(), and ~HcalElectronicsSim().

int HcalElectronicsSim::theStartingCapId
private

Definition at line 48 of file HcalElectronicsSim.h.

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

bool HcalElectronicsSim::theStartingCapIdIsRandom
private

Definition at line 49 of file HcalElectronicsSim.h.

Referenced by newEvent(), and setStartingCapId().

HcalTDC HcalElectronicsSim::theTDC
private

Definition at line 45 of file HcalElectronicsSim.h.

Referenced by analogToDigital(), setDbService(), and setRandomEngine().