CMS 3D CMS Logo

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

List of all members.

Public Types

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

Public Member Functions

virtual void fill ()
 HcalSignalGenerator (const edm::InputTag &inputTag)
void initializeEvent (const edm::EventPrincipal *eventPrincipal, const edm::EventSetup *eventSetup)
 some users use EventPrincipals, not Events. We support both
void initializeEvent (const edm::Event *event, const edm::EventSetup *eventSetup)
virtual ~HcalSignalGenerator ()

Private Member Functions

CaloSamples samplesInPE (const DIGI &digi)

Private Attributes

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

Detailed Description

template<class HCALDIGITIZERTRAITS>
class HcalSignalGenerator< HCALDIGITIZERTRAITS >

Converts digis back into analog signals, to be used as noise

Definition at line 24 of file HcalSignalGenerator.h.


Member Typedef Documentation

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

Definition at line 28 of file HcalSignalGenerator.h.

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

Definition at line 27 of file HcalSignalGenerator.h.


Constructor & Destructor Documentation

template<class HCALDIGITIZERTRAITS>
HcalSignalGenerator< HCALDIGITIZERTRAITS >::HcalSignalGenerator ( const edm::InputTag inputTag) [inline]

Definition at line 30 of file HcalSignalGenerator.h.

template<class HCALDIGITIZERTRAITS>
virtual HcalSignalGenerator< HCALDIGITIZERTRAITS >::~HcalSignalGenerator ( ) [inline, virtual]

Definition at line 33 of file HcalSignalGenerator.h.

{}

Member Function Documentation

template<class HCALDIGITIZERTRAITS>
virtual void HcalSignalGenerator< HCALDIGITIZERTRAITS >::fill ( void  ) [inline, virtual]

Definition at line 52 of file HcalSignalGenerator.h.

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

  {
    theNoiseSignals.clear();
    edm::Handle<COLLECTION> pDigis;
    const COLLECTION *  digis = 0;
    // try accessing by whatever is set, Event or EventPrincipal
    if(theEvent) 
     {
      if( theEvent->getByLabel(theInputTag, pDigis) ) {
        digis = pDigis.product(); // get a ptr to the product
        LogTrace("HcalSignalGenerator") << "total # digis  for "  << theInputTag << " " <<  digis->size();
      }
      else
      {
        throw cms::Exception("HcalSignalGenerator") << "Cannot find input data " << theInputTag;
      }
    }
    else if(theEventPrincipal)
    {
       boost::shared_ptr<edm::Wrapper<COLLECTION>  const> digisPTR =
          edm::getProductByTag<COLLECTION>(*theEventPrincipal, theInputTag );
       if(digisPTR) {
          digis = digisPTR->product();
       }
    }
    else
    {
      throw cms::Exception("HcalSignalGenerator") << "No Event or EventPrincipal was set";
    }

    if (digis)
    {
      // loop over digis, adding these to the existing maps
      for(typename COLLECTION::const_iterator it  = digis->begin();
          it != digis->end(); ++it) 
      {
        // for the first signal, set the starting cap id
        if((it == digis->begin()) && theElectronicsSim)
        {
          int startingCapId = (*it)[0].capid();
          theElectronicsSim->setStartingCapId(startingCapId);
          theParameterMap->setFrameSize(it->id(), it->size());
        }

        theNoiseSignals.push_back(samplesInPE(*it));
      }
    }
  }
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 44 of file HcalSignalGenerator.h.

  {
    theEventPrincipal = eventPrincipal;
    eventSetup->get<HcalDbRecord>().get(theConditions);
    theShape = theConditions->getHcalShape (); // this one is generic
    theParameterMap->setDbService(theConditions.product());
  }
template<class HCALDIGITIZERTRAITS>
void HcalSignalGenerator< HCALDIGITIZERTRAITS >::initializeEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
) [inline]

Definition at line 35 of file HcalSignalGenerator.h.

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

  {
    theEvent = event;
    eventSetup->get<HcalDbRecord>().get(theConditions);
    theShape = theConditions->getHcalShape (); // this one is generic
    theParameterMap->setDbService(theConditions.product());
  }
template<class HCALDIGITIZERTRAITS>
CaloSamples HcalSignalGenerator< HCALDIGITIZERTRAITS >::samplesInPE ( const DIGI digi) [inline, private]

Definition at line 103 of file HcalSignalGenerator.h.

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

  {
    // calibration, for future reference:  (same block for all Hcal types)
    HcalDetId cell = digi.id();
    //         const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
    const HcalQIECoder* channelCoder = theConditions->getHcalCoder (cell);
    HcalCoderDb coder (*channelCoder, *theShape);
    CaloSamples result;
    coder.adc2fC(digi, result);
    fC2pe(result);
    return result;
  }

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 123 of file HcalSignalGenerator.h.

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

template<class HCALDIGITIZERTRAITS>
const HcalQIEShape* HcalSignalGenerator< HCALDIGITIZERTRAITS >::theShape [private]