CMS 3D CMS Logo

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

#include <CSCDigiProducer.h>

Inheritance diagram for CSCDigiProducer:
edm::stream::EDProducer<>

Public Types

typedef CSCDigitizer::DigiSimLinks DigiSimLinks
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

 CSCDigiProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~CSCDigiProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordgeom_Token
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagfield_Token
 
edm::ESGetToken< ParticleDataTable, edm::DefaultRecordpdt_Token
 
CSCDigitizer theDigitizer
 
CSCStripConditionstheStripConditions
 

Detailed Description

Definition at line 17 of file CSCDigiProducer.h.

Member Typedef Documentation

◆ DigiSimLinks

Definition at line 19 of file CSCDigiProducer.h.

Constructor & Destructor Documentation

◆ CSCDigiProducer()

CSCDigiProducer::CSCDigiProducer ( const edm::ParameterSet ps)
explicit

Definition at line 20 of file CSCDigiProducer.cc.

20  : theDigitizer(ps), theStripConditions(nullptr) {
21  geom_Token =
22  esConsumes<CSCGeometry, MuonGeometryRecord>(edm::ESInputTag("", ps.getParameter<std::string>("GeometryType")));
23  magfield_Token = esConsumes<MagneticField, IdealMagneticFieldRecord>();
24  pdt_Token = esConsumes<ParticleDataTable, edm::DefaultRecord>();
25  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
26  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
27  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
28  produces<DigiSimLinks>("MuonCSCWireDigiSimLinks");
29  produces<DigiSimLinks>("MuonCSCStripDigiSimLinks");
30  std::string stripConditions(ps.getParameter<std::string>("stripConditions"));
31 
32  edm::ParameterSet stripPSet = ps.getParameter<edm::ParameterSet>("strips");
33  if (stripConditions == "Configurable") {
35  } else if (stripConditions == "Database") {
36  theStripConditions = new CSCDbStripConditions(stripPSet, consumesCollector());
37  } else {
38  throw cms::Exception("CSCDigiProducer") << "Bad option for strip conditions: " << stripConditions;
39  }
41 
43  if (!rng.isAvailable()) {
44  throw cms::Exception("Configuration") << "CSCDigitizer requires the RandomNumberGeneratorService\n"
45  "which is not present in the configuration file. You must add the "
46  "service\n"
47  "in the configuration file or remove the modules that require it.";
48  }
49 
50  std::string mix_ = ps.getParameter<std::string>("mixLabel");
51  std::string collection_ = ps.getParameter<std::string>("InputCollection");
52  cf_token = consumes<CrossingFrame<PSimHit>>(edm::InputTag(mix_, collection_));
53 }

References cf_token, Exception, geom_Token, edm::ParameterSet::getParameter(), HLT_FULL_cff::InputTag, edm::Service< T >::isAvailable(), magfield_Token, pdt_Token, CSCDigitizer::setStripConditions(), AlCaHLTBitMon_QueryRunRegistry::string, muonCSCDigis_cfi::stripConditions, theDigitizer, and theStripConditions.

◆ ~CSCDigiProducer()

CSCDigiProducer::~CSCDigiProducer ( )
override

Definition at line 55 of file CSCDigiProducer.cc.

55 { delete theStripConditions; }

References theStripConditions.

Member Function Documentation

◆ produce()

void CSCDigiProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Produces the EDM products,

Definition at line 57 of file CSCDigiProducer.cc.

57  {
58  edm::LogVerbatim("CSCDigitizer") << "[CSCDigiProducer::produce] starting event " << ev.id().event() << " of run "
59  << ev.id().run();
61  CLHEP::HepRandomEngine *engine = &rng->getEngine(ev.streamID());
62 
64  ev.getByToken(cf_token, cf);
65 
66  std::unique_ptr<MixCollection<PSimHit>> hits(new MixCollection<PSimHit>(cf.product()));
67 
68  // Create empty output
69 
70  std::unique_ptr<CSCWireDigiCollection> pWireDigis(new CSCWireDigiCollection());
71  std::unique_ptr<CSCStripDigiCollection> pStripDigis(new CSCStripDigiCollection());
72  std::unique_ptr<CSCComparatorDigiCollection> pComparatorDigis(new CSCComparatorDigiCollection());
73  std::unique_ptr<DigiSimLinks> pWireDigiSimLinks(new DigiSimLinks());
74  std::unique_ptr<DigiSimLinks> pStripDigiSimLinks(new DigiSimLinks());
75 
76  //@@ DOES NOTHING IF NO HITS. Remove this for when there's real neutrons
77  if (hits->size() > 0) {
78  // find the geometry & conditions for this event
79  edm::ESHandle<CSCGeometry> hGeom = eventSetup.getHandle(geom_Token);
80  const CSCGeometry *pGeom = &*hGeom;
81 
83 
84  // find the magnetic field
86 
88 
89  // set the particle table
90  edm::ESHandle<ParticleDataTable> pdt = eventSetup.getHandle(pdt_Token);
91  eventSetup.getData(pdt);
93 
95 
96  // run the digitizer
98  *hits, *pWireDigis, *pStripDigis, *pComparatorDigis, *pWireDigiSimLinks, *pStripDigiSimLinks, engine);
99  }
100 
101  // store them in the event
102  ev.put(std::move(pWireDigis), "MuonCSCWireDigi");
103  ev.put(std::move(pStripDigis), "MuonCSCStripDigi");
104  ev.put(std::move(pComparatorDigis), "MuonCSCComparatorDigi");
105  ev.put(std::move(pWireDigiSimLinks), "MuonCSCWireDigiSimLinks");
106  ev.put(std::move(pStripDigiSimLinks), "MuonCSCStripDigiSimLinks");
107 }

