CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HcalSignalGenerator< HCALDIGITIZERTRAITS > Class Template Reference

#include <HcalSignalGenerator.h>

Inheritance diagram for HcalSignalGenerator< HCALDIGITIZERTRAITS >:
HcalBaseSignalGenerator CaloVNoiseSignalGenerator

Public Types

typedef
HCALDIGITIZERTRAITS::DigiCollection 
COLLECTION
 
typedef HCALDIGITIZERTRAITS::Digi DIGI
 

Public Member Functions

virtual void fill (edm::ModuleCallingContext const *mcc)
 
 HcalSignalGenerator ()
 
 HcalSignalGenerator (const edm::InputTag &inputTag, const edm::EDGetTokenT< COLLECTION > &t)
 
void initializeEvent (const edm::Event *event, const edm::EventSetup *eventSetup)
 
void initializeEvent (const edm::EventPrincipal *eventPrincipal, const edm::EventSetup *eventSetup)
 some users use EventPrincipals, not Events. We support both More...
 
virtual ~HcalSignalGenerator ()
 
- Public Member Functions inherited from HcalBaseSignalGenerator
 HcalBaseSignalGenerator ()
 
void setElectronicsSim (HcalElectronicsSim *electronicsSim)
 
void setParameterMap (HcalSimParameterMap *map)
 
virtual ~HcalBaseSignalGenerator ()
 
- Public Member Functions inherited from CaloVNoiseSignalGenerator
 CaloVNoiseSignalGenerator ()
 
bool contains (const DetId &detId) const
 
void fillEvent (CLHEP::HepRandomEngine *)
 fill theNoiseSignals with one event's worth of noise, in units of pe More...
 
void fillEvent ()
 
void getNoiseSignals (std::vector< CaloSamples > &noiseSignals)
 
void setNoiseSignals (const std::vector< CaloSamples > &noiseSignals)
 
virtual ~CaloVNoiseSignalGenerator ()
 

Private Member Functions

virtual void fillNoiseSignals (CLHEP::HepRandomEngine *) override
 
virtual void fillNoiseSignals () override
 
CaloSamples samplesInPE (const DIGI &digi)
 
bool validDigi (const DIGI &digi)
 

Private Attributes

edm::ESHandle< HcalDbServicetheConditions
 
const edm::EventtheEvent
 these fields are set in initializeEvent() More...
 
const edm::EventPrincipaltheEventPrincipal
 
edm::InputTag theInputTag
 these come from the ParameterSet More...
 
edm::EDGetTokenT< COLLECTIONtok_
 

Additional Inherited Members

- Protected Member Functions inherited from HcalBaseSignalGenerator
void fC2pe (CaloSamples &samples) const
 
- Protected Attributes inherited from HcalBaseSignalGenerator
HcalElectronicsSimtheElectronicsSim
 
HcalSimParameterMaptheParameterMap
 
- Protected Attributes inherited from CaloVNoiseSignalGenerator
std::vector< CaloSamplestheNoiseSignals
 

Detailed Description

template<class HCALDIGITIZERTRAITS>
class HcalSignalGenerator< HCALDIGITIZERTRAITS >

Definition at line 29 of file HcalSignalGenerator.h.

Member Typedef Documentation

template<class HCALDIGITIZERTRAITS>
typedef HCALDIGITIZERTRAITS::DigiCollection HcalSignalGenerator< HCALDIGITIZERTRAITS >::COLLECTION

Definition at line 33 of file HcalSignalGenerator.h.

template<class HCALDIGITIZERTRAITS>
typedef HCALDIGITIZERTRAITS::Digi HcalSignalGenerator< HCALDIGITIZERTRAITS >::DIGI

Definition at line 32 of file HcalSignalGenerator.h.

Constructor & Destructor Documentation

template<class HCALDIGITIZERTRAITS>
HcalSignalGenerator< HCALDIGITIZERTRAITS >::HcalSignalGenerator ( )
inline
template<class HCALDIGITIZERTRAITS>
HcalSignalGenerator< HCALDIGITIZERTRAITS >::HcalSignalGenerator ( const edm::InputTag inputTag,
const edm::EDGetTokenT< COLLECTION > &  t 
)
inline

Definition at line 37 of file HcalSignalGenerator.h.

39  { }
edm::InputTag theInputTag
these come from the ParameterSet
const edm::Event * theEvent
these fields are set in initializeEvent()
const edm::EventPrincipal * theEventPrincipal
edm::EDGetTokenT< COLLECTION > tok_
template<class HCALDIGITIZERTRAITS>
virtual HcalSignalGenerator< HCALDIGITIZERTRAITS >::~HcalSignalGenerator ( )
inlinevirtual

