CMS 3D CMS Logo

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

#include <EcalSignalGenerator.h>

Inheritance diagram for EcalSignalGenerator< ECALDIGITIZERTRAITS >:
EcalBaseSignalGenerator CaloVNoiseSignalGenerator

Public Types

typedef ECALDIGITIZERTRAITS::DigiCollection COLLECTION
 
typedef ECALDIGITIZERTRAITS::Digi DIGI
 

Public Member Functions

 EcalSignalGenerator ()
 
 EcalSignalGenerator (const edm::InputTag &inputTag, const edm::EDGetTokenT< COLLECTION > &t, const double EBs25notCont, const double EEs25notCont, const double peToABarrel, const double peToAEndcap)
 
virtual void fill (edm::ModuleCallingContext const *mcc)
 
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...
 
 ~EcalSignalGenerator () override
 
- Public Member Functions inherited from EcalBaseSignalGenerator
 EcalBaseSignalGenerator ()
 
 ~EcalBaseSignalGenerator () 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 Types

enum  { NBITS = 12, MAXADC = 4095, ADCGAINSWITCH = 4079, NGAINS = 3 }
 

Private Member Functions

void fillNoiseSignals () override
 
void fillNoiseSignals (CLHEP::HepRandomEngine *) override
 
double fullScaleEnergy (const DetId &detId) const
 
const std::vector< float > GetGainRatios (const DetId &detid)
 
double peToAConversion (const DetId &detId) const
 
CaloSamples samplesInPE (const DIGI &digi)
 
bool validDigi (const DIGI &digi)
 

Private Attributes

const EcalADCToGeVConstantagc
 
const ESGainesgain
 
int ESgain
 
const ESIntercalibConstantsesmips
 
const ESMIPToGeVConstantesMipToGeV
 
double ESMIPToGeV
 
edm::ESHandle< EcalGainRatiosgrHandle
 
edm::ESHandle< ESGainhesgain
 
edm::ESHandle< ESIntercalibConstantshesMIPs
 
edm::ESHandle< ESMIPToGeVConstanthesMIPToGeV
 
const EcalIntercalibConstantsMCical
 
double m_EBs25notCont
 
double m_EEs25notCont
 
double m_maxEneEB
 
double m_maxEneEE
 
double m_peToABarrel
 
double m_peToAEndcap
 
edm::ESHandle< EcalADCToGeVConstantpAgc
 
edm::ESHandle< EcalIntercalibConstantsMCpIcal
 
double theDefaultGains [NGAINS]
 
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 Attributes inherited from CaloVNoiseSignalGenerator
std::vector< CaloSamplestheNoiseSignals
 

Detailed Description

template<class ECALDIGITIZERTRAITS>
class EcalSignalGenerator< ECALDIGITIZERTRAITS >

Definition at line 46 of file EcalSignalGenerator.h.

Member Typedef Documentation

template<class ECALDIGITIZERTRAITS>
typedef ECALDIGITIZERTRAITS::DigiCollection EcalSignalGenerator< ECALDIGITIZERTRAITS >::COLLECTION

Definition at line 50 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
typedef ECALDIGITIZERTRAITS::Digi EcalSignalGenerator< ECALDIGITIZERTRAITS >::DIGI

Definition at line 49 of file EcalSignalGenerator.h.

Member Enumeration Documentation

template<class ECALDIGITIZERTRAITS>
anonymous enum
private
Enumerator
NBITS 
MAXADC 
ADCGAINSWITCH 
NGAINS 

Definition at line 191 of file EcalSignalGenerator.h.

191  { NBITS = 12 , // number of available bits
192  MAXADC = 4095 , // 2^12 -1, adc max range
193  ADCGAINSWITCH = 4079 , // adc gain switch
194  NGAINS = 3 }; // number of electronic gains

Constructor & Destructor Documentation

template<class ECALDIGITIZERTRAITS>
EcalSignalGenerator< ECALDIGITIZERTRAITS >::EcalSignalGenerator ( )
inline
template<class ECALDIGITIZERTRAITS>
EcalSignalGenerator< ECALDIGITIZERTRAITS >::EcalSignalGenerator ( const edm::InputTag inputTag,
const edm::EDGetTokenT< COLLECTION > &  t,
const double  EBs25notCont,
const double  EEs25notCont,
const double  peToABarrel,
const double  peToAEndcap 
)
inline

Definition at line 54 of file EcalSignalGenerator.h.

