CMS 3D CMS Logo

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

#include <EcalTBDigiProducer.h>

Inheritance diagram for EcalTBDigiProducer:
EcalDigiProducer DigiAccumulatorMixMod

Public Member Functions

 EcalTBDigiProducer (const edm::ParameterSet &params, edm::ProducerBase &mixMod, edm::ConsumesCollector &iC)
 
void finalizeEvent (edm::Event &, edm::EventSetup const &) override
 
void initializeEvent (edm::Event const &, edm::EventSetup const &) override
 
 ~EcalTBDigiProducer () override
 
- Public Member Functions inherited from EcalDigiProducer
void accumulate (edm::Event const &e, edm::EventSetup const &c) override
 
void accumulate (PileUpEventPrincipal const &e, edm::EventSetup const &c, edm::StreamID const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::ProducerBase &mixMod, edm::ConsumesCollector &iC)
 
 EcalDigiProducer (const edm::ParameterSet &params, edm::ConsumesCollector &iC)
 
void setEBNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setEENoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
void setESNoiseSignalGenerator (EcalBaseSignalGenerator *noiseGenerator)
 
 ~EcalDigiProducer () override
 
- Public Member Functions inherited from DigiAccumulatorMixMod
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 Member Functions

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

Private Attributes

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

Additional Inherited Members

- Protected Attributes inherited from EcalDigiProducer
std::unique_ptr< EBHitResponsem_EBResponse
 
std::unique_ptr< EEHitResponsem_EEResponse
 
std::unique_ptr< const EcalSimParameterMapm_ParameterMap
 

Detailed Description

Definition at line 20 of file EcalTBDigiProducer.h.

Constructor & Destructor Documentation

EcalTBDigiProducer::EcalTBDigiProducer ( const edm::ParameterSet params,
edm::ProducerBase mixMod,
edm::ConsumesCollector iC 
)

Definition at line 15 of file EcalTBDigiProducer.cc.

References edm::ConsumesCollector::consumes(), 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, eostools::move(), edm::ProductRegistryHelper::produces(), diffTwoXMLs::ranges, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::runRanges, AlCaHLTBitMon_QueryRunRegistry::string, ecalSimParameterMap_cff::syncPhase, EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMax, and EcalTBTDCRecInfoAlgo::EcalTBTDCRanges::tdcMin.

15  :
16  EcalDigiProducer(params, mixMod, iC)
17 {
18  std::string const instance("simEcalUnsuppressedDigis");
19  m_EBdigiFinalTag = params.getParameter<std::string>( "EBdigiFinalCollection" ) ;
20  m_EBdigiTempTag = params.getParameter<std::string>( "EBdigiCollection");
21 
22  mixMod.produces<EBDigiCollection>(instance + m_EBdigiFinalTag) ; // after selective readout
24 
25  const bool syncPhase ( params.getParameter<bool>("syncPhase") ) ;
26 
27  // possible phase shift for asynchronous trigger (e.g. test-beam)
28 
30  m_thisPhaseShift = 1. ;
31 
32  typedef std::vector< edm::ParameterSet > Parameters;
33  Parameters ranges=params.getParameter<Parameters>( "tdcRanges" ) ;
34  for( Parameters::iterator itRanges = ranges.begin();
35  itRanges != ranges.end(); ++itRanges )
36  {
38  aRange.runRanges.first = itRanges->getParameter<int>("startRun");
39  aRange.runRanges.second = itRanges->getParameter<int>("endRun");
40  aRange.tdcMin = itRanges->getParameter< std::vector<double> >("tdcMin");
41  aRange.tdcMax = itRanges->getParameter< std::vector<double> >("tdcMax");
42  m_tdcRanges.push_back(std::move(aRange));
43  }
44 
46  params.getUntrackedParameter< bool >("use2004OffsetConvention",
47  false ) ;
48 
50  params.getUntrackedParameter<std::string>( "EcalTBInfoLabel" ,
51  "SimEcalTBG4Object" ) ;
52 
53  m_doReadout = params.getParameter<bool>( "doReadout" ) ;
54 
55  m_theTBReadout = new EcalTBReadout( m_ecalTBInfoLabel ) ;
56 
57  m_tunePhaseShift = params.getParameter<double>( "tunePhaseShift" ) ;
58 
59  if( m_doPhaseShift )
60  {
61  iC.consumes<PEcalTBInfo>(edm::InputTag(params.getUntrackedParameter<std::string>("EcalTBInfoLabel","SimEcalTBG4Object")));
62  }
63 }
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalDigiProducer(const edm::ParameterSet &params, edm::ProducerBase &mixMod, edm::ConsumesCollector &iC)
static PFTauRenderPlugin instance
std::vector< EcalTBTDCRecInfoAlgo::EcalTBTDCRanges > m_tdcRanges
vector< ParameterSet > Parameters
std::string m_EBdigiFinalTag
string ranges
Definition: diffTwoXMLs.py:78
EcalTBReadout * m_theTBReadout
std::string m_EBdigiTempTag
std::string m_ecalTBInfoLabel
def move(src, dest)
Definition: eostools.py:510
EcalTBDigiProducer::~EcalTBDigiProducer ( )
override

