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
EcalDigiProducer Class Reference

#include <EcalDigiProducer.h>

Inheritance diagram for EcalDigiProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 EcalDigiProducer (const edm::ParameterSet &params)
 
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
 
virtual ~EcalDigiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

void checkCalibrations (const edm::EventSetup &eventSetup)
 
void checkGeometry (const edm::EventSetup &eventSetup)
 
void updateGeometry ()
 

Private Attributes

EcalCoderm_APDCoder
 
EBDigitizerm_APDDigitizer
 
EcalElectronicsSimm_APDElectronicsSim
 
APDSimParametersm_apdParameters
 
EBHitResponsem_APDResponse
 
const APDShape m_APDShape
 
EBDigitizerm_BarrelDigitizer
 
EcalCoderm_Coder
 
bool m_doFast
 
CorrelatedNoisifier
< EcalCorrMatrix > * 
m_EBCorrNoise [3]
 
std::string m_EBdigiCollection
 
EBHitResponsem_EBResponse
 
double m_EBs25notCont
 
const EBShape m_EBShape
 
CorrelatedNoisifier
< EcalCorrMatrix > * 
m_EECorrNoise [3]
 
std::string m_EEdigiCollection
 
CaloHitRespoNewm_EEResponse
 
double m_EEs25notCont
 
const EEShape m_EEShape
 
EcalElectronicsSimm_ElectronicsSim
 
EEDigitizerm_EndcapDigitizer
 
std::string m_ESdigiCollection
 
ESDigitizerm_ESDigitizer
 
ESFastTDigitizerm_ESDigitizerFast
 
ESElectronicsSimm_ESElectronicsSim
 
ESElectronicsSimFastm_ESElectronicsSimFast
 
CaloHitResponsem_ESResponse
 
ESShapem_ESShape
 
const CaloGeometrym_Geometry
 
std::string m_hitsProducerTag
 
const EcalSimParameterMapm_ParameterMap
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 37 of file EcalDigiProducer.h.

Constructor & Destructor Documentation

EcalDigiProducer::EcalDigiProducer ( const edm::ParameterSet params)

output collections names

Definition at line 39 of file EcalDigiProducer.cc.

References ecalTPGAnalyzer_cfg::binOfMaximum, edm::ParameterSet::getParameter(), getHLTprescales::index, m_APDCoder, m_APDDigitizer, m_APDElectronicsSim, m_apdParameters, m_APDResponse, m_APDShape, m_BarrelDigitizer, m_Coder, m_doFast, m_EBCorrNoise, m_EBdigiCollection, m_EBResponse, m_EBs25notCont, m_EBShape, m_EECorrNoise, m_EEdigiCollection, m_EEResponse, m_EEs25notCont, m_EEShape, m_ElectronicsSim, m_EndcapDigitizer, m_ESdigiCollection, m_ESDigitizer, m_ESDigitizerFast, m_ESElectronicsSim, m_ESElectronicsSimFast, m_ESResponse, m_ESShape, m_hitsProducerTag, m_ParameterMap, and CaloHitRespoNew::setPhaseShift().