56  theEvent(nullptr),
57  theEventPrincipal(nullptr),
58  theInputTag(inputTag),
59  tok_(t)
60  {
61  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
62  theDefaultGains[2] = defaultRatios->gain6Over1() ;
63  theDefaultGains[1] = theDefaultGains[2]*(defaultRatios->gain12Over6()) ;
64  m_EBs25notCont = EBs25notCont;
65  m_EEs25notCont = EEs25notCont;
66  m_peToABarrel = peToABarrel;
67  m_peToAEndcap = peToAEndcap;
68 
69  }
const edm::Event * theEvent
these fields are set in initializeEvent()
double theDefaultGains[NGAINS]
edm::EDGetTokenT< COLLECTION > tok_
float gain6Over1() const
const edm::EventPrincipal * theEventPrincipal
edm::InputTag theInputTag
these come from the ParameterSet
float gain12Over6() const
template<class ECALDIGITIZERTRAITS>
EcalSignalGenerator< ECALDIGITIZERTRAITS >::~EcalSignalGenerator ( )
inlineoverride

Definition at line 71 of file EcalSignalGenerator.h.

71 {}

Member Function Documentation

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

Definition at line 130 of file EcalSignalGenerator.h.

Referenced by edm::DataMixingEcalDigiWorkerProd::addEcalPileups().

131  {
132 
133  theNoiseSignals.clear();
135  const COLLECTION * digis = nullptr;
136  // try accessing by whatever is set, Event or EventPrincipal
137  if(theEvent)
138  {
139  if( theEvent->getByToken(tok_, pDigis) ) {
140  digis = pDigis.product(); // get a ptr to the product
141  }
142  else
143  {
144  throw cms::Exception("EcalSignalGenerator") << "Cannot find input data " << theInputTag;
145  }
146  }
147  else if(theEventPrincipal)
148  {
149  std::shared_ptr<edm::Wrapper<COLLECTION> const> digisPTR =
150  edm::getProductByTag<COLLECTION>(*theEventPrincipal, theInputTag, mcc );
151  if(digisPTR) {
152  digis = digisPTR->product();
153  }
154  }
155  else
156  {
157  throw cms::Exception("EcalSignalGenerator") << "No Event or EventPrincipal was set";
158  }
159 
160  if (digis)
161  {
162  // loop over digis, adding these to the existing maps
163  for(typename COLLECTION::const_iterator it = digis->begin();
164  it != digis->end(); ++it)
165  {
166  // need to convert to something useful
167  if(validDigi(*it)){
168  theNoiseSignals.push_back(samplesInPE(*it));
169  }
170  }
171  }
172  //else { std::cout << " NO digis for this input: " << theInputTag << std::endl;}
173  }
const edm::Event * theEvent
these fields are set in initializeEvent()
ECALDIGITIZERTRAITS::DigiCollection COLLECTION
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< COLLECTION > tok_
std::vector< CaloSamples > theNoiseSignals
bool validDigi(const DIGI &digi)
const edm::EventPrincipal * theEventPrincipal
T const * product() const
Definition: Handle.h:81
CaloSamples samplesInPE(const DIGI &digi)
edm::InputTag theInputTag
these come from the ParameterSet
template<class ECALDIGITIZERTRAITS>
void EcalSignalGenerator< ECALDIGITIZERTRAITS >::fillNoiseSignals ( )
inlineoverrideprivatevirtual

Implements CaloVNoiseSignalGenerator.

Definition at line 186 of file EcalSignalGenerator.h.

186 {}
template<class ECALDIGITIZERTRAITS>
void EcalSignalGenerator< ECALDIGITIZERTRAITS >::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 187 of file EcalSignalGenerator.h.

187 {}
template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::fullScaleEnergy ( const DetId detId) const
inlineprivate

Definition at line 213 of file EcalSignalGenerator.h.

Referenced by EcalSignalGenerator< EBDigitizerTraits >::samplesInPE(), and EcalSignalGenerator< EEDigitizerTraits >::samplesInPE().

214  {
215  return detId.subdetId() == EcalBarrel ? m_maxEneEB : m_maxEneEE ;
216  }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
template<class ECALDIGITIZERTRAITS>
const std::vector<float> EcalSignalGenerator< ECALDIGITIZERTRAITS >::GetGainRatios ( const DetId detid)
inlineprivate

Definition at line 198 of file EcalSignalGenerator.h.

Referenced by EcalSignalGenerator< EBDigitizerTraits >::samplesInPE(), and EcalSignalGenerator< EEDigitizerTraits >::samplesInPE().

