CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalTBDigiProducer Class Reference

#include <EcalTBDigiProducer.h>

Inheritance diagram for EcalTBDigiProducer:
EcalDigiProducer DigiAccumulatorMixMod

List of all members.

Public Member Functions

 EcalTBDigiProducer (const edm::ParameterSet &params, edm::EDProducer &mixMod)
virtual void finalizeEvent (edm::Event &, edm::EventSetup const &)
virtual void initializeEvent (edm::Event const &, edm::EventSetup const &)
virtual ~EcalTBDigiProducer ()

Private Member Functions

virtual void cacheEBDigis (const EBDigiCollection *ebDigiPtr) const
virtual void cacheEEDigis (const EEDigiCollection *eeDigiPtr) const
void fillTBTDCRawInfo (EcalTBTDCRawInfo &theTBTDCRawInfo)
void setPhaseShift (const DetId &detId)

Private Attributes

bool m_doPhaseShift
bool m_doReadout
std::string m_EBdigiFinalTag
std::auto_ptr< EBDigiCollectionm_ebDigis
std::string m_EBdigiTempTag
std::string m_ecalTBInfoLabel
std::auto_ptr< EEDigiCollectionm_eeDigis
std::auto_ptr< EcalTBTDCRawInfom_TDCproduct
std::vector
< EcalTBTDCRecInfoAlgo::EcalTBTDCRanges
m_tdcRanges
EcalTBReadoutm_theTBReadout
const EcalTrigTowerConstituentsMap m_theTTmap
double m_thisPhaseShift
double m_tunePhaseShift
bool m_use2004OffsetConvention

Detailed Description

Definition at line 18 of file EcalTBDigiProducer.h.


Constructor & Destructor Documentation

EcalTBDigiProducer::EcalTBDigiProducer ( const edm::ParameterSet params,
edm::EDProducer mixMod 
)

Definition at line 14 of file EcalTBDigiProducer.cc.

References funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), instance, m_doPhaseShift, m_doReadout, m_EBdigiFinalTag, m_EBdigiTempTag, m_ecalTBInfoLabel, m_tdcRanges, m_theTBReadout, m_thisPhaseShift, m_tunePhaseShift, m_use2004OffsetConvention, diffTwoXMLs::ranges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, AlCaHLTBitMon_QueryRunRegistry::string, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, and EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin.

                                                                                             :
   EcalDigiProducer( params, mixMod )
{
   std::string const instance("simEcalUnsuppressedDigis");
   m_EBdigiFinalTag = params.getParameter<std::string>( "EBdigiFinalCollection" ) ;
   m_EBdigiTempTag  = params.getParameter<std::string>( "EBdigiCollection");

   mixMod.produces<EBDigiCollection>(instance + m_EBdigiFinalTag) ; // after selective readout
   mixMod.produces<EcalTBTDCRawInfo>(instance) ;

   const bool syncPhase ( params.getParameter<bool>("syncPhase") ) ;

   // possible phase shift for asynchronous trigger (e.g. test-beam)

   m_doPhaseShift = !syncPhase ;
   m_thisPhaseShift = 1. ;

   typedef std::vector< edm::ParameterSet > Parameters;
   Parameters ranges=params.getParameter<Parameters>( "tdcRanges" ) ;
   for( Parameters::iterator itRanges = ranges.begin(); 
        itRanges != ranges.end(); ++itRanges )
   {
      EcalTBTDCRecInfoAlgo::EcalTBTDCRanges aRange;
      aRange.runRanges.first = itRanges->getParameter<int>("startRun");
      aRange.runRanges.second = itRanges->getParameter<int>("endRun");
      aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
      aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
      m_tdcRanges.push_back(std::move(aRange));
   }

   m_use2004OffsetConvention = 
      params.getUntrackedParameter< bool >("use2004OffsetConvention",
                                           false ) ;

   m_ecalTBInfoLabel =
      params.getUntrackedParameter<std::string>( "EcalTBInfoLabel" ,
                                                 "SimEcalTBG4Object" ) ;

   m_doReadout = params.getParameter<bool>( "doReadout" ) ;

   m_theTBReadout = new EcalTBReadout( m_ecalTBInfoLabel ) ;

   m_tunePhaseShift =  params.getParameter<double>( "tunePhaseShift" ) ;
}
EcalTBDigiProducer::~EcalTBDigiProducer ( ) [virtual]