39  :
40  m_APDDigitizer ( 0 ) ,
41  m_BarrelDigitizer ( 0 ) ,
42  m_EndcapDigitizer ( 0 ) ,
43  m_ESDigitizer ( 0 ) ,
44  m_ESDigitizerFast ( 0 ) ,
45  m_ParameterMap ( 0 ) ,
46  m_APDShape ( params.getParameter<double>( "apdShapeTstart" ) ,
47  params.getParameter<double>( "apdShapeTau" ) ) ,
48  m_EBShape ( ) ,
49  m_EEShape ( ) ,
50  m_ESShape ( new ESShape() ) ,
51  m_APDResponse ( 0 ) ,
52  m_EBResponse ( 0 ) ,
53  m_EEResponse ( 0 ) ,
54  m_ESResponse ( 0 ) ,
55  m_ElectronicsSim ( 0 ) ,
56  m_ESElectronicsSim ( 0 ) ,
58  m_Coder ( 0 ) ,
59  m_APDElectronicsSim ( 0 ) ,
60  m_APDCoder ( 0 ) ,
61  m_Geometry ( 0 ) ,
62  m_apdParameters ( 0 )
63 {
65 
66  m_EBdigiCollection = params.getParameter<std::string>("EBdigiCollection");
67  m_EEdigiCollection = params.getParameter<std::string>("EEdigiCollection");
68  m_ESdigiCollection = params.getParameter<std::string>("ESdigiCollection");
69  const bool addNoise = params.getParameter<bool> ("doNoise");
70  const double simHitToPhotoelectronsBarrel = params.getParameter<double> ("simHitToPhotoelectronsBarrel");
71  const double simHitToPhotoelectronsEndcap = params.getParameter<double> ("simHitToPhotoelectronsEndcap");
72  const double photoelectronsToAnalogBarrel = params.getParameter<double> ("photoelectronsToAnalogBarrel");
73  const double photoelectronsToAnalogEndcap = params.getParameter<double> ("photoelectronsToAnalogEndcap");
74  const double samplingFactor = params.getParameter<double> ("samplingFactor");
75  const double timePhase = params.getParameter<double> ("timePhase");
76  const unsigned int readoutFrameSize = params.getParameter<int> ("readoutFrameSize");
77  const int binOfMaximum = params.getParameter<int> ("binOfMaximum");
78  const bool doPhotostatistics = params.getParameter<bool> ("doPhotostatistics");
79  const bool syncPhase = params.getParameter<bool> ("syncPhase");
80  const bool cosmicsPhase = params.getParameter<bool> ("cosmicsPhase");
81  const double cosmicsShift = params.getParameter<double> ("cosmicsShift");
82  const std::vector<double> ebCorMatG12 = params.getParameter< std::vector<double> >("EBCorrNoiseMatrixG12");
83  const std::vector<double> eeCorMatG12 = params.getParameter< std::vector<double> >("EECorrNoiseMatrixG12");
84  const std::vector<double> ebCorMatG06 = params.getParameter< std::vector<double> >("EBCorrNoiseMatrixG06");
85  const std::vector<double> eeCorMatG06 = params.getParameter< std::vector<double> >("EECorrNoiseMatrixG06");
86  const std::vector<double> ebCorMatG01 = params.getParameter< std::vector<double> >("EBCorrNoiseMatrixG01");
87  const std::vector<double> eeCorMatG01 = params.getParameter< std::vector<double> >("EECorrNoiseMatrixG01");
88  const bool applyConstantTerm = params.getParameter<bool> ("applyConstantTerm");
89  const double rmsConstantTerm = params.getParameter<double> ("ConstantTerm");
90  const bool addESNoise = params.getParameter<bool> ("doESNoise");
91  const int numESdetId = params.getParameter<int> ("numESdetId");
92  m_doFast = params.getParameter<bool> ("doFast");
93  m_EBs25notCont = params.getParameter<double> ("EBs25notContainment");
94  m_EEs25notCont = params.getParameter<double> ("EEs25notContainment");
95  m_hitsProducerTag = params.getParameter<std::string>("hitsProducer");
96 
97  const bool apdAddToBarrel ( params.getParameter<bool> ("apdAddToBarrel") ) ;
98  const bool apdSeparateDigi ( params.getParameter<bool> ("apdSeparateDigi") ) ;
99  const double apdSimToPELow ( params.getParameter<double> ("apdSimToPELow" ) ) ;
100  const double apdSimToPEHigh ( params.getParameter<double> ("apdSimToPEHigh") ) ;
101  const double apdTimeOffset ( params.getParameter<double> ("apdTimeOffset" ) ) ;
102  const double apdTimeOffWidth ( params.getParameter<double> ("apdTimeOffWidth" ) ) ;
103  const bool apdDoPEStats ( params.getParameter<bool> ("apdDoPEStats" ) ) ;
104  const std::string apdDigiTag ( params.getParameter<std::string>("apdDigiTag") ) ;
105 
106 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
107 
108  if( apdSeparateDigi ) produces<EBDigiCollection>( apdDigiTag ) ;
109  produces<EBDigiCollection>( m_EBdigiCollection ) ;
110  produces<EEDigiCollection>( m_EEdigiCollection ) ;
111  produces<ESDigiCollection>( m_ESdigiCollection ) ;
112 
113  // initialize the default valuer for hardcoded parameters and the EB/EE shape
114 
115  m_ParameterMap = new EcalSimParameterMap( simHitToPhotoelectronsBarrel ,
116  simHitToPhotoelectronsEndcap ,
117  photoelectronsToAnalogBarrel ,
118  photoelectronsToAnalogEndcap ,
119  samplingFactor ,
120  timePhase ,
121  readoutFrameSize ,
122  binOfMaximum ,
123  doPhotostatistics ,
124  syncPhase ) ;
125 
126  m_apdParameters = new APDSimParameters( apdAddToBarrel ,
127  apdSeparateDigi ,
128  apdSimToPELow ,
129  apdSimToPEHigh ,
130  apdTimeOffset ,
131  apdTimeOffWidth ,
132  apdDoPEStats ,
133  apdDigiTag ) ;
134 
135 
136 
137  if( apdSeparateDigi )
138  m_APDResponse = new EBHitResponse( m_ParameterMap ,
139  &m_EBShape ,
140  true ,
142  &m_APDShape ) ;
143 
144  m_EBResponse = new EBHitResponse( m_ParameterMap ,
145  &m_EBShape ,
146  false , // barrel
148  &m_APDShape ) ;
149 
150  m_EEResponse = new CaloHitRespoNew( m_ParameterMap, &m_EEShape ) ;
151  m_ESResponse = new CaloHitResponse( m_ParameterMap, m_ESShape ) ;
152 
153  // further phase for cosmics studies
154  if( cosmicsPhase )
155  {
156  m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ;
157  m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ;
158  }
159 
160  EcalCorrMatrix ebMatrix[ 3 ] ;
161  EcalCorrMatrix eeMatrix[ 3 ] ;
162 
163  assert( ebCorMatG12.size() == readoutFrameSize ) ;
164  assert( eeCorMatG12.size() == readoutFrameSize ) ;
165  assert( ebCorMatG06.size() == readoutFrameSize ) ;
166  assert( eeCorMatG06.size() == readoutFrameSize ) ;
167  assert( ebCorMatG01.size() == readoutFrameSize ) ;
168  assert( eeCorMatG01.size() == readoutFrameSize ) ;
169 
170  assert( 1.e-7 > fabs( ebCorMatG12[0] - 1.0 ) ) ;
171  assert( 1.e-7 > fabs( ebCorMatG06[0] - 1.0 ) ) ;
172  assert( 1.e-7 > fabs( ebCorMatG01[0] - 1.0 ) ) ;
173  assert( 1.e-7 > fabs( eeCorMatG12[0] - 1.0 ) ) ;
174  assert( 1.e-7 > fabs( eeCorMatG06[0] - 1.0 ) ) ;
175  assert( 1.e-7 > fabs( eeCorMatG01[0] - 1.0 ) ) ;
176 
177  for ( unsigned int row ( 0 ) ; row != readoutFrameSize ; ++row )
178  {
179  assert( 0 == row || 1. >= ebCorMatG12[row] ) ;
180  assert( 0 == row || 1. >= ebCorMatG06[row] ) ;
181  assert( 0 == row || 1. >= ebCorMatG01[row] ) ;
182  assert( 0 == row || 1. >= eeCorMatG12[row] ) ;
183  assert( 0 == row || 1. >= eeCorMatG06[row] ) ;
184  assert( 0 == row || 1. >= eeCorMatG01[row] ) ;
185  for ( unsigned int column ( 0 ) ; column <= row ; ++column )
186  {
187  const unsigned int index ( row - column ) ;
188  ebMatrix[0]( row, column ) = ebCorMatG12[ index ] ;
189  eeMatrix[0]( row, column ) = eeCorMatG12[ index ] ;
190  ebMatrix[1]( row, column ) = ebCorMatG06[ index ] ;
191  eeMatrix[1]( row, column ) = eeCorMatG06[ index ] ;
192  ebMatrix[2]( row, column ) = ebCorMatG01[ index ] ;
193  eeMatrix[2]( row, column ) = eeCorMatG01[ index ] ;
194  }
195  }
196 
197  m_EBCorrNoise[0] = new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[0] ) ;
198  m_EECorrNoise[0] = new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[0] ) ;
199  m_EBCorrNoise[1] = new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[1] ) ;
200  m_EECorrNoise[1] = new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[1] ) ;
201  m_EBCorrNoise[2] = new CorrelatedNoisifier<EcalCorrMatrix>( ebMatrix[2] ) ;
202  m_EECorrNoise[2] = new CorrelatedNoisifier<EcalCorrMatrix>( eeMatrix[2] ) ;
203 
204  m_Coder = new EcalCoder( addNoise ,
205  m_EBCorrNoise[0] ,
206  m_EECorrNoise[0] ,
207  m_EBCorrNoise[1] ,
208  m_EECorrNoise[1] ,
209  m_EBCorrNoise[2] ,
210  m_EECorrNoise[2] ) ;
211 
212  m_ElectronicsSim = new EcalElectronicsSim( m_ParameterMap ,
213  m_Coder ,
214  applyConstantTerm ,
215  rmsConstantTerm ) ;
216 
217 
218  if( apdSeparateDigi )
219  {
220  m_APDCoder = new EcalCoder( false ,
221  m_EBCorrNoise[0] ,
222  m_EECorrNoise[0] ,
223  m_EBCorrNoise[1] ,
224  m_EECorrNoise[1] ,
225  m_EBCorrNoise[2] ,
226  m_EECorrNoise[2] ) ;
227 
228  m_APDElectronicsSim = new EcalElectronicsSim( m_ParameterMap ,
229  m_APDCoder ,
230  applyConstantTerm ,
231  rmsConstantTerm ) ;
232 
235  false ) ;
236  }
237 
240  addNoise ) ;
241 
244  addNoise ) ;
245 
246  if( !m_doFast )
247  {
248  m_ESElectronicsSim = new ESElectronicsSim( addESNoise ) ;
249 
252  addESNoise );
253  }
254  else
255  {
256  m_ESElectronicsSimFast = new ESElectronicsSimFast( addESNoise ) ;
257 
260  addESNoise ,
261  numESdetId ) ;
262  }
263 }
EEDigitizer * m_EndcapDigitizer
T getParameter(std::string const &) const
CaloHitRespoNew * m_EEResponse
EcalTDigitizer< EEDigitizerTraits > EEDigitizer
EcalCoder * m_Coder
CorrelatedNoisifier< EcalCorrMatrix > * m_EBCorrNoise[3]
const APDShape m_APDShape
const EcalSimParameterMap * m_ParameterMap
Creates electronics signals from EB hits , including APD.
Definition: EBHitResponse.h:17
Creates electronics signals from hits.
ESElectronicsSimFast * m_ESElectronicsSimFast
ESDigitizer * m_ESDigitizer
CorrelatedNoisifier< EcalCorrMatrix > * m_EECorrNoise[3]
EcalElectronicsSim * m_ElectronicsSim
CaloHitResponse * m_ESResponse
std::string m_EBdigiCollection
EBHitResponse * m_APDResponse
Creates electronics signals from hits.
EBHitResponse * m_EBResponse
ESElectronicsSim * m_ESElectronicsSim
APDSimParameters * m_apdParameters
EBDigitizer * m_BarrelDigitizer
math::ErrorD< CaloSamples::MAXSAMPLES >::type EcalCorrMatrix
const CaloGeometry * m_Geometry
void setPhaseShift(double phaseShift)
EcalCoder * m_APDCoder
CaloTDigitizer< ESDigitizerTraits > ESDigitizer
std::string m_ESdigiCollection
EcalTDigitizer< EBDigitizerTraits > EBDigitizer
EBDigitizer * m_APDDigitizer
ESFastTDigitizer * m_ESDigitizerFast
const EEShape m_EEShape
std::string m_hitsProducerTag
const EBShape m_EBShape
EcalElectronicsSim * m_APDElectronicsSim
std::string m_EEdigiCollection
EcalDigiProducer::~EcalDigiProducer ( )
virtual

