CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalTimeDigiProducer Class Reference

#include <EcalTimeDigiProducer.h>

Inheritance diagram for EcalTimeDigiProducer:
DigiAccumulatorMixMod

Public Member Functions

virtual void accumulate (edm::Event const &e, edm::EventSetup const &c)
 
virtual void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &)
 
 EcalTimeDigiProducer (const edm::ParameterSet &params, edm::stream::EDProducerBase &mixMod, edm::ConsumesCollector &)
 
virtual void finalizeEvent (edm::Event &e, edm::EventSetup const &c)
 
virtual void initializeEvent (edm::Event const &e, edm::EventSetup const &c)
 
virtual ~EcalTimeDigiProducer ()
 
- Public Member Functions inherited from DigiAccumulatorMixMod
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void beginRun (edm::Run const &run, edm::EventSetup const &setup)
 
 DigiAccumulatorMixMod ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
 
virtual void endRun (edm::Run const &run, edm::EventSetup const &setup)
 
virtual void finalizeBunchCrossing (edm::Event &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual PileupMixingContentgetEventPileupInfo ()
 
virtual void initializeBunchCrossing (edm::Event const &event, edm::EventSetup const &setup, int bunchCrossing)
 
virtual void StorePileupInformation (std::vector< int > &numInteractionList, std::vector< int > &bunchCrossingList, std::vector< float > &TrueInteractionList, std::vector< edm::EventID > &eventList, int bunchSpace)
 
virtual ~DigiAccumulatorMixMod ()
 

Private Types

typedef edm::Handle< std::vector< PCaloHit > > HitsHandle
 

Private Member Functions

void accumulateCaloHits (HitsHandle const &ebHandle, HitsHandle const &eeHandle, int bunchCrossing)
 
void checkGeometry (const edm::EventSetup &eventSetup)
 
void updateGeometry ()
 

Private Attributes

EcalTimeMapDigitizerm_BarrelDigitizer
 
const std::string m_EBdigiCollection
 
const std::string m_EEdigiCollection
 
EcalTimeMapDigitizerm_EndcapDigitizer
 
const CaloGeometrym_Geometry
 
const edm::InputTag m_hitsProducerTagEB
 
const edm::InputTag m_hitsProducerTagEE
 
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEB
 
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEE
 
int m_timeLayerEB
 
int m_timeLayerEE
 

Detailed Description

Definition at line 32 of file EcalTimeDigiProducer.h.

Member Typedef Documentation

typedef edm::Handle<std::vector<PCaloHit> > EcalTimeDigiProducer::HitsHandle
private

Definition at line 45 of file EcalTimeDigiProducer.h.

Constructor & Destructor Documentation

EcalTimeDigiProducer::EcalTimeDigiProducer ( const edm::ParameterSet params,
edm::stream::EDProducerBase mixMod,
edm::ConsumesCollector sumes 
)

Definition at line 24 of file EcalTimeDigiProducer.cc.

References gather_cfg::cout, EcalBarrel, EcalEndcap, m_BarrelDigitizer, m_EBdigiCollection, m_EEdigiCollection, m_EndcapDigitizer, m_timeLayerEB, m_timeLayerEE, and EcalTimeMapDigitizer::setTimeLayerId().

24  :
26  m_EBdigiCollection ( params.getParameter<std::string>("EBtimeDigiCollection") ) ,
27  m_EEdigiCollection ( params.getParameter<std::string>("EEtimeDigiCollection") ) ,
28  m_hitsProducerTagEB ( params.getParameter<edm::InputTag>("hitsProducerEB" ) ) ,
29  m_hitsProducerTagEE ( params.getParameter<edm::InputTag>("hitsProducerEE" ) ) ,
30  m_hitsProducerTokenEB ( sumes.consumes<std::vector<PCaloHit> >( m_hitsProducerTagEB) ) ,
31  m_hitsProducerTokenEE ( sumes.consumes<std::vector<PCaloHit> >( m_hitsProducerTagEE) ) ,
32  m_timeLayerEB ( params.getParameter<int> ("timeLayerBarrel") ),
33  m_timeLayerEE ( params.getParameter<int> ("timeLayerEndcap") ),
34  m_Geometry ( 0 )
35 {
38 
41 
42 #ifdef ecal_time_debug
43  std::cout << "[EcalTimeDigiProducer]::Create EB " << m_EBdigiCollection << " and EE " << m_EEdigiCollection << " collections and digitizers" << std::endl;
44 #endif
45 
46  m_BarrelDigitizer->setTimeLayerId(m_timeLayerEB);
48 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
EcalTimeMapDigitizer * m_EndcapDigitizer
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEE
void setTimeLayerId(const int &layerId)
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEB
const edm::InputTag m_hitsProducerTagEB
const std::string m_EEdigiCollection
EcalTimeMapDigitizer * m_BarrelDigitizer
const CaloGeometry * m_Geometry
const edm::InputTag m_hitsProducerTagEE
const std::string m_EBdigiCollection
EcalTimeDigiProducer::~EcalTimeDigiProducer ( )
virtual

Definition at line 50 of file EcalTimeDigiProducer.cc.

51 {
52 }

Member Function Documentation

void EcalTimeDigiProducer::accumulate ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 77 of file EcalTimeDigiProducer.cc.

References accumulateCaloHits(), gather_cfg::cout, edm::Event::getByToken(), m_hitsProducerTokenEB, and m_hitsProducerTokenEE.

77  {
78  // Step A: Get Inputs
80  e.getByToken(m_hitsProducerTokenEB, ebHandle);
81 
83  e.getByToken(m_hitsProducerTokenEE, eeHandle);
84 
85 #ifdef ecal_time_debug
86  std::cout << "[EcalTimeDigiProducer]::Accumulate Hits HS event" << std::endl;
87 #endif
88 
89  accumulateCaloHits(ebHandle, eeHandle, 0);
90 }
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEE
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, int bunchCrossing)
const edm::EDGetTokenT< std::vector< PCaloHit > > m_hitsProducerTokenEB
void EcalTimeDigiProducer::accumulate ( PileUpEventPrincipal const &  e,
edm::EventSetup const &  c,
edm::StreamID const &   
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 93 of file EcalTimeDigiProducer.cc.

References accumulateCaloHits(), PileUpEventPrincipal::bunchCrossing(), gather_cfg::cout, PileUpEventPrincipal::getByLabel(), m_hitsProducerTagEB, and m_hitsProducerTagEE.

93  {
95  e.getByLabel(m_hitsProducerTagEB, ebHandle);
96 
98  e.getByLabel(m_hitsProducerTagEE, eeHandle);
99 
100 #ifdef ecal_time_debug
101  std::cout << "[EcalTimeDigiProducer]::Accumulate Hits for BC " << e.bunchCrossing() << std::endl;
102 #endif
103  accumulateCaloHits(ebHandle, eeHandle, e.bunchCrossing());
104 }
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, int bunchCrossing)
const edm::InputTag m_hitsProducerTagEB
const edm::InputTag m_hitsProducerTagEE
void EcalTimeDigiProducer::accumulateCaloHits ( HitsHandle const &  ebHandle,
HitsHandle const &  eeHandle,
int  bunchCrossing 
)
private

Definition at line 64 of file EcalTimeDigiProducer.cc.

References EcalTimeMapDigitizer::add(), edm::HandleBase::isValid(), m_BarrelDigitizer, m_EndcapDigitizer, and edm::Handle< T >::product().

Referenced by accumulate().

64  {
65  // accumulate the simHits and do the averages in a given layer per bunch crossing
66  if(ebHandle.isValid()) {
67  m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing);
68  }
69 
70  if(eeHandle.isValid()) {
71  m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing);
72  }
73 
74 }
EcalTimeMapDigitizer * m_EndcapDigitizer
EcalTimeMapDigitizer * m_BarrelDigitizer
void add(const std::vector< PCaloHit > &hits, int bunchCrossing)
void EcalTimeDigiProducer::checkGeometry ( const edm::EventSetup eventSetup)
private

