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 12 of file HcalElectronicsSim.cc.

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

Definition at line 22 of file HcalElectronicsSim.cc.

22  {
23 }

Member Function Documentation

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

Definition at line 39 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 60 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 81 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 101 of file HcalElectronicsSim.cc.

References PreMixDigis, and query::result.

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

Definition at line 122 of file HcalElectronicsSim.cc.

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

123  {
124  convert<HcalUpgradeDataFrame>(lf, result, engine);
125 // std::cout << HcalDetId(lf.id()) << ' ' << lf;
126  theTDC.timing(lf, result, engine);
127 }
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 32 of file HcalElectronicsSim.cc.

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

32  {
33  result.setSize(frame.size());
34  theAmplifier->amplify(frame, engine);
35  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
36 }
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 129 of file HcalElectronicsSim.cc.

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

129  {
130  // pick a new starting Capacitor ID
132  {
133  theStartingCapId = CLHEP::RandFlat::shootInt(engine, 4);
135  }
136 }
HcalAmplifier * theAmplifier
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:44
void HcalElectronicsSim::setDbService ( const HcalDbService service)

Definition at line 26 of file HcalElectronicsSim.cc.

References HcalTDC::setDbService(), and theTDC.

Referenced by HcalDigitizer::initializeEvent().

26  {
27  // theAmplifier->setDbService(service);
28  theTDC.setDbService(service);
29 }
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 139 of file HcalElectronicsSim.cc.

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

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

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

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().