Definition at line 265 of file EcalDigiProducer.cc.

References m_APDCoder, m_APDDigitizer, m_APDElectronicsSim, m_apdParameters, m_APDResponse, m_BarrelDigitizer, m_Coder, m_EBCorrNoise, m_EBResponse, m_EECorrNoise, m_EEResponse, m_ElectronicsSim, m_EndcapDigitizer, m_ESDigitizer, m_ESDigitizerFast, m_ESElectronicsSim, m_ESElectronicsSimFast, m_ESResponse, m_ESShape, and m_ParameterMap.

266 {
267  delete m_APDDigitizer ;
268  delete m_BarrelDigitizer ;
269  delete m_EndcapDigitizer ;
270  delete m_ESDigitizer ;
271  delete m_ESDigitizerFast ;
272  delete m_ParameterMap ;
273  delete m_ESShape ;
274  delete m_APDResponse ;
275  delete m_EBResponse ;
276  delete m_EEResponse ;
277  delete m_ESResponse ;
278  delete m_EBCorrNoise[0] ;
279  delete m_EECorrNoise[0] ;
280  delete m_EBCorrNoise[1] ;
281  delete m_EECorrNoise[1] ;
282  delete m_EBCorrNoise[2] ;
283  delete m_EECorrNoise[2] ;
284  delete m_ElectronicsSim ;
285  delete m_ESElectronicsSim ;
286  delete m_ESElectronicsSimFast ;
287  delete m_Coder ;
288  delete m_APDElectronicsSim ;
289  delete m_APDCoder ;
290  delete m_apdParameters ;
291 }
EEDigitizer * m_EndcapDigitizer
CaloHitRespoNew * m_EEResponse
EcalCoder * m_Coder
CorrelatedNoisifier< EcalCorrMatrix > * m_EBCorrNoise[3]
const EcalSimParameterMap * m_ParameterMap
ESElectronicsSimFast * m_ESElectronicsSimFast
ESDigitizer * m_ESDigitizer
CorrelatedNoisifier< EcalCorrMatrix > * m_EECorrNoise[3]
EcalElectronicsSim * m_ElectronicsSim
CaloHitResponse * m_ESResponse
EBHitResponse * m_APDResponse
EBHitResponse * m_EBResponse
ESElectronicsSim * m_ESElectronicsSim
APDSimParameters * m_apdParameters
EBDigitizer * m_BarrelDigitizer
EcalCoder * m_APDCoder
EBDigitizer * m_APDDigitizer
ESFastTDigitizer * m_ESDigitizerFast
EcalElectronicsSim * m_APDElectronicsSim

