CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
MuonGeometryRecord
geom_Token
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
magfield_Token
 
edm::ESGetToken
< ParticleDataTable,
edm::DefaultRecord
pdt_Token
 
CSCDigitizer theDigitizer
 
CSCStripConditionstheStripConditions
 

Detailed Description

Definition at line 17 of file CSCDigiProducer.h.

Member Typedef Documentation

Definition at line 19 of file CSCDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file CSCDigiProducer.cc.

References theStripConditions.

55 { delete theStripConditions; }
CSCStripConditions * theStripConditions

Member Function Documentation

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(), edm::EventID::event(), geom_Token, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), edm::EventSetup::getHandle(), edm::EventBase::id(), CSCStripConditions::initializeEvent(), volumeBasedMagneticField_160812_cfi::magfield, magfield_Token, eostools::move(), pdt_Token, edm::Handle< T >::product(), edm::Event::put(), edm::EventID::run(), CSCDigitizer::setGeometry(), CSCDigitizer::setMagneticField(), CSCDigitizer::setParticleDataTable(), edm::Event::streamID(), 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
79  edm::ESHandle<CSCGeometry> hGeom = eventSetup.getHandle(geom_Token);
80  const CSCGeometry *pGeom = &*hGeom;
81 
83 
84  // find the magnetic field
86 
87  theDigitizer.setMagneticField(&*magfield);
88 
89  // set the particle table
90  edm::ESHandle<ParticleDataTable> pdt = eventSetup.getHandle(pdt_Token);
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
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
CSCStripConditions * theStripConditions
bool ev
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
def move
Definition: eostools.py:511
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfield_Token
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geom_Token
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
T const * product() const
Definition: Handle.h:70
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

Member Data Documentation

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

Definition at line 31 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

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

Definition at line 32 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

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

Definition at line 33 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

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

Definition at line 34 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

CSCDigitizer CSCDigiProducer::theDigitizer
private

Definition at line 28 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

CSCStripConditions* CSCDigiProducer::theStripConditions
private

Definition at line 29 of file CSCDigiProducer.h.

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