References cf_token, CSCDigitizer::doAction(), ev, geom_Token, edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), edm::EventSetup::getHandle(), hfClusterShapes_cfi::hits, CSCStripConditions::initializeEvent(), volumeBasedMagneticField_160812_cfi::magfield, magfield_Token, eostools::move(), pdt_Token, edm::Handle< T >::product(), CSCDigitizer::setGeometry(), CSCDigitizer::setMagneticField(), CSCDigitizer::setParticleDataTable(), theDigitizer, and theStripConditions.

Member Data Documentation

◆ cf_token

edm::EDGetTokenT<CrossingFrame<PSimHit> > CSCDigiProducer::cf_token
private

Definition at line 31 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ geom_Token

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> CSCDigiProducer::geom_Token
private

Definition at line 32 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ magfield_Token

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CSCDigiProducer::magfield_Token
private

Definition at line 33 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ pdt_Token

edm::ESGetToken<ParticleDataTable, edm::DefaultRecord> CSCDigiProducer::pdt_Token
private

Definition at line 34 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ theDigitizer

CSCDigitizer CSCDigiProducer::theDigitizer
private

Definition at line 28 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ theStripConditions

CSCStripConditions* CSCDigiProducer::theStripConditions
private

Definition at line 29 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), produce(), and ~CSCDigiProducer().

CSCDigiProducer::geom_Token
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geom_Token
Definition: CSCDigiProducer.h:32
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::ESInputTag
Definition: ESInputTag.h:87
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CSCDigitizer::setMagneticField
void setMagneticField(const MagneticField *field)
sets the magnetic field
Definition: CSCDigitizer.cc:176
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
CSCDigiProducer::magfield_Token
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfield_Token
Definition: CSCDigiProducer.h:33
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
CSCDigitizer::doAction
void doAction(MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks, CLHEP::HepRandomEngine *)
Definition: CSCDigitizer.cc:39
edm::Handle
Definition: AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
CSCDigitizer::setGeometry
void setGeometry(const CSCGeometry *geom)
sets geometry
Definition: CSCDigitizer.h:62
CSCGeometry
Definition: CSCGeometry.h:24
CSCStripDigiCollection
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
Definition: CSCStripDigiCollection.h:14
CSCDigitizer::setStripConditions
void setStripConditions(CSCStripConditions *cond)
Definition: CSCDigitizer.cc:178
MixCollection
Definition: MixCollection.h:11
CSCComparatorDigiCollection
MuonDigiCollection< CSCDetId, CSCComparatorDigi > CSCComparatorDigiCollection
Definition: CSCComparatorDigiCollection.h:14
muonCSCDigis_cfi.stripConditions
stripConditions
Definition: muonCSCDigis_cfi.py:78
edm::ESHandle< CSCGeometry >
CSCDigiProducer::pdt_Token
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > pdt_Token
Definition: CSCDigiProducer.h:34
CSCConfigurableStripConditions
Definition: CSCConfigurableStripConditions.h:8
CSCDigiProducer::theStripConditions
CSCStripConditions * theStripConditions
Definition: CSCDigiProducer.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Service< edm::RandomNumberGenerator >
CSCStripConditions::initializeEvent
virtual void initializeEvent(const edm::EventSetup &es)
Definition: CSCStripConditions.h:24
CSCDbStripConditions
Definition: CSCDbStripConditions.h:8
CSCWireDigiCollection
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
Definition: CSCWireDigiCollection.h:15
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCDigiProducer::cf_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
Definition: CSCDigiProducer.h:31
CSCDigiProducer::DigiSimLinks
CSCDigitizer::DigiSimLinks DigiSimLinks
Definition: CSCDigiProducer.h:19
CSCDigiProducer::theDigitizer
CSCDigitizer theDigitizer
Definition: CSCDigiProducer.h:28
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
CSCDigitizer::setParticleDataTable
void setParticleDataTable(const ParticleDataTable *pdt)
Definition: CSCDigitizer.cc:183