Member Function Documentation

void EcalDigiProducer::checkCalibrations ( const edm::EventSetup eventSetup)
private

Definition at line 421 of file EcalDigiProducer.cc.

References EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), edm::EventSetup::get(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), LogDebug, m_APDCoder, m_APDResponse, m_Coder, m_doFast, m_EBResponse, m_EBs25notCont, m_EEs25notCont, m_ESDigitizerFast, m_ESElectronicsSim, m_ESElectronicsSimFast, m_ESShape, EcalCoder::MAXADC, EcalCoder::NGAINS, edm::ESHandle< class >::product(), EcalCoder::setFullScaleEnergy(), ESElectronicsSim::setGain(), ESElectronicsSimFast::setGain(), ESShape::setGain(), ESFastTDigitizer::setGain(), EcalCoder::setGainRatios(), EBHitResponse::setIntercal(), EcalCoder::setIntercalibConstants(), ESElectronicsSim::setMIPs(), ESElectronicsSimFast::setMIPs(), ESElectronicsSim::setMIPToGeV(), ESElectronicsSimFast::setMIPToGeV(), ESElectronicsSim::setPedestals(), ESElectronicsSimFast::setPedestals(), and EcalCoder::setPedestals().

Referenced by produce().

422 {
423  // Pedestals from event setup
424 
426  eventSetup.get<EcalPedestalsRcd>().get( dbPed ) ;
427  const EcalPedestals* pedestals ( dbPed.product() ) ;
428 
429  m_Coder->setPedestals( pedestals ) ;
430  if( 0 != m_APDCoder ) m_APDCoder->setPedestals( pedestals ) ;
431 
432  // Ecal Intercalibration Constants
434  eventSetup.get<EcalIntercalibConstantsMCRcd>().get( pIcal ) ;
435  const EcalIntercalibConstantsMC* ical ( pIcal.product() ) ;
436 
438  if( 0 != m_APDCoder) m_APDCoder->setIntercalibConstants( ical ) ;
439 
440  m_EBResponse->setIntercal( ical ) ;
441  if( 0 != m_APDResponse ) m_APDResponse->setIntercal( ical ) ;
442 
443  // ADC -> GeV Scale
445  eventSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
446  const EcalADCToGeVConstant* agc = pAgc.product();
447 
448  // Gain Ratios
450  eventSetup.get<EcalGainRatiosRcd>().get(pRatio);
451  const EcalGainRatios* gr = pRatio.product();
452 
453  m_Coder->setGainRatios( gr );
454  if( 0 != m_APDCoder) m_APDCoder->setGainRatios( gr );
455 
456  EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
457 
458  double theGains[m_Coder->NGAINS+1];
459  theGains[0] = 0.;
460  theGains[3] = 1.;
461  theGains[2] = defaultRatios->gain6Over1() ;
462  theGains[1] = theGains[2]*(defaultRatios->gain12Over6()) ;
463 
464  LogDebug("EcalDigi") << " Gains: " << "\n" << " g1 = " << theGains[1]
465  << "\n" << " g2 = " << theGains[2]
466  << "\n" << " g3 = " << theGains[3] ;
467 
468  delete defaultRatios;
469 
470  const double EBscale (
471  ( agc->getEBValue())*theGains[1]*(m_Coder->MAXADC)*m_EBs25notCont ) ;
472 
473  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEBValue()
474  << "\n" << " notCont = " << m_EBs25notCont
475  << "\n" << " saturation for EB = " << EBscale
476  << ", " << m_EBs25notCont ;
477 
478  const double EEscale (
479  (agc->getEEValue())*theGains[1]*(m_Coder->MAXADC)*m_EEs25notCont ) ;
480 
481  LogDebug("EcalDigi") << " GeV/ADC = " << agc->getEEValue()
482  << "\n" << " notCont = " << m_EEs25notCont
483  << "\n" << " saturation for EB = " << EEscale
484  << ", " << m_EEs25notCont ;
485 
486  m_Coder->setFullScaleEnergy( EBscale ,
487  EEscale ) ;
488  if( 0 != m_APDCoder ) m_APDCoder->setFullScaleEnergy( EBscale ,
489  EEscale ) ;
490 
491 
492  // ES condition objects
493  edm::ESHandle<ESGain> hesgain ;
495  edm::ESHandle<ESPedestals> hesPedestals ;
497 
498  eventSetup.get<ESGainRcd>(). get( hesgain ) ;
499  eventSetup.get<ESMIPToGeVConstantRcd>(). get( hesMIPToGeV ) ;
500  eventSetup.get<ESPedestalsRcd>(). get( hesPedestals ) ;
501  eventSetup.get<ESIntercalibConstantsRcd>().get( hesMIPs ) ;
502 
503  const ESGain* esgain ( hesgain.product() ) ;
504  const ESPedestals* espeds ( hesPedestals.product() ) ;
505  const ESIntercalibConstants* esmips ( hesMIPs.product() ) ;
506  const ESMIPToGeVConstant* esMipToGeV ( hesMIPToGeV.product() ) ;
507  const int ESGain ( 1.1 > esgain->getESGain() ? 1 : 2 ) ;
508  const double ESMIPToGeV ( ( 1 == ESGain ) ?
509  esMipToGeV->getESValueLow() :
510  esMipToGeV->getESValueHigh() ) ;
511 
513 
514  if( !m_doFast )
515  {
517  m_ESElectronicsSim->setPedestals( espeds ) ;
518  m_ESElectronicsSim->setMIPs( esmips ) ;
519  m_ESElectronicsSim->setMIPToGeV( ESMIPToGeV ) ;
520  }
521  else
522  {
526  m_ESElectronicsSimFast->setMIPs( esmips ) ;
527  m_ESElectronicsSimFast->setMIPToGeV( ESMIPToGeV ) ;
528  }
529 }
#define LogDebug(id)
void setGain(const int gain)
void setGain(const int gain)
void setMIPToGeV(const double MIPToGeV)
EcalCoder * m_Coder
Definition: ESGain.h:5
void setGain(const int gain)
Definition: ESShape.h:26
void setMIPs(const ESIntercalibConstants *mips)
void setMIPToGeV(const double MIPToGeV)
void setIntercalibConstants(const EcalIntercalibConstantsMC *ical)
Definition: EcalCoder.cc:58
ESElectronicsSimFast * m_ESElectronicsSimFast
void setPedestals(const ESPedestals *peds)
void setPedestals(const ESPedestals *peds)
void setIntercal(const EcalIntercalibConstantsMC *ical)
EBHitResponse * m_APDResponse
void setPedestals(const EcalPedestals *pedestals)
can be fetched every event from the EventSetup
Definition: EcalCoder.cc:46
EBHitResponse * m_EBResponse
ESElectronicsSim * m_ESElectronicsSim
float gain6Over1() const
EcalCoder * m_APDCoder
void setGainRatios(const EcalGainRatios *gainRatios)
Definition: EcalCoder.cc:52
void setFullScaleEnergy(double EBscale, double EEscale)
Definition: EcalCoder.cc:37
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
float gain12Over6() const
void setGain(const int gain)
set ES Gain
ESFastTDigitizer * m_ESDigitizerFast
void setMIPs(const ESIntercalibConstants *mips)
void EcalDigiProducer::checkGeometry ( const edm::EventSetup eventSetup)
private