198  {
199 
200  std::vector<float> gainRatios(4);
201  // get gain ratios
202  EcalMGPAGainRatio theRatio= (*grHandle)[detid];
203 
204  gainRatios[0] = 0.;
205  gainRatios[3] = 1.;
206  gainRatios[2] = theRatio.gain6Over1();
207  gainRatios[1] = theRatio.gain6Over1() * theRatio.gain12Over6();
208 
209  return gainRatios;
210  }
float gain6Over1() const
float gain12Over6() const
template<class ECALDIGITIZERTRAITS>
void EcalSignalGenerator< ECALDIGITIZERTRAITS >::initializeEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
)
inline

Definition at line 74 of file EcalSignalGenerator.h.

Referenced by edm::DataMixingEcalDigiWorkerProd::addEcalPileups().

75  {
76  theEvent = event;
77  eventSetup->get<EcalGainRatiosRcd>().get(grHandle); // find the gains
78  // Ecal Intercalibration Constants
79  eventSetup->get<EcalIntercalibConstantsMCRcd>().get( pIcal ) ;
80  ical = pIcal.product();
81  // adc to GeV
82  eventSetup->get<EcalADCToGeVConstantRcd>().get(pAgc);
83  agc = pAgc.product();
84 
87 
88  //ES
89  eventSetup->get<ESGainRcd>(). get( hesgain ) ;
90  eventSetup->get<ESMIPToGeVConstantRcd>(). get( hesMIPToGeV ) ;
91  eventSetup->get<ESIntercalibConstantsRcd>().get( hesMIPs ) ;
92 
93  esgain = hesgain.product() ;
94  esmips = hesMIPs.product() ;
96  if( 1.1 > esgain->getESGain() ) ESgain = 1;
97  else ESgain = 2;
100  }
const edm::Event * theEvent
these fields are set in initializeEvent()
double theDefaultGains[NGAINS]
edm::ESHandle< ESMIPToGeVConstant > hesMIPToGeV
float getESValueLow() const
edm::ESHandle< ESIntercalibConstants > hesMIPs
edm::ESHandle< ESGain > hesgain
const EcalIntercalibConstantsMC * ical
edm::ESHandle< EcalADCToGeVConstant > pAgc
const EcalADCToGeVConstant * agc
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
edm::ESHandle< EcalGainRatios > grHandle
float getESGain() const
Definition: ESGain.h:13
const T & get() const
Definition: EventSetup.h:59
edm::ESHandle< EcalIntercalibConstantsMC > pIcal
float getESValueHigh() const
const ESIntercalibConstants * esmips
T const * product() const
Definition: ESHandle.h:86
const ESMIPToGeVConstant * esMipToGeV
template<class ECALDIGITIZERTRAITS>
void EcalSignalGenerator< ECALDIGITIZERTRAITS >::initializeEvent ( const edm::EventPrincipal eventPrincipal,
const edm::EventSetup eventSetup 
)
inline

some users use EventPrincipals, not Events. We support both

Definition at line 103 of file EcalSignalGenerator.h.

104  {
105  theEventPrincipal = eventPrincipal;
106  eventSetup->get<EcalGainRatiosRcd>().get(grHandle); // find the gains
107  // Ecal Intercalibration Constants
108  eventSetup->get<EcalIntercalibConstantsMCRcd>().get( pIcal ) ;
109  ical = pIcal.product();
110  // adc to GeV
111  eventSetup->get<EcalADCToGeVConstantRcd>().get(pAgc);
112  agc = pAgc.product();
115 
116  //ES
117  eventSetup->get<ESGainRcd>(). get( hesgain ) ;
118  eventSetup->get<ESMIPToGeVConstantRcd>(). get( hesMIPToGeV ) ;
119  eventSetup->get<ESIntercalibConstantsRcd>().get( hesMIPs ) ;
120 
121  esgain = hesgain.product() ;
122  esmips = hesMIPs.product() ;
124  if( 1.1 > esgain->getESGain() ) ESgain = 1;
125  else ESgain = 2;
126  if( ESgain ==1 ) ESMIPToGeV = esMipToGeV->getESValueLow();
128  }
double theDefaultGains[NGAINS]
edm::ESHandle< ESMIPToGeVConstant > hesMIPToGeV
float getESValueLow() const
edm::ESHandle< ESIntercalibConstants > hesMIPs
edm::ESHandle< ESGain > hesgain
const EcalIntercalibConstantsMC * ical
edm::ESHandle< EcalADCToGeVConstant > pAgc
const EcalADCToGeVConstant * agc
edm::ESHandle< EcalGainRatios > grHandle
const edm::EventPrincipal * theEventPrincipal
float getESGain() const
Definition: ESGain.h:13
const T & get() const
Definition: EventSetup.h:59
edm::ESHandle< EcalIntercalibConstantsMC > pIcal
float getESValueHigh() const
const ESIntercalibConstants * esmips
T const * product() const
Definition: ESHandle.h:86
const ESMIPToGeVConstant * esMipToGeV
template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::peToAConversion ( const DetId detId) const
inlineprivate

