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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
 
std::string geometryType
 
CSCDigitizer theDigitizer
 
CSCStripConditionstheStripConditions
 

Detailed Description

Definition at line 12 of file CSCDigiProducer.h.

Member Typedef Documentation

◆ DigiSimLinks

Definition at line 14 of file CSCDigiProducer.h.

Constructor & Destructor Documentation

◆ CSCDigiProducer()

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

Definition at line 27 of file CSCDigiProducer.cc.

27  : theDigitizer(ps), theStripConditions(nullptr) {
28  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
29  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
30  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
31  produces<DigiSimLinks>("MuonCSCWireDigiSimLinks");
32  produces<DigiSimLinks>("MuonCSCStripDigiSimLinks");
33  std::string stripConditions(ps.getParameter<std::string>("stripConditions"));
34  geometryType = ps.getParameter<std::string>("GeometryType");
35  edm::ParameterSet stripPSet = ps.getParameter<edm::ParameterSet>("strips");
36  if (stripConditions == "Configurable") {
38  } else if (stripConditions == "Database") {
40  } else {
41  throw cms::Exception("CSCDigiProducer") << "Bad option for strip conditions: " << stripConditions;
42  }
44 
46  if (!rng.isAvailable()) {
47  throw cms::Exception("Configuration") << "CSCDigitizer requires the RandomNumberGeneratorService\n"
48  "which is not present in the configuration file. You must add the "
49  "service\n"
50  "in the configuration file or remove the modules that require it.";
51  }
52 
53  std::string mix_ = ps.getParameter<std::string>("mixLabel");
54  std::string collection_ = ps.getParameter<std::string>("InputCollection");
55  cf_token = consumes<CrossingFrame<PSimHit>>(edm::InputTag(mix_, collection_));
56 }

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

◆ ~CSCDigiProducer()

CSCDigiProducer::~CSCDigiProducer ( )
override

Definition at line 58 of file CSCDigiProducer.cc.

58 { 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 60 of file CSCDigiProducer.cc.

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

References cf_token, CSCDigitizer::doAction(), ev, geometryType, edm::EventSetup::get(), get, edm::EventSetup::getData(), edm::RandomNumberGenerator::getEngine(), hfClusterShapes_cfi::hits, CSCStripConditions::initializeEvent(), volumeBasedMagneticField_160812_cfi::magfield, eostools::move(), 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 26 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ geometryType

std::string CSCDigiProducer::geometryType
private

Definition at line 25 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ theDigitizer

CSCDigitizer CSCDigiProducer::theDigitizer
private

Definition at line 23 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

◆ theStripConditions

CSCStripConditions* CSCDigiProducer::theStripConditions
private

Definition at line 24 of file CSCDigiProducer.h.

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

edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
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
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:61
CSCGeometry
Definition: CSCGeometry.h:24
CSCStripDigiCollection
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
Definition: CSCStripDigiCollection.h:14
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
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::geometryType
std::string geometryType
Definition: CSCDigiProducer.h:25
CSCConfigurableStripConditions
Definition: CSCConfigurableStripConditions.h:8
CSCDigiProducer::theStripConditions
CSCStripConditions * theStripConditions
Definition: CSCDigiProducer.h:24
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::Service< edm::RandomNumberGenerator >
edm::LogVerbatim
Definition: MessageLogger.h:297
get
#define get
CSCStripConditions::initializeEvent
virtual void initializeEvent(const edm::EventSetup &es)
Definition: CSCStripConditions.h:24
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CSCDbStripConditions
Definition: CSCDbStripConditions.h:8
CSCWireDigiCollection
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
Definition: CSCWireDigiCollection.h:15
eostools.move
def move(src, dest)
Definition: eostools.py:511
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
Exception
Definition: hltDiff.cc:246
CSCDigiProducer::cf_token
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
Definition: CSCDigiProducer.h:26
CSCDigiProducer::DigiSimLinks
CSCDigitizer::DigiSimLinks DigiSimLinks
Definition: CSCDigiProducer.h:14
CSCDigiProducer::theDigitizer
CSCDigitizer theDigitizer
Definition: CSCDigiProducer.h:23
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
CSCDigitizer::setParticleDataTable
void setParticleDataTable(const ParticleDataTable *pdt)
Definition: CSCDigitizer.cc:183
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34