Definition at line 532 of file EcalDigiProducer.cc.

References edm::EventSetup::get(), m_Geometry, and updateGeometry().

Referenced by produce().

533 {
534  // TODO find a way to avoid doing this every event
535  edm::ESHandle<CaloGeometry> hGeometry ;
536  eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
537 
538  const CaloGeometry* pGeometry = &*hGeometry;
539 
540  if( pGeometry != m_Geometry )
541  {
542  m_Geometry = pGeometry;
543  updateGeometry();
544  }
545 }
const CaloGeometry * m_Geometry
const T & get() const
Definition: EventSetup.h:55
void EcalDigiProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 294 of file EcalDigiProducer.cc.

References checkCalibrations(), checkGeometry(), APDSimParameters::digiTag(), MixCollection< T >::inRegistry(), edm::HandleBase::isValid(), m_APDDigitizer, m_apdParameters, m_APDResponse, m_BarrelDigitizer, m_doFast, m_EBdigiCollection, m_EEdigiCollection, m_EndcapDigitizer, m_ESdigiCollection, m_ESDigitizer, m_ESDigitizerFast, m_hitsProducerTag, edm::Handle< T >::product(), EcalTDigitizer< Traits >::run(), CaloTDigitizer< Traits >::run(), and ESFastTDigitizer::run().