Definition at line 219 of file EcalSignalGenerator.h.

Referenced by EcalSignalGenerator< EBDigitizerTraits >::samplesInPE(), and EcalSignalGenerator< EEDigitizerTraits >::samplesInPE().

220  {
221  return detId.subdetId() == EcalBarrel ? m_peToABarrel : m_peToAEndcap ;
222  }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
template<class ECALDIGITIZERTRAITS>
CaloSamples EcalSignalGenerator< ECALDIGITIZERTRAITS >::samplesInPE ( const DIGI digi)
private
template<class ECALDIGITIZERTRAITS>
bool EcalSignalGenerator< ECALDIGITIZERTRAITS >::validDigi ( const DIGI digi)
inlineprivate

Definition at line 177 of file EcalSignalGenerator.h.

178  {
179  int DigiSum = 0;
180  for(int id = 0; id<digi.size(); id++) {
181  if(digi[id].adc() > 0) ++DigiSum;
182  }
183  return(DigiSum>0);
184  }
int adc(sample_type sample)
get the ADC sample (12 bits)

Member Data Documentation

template<class ECALDIGITIZERTRAITS>
const EcalADCToGeVConstant* EcalSignalGenerator< ECALDIGITIZERTRAITS >::agc
private

Definition at line 256 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
const ESGain* EcalSignalGenerator< ECALDIGITIZERTRAITS >::esgain
private

Definition at line 241 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
int EcalSignalGenerator< ECALDIGITIZERTRAITS >::ESgain
private

Definition at line 244 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
const ESIntercalibConstants* EcalSignalGenerator< ECALDIGITIZERTRAITS >::esmips
private
template<class ECALDIGITIZERTRAITS>
const ESMIPToGeVConstant* EcalSignalGenerator< ECALDIGITIZERTRAITS >::esMipToGeV
private

Definition at line 243 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::ESMIPToGeV
private
template<class ECALDIGITIZERTRAITS>
edm::ESHandle<EcalGainRatios> EcalSignalGenerator< ECALDIGITIZERTRAITS >::grHandle
private

Definition at line 229 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::ESHandle<ESGain> EcalSignalGenerator< ECALDIGITIZERTRAITS >::hesgain
private

Definition at line 237 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::ESHandle<ESIntercalibConstants> EcalSignalGenerator< ECALDIGITIZERTRAITS >::hesMIPs
private

Definition at line 239 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::ESHandle<ESMIPToGeVConstant> EcalSignalGenerator< ECALDIGITIZERTRAITS >::hesMIPToGeV
private

Definition at line 238 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
const EcalIntercalibConstantsMC* EcalSignalGenerator< ECALDIGITIZERTRAITS >::ical
private
template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_EBs25notCont
private

Definition at line 247 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_EEs25notCont
private

Definition at line 248 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_maxEneEB
private

Definition at line 253 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_maxEneEE
private

Definition at line 254 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_peToABarrel
private

Definition at line 250 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::m_peToAEndcap
private

Definition at line 251 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::ESHandle<EcalADCToGeVConstant> EcalSignalGenerator< ECALDIGITIZERTRAITS >::pAgc
private

Definition at line 231 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::ESHandle<EcalIntercalibConstantsMC> EcalSignalGenerator< ECALDIGITIZERTRAITS >::pIcal
private

Definition at line 230 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
double EcalSignalGenerator< ECALDIGITIZERTRAITS >::theDefaultGains[NGAINS]
private

Definition at line 259 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
const edm::Event* EcalSignalGenerator< ECALDIGITIZERTRAITS >::theEvent
private

these fields are set in initializeEvent()

Definition at line 226 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
const edm::EventPrincipal* EcalSignalGenerator< ECALDIGITIZERTRAITS >::theEventPrincipal
private

Definition at line 227 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::InputTag EcalSignalGenerator< ECALDIGITIZERTRAITS >::theInputTag
private

these come from the ParameterSet

Definition at line 234 of file EcalSignalGenerator.h.

template<class ECALDIGITIZERTRAITS>
edm::EDGetTokenT<COLLECTION> EcalSignalGenerator< ECALDIGITIZERTRAITS >::tok_
private

Definition at line 235 of file EcalSignalGenerator.h.