CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HcalSignalGenerator< Traits > Class Template Reference

#include <HcalSignalGenerator.h>

Inheritance diagram for HcalSignalGenerator< Traits >:
HcalBaseSignalGenerator CaloVNoiseSignalGenerator

Public Types

typedef Traits::DigiCollection COLLECTION
 
typedef Traits::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...
 
 ~HcalSignalGenerator () override
 
- Public Member Functions inherited from HcalBaseSignalGenerator
 HcalBaseSignalGenerator ()
 
void setElectronicsSim (HcalElectronicsSim *electronicsSim)
 
void setParameterMap (HcalSimParameterMap *map)
 
 ~HcalBaseSignalGenerator () override
 
- Public Member Functions inherited from CaloVNoiseSignalGenerator
 CaloVNoiseSignalGenerator ()
 
bool contains (const DetId &detId) const
 
void fillEvent ()
 
void fillEvent (CLHEP::HepRandomEngine *)
 fill theNoiseSignals with one event's worth of noise, in units of pe More...
 
void getNoiseSignals (std::vector< CaloSamples > &noiseSignals)
 
void setNoiseSignals (const std::vector< CaloSamples > &noiseSignals)
 
virtual ~CaloVNoiseSignalGenerator ()
 

Private Member Functions

virtual void fillDigis (const COLLECTION *digis)
 
void fillNoiseSignals () override
 
void fillNoiseSignals (CLHEP::HepRandomEngine *) 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 Traits>
class HcalSignalGenerator< Traits >

Definition at line 31 of file HcalSignalGenerator.h.

Member Typedef Documentation

◆ COLLECTION

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

Definition at line 34 of file HcalSignalGenerator.h.

◆ DIGI

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

Definition at line 33 of file HcalSignalGenerator.h.

Constructor & Destructor Documentation

◆ HcalSignalGenerator() [1/2]

template<class Traits>
HcalSignalGenerator< Traits >::HcalSignalGenerator ( )
inline

Definition at line 36 of file HcalSignalGenerator.h.

◆ HcalSignalGenerator() [2/2]

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

Definition at line 38 of file HcalSignalGenerator.h.

◆ ~HcalSignalGenerator()

template<class Traits>
HcalSignalGenerator< Traits >::~HcalSignalGenerator ( )
inlineoverride

Definition at line 41 of file HcalSignalGenerator.h.

41 {}

Member Function Documentation

◆ fill()

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

Definition at line 56 of file HcalSignalGenerator.h.

56  {
57  theNoiseSignals.clear();
59  const COLLECTION* digis = nullptr;
60  // try accessing by whatever is set, Event or EventPrincipal
61  if (theEvent) {
62  if (theEvent->getByToken(tok_, pDigis)) {
63  digis = pDigis.product(); // get a ptr to the product
64  LogTrace("HcalSignalGenerator") << "total # digis for " << theInputTag << " " << digis->size();
65  } else {
66  throw cms::Exception("HcalSignalGenerator") << "Cannot find input data " << theInputTag;
67  }
68  } else if (theEventPrincipal) {
69  std::shared_ptr<edm::Wrapper<COLLECTION> const> digisPTR =
70  edm::getProductByTag<COLLECTION>(*theEventPrincipal, theInputTag, mcc);
71  if (digisPTR) {
72  digis = digisPTR->product();
73  }
74  } else {
75  throw cms::Exception("HcalSignalGenerator") << "No Event or EventPrincipal was set";
76  }
77 
78  if (digis)
79  fillDigis(digis);
80  }

Referenced by edm::DataMixingHcalDigiWorkerProd::addHcalPileups(), and PreMixingHcalWorker::addPileups().

◆ fillDigis()

template<class Traits>
virtual void HcalSignalGenerator< Traits >::fillDigis ( const COLLECTION digis)
inlineprivatevirtual

Definition at line 83 of file HcalSignalGenerator.h.