296 {
297  // Step A: Get Inputs
298 
299  checkGeometry( eventSetup );
300  checkCalibrations( eventSetup );
301 
302  // Get input
303  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
304 
305  // test access to SimHits
306  const std::string barrelHitsName ( m_hitsProducerTag + "EcalHitsEB" ) ;
307  const std::string endcapHitsName ( m_hitsProducerTag + "EcalHitsEE" ) ;
308  const std::string preshowerHitsName ( m_hitsProducerTag + "EcalHitsES" ) ;
309 
310  event.getByLabel( "mix",
311  barrelHitsName ,
312  crossingFrame ) ;
313 
314  MixCollection<PCaloHit>* EBHits (
315  !crossingFrame.isValid() ? 0 :
316  new MixCollection<PCaloHit>( crossingFrame.product() ) ) ;
317 
318  const bool isEB ( crossingFrame.isValid() &&
319  0 != EBHits &&
320  EBHits->inRegistry() ) ;
321 
322  if( !crossingFrame.isValid() )
323  edm::LogError("EcalDigiProducer") << "Error! can't get the product "
324  << barrelHitsName.c_str() ;
325 
326  event.getByLabel( "mix",
327  endcapHitsName ,
328  crossingFrame ) ;
329 
330  MixCollection<PCaloHit>* EEHits (
331  !crossingFrame.isValid() ? 0 :
332  new MixCollection<PCaloHit>( crossingFrame.product() ) ) ;
333 
334  const bool isEE ( crossingFrame.isValid() &&
335  0 != EEHits &&
336  EEHits->inRegistry() ) ;
337 
338  if( !crossingFrame.isValid() )
339  edm::LogError("EcalDigiProducer") << "Error! can't get the product "
340  << endcapHitsName.c_str() ;
341 
342  event.getByLabel( "mix",
343  preshowerHitsName ,
344  crossingFrame ) ;
345 
346  MixCollection<PCaloHit>* ESHits (
347  !crossingFrame.isValid() ? 0 :
348  new MixCollection<PCaloHit>( crossingFrame.product() ) ) ;
349 
350  const bool isES ( crossingFrame.isValid() &&
351  0 != ESHits &&
352  ESHits->inRegistry() ) ;
353 
354  if( !crossingFrame.isValid() )
355  edm::LogError("EcalDigiProducer") << "Error! can't get the product "
356  << preshowerHitsName.c_str() ;
357 
358  const bool apdSeparateDigi ( 0 != m_APDResponse ) ;
359 
360  // Step B: Create empty output
361  std::auto_ptr<EBDigiCollection> apdResult ( !apdSeparateDigi ? 0 :
362  new EBDigiCollection() ) ;
363  std::auto_ptr<EBDigiCollection> barrelResult ( new EBDigiCollection() ) ;
364  std::auto_ptr<EEDigiCollection> endcapResult ( new EEDigiCollection() ) ;
365  std::auto_ptr<ESDigiCollection> preshowerResult( new ESDigiCollection() ) ;
366 
367  // run the algorithm
368 
369  if( isEB )
370  {
371  std::auto_ptr<MixCollection<PCaloHit> > barrelHits( EBHits ) ;
372  m_BarrelDigitizer->run( *barrelHits ,
373  *barrelResult ) ;
374 
375  edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size() ;
376 
377  if( apdSeparateDigi )
378  {
379  m_APDDigitizer->run( *barrelHits ,
380  *apdResult ) ;
381 
382  edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size() ;
383  }
384  }
385 
386  if( isEE )
387  {
388  std::auto_ptr<MixCollection<PCaloHit> > endcapHits( EEHits ) ;
389  m_EndcapDigitizer->run( *endcapHits ,
390  *endcapResult ) ;
391  edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size() ;
392  }
393 
394  if( isES )
395  {
396  std::auto_ptr<MixCollection<PCaloHit> > preshowerHits( ESHits ) ;
397  if (!m_doFast)
398  {
399  m_ESDigitizer->run( *preshowerHits ,
400  *preshowerResult ) ;
401  }
402  else
403  {
404  m_ESDigitizerFast->run(*preshowerHits, *preshowerResult);
405  }
406  edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size();
407  }
408 
409  const std::string& apdDigiTag ( m_apdParameters->digiTag() ) ;
410 
411  // Step D: Put outputs into event
412  if( apdSeparateDigi )
413  event.put( apdResult, apdDigiTag ) ;
414  event.put( barrelResult, m_EBdigiCollection ) ;
415  event.put( endcapResult, m_EEdigiCollection ) ;
416  event.put( preshowerResult, m_ESdigiCollection ) ;
417 
418 }
EEDigitizer * m_EndcapDigitizer
void run(MixCollection< PCaloHit > &input, DigiCollection &output)
void run(MixCollection< PCaloHit > &input, ESDigiCollection &output)
turns hits into digis
ESDigitizer * m_ESDigitizer
std::string m_EBdigiCollection
EBHitResponse * m_APDResponse
void run(MixCollection< PCaloHit > &input, DigiCollection &output)
turns hits into digis
APDSimParameters * m_apdParameters
EBDigitizer * m_BarrelDigitizer
bool isValid() const
Definition: HandleBase.h:76
void checkGeometry(const edm::EventSetup &eventSetup)
std::string m_ESdigiCollection
edm::SortedCollection< ESDataFrame > ESDigiCollection
T const * product() const
Definition: Handle.h:74
EBDigitizer * m_APDDigitizer
const std::string & digiTag() const
ESFastTDigitizer * m_ESDigitizerFast
std::string m_hitsProducerTag
void checkCalibrations(const edm::EventSetup &eventSetup)
std::string m_EEdigiCollection
void EcalDigiProducer::updateGeometry ( )
private