Definition at line 41 of file HcalSignalGenerator.h.

41 {}

Member Function Documentation

template<class HCALDIGITIZERTRAITS>
virtual void HcalSignalGenerator< HCALDIGITIZERTRAITS >::fill ( edm::ModuleCallingContext const *  mcc)
inlinevirtual

Definition at line 59 of file HcalSignalGenerator.h.

Referenced by edm::DataMixingHcalDigiWorkerProd::addHcalPileups().

60  {
61 
62  theNoiseSignals.clear();
64  const COLLECTION * digis = 0;
65  // try accessing by whatever is set, Event or EventPrincipal
66  if(theEvent)
67  {
68  if( theEvent->getByToken(tok_, pDigis) ) {
69  digis = pDigis.product(); // get a ptr to the product
70  LogTrace("HcalSignalGenerator") << "total # digis for " << theInputTag << " " << digis->size();
71  }
72  else
73  {
74  throw cms::Exception("HcalSignalGenerator") << "Cannot find input data " << theInputTag;
75  }
76  }
77  else if(theEventPrincipal)
78  {
79  std::shared_ptr<edm::Wrapper<COLLECTION> const> digisPTR =
80  edm::getProductByTag<COLLECTION>(*theEventPrincipal, theInputTag, mcc );
81  if(digisPTR) {
82  digis = digisPTR->product();
83  }
84  }
85  else
86  {
87  throw cms::Exception("HcalSignalGenerator") << "No Event or EventPrincipal was set";
88  }
89 
90  if (digis)
91  {
92 
93  // loop over digis, adding these to the existing maps
94  for(typename COLLECTION::const_iterator it = digis->begin();
95  it != digis->end(); ++it)
96  {
97  // for the first signal, set the starting cap id
98  if((it == digis->begin()) && theElectronicsSim)
99  {
100  int startingCapId = (*it)[0].capid();
101  theElectronicsSim->setStartingCapId(startingCapId);
102  // theParameterMap->setFrameSize(it->id(), it->size()); //don't need this
103  }
104  if(validDigi(*it)) {
105  theNoiseSignals.push_back(samplesInPE(*it));
106  }
107  }
108  }
109  }
edm::InputTag theInputTag
these come from the ParameterSet
void setStartingCapId(int startingCapId)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
HCALDIGITIZERTRAITS::DigiCollection COLLECTION
const edm::Event * theEvent
these fields are set in initializeEvent()
CaloSamples samplesInPE(const DIGI &digi)
std::vector< CaloSamples > theNoiseSignals
const edm::EventPrincipal * theEventPrincipal
edm::EDGetTokenT< COLLECTION > tok_
#define LogTrace(id)
HcalElectronicsSim * theElectronicsSim
T const * product() const
Definition: Handle.h:81
bool validDigi(const DIGI &digi)
template<class HCALDIGITIZERTRAITS>
virtual void HcalSignalGenerator< HCALDIGITIZERTRAITS >::fillNoiseSignals ( CLHEP::HepRandomEngine *  )
inlineoverrideprivatevirtual

if you want to fill signals on demand, override this subclass is responsible for clearing theNoiseSignals before adding

Implements CaloVNoiseSignalGenerator.

Definition at line 114 of file HcalSignalGenerator.h.

114 {}
template<class HCALDIGITIZERTRAITS>
virtual void HcalSignalGenerator< HCALDIGITIZERTRAITS >::fillNoiseSignals ( )
inlineoverrideprivatevirtual

Implements CaloVNoiseSignalGenerator.

Definition at line 115 of file HcalSignalGenerator.h.

115 {}
template<class HCALDIGITIZERTRAITS>
void HcalSignalGenerator< HCALDIGITIZERTRAITS >::initializeEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inline

Definition at line 44 of file HcalSignalGenerator.h.

Referenced by edm::DataMixingHcalDigiWorkerProd::addHcalPileups().

45  {
46  theEvent = event;
47  eventSetup->get<HcalDbRecord>().get(theConditions);
49  }
const edm::Event * theEvent
these fields are set in initializeEvent()
edm::ESHandle< HcalDbService > theConditions
HcalSimParameterMap * theParameterMap
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void setDbService(const HcalDbService *service)
template<class HCALDIGITIZERTRAITS>
void HcalSignalGenerator< HCALDIGITIZERTRAITS >::initializeEvent ( const edm::EventPrincipal eventPrincipal,
const edm::EventSetup eventSetup 
)
inline

some users use EventPrincipals, not Events. We support both

Definition at line 52 of file HcalSignalGenerator.h.

