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

Definition at line 31 of file HcalSignalGenerator.h.

Member Typedef Documentation

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

Definition at line 35 of file HcalSignalGenerator.h.

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

Definition at line 34 of file HcalSignalGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file HcalSignalGenerator.h.

40  : HcalBaseSignalGenerator(), theEvent(nullptr), theEventPrincipal(nullptr), theInputTag(inputTag), tok_(t)
41  { }
const edm::EventPrincipal * theEventPrincipal
const edm::Event * theEvent
these fields are set in initializeEvent()
edm::InputTag theInputTag
these come from the ParameterSet
edm::EDGetTokenT< COLLECTION > tok_
template<class Traits>
HcalSignalGenerator< Traits >::~HcalSignalGenerator ( )
inlineoverride

Definition at line 43 of file HcalSignalGenerator.h.

43 {}

Member Function Documentation

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

Definition at line 61 of file HcalSignalGenerator.h.

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

62  {
63 
64  theNoiseSignals.clear();
66  const COLLECTION * digis = nullptr;
67  // try accessing by whatever is set, Event or EventPrincipal
68  if(theEvent)
69  {
70  if( theEvent->getByToken(tok_, pDigis) ) {
71  digis = pDigis.product(); // get a ptr to the product
72  LogTrace("HcalSignalGenerator") << "total # digis for " << theInputTag << " " << digis->size();
73  }
74  else
75  {
76  throw cms::Exception("HcalSignalGenerator") << "Cannot find input data " << theInputTag;
77  }
78  }
79  else if(theEventPrincipal)
80  {
81  std::shared_ptr<edm::Wrapper<COLLECTION> const> digisPTR =
82  edm::getProductByTag<COLLECTION>(*theEventPrincipal, theInputTag, mcc );
83  if(digisPTR) {
84  digis = digisPTR->product();
85  }
86  }
87  else
88  {
89  throw cms::Exception("HcalSignalGenerator") << "No Event or EventPrincipal was set";
90  }
91 
92  if (digis) fillDigis(digis);
93  }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
const edm::EventPrincipal * theEventPrincipal
std::vector< CaloSamples > theNoiseSignals
const edm::Event * theEvent
these fields are set in initializeEvent()
#define LogTrace(id)
T const * product() const
Definition: Handle.h:81
Traits::DigiCollection COLLECTION
edm::InputTag theInputTag
these come from the ParameterSet
virtual void fillDigis(const COLLECTION *digis)
edm::EDGetTokenT< COLLECTION > tok_
template<class Traits>
virtual void HcalSignalGenerator< Traits >::fillDigis ( const COLLECTION digis)
inlineprivatevirtual

Definition at line 97 of file HcalSignalGenerator.h.

97  {
98  // loop over digis, adding these to the existing maps
99  for(typename COLLECTION::const_iterator it = digis->begin(); it != digis->end(); ++it)
100  {
101  // for the first signal, set the starting cap id
102  if((it == digis->begin()) && theElectronicsSim)
103  {
104  int startingCapId = (*it)[0].capid();
105  theElectronicsSim->setStartingCapId(startingCapId);
106  // theParameterMap->setFrameSize(it->id(), it->size()); //don't need this
107  }
108  if(validDigi(*it)) {
109  theNoiseSignals.push_back(samplesInPE(*it));
110  }
111  }
112  }
CaloSamples samplesInPE(const DIGI &digi)
void setStartingCapId(int startingCapId)
bool validDigi(const DIGI &digi)
std::vector< CaloSamples > theNoiseSignals
HcalElectronicsSim * theElectronicsSim
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 114 of file HcalSignalGenerator.h.

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

Implements CaloVNoiseSignalGenerator.

Definition at line 115 of file HcalSignalGenerator.h.

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

Definition at line 46 of file HcalSignalGenerator.h.

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

47  {
48  theEvent = event;
49  eventSetup->get<HcalDbRecord>().get(theConditions);
51  }
edm::ESHandle< HcalDbService > theConditions
const edm::Event * theEvent
these fields are set in initializeEvent()
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:59
T const * product() const
Definition: ESHandle.h:86
void setDbService(const HcalDbService *service)
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 54 of file HcalSignalGenerator.h.

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

Definition at line 125 of file HcalSignalGenerator.h.

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

Definition at line 117 of file HcalSignalGenerator.h.

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

Member Data Documentation

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

Definition at line 174 of file HcalSignalGenerator.h.

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

these fields are set in initializeEvent()

Definition at line 172 of file HcalSignalGenerator.h.

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

Definition at line 173 of file HcalSignalGenerator.h.

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

these come from the ParameterSet

Definition at line 176 of file HcalSignalGenerator.h.

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

Definition at line 177 of file HcalSignalGenerator.h.