Definition at line 548 of file EcalDigiProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, CaloGeometry::getSubdetectorGeometry(), CaloSubdetectorGeometry::getValidDetIds(), m_APDResponse, m_doFast, m_EBResponse, m_EEResponse, m_ESDigitizer, m_ESDigitizerFast, m_ESResponse, m_Geometry, CaloTDigitizer< Traits >::setDetIds(), ESFastTDigitizer::setDetIds(), CaloHitResponse::setGeometry(), and CaloHitRespoNew::setGeometry().

Referenced by checkGeometry().

549 {
557 // m_Geometry->getSubdetectorGeometry( DetId::Ecal, EcalPreshower ) ) ;
558 
559 
560  const std::vector<DetId>& theESDets (
563 
564  if( !m_doFast )
565  {
566  m_ESDigitizer->setDetIds( theESDets ) ;
567  }
568  else
569  {
570  m_ESDigitizerFast->setDetIds( theESDets ) ;
571  }
572 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
CaloHitRespoNew * m_EEResponse
void setGeometry(const CaloGeometry *geometry)
geometry needed for time-of-flight
ESDigitizer * m_ESDigitizer
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void setGeometry(const CaloSubdetectorGeometry *geometry)
CaloHitResponse * m_ESResponse
EBHitResponse * m_APDResponse
EBHitResponse * m_EBResponse
const CaloGeometry * m_Geometry
void setDetIds(const std::vector< DetId > &detIds)
tell the digitizer which cells exist
ESFastTDigitizer * m_ESDigitizerFast
void setDetIds(const std::vector< DetId > &detIds)

Member Data Documentation

EcalCoder* EcalDigiProducer::m_APDCoder
private

Definition at line 80 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), and ~EcalDigiProducer().

EBDigitizer* EcalDigiProducer::m_APDDigitizer
private

Definition at line 57 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), produce(), and ~EcalDigiProducer().