53  {
54  theEventPrincipal = eventPrincipal;
55  eventSetup->get<HcalDbRecord>().get(theConditions);
57  }
edm::ESHandle< HcalDbService > theConditions
const edm::EventPrincipal * theEventPrincipal
HcalSimParameterMap * theParameterMap
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void setDbService(const HcalDbService *service)
template<class HCALDIGITIZERTRAITS>
CaloSamples HcalSignalGenerator< HCALDIGITIZERTRAITS >::samplesInPE ( const DIGI digi)
inlineprivate

Definition at line 127 of file HcalSignalGenerator.h.

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

128  {
129 
130  // For PreMixing, (Note that modifications will need to be made for DataMixing) the
131  // energy for each channel is kept as fC*10, but stored as an integer in ADC. If this
132  // results in an overflow, the "standard" ADC conversion is used and that channel is marked
133  // with an error that allows the "standard" decoding to convert ADC back to fC. So, most
134  // channels get to fC by just dividing ADC/10; some require special treatment.
135 
136  // calibration, for future reference: (same block for all Hcal types)
137  HcalDetId cell = digi.id();
138  // const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
139  //const HcalQIECoder* channelCoder = theConditions->getHcalCoder (cell);
140  //const HcalQIEShape* channelShape = theConditions->getHcalShape (cell);
141  //HcalCoderDb coder (*channelCoder, *channelShape);
142  CaloSamples result = CaloSamples(cell,digi.size());;
143  //coder.adc2fC(digi, result);
144 
145  // first, check if there was an overflow in this fake digi:
146  bool overflow = false;
147  // find and list them
148 
149  for(int isample=0; isample<digi.size(); ++isample) {
150  if(digi[isample].er()) overflow = true;
151  }
152 
153  if(overflow) { // do full conversion, go back and overwrite fake entries
154 
155  const HcalQIECoder* channelCoder = theConditions->getHcalCoder (cell);
156  const HcalQIEShape* channelShape = theConditions->getHcalShape (cell);
157  HcalCoderDb coder (*channelCoder, *channelShape);
158  coder.adc2fC(digi, result);
159 
160  // overwrite with coded information
161  for(int isample=0; isample<digi.size(); ++isample) {
162  if(!digi[isample].er()) result[isample] = float(digi[isample].adc())/10.;
163  }
164  }
165  else { // saves creating the coder, etc., every time
166  // use coded information
167  for(int isample=0; isample<digi.size(); ++isample) {
168  result[isample] = float(digi[isample].adc())/10.;
169  }
170  result.setPresamples(digi.presamples());
171  }
172 
173  // std::cout << " HcalSignalGenerator: noise input ADC " << digi << std::endl;
174  // std::cout << " HcalSignalGenerator: noise input in fC " << result << std::endl;
175 
176  // translation done in fC, convert to pe:
177  fC2pe(result);
178 
179  return result;
180  }
int adc(sample_type sample)
get the ADC sample (12 bits)
void fC2pe(CaloSamples &samples) const
edm::ESHandle< HcalDbService > theConditions
tuple result
Definition: query.py:137
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
template<class HCALDIGITIZERTRAITS>
bool HcalSignalGenerator< HCALDIGITIZERTRAITS >::validDigi ( const DIGI digi)
inlineprivate

Definition at line 117 of file HcalSignalGenerator.h.

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

118  {
119  int DigiSum = 0;
120  for(int id = 0; id<digi.size(); id++) {
121  if(digi[id].adc() > 0) ++DigiSum;
122  }
123  return(DigiSum>0);
124  }
int adc(sample_type sample)
get the ADC sample (12 bits)

Member Data Documentation

template<class HCALDIGITIZERTRAITS>
edm::ESHandle<HcalDbService> HcalSignalGenerator< HCALDIGITIZERTRAITS >::theConditions
private
template<class HCALDIGITIZERTRAITS>
const edm::Event* HcalSignalGenerator< HCALDIGITIZERTRAITS >::theEvent
private
template<class HCALDIGITIZERTRAITS>
const edm::EventPrincipal* HcalSignalGenerator< HCALDIGITIZERTRAITS >::theEventPrincipal
private
template<class HCALDIGITIZERTRAITS>
edm::InputTag HcalSignalGenerator< HCALDIGITIZERTRAITS >::theInputTag
private

these come from the ParameterSet

Definition at line 187 of file HcalSignalGenerator.h.

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

template<class HCALDIGITIZERTRAITS>
edm::EDGetTokenT<COLLECTION> HcalSignalGenerator< HCALDIGITIZERTRAITS >::tok_
private