CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CSCDigiProducer Class Reference

#include <CSCDigiProducer.h>

Inheritance diagram for CSCDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef CSCDigitizer::DigiSimLinks DigiSimLinks
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 CSCDigiProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~CSCDigiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file CSCDigiProducer.h.

Member Typedef Documentation

Definition at line 15 of file CSCDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file CSCDigiProducer.cc.

References cf_token, edm::hlt::Exception, geometryType, edm::RandomNumberGenerator::getEngine(), edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CSCStripConditions::setRandomEngine(), CSCDigitizer::setRandomEngine(), CSCDigitizer::setStripConditions(), AlCaHLTBitMon_QueryRunRegistry::string, theDigitizer, and theStripConditions.

26 : theDigitizer(ps),
28 {
29  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
30  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
31  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
32  produces<DigiSimLinks>("MuonCSCWireDigiSimLinks");
33  produces<DigiSimLinks>("MuonCSCStripDigiSimLinks");
34  std::string stripConditions( ps.getParameter<std::string>("stripConditions") );
35  geometryType = ps.getParameter<std::string>("GeometryType");
36  edm::ParameterSet stripPSet = ps.getParameter<edm::ParameterSet>("strips");
37  if( stripConditions == "Configurable" )
38  {
40  }
41  else if ( stripConditions == "Database" )
42  {
44  }
45  else
46  {
47  throw cms::Exception("CSCDigiProducer")
48  << "Bad option for strip conditions: "
49  << stripConditions;
50  }
52 
54  if ( ! rng.isAvailable()) {
55  throw cms::Exception("Configuration")
56  << "CSCDigitizer requires the RandomNumberGeneratorService\n"
57  "which is not present in the configuration file. You must add the service\n"
58  "in the configuration file or remove the modules that require it.";
59  }
60 
61  CLHEP::HepRandomEngine& engine = rng->getEngine();
62 
65 
66  std::string mix_ = ps.getParameter<std::string>("mixLabel");
67  std::string collection_ = ps.getParameter<std::string>("InputCollection");
68  cf_token = consumes<CrossingFrame<PSimHit> >( edm::InputTag(mix_, collection_) );
69 }
T getParameter(std::string const &) const
CSCDigitizer theDigitizer
void setRandomEngine(CLHEP::HepRandomEngine &engine)
CSCStripConditions * theStripConditions
void setRandomEngine(CLHEP::HepRandomEngine &engine)
std::string geometryType
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
bool isAvailable() const
Definition: Service.h:46
void setStripConditions(CSCStripConditions *cond)
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
CSCDigiProducer::~CSCDigiProducer ( )
virtual

Definition at line 72 of file CSCDigiProducer.cc.

References theStripConditions.

73 {
74  delete theStripConditions;
75 }
CSCStripConditions * theStripConditions

Member Function Documentation

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

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 78 of file CSCDigiProducer.cc.

References cf_token, CSCDigitizer::doAction(), geometryType, edm::EventSetup::get(), edm::Event::getByToken(), edm::EventSetup::getData(), CSCStripConditions::initializeEvent(), HLT_ES_cff::magfield, edm::Handle< T >::product(), edm::Event::put(), CSCDigitizer::setGeometry(), CSCDigitizer::setMagneticField(), CSCDigitizer::setParticleDataTable(), theDigitizer, and theStripConditions.

78  {
79 
81  e.getByToken(cf_token, cf);
82 
83  std::auto_ptr<MixCollection<PSimHit> >
84  hits( new MixCollection<PSimHit>(cf.product()) );
85 
86  // Create empty output
87 
88  std::auto_ptr<CSCWireDigiCollection> pWireDigis(new CSCWireDigiCollection());
89  std::auto_ptr<CSCStripDigiCollection> pStripDigis(new CSCStripDigiCollection());
90  std::auto_ptr<CSCComparatorDigiCollection> pComparatorDigis(new CSCComparatorDigiCollection());
91  std::auto_ptr<DigiSimLinks> pWireDigiSimLinks(new DigiSimLinks() );
92  std::auto_ptr<DigiSimLinks> pStripDigiSimLinks(new DigiSimLinks() );
93 
94  //@@ DOES NOTHING IF NO HITS. Remove this for when there's real neutrons
95  if(hits->size() > 0)
96  {
97  // find the geometry & conditions for this event
99  eventSetup.get<MuonGeometryRecord>().get(geometryType,hGeom);
100  const CSCGeometry *pGeom = &*hGeom;
101 
102  theDigitizer.setGeometry( pGeom );
103 
104  // find the magnetic field
106  eventSetup.get<IdealMagneticFieldRecord>().get(magfield);
107 
108  theDigitizer.setMagneticField(&*magfield);
109 
110 
111  // set the particle table
113  eventSetup.getData( pdt );
115 
116  theStripConditions->initializeEvent(eventSetup);
117 
118  // run the digitizer
119  theDigitizer.doAction(*hits, *pWireDigis, *pStripDigis, *pComparatorDigis,
120  *pWireDigiSimLinks, *pStripDigiSimLinks);
121  }
122 
123 
124  // store them in the event
125  e.put(pWireDigis, "MuonCSCWireDigi");
126  e.put(pStripDigis, "MuonCSCStripDigi");
127  e.put(pComparatorDigis, "MuonCSCComparatorDigi");
128  e.put(pWireDigiSimLinks, "MuonCSCWireDigiSimLinks");
129  e.put(pStripDigiSimLinks, "MuonCSCStripDigiSimLinks");
130 }
CSCDigitizer::DigiSimLinks DigiSimLinks
CSCDigitizer theDigitizer
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
tuple magfield
Definition: HLT_ES_cff.py:2311
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
CSCStripConditions * theStripConditions
virtual void initializeEvent(const edm::EventSetup &es)
std::string geometryType
MuonDigiCollection< CSCDetId, CSCComparatorDigi > CSCComparatorDigiCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< CrossingFrame< PSimHit > > cf_token
void doAction(MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks)
Definition: CSCDigitizer.cc:45
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
void setParticleDataTable(const ParticleDataTable *pdt)
T const * product() const
Definition: Handle.h:81
void setGeometry(const CSCGeometry *geom)
sets geometry
Definition: CSCDigitizer.h:57
void setMagneticField(const MagneticField *field)
sets the magnetic field

Member Data Documentation

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

Definition at line 28 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

std::string CSCDigiProducer::geometryType
private

Definition at line 27 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

CSCDigitizer CSCDigiProducer::theDigitizer
private

Definition at line 25 of file CSCDigiProducer.h.

Referenced by CSCDigiProducer(), and produce().

CSCStripConditions* CSCDigiProducer::theStripConditions
private

Definition at line 26 of file CSCDigiProducer.h.

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