EcalElectronicsSim* EcalDigiProducer::m_APDElectronicsSim
private

Definition at line 79 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and ~EcalDigiProducer().

APDSimParameters* EcalDigiProducer::m_apdParameters
private

Definition at line 94 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), produce(), and ~EcalDigiProducer().

EBHitResponse* EcalDigiProducer::m_APDResponse
private
const APDShape EcalDigiProducer::m_APDShape
private

Definition at line 64 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

EBDigitizer* EcalDigiProducer::m_BarrelDigitizer
private

Definition at line 58 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), produce(), and ~EcalDigiProducer().

EcalCoder* EcalDigiProducer::m_Coder
private

Definition at line 77 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), and ~EcalDigiProducer().

bool EcalDigiProducer::m_doFast
private

Definition at line 92 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), produce(), and updateGeometry().

CorrelatedNoisifier<EcalCorrMatrix>* EcalDigiProducer::m_EBCorrNoise[3]
private

Definition at line 96 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and ~EcalDigiProducer().

std::string EcalDigiProducer::m_EBdigiCollection
private

Definition at line 84 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and produce().

EBHitResponse* EcalDigiProducer::m_EBResponse
private
double EcalDigiProducer::m_EBs25notCont
private

Definition at line 90 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), and EcalDigiProducer().

const EBShape EcalDigiProducer::m_EBShape
private

Definition at line 65 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

CorrelatedNoisifier<EcalCorrMatrix>* EcalDigiProducer::m_EECorrNoise[3]
private

Definition at line 97 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and ~EcalDigiProducer().

std::string EcalDigiProducer::m_EEdigiCollection
private

Definition at line 85 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and produce().

CaloHitRespoNew* EcalDigiProducer::m_EEResponse
private

Definition at line 71 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), updateGeometry(), and ~EcalDigiProducer().

double EcalDigiProducer::m_EEs25notCont
private

Definition at line 91 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), and EcalDigiProducer().

const EEShape EcalDigiProducer::m_EEShape
private

Definition at line 66 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer().

EcalElectronicsSim* EcalDigiProducer::m_ElectronicsSim
private

Definition at line 74 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and ~EcalDigiProducer().

EEDigitizer* EcalDigiProducer::m_EndcapDigitizer
private

Definition at line 59 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), produce(), and ~EcalDigiProducer().

std::string EcalDigiProducer::m_ESdigiCollection
private

Definition at line 86 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and produce().

ESDigitizer* EcalDigiProducer::m_ESDigitizer
private

Definition at line 60 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), produce(), updateGeometry(), and ~EcalDigiProducer().

ESFastTDigitizer* EcalDigiProducer::m_ESDigitizerFast
private
ESElectronicsSim* EcalDigiProducer::m_ESElectronicsSim
private

Definition at line 75 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), and ~EcalDigiProducer().

ESElectronicsSimFast* EcalDigiProducer::m_ESElectronicsSimFast
private

Definition at line 76 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), and ~EcalDigiProducer().

CaloHitResponse* EcalDigiProducer::m_ESResponse
private

Definition at line 72 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), updateGeometry(), and ~EcalDigiProducer().

ESShape* EcalDigiProducer::m_ESShape
private

Definition at line 67 of file EcalDigiProducer.h.

Referenced by checkCalibrations(), EcalDigiProducer(), and ~EcalDigiProducer().

const CaloGeometry* EcalDigiProducer::m_Geometry
private

Definition at line 82 of file EcalDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

std::string EcalDigiProducer::m_hitsProducerTag
private

Definition at line 88 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and produce().

const EcalSimParameterMap* EcalDigiProducer::m_ParameterMap
private

Definition at line 63 of file EcalDigiProducer.h.

Referenced by EcalDigiProducer(), and ~EcalDigiProducer().