Definition at line 141 of file EcalTimeDigiProducer.cc.

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

Referenced by initializeEvent().

142 {
143  // TODO find a way to avoid doing this every event
144  edm::ESHandle<CaloGeometry> hGeometry ;
145  eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
146 
147  const CaloGeometry* pGeometry = &*hGeometry;
148 
149  if( pGeometry != m_Geometry )
150  {
151  m_Geometry = pGeometry;
152  updateGeometry();
153  }
154 }
const T & get() const
Definition: EventSetup.h:55
const CaloGeometry * m_Geometry
void EcalTimeDigiProducer::finalizeEvent ( edm::Event e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 107 of file EcalTimeDigiProducer.cc.

References gather_cfg::cout, m_BarrelDigitizer, m_EBdigiCollection, m_EEdigiCollection, m_EndcapDigitizer, eostools::move(), and EcalTimeMapDigitizer::run().

107  {
108  std::unique_ptr<EcalTimeDigiCollection> barrelResult ( new EcalTimeDigiCollection() ) ;
109  std::unique_ptr<EcalTimeDigiCollection> endcapResult ( new EcalTimeDigiCollection() ) ;
110 
111 #ifdef ecal_time_debug
112  std::cout << "[EcalTimeDigiProducer]::finalizeEvent" << std::endl;
113 #endif
114 
115  // here basically just put everything in the final collections
116  m_BarrelDigitizer->run( *barrelResult ) ;
117 
118 #ifdef ecal_time_debug
119  std::cout << "[EcalTimeDigiProducer]::EB Digi size " << barrelResult->size() << std::endl;
120 #endif
121 
122  edm::LogInfo("TimeDigiInfo") << "EB time Digis: " << barrelResult->size() ;
123 
124  m_EndcapDigitizer->run( *endcapResult ) ;
125 
126 #ifdef ecal_time_debug
127  std::cout << "[EcalTimeDigiProducer]::EE Digi size " << endcapResult->size() << std::endl;
128 #endif
129 
130  edm::LogInfo("TimeDigiInfo") << "EE Digis: " << endcapResult->size() ;
131 
132 #ifdef ecal_time_debug
133  std::cout << "[EcalTimeDigiProducer]::putting collections into the event " << std::endl;
134 #endif
135 
136  event.put( std::move(barrelResult), m_EBdigiCollection ) ;
137  event.put( std::move(endcapResult), m_EEdigiCollection ) ;
138 }
EcalTimeMapDigitizer * m_EndcapDigitizer
void run(EcalTimeDigiCollection &output)
const std::string m_EEdigiCollection
edm::SortedCollection< EcalTimeDigi > EcalTimeDigiCollection
EcalTimeMapDigitizer * m_BarrelDigitizer
def move(src, dest)
Definition: eostools.py:510
const std::string m_EBdigiCollection
void EcalTimeDigiProducer::initializeEvent ( edm::Event const &  e,
edm::EventSetup const &  c 
)
virtual

Implements DigiAccumulatorMixMod.

Definition at line 55 of file EcalTimeDigiProducer.cc.

References checkGeometry(), EcalTimeMapDigitizer::initializeMap(), m_BarrelDigitizer, and m_EndcapDigitizer.

55  {
56  checkGeometry( eventSetup );
57  // checkCalibrations( event, eventSetup );
58  // here the methods to clean the maps
61 }
EcalTimeMapDigitizer * m_EndcapDigitizer
EcalTimeMapDigitizer * m_BarrelDigitizer
void checkGeometry(const edm::EventSetup &eventSetup)
void EcalTimeDigiProducer::updateGeometry ( )
private

Definition at line 157 of file EcalTimeDigiProducer.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, CaloGeometry::getSubdetectorGeometry(), m_BarrelDigitizer, m_EndcapDigitizer, m_Geometry, and EcalTimeMapDigitizer::setGeometry().

Referenced by checkGeometry().

158 {
163 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
EcalTimeMapDigitizer * m_EndcapDigitizer
void setGeometry(const CaloSubdetectorGeometry *geometry)
EcalTimeMapDigitizer * m_BarrelDigitizer
const CaloGeometry * m_Geometry

Member Data Documentation

EcalTimeMapDigitizer* EcalTimeDigiProducer::m_BarrelDigitizer
private
const std::string EcalTimeDigiProducer::m_EBdigiCollection
private

Definition at line 52 of file EcalTimeDigiProducer.h.

Referenced by EcalTimeDigiProducer(), and finalizeEvent().

const std::string EcalTimeDigiProducer::m_EEdigiCollection
private

Definition at line 53 of file EcalTimeDigiProducer.h.

Referenced by EcalTimeDigiProducer(), and finalizeEvent().

EcalTimeMapDigitizer* EcalTimeDigiProducer::m_EndcapDigitizer
private
const CaloGeometry* EcalTimeDigiProducer::m_Geometry
private

Definition at line 62 of file EcalTimeDigiProducer.h.

Referenced by checkGeometry(), and updateGeometry().

const edm::InputTag EcalTimeDigiProducer::m_hitsProducerTagEB
private

Definition at line 54 of file EcalTimeDigiProducer.h.

Referenced by accumulate().

const edm::InputTag EcalTimeDigiProducer::m_hitsProducerTagEE
private

Definition at line 55 of file EcalTimeDigiProducer.h.

Referenced by accumulate().

const edm::EDGetTokenT<std::vector<PCaloHit> > EcalTimeDigiProducer::m_hitsProducerTokenEB
private

Definition at line 56 of file EcalTimeDigiProducer.h.

Referenced by accumulate().

const edm::EDGetTokenT<std::vector<PCaloHit> > EcalTimeDigiProducer::m_hitsProducerTokenEE
private

Definition at line 57 of file EcalTimeDigiProducer.h.

Referenced by accumulate().

int EcalTimeDigiProducer::m_timeLayerEB
private

Definition at line 60 of file EcalTimeDigiProducer.h.

Referenced by EcalTimeDigiProducer().

int EcalTimeDigiProducer::m_timeLayerEE
private

Definition at line 61 of file EcalTimeDigiProducer.h.

Referenced by EcalTimeDigiProducer().