83  {
84  // loop over digis, adding these to the existing maps
85  for (typename COLLECTION::const_iterator it = digis->begin(); it != digis->end(); ++it) {
86  // for the first signal, set the starting cap id
87  if ((it == digis->begin()) && theElectronicsSim) {
88  int startingCapId = (*it)[0].capid();
89  theElectronicsSim->setStartingCapId(startingCapId);
90  // theParameterMap->setFrameSize(it->id(), it->size()); //don't need this
91  }
92  if (validDigi(*it)) {
93  theNoiseSignals.push_back(samplesInPE(*it));
94  }
95  }
96  }

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

◆ fillNoiseSignals() [1/2]

template<class Traits>
void HcalSignalGenerator< Traits >::fillNoiseSignals ( )
inlineoverrideprivatevirtual

Implements CaloVNoiseSignalGenerator.

Definition at line 99 of file HcalSignalGenerator.h.

99 {}

◆ fillNoiseSignals() [2/2]

template<class Traits>
void HcalSignalGenerator< Traits >::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 98 of file HcalSignalGenerator.h.

98 {}

◆ initializeEvent() [1/2]

template<class Traits>
void HcalSignalGenerator< Traits >::initializeEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inline

◆ initializeEvent() [2/2]

template<class Traits>
void HcalSignalGenerator< Traits >::initializeEvent ( const edm::EventPrincipal eventPrincipal,
const edm::EventSetup eventSetup 
)
inline

some users use EventPrincipals, not Events. We support both

Definition at line 50 of file HcalSignalGenerator.h.

50  {
51  theEventPrincipal = eventPrincipal;
52  eventSetup->get<HcalDbRecord>().get(theConditions);
54  }

◆ samplesInPE()

template<class Traits>
CaloSamples HcalSignalGenerator< Traits >::samplesInPE ( const DIGI digi)
inlineprivate

Definition at line 110 of file HcalSignalGenerator.h.

110  {
111  // For PreMixing, (Note that modifications will need to be made for DataMixing) the
112  // energy for each channel is kept as fC*10, but stored as an integer in ADC. If this
113  // results in an overflow, the "standard" ADC conversion is used and that channel is marked
114  // with an error that allows the "standard" decoding to convert ADC back to fC. So, most
115  // channels get to fC by just dividing ADC/10; some require special treatment.
116 
117  // calibration, for future reference: (same block for all Hcal types)
118  HcalDetId cell = digi.id();
119  CaloSamples result = CaloSamples(cell, digi.size());
120 
121  // first, check if there was an overflow in this fake digi:
122  bool overflow = false;
123  // find and list them
124 
125  for (int isample = 0; isample < digi.size(); ++isample) {
126  if (digi[isample].er())
127  overflow = true;
128  }
129 
130  if (overflow) { // do full conversion, go back and overwrite fake entries
131 
132  const HcalQIECoder* channelCoder = theConditions->getHcalCoder(cell);
133  const HcalQIEShape* channelShape = theConditions->getHcalShape(cell);
134  HcalCoderDb coder(*channelCoder, *channelShape);
135  coder.adc2fC(digi, result);
136 
137  // overwrite with coded information
138  for (int isample = 0; isample < digi.size(); ++isample) {
139  if (!digi[isample].er())
140  result[isample] = float(digi[isample].adc()) / Traits::PreMixFactor;
141  }
142  } else { // saves creating the coder, etc., every time
143  // use coded information
144  for (int isample = 0; isample < digi.size(); ++isample) {
145  result[isample] = float(digi[isample].adc()) / Traits::PreMixFactor;
146  }
147  result.setPresamples(digi.presamples());
148  }
149 
150  // translation done in fC, convert to pe:
151  fC2pe(result);
152 
153  return result;
154  }

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

◆ validDigi()

template<class Traits>
bool HcalSignalGenerator< Traits >::validDigi ( const DIGI digi)
inlineprivate

Definition at line 101 of file HcalSignalGenerator.h.