Definition at line 59 of file EcalTBDigiProducer.cc.

{
}

Member Function Documentation

void EcalTBDigiProducer::cacheEBDigis ( const EBDigiCollection ebDigiPtr) const [private, virtual]

Reimplemented from EcalDigiProducer.

Definition at line 164 of file EcalTBDigiProducer.cc.

References m_ebDigis.

{
   m_ebDigis.reset( new EBDigiCollection ) ;
   *m_ebDigis = *ebDigiPtr ;
}
void EcalTBDigiProducer::cacheEEDigis ( const EEDigiCollection eeDigiPtr) const [private, virtual]

Reimplemented from EcalDigiProducer.

Definition at line 171 of file EcalTBDigiProducer.cc.

References gather_cfg::cout, and edm::DataFrameContainer::size().

{
   std::cout<< "===**** EcalTBDigiProducer: number of endcap digis = "
            << eeDigiPtr->size()<<std::endl ;
}
void EcalTBDigiProducer::fillTBTDCRawInfo ( EcalTBTDCRawInfo theTBTDCRawInfo) [private]

Definition at line 146 of file EcalTBDigiProducer.cc.

References LogDebug, m_tdcRanges, m_thisPhaseShift, EcalTBTDCRawInfo::setSample(), Ecal2004TBTDCRanges_cff::tdcMax, and Ecal2004TBTDCRanges_cff::tdcMin.

Referenced by initializeEvent().

{
   const unsigned int thisChannel ( 1 ) ;
  
   const unsigned int thisCount ( 
      (unsigned int)( m_thisPhaseShift*( m_tdcRanges[0].tdcMax[0]
                                         - m_tdcRanges[0].tdcMin[0] ) 
                      + m_tdcRanges[0].tdcMin[0] ) ) ;

   EcalTBTDCSample theTBTDCSample ( thisChannel, thisCount ) ;

   const unsigned int sampleIndex ( 0 ) ;
   theTBTDCRawInfo.setSample( sampleIndex, theTBTDCSample ) ;

   LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo ;
}
void EcalTBDigiProducer::finalizeEvent ( edm::Event event,
edm::EventSetup const &  eventSetup 
) [virtual]

Reimplemented from EcalDigiProducer.

Definition at line 87 of file EcalTBDigiProducer.cc.

References gather_cfg::cout, instance, m_doReadout, m_EBdigiFinalTag, m_ebDigis, m_eeDigis, m_TDCproduct, m_theTBReadout, m_theTTmap, EcalTBReadout::performReadout(), and AlCaHLTBitMon_QueryRunRegistry::string.

                                                                                         {
   m_ebDigis.reset( new EBDigiCollection ) ;

   EcalDigiProducer::finalizeEvent( event, eventSetup ) ;

   const EBDigiCollection* barrelResult ( &*m_ebDigis ) ;

   std::auto_ptr<EBDigiCollection> barrelReadout( new EBDigiCollection() ) ;
   if( m_doReadout ) 
   {
      m_theTBReadout->performReadout( event,
                                      m_theTTmap,
                                      *barrelResult,
                                      *barrelReadout ) ;
   }
   else 
   {
      *barrelReadout = *barrelResult ;
   }

   std::cout<< "===**** EcalTBDigiProducer: number of barrel digis = "
            << barrelReadout->size()<<std::endl ;

   std::string const instance("simEcalUnsuppressedDigis");
   event.put(barrelReadout, instance + m_EBdigiFinalTag) ;
   event.put(m_TDCproduct, instance) ;

   m_ebDigis.reset(); // release memory
   m_eeDigis.reset(); // release memory
}
void EcalTBDigiProducer::initializeEvent ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
) [virtual]

Reimplemented from EcalDigiProducer.

Definition at line 63 of file EcalTBDigiProducer.cc.

References gather_cfg::cout, DetId::Ecal, EcalBarrel, fillTBTDCRawInfo(), edm::EventSetup::get(), m_doPhaseShift, m_ecalTBInfoLabel, m_TDCproduct, m_theTBReadout, m_thisPhaseShift, EcalTBReadout::setDetIds(), and setPhaseShift().

                                                                                               {
  std::cout<<"====****Entering EcalTBDigiProducer produce()"<<std::endl ;
   edm::ESHandle<CaloGeometry>               hGeometry ;
   eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
   const std::vector<DetId>& theBarrelDets (
      hGeometry->getValidDetIds(DetId::Ecal, EcalBarrel) ) ;

   m_theTBReadout->setDetIds( theBarrelDets ) ;

   m_TDCproduct.reset( new EcalTBTDCRawInfo(1) ) ;
   if( m_doPhaseShift ) 
   {
      edm::Handle<PEcalTBInfo>             theEcalTBInfo   ;
      event.getByLabel( m_ecalTBInfoLabel, theEcalTBInfo ) ;
      m_thisPhaseShift = theEcalTBInfo->phaseShift() ;

      DetId detId( DetId::Ecal, 1 ) ;
      setPhaseShift( detId ) ;

      fillTBTDCRawInfo( *m_TDCproduct ) ; // fill the TDC info in the event    
   }
   EcalDigiProducer::initializeEvent( event, eventSetup ) ;
}
void EcalTBDigiProducer::setPhaseShift ( const DetId detId) [private]

Definition at line 119 of file EcalTBDigiProducer.cc.

References LogDebug, EcalDigiProducer::m_EBResponse, EcalDigiProducer::m_EEResponse, EcalDigiProducer::m_ParameterMap, m_thisPhaseShift, m_tunePhaseShift, m_use2004OffsetConvention, Parameters::parameters, EcalHitResponse::setPhaseShift(), DetId::subdetId(), and CaloSimParameters::syncPhase().

Referenced by initializeEvent().

{  
   const CaloSimParameters& parameters ( 
      EcalDigiProducer::m_ParameterMap->simParameters( detId ) ) ;

   if ( !parameters.syncPhase() ) 
   {
      const int myDet ( detId.subdetId() ) ;

      LogDebug("EcalDigi") << "Setting the phase shift " 
                           << m_thisPhaseShift 
                           << " and the offset " 
                           << m_tunePhaseShift 
                           << " for the subdetector " 
                           << myDet;

      if( myDet == 1 ) 
      {
         double passPhaseShift ( m_thisPhaseShift + m_tunePhaseShift ) ;
         if( m_use2004OffsetConvention ) passPhaseShift = 1. - passPhaseShift ;
         EcalDigiProducer::m_EBResponse->setPhaseShift( passPhaseShift ) ;
         EcalDigiProducer::m_EEResponse->setPhaseShift( passPhaseShift ) ;
      }
   }
}

Member Data Documentation

Definition at line 45 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and initializeEvent().

Definition at line 48 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and finalizeEvent().

std::string EcalTBDigiProducer::m_EBdigiFinalTag [private]

Definition at line 42 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and finalizeEvent().

std::auto_ptr<EBDigiCollection> EcalTBDigiProducer::m_ebDigis [mutable, private]

Definition at line 55 of file EcalTBDigiProducer.h.

Referenced by cacheEBDigis(), and finalizeEvent().

std::string EcalTBDigiProducer::m_EBdigiTempTag [private]

Definition at line 43 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer().

Definition at line 41 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and initializeEvent().

std::auto_ptr<EEDigiCollection> EcalTBDigiProducer::m_eeDigis [mutable, private]

Definition at line 56 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent().

std::auto_ptr<EcalTBTDCRawInfo> EcalTBDigiProducer::m_TDCproduct [mutable, private]

Definition at line 57 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent(), and initializeEvent().

Definition at line 50 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and fillTBTDCRawInfo().

Definition at line 39 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), finalizeEvent(), and initializeEvent().

Definition at line 38 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent().

Definition at line 53 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().

Definition at line 51 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().