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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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.

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

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCDigitizer theDigitizer
CSCStripConditions * theStripConditions
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfield_Token
void setStripConditions(CSCStripConditions *cond)
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geom_Token
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > pdt_Token
bool isAvailable() const
Definition: Service.h:40

◆ ~CSCDigiProducer()

CSCDigiProducer::~CSCDigiProducer ( )
override

Definition at line 55 of file CSCDigiProducer.cc.

References theStripConditions.

55 { delete theStripConditions; }
CSCStripConditions * 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.

References cf_token, CSCDigitizer::doAction(), makeMEIFBenchmarkPlots::ev, options_cfi::eventSetup, geom_Token, edm::RandomNumberGenerator::getEngine(), 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.

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
80  const CSCGeometry *pGeom = &*hGeom;
81 
83 
84  // find the magnetic field
86 
88 
89  // set the particle table
92 
94 
95  // run the digitizer
97  *hits, *pWireDigis, *pStripDigis, *pComparatorDigis, *pWireDigiSimLinks, *pStripDigiSimLinks, engine);
98  }
99 
100  // store them in the event
101  ev.put(std::move(pWireDigis), "MuonCSCWireDigi");
102  ev.put(std::move(pStripDigis), "MuonCSCStripDigi");
103  ev.put(std::move(pComparatorDigis), "MuonCSCComparatorDigi");
104  ev.put(std::move(pWireDigiSimLinks), "MuonCSCWireDigiSimLinks");
105  ev.put(std::move(pStripDigiSimLinks), "MuonCSCStripDigiSimLinks");
106 }
Log< level::Info, true > LogVerbatim
CSCDigitizer::DigiSimLinks DigiSimLinks
CSCDigitizer theDigitizer
T const * product() const
Definition: Handle.h:70
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
CSCStripConditions * theStripConditions
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
virtual void initializeEvent(const edm::EventSetup &es)
MuonDigiCollection< CSCDetId, CSCComparatorDigi > CSCComparatorDigiCollection
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfield_Token
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geom_Token
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
void setParticleDataTable(const ParticleDataTable *pdt)
void doAction(MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks, CLHEP::HepRandomEngine *)
Definition: CSCDigitizer.cc:39
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > pdt_Token
void setGeometry(const CSCGeometry *geom)
sets geometry
Definition: CSCDigitizer.h:62
void setMagneticField(const MagneticField *field)
sets the magnetic field
def move(src, dest)
Definition: eostools.py:511

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().