Definition at line 65 of file EcalTBDigiProducer.cc.

66 {
67 }

Member Function Documentation

void EcalTBDigiProducer::cacheEBDigis ( const EBDigiCollection ebDigiPtr) const
overrideprivatevirtual

Reimplemented from EcalDigiProducer.

Definition at line 170 of file EcalTBDigiProducer.cc.

References m_ebDigis.

171 {
172  m_ebDigis.reset( new EBDigiCollection ) ;
173  *m_ebDigis = *ebDigiPtr ;
174 }
std::unique_ptr< EBDigiCollection > m_ebDigis
void EcalTBDigiProducer::cacheEEDigis ( const EEDigiCollection eeDigiPtr) const
overrideprivatevirtual

Reimplemented from EcalDigiProducer.

Definition at line 177 of file EcalTBDigiProducer.cc.

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

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

Definition at line 152 of file EcalTBDigiProducer.cc.

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

Referenced by initializeEvent().

153 {
154  const unsigned int thisChannel ( 1 ) ;
155 
156  const unsigned int thisCount (
157  (unsigned int)( m_thisPhaseShift*( m_tdcRanges[0].tdcMax[0]
158  - m_tdcRanges[0].tdcMin[0] )
159  + m_tdcRanges[0].tdcMin[0] ) ) ;
160 
161  EcalTBTDCSample theTBTDCSample ( thisChannel, thisCount ) ;
162 
163  const unsigned int sampleIndex ( 0 ) ;
164  theTBTDCRawInfo.setSample( sampleIndex, theTBTDCSample ) ;
165 
166  LogDebug("EcalDigi") << theTBTDCSample << "\n" << theTBTDCRawInfo ;
167 }
#define LogDebug(id)
std::vector< EcalTBTDCRecInfoAlgo::EcalTBTDCRanges > m_tdcRanges
void setSample(unsigned int i, const EcalTBTDCSample &sam)
void EcalTBDigiProducer::finalizeEvent ( edm::Event ,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from EcalDigiProducer.

Definition at line 93 of file EcalTBDigiProducer.cc.

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

93  {
94  m_ebDigis.reset( new EBDigiCollection ) ;
95 
96  EcalDigiProducer::finalizeEvent( event, eventSetup ) ;
97 
98  const EBDigiCollection* barrelResult ( &*m_ebDigis ) ;
99 
100  std::unique_ptr<EBDigiCollection> barrelReadout( new EBDigiCollection() ) ;
101  if( m_doReadout )
102  {
104  m_theTTmap,
105  *barrelResult,
106  *barrelReadout ) ;
107  }
108  else
109  {
110  *barrelReadout = *barrelResult ;
111  }
112 
113  std::cout<< "===**** EcalTBDigiProducer: number of barrel digis = "
114  << barrelReadout->size()<<std::endl ;
115 
116  std::string const instance("simEcalUnsuppressedDigis");
117  event.put(std::move(barrelReadout), instance + m_EBdigiFinalTag) ;
118  event.put(std::move(m_TDCproduct), instance) ;
119 
120  m_ebDigis.reset(); // release memory
121  m_eeDigis.reset(); // release memory
122 }
const EcalTrigTowerConstituentsMap m_theTTmap
std::unique_ptr< EEDigiCollection > m_eeDigis
static PFTauRenderPlugin instance
std::unique_ptr< EBDigiCollection > m_ebDigis
std::string m_EBdigiFinalTag
void performReadout(edm::Event &event, const EcalTrigTowerConstituentsMap &theTTmap, const EBDigiCollection &input, EBDigiCollection &output)
master function to be called once per event
EcalTBReadout * m_theTBReadout
std::unique_ptr< EcalTBTDCRawInfo > m_TDCproduct
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
def move(src, dest)
Definition: eostools.py:510
Definition: event.py:1
void EcalTBDigiProducer::initializeEvent ( edm::Event const &  event,
edm::EventSetup const &  eventSetup 
)
overridevirtual

Reimplemented from EcalDigiProducer.

Definition at line 69 of file EcalTBDigiProducer.cc.

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