101  {
102  int DigiSum = 0;
103  for (int id = 0; id < digi.size(); id++) {
104  if (digi[id].adc() > 0)
105  ++DigiSum;
106  }
107  return (DigiSum > 0);
108  }

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

Member Data Documentation

◆ theConditions

template<class Traits>
edm::ESHandle<HcalDbService> HcalSignalGenerator< Traits >::theConditions
private

◆ theEvent

template<class Traits>
const edm::Event* HcalSignalGenerator< Traits >::theEvent
private

◆ theEventPrincipal

template<class Traits>
const edm::EventPrincipal* HcalSignalGenerator< Traits >::theEventPrincipal
private

◆ theInputTag

template<class Traits>
edm::InputTag HcalSignalGenerator< Traits >::theInputTag
private

these come from the ParameterSet

Definition at line 161 of file HcalSignalGenerator.h.

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

◆ tok_

template<class Traits>
edm::EDGetTokenT<COLLECTION> HcalSignalGenerator< Traits >::tok_
private
HcalBaseSignalGenerator::fC2pe
void fC2pe(CaloSamples &samples) const
Definition: HcalBaseSignalGenerator.h:20
HcalSignalGenerator::COLLECTION
Traits::DigiCollection COLLECTION
Definition: HcalSignalGenerator.h:34
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HcalSignalGenerator::samplesInPE
CaloSamples samplesInPE(const DIGI &digi)
Definition: HcalSignalGenerator.h:110
HcalElectronicsSim::setStartingCapId
void setStartingCapId(int startingCapId)
Definition: HcalElectronicsSim.cc:163
HcalSignalGenerator::tok_
edm::EDGetTokenT< COLLECTION > tok_
Definition: HcalSignalGenerator.h:162
edm::Handle
Definition: AssociativeIterator.h:50
HcalSimParameterMap::setDbService
void setDbService(const HcalDbService *service)
Definition: HcalSimParameterMap.cc:57
HcalDbService::getHcalShape
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:326
HcalDbService::getHcalCoder
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:319
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
HcalBaseSignalGenerator::theParameterMap
HcalSimParameterMap * theParameterMap
Definition: HcalBaseSignalGenerator.h:26
CaloVNoiseSignalGenerator::theNoiseSignals
std::vector< CaloSamples > theNoiseSignals
Definition: CaloVNoiseSignalGenerator.h:34
HcalBaseSignalGenerator::HcalBaseSignalGenerator
HcalBaseSignalGenerator()
Definition: HcalBaseSignalGenerator.h:10
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
HcalSignalGenerator::theInputTag
edm::InputTag theInputTag
these come from the ParameterSet
Definition: HcalSignalGenerator.h:161
OrderedSet.t
t
Definition: OrderedSet.py:90
HcalBaseSignalGenerator::theElectronicsSim
HcalElectronicsSim * theElectronicsSim
Definition: HcalBaseSignalGenerator.h:27
HcalSignalGenerator::validDigi
bool validDigi(const DIGI &digi)
Definition: HcalSignalGenerator.h:101
HcalDetId
Definition: HcalDetId.h:12
CaloSamples
Definition: CaloSamples.h:14
get
#define get
HcalQIECoder
Definition: HcalQIECoder.h:20
HcalSignalGenerator::theEvent
const edm::Event * theEvent
these fields are set in initializeEvent()
Definition: HcalSignalGenerator.h:157
HcalSignalGenerator::theConditions
edm::ESHandle< HcalDbService > theConditions
Definition: HcalSignalGenerator.h:159
HcalSignalGenerator::fillDigis
virtual void fillDigis(const COLLECTION *digis)
Definition: HcalSignalGenerator.h:83
Exception
Definition: hltDiff.cc:246
HcalSignalGenerator::theEventPrincipal
const edm::EventPrincipal * theEventPrincipal
Definition: HcalSignalGenerator.h:158
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalCoderDb
Definition: HcalCoderDb.h:15
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
HcalDbRecord
Definition: HcalDbRecord.h:30
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
event
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