CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EcalTBDigiProducer Class Reference

#include <EcalTBDigiProducer.h>

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

List of all members.

Public Member Functions

virtual void cacheEBDigis (const EBDigiCollection *ebDigiPtr) const
virtual void cacheEEDigis (const EEDigiCollection *eeDigiPtr) const
 EcalTBDigiProducer (const edm::ParameterSet &params)
virtual void produce (edm::Event &event, const edm::EventSetup &eventSetup)
virtual ~EcalTBDigiProducer ()

Private Member Functions

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::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 10 of file EcalTBDigiProducer.h.


Constructor & Destructor Documentation

EcalTBDigiProducer::EcalTBDigiProducer ( const edm::ParameterSet params)

Definition at line 12 of file EcalTBDigiProducer.cc.

References funct::false, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), 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, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, and EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin.

                                                                      :
   EcalDigiProducer( params )
{
   m_EBdigiFinalTag = params.getParameter<std::string>( "EBdigiFinalCollection" ) ;
   m_EBdigiTempTag  = params.getParameter<std::string>( "EBdigiCollection");

   produces<EBDigiCollection>( m_EBdigiFinalTag ) ; // after selective readout
   produces<EcalTBTDCRawInfo>() ;

   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(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 56 of file EcalTBDigiProducer.cc.

{
}

Member Function Documentation

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

Reimplemented from EcalDigiProducer.

Definition at line 159 of file EcalTBDigiProducer.cc.

References m_ebDigis.

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

Reimplemented from EcalDigiProducer.

Definition at line 166 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 141 of file EcalTBDigiProducer.cc.

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

Referenced by produce().

{
   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::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Produces the EDM products,

Reimplemented from EcalDigiProducer.

Definition at line 60 of file EcalTBDigiProducer.cc.

References gather_cfg::cout, DetId::Ecal, EcalBarrel, fillTBTDCRawInfo(), edm::EventSetup::get(), m_doPhaseShift, m_doReadout, m_EBdigiFinalTag, m_ebDigis, m_ecalTBInfoLabel, m_eeDigis, m_theTBReadout, m_theTTmap, m_thisPhaseShift, EcalTBReadout::performReadout(), 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 ) ;

   std::auto_ptr<EcalTBTDCRawInfo> TDCproduct( 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( *TDCproduct ) ; // fill the TDC info in the event    
   }

   m_ebDigis = std::auto_ptr<EBDigiCollection> ( new EBDigiCollection ) ;

   EcalDigiProducer::produce( 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 ;

   event.put( barrelReadout, m_EBdigiFinalTag ) ;
   event.put( TDCproduct ) ;

   m_ebDigis.reset() ; // release memory
   m_eeDigis.reset() ; // release memory
}
void EcalTBDigiProducer::setPhaseShift ( const DetId detId) [private]

Definition at line 114 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 produce().

{  
   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 37 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and produce().

Definition at line 40 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and produce().

std::string EcalTBDigiProducer::m_EBdigiFinalTag [private]

Definition at line 34 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and produce().

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

Definition at line 47 of file EcalTBDigiProducer.h.

Referenced by cacheEBDigis(), and produce().

std::string EcalTBDigiProducer::m_EBdigiTempTag [private]

Definition at line 35 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer().

Definition at line 33 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and produce().

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

Definition at line 48 of file EcalTBDigiProducer.h.

Referenced by produce().

Definition at line 42 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and fillTBTDCRawInfo().

Definition at line 31 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and produce().

Definition at line 30 of file EcalTBDigiProducer.h.

Referenced by produce().

Definition at line 38 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), fillTBTDCRawInfo(), produce(), and setPhaseShift().

Definition at line 45 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().

Definition at line 43 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().