69  {
70  std::cout<<"====****Entering EcalTBDigiProducer produce()"<<std::endl ;
71  edm::ESHandle<CaloGeometry> hGeometry ;
72  eventSetup.get<CaloGeometryRecord>().get( hGeometry ) ;
73  const std::vector<DetId>& theBarrelDets (
74  hGeometry->getValidDetIds(DetId::Ecal, EcalBarrel) ) ;
75 
76  m_theTBReadout->setDetIds( theBarrelDets ) ;
77 
78  m_TDCproduct.reset( new EcalTBTDCRawInfo(1) ) ;
79  if( m_doPhaseShift )
80  {
81  edm::Handle<PEcalTBInfo> theEcalTBInfo ;
82  event.getByLabel( m_ecalTBInfoLabel, theEcalTBInfo ) ;
83  m_thisPhaseShift = theEcalTBInfo->phaseShift() ;
84 
85  DetId detId( DetId::Ecal, 1 ) ;
86  setPhaseShift( detId ) ;
87 
88  fillTBTDCRawInfo( *m_TDCproduct ) ; // fill the TDC info in the event
89  }
91 }
void fillTBTDCRawInfo(EcalTBTDCRawInfo &theTBTDCRawInfo)
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
void setPhaseShift(const DetId &detId)
void setDetIds(const std::vector< DetId > &detIds)
tell the readout which cells exist
Definition: EcalTBReadout.h:27
Definition: DetId.h:18
EcalTBReadout * m_theTBReadout
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
double phaseShift() const
Definition: PEcalTBInfo.h:38
std::unique_ptr< EcalTBTDCRawInfo > m_TDCproduct
std::string m_ecalTBInfoLabel
Definition: event.py:1
void EcalTBDigiProducer::setPhaseShift ( const DetId detId)
private

Definition at line 125 of file EcalTBDigiProducer.cc.

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

Referenced by initializeEvent().

126 {
127  const CaloSimParameters& parameters (
128  EcalDigiProducer::m_ParameterMap->simParameters( detId ) ) ;
129 
130  if ( !parameters.syncPhase() )
131  {
132  const int myDet ( detId.subdetId() ) ;
133 
134  LogDebug("EcalDigi") << "Setting the phase shift "
135  << m_thisPhaseShift
136  << " and the offset "
137  << m_tunePhaseShift
138  << " for the subdetector "
139  << myDet;
140 
141  if( myDet == 1 )
142  {
143  double passPhaseShift ( m_thisPhaseShift + m_tunePhaseShift ) ;
144  if( m_use2004OffsetConvention ) passPhaseShift = 1. - passPhaseShift ;
145  EcalDigiProducer::m_EBResponse->setPhaseShift( passPhaseShift ) ;
146  EcalDigiProducer::m_EEResponse->setPhaseShift( passPhaseShift ) ;
147  }
148  }
149 }
#define LogDebug(id)
Main class for Parameters in different subdetectors.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
std::unique_ptr< EEHitResponse > m_EEResponse
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< const EcalSimParameterMap > m_ParameterMap

Member Data Documentation

bool EcalTBDigiProducer::m_doPhaseShift
private

Definition at line 47 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and initializeEvent().

bool EcalTBDigiProducer::m_doReadout
private

Definition at line 50 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and finalizeEvent().

std::string EcalTBDigiProducer::m_EBdigiFinalTag
private

Definition at line 44 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and finalizeEvent().

std::unique_ptr<EBDigiCollection> EcalTBDigiProducer::m_ebDigis
mutableprivate

Definition at line 57 of file EcalTBDigiProducer.h.

Referenced by cacheEBDigis(), and finalizeEvent().

std::string EcalTBDigiProducer::m_EBdigiTempTag
private

Definition at line 45 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer().

std::string EcalTBDigiProducer::m_ecalTBInfoLabel
private

Definition at line 43 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and initializeEvent().

std::unique_ptr<EEDigiCollection> EcalTBDigiProducer::m_eeDigis
mutableprivate

Definition at line 58 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent().

std::unique_ptr<EcalTBTDCRawInfo> EcalTBDigiProducer::m_TDCproduct
mutableprivate

Definition at line 59 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent(), and initializeEvent().

std::vector<EcalTBTDCRecInfoAlgo::EcalTBTDCRanges> EcalTBDigiProducer::m_tdcRanges
private

Definition at line 52 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and fillTBTDCRawInfo().

EcalTBReadout* EcalTBDigiProducer::m_theTBReadout
private

Definition at line 41 of file EcalTBDigiProducer.h.

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

const EcalTrigTowerConstituentsMap EcalTBDigiProducer::m_theTTmap
private

Definition at line 40 of file EcalTBDigiProducer.h.

Referenced by finalizeEvent().

double EcalTBDigiProducer::m_thisPhaseShift
private
double EcalTBDigiProducer::m_tunePhaseShift
private

Definition at line 55 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().

bool EcalTBDigiProducer::m_use2004OffsetConvention
private

Definition at line 53 of file EcalTBDigiProducer.h.

Referenced by EcalTBDigiProducer(), and setPhaseShift().