CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDigiProducer.cc
Go to the documentation of this file.
17 
18 
19 
21 : theDigitizer(ps),
22  theStripConditions(0)
23 {
24  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
25  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
26  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
27  produces<DigiSimLinks>("MuonCSCWireDigiSimLinks");
28  produces<DigiSimLinks>("MuonCSCStripDigiSimLinks");
29  std::string stripConditions( ps.getParameter<std::string>("stripConditions") );
30  geometryType = ps.getParameter<std::string>("GeometryType");
31  edm::ParameterSet stripPSet = ps.getParameter<edm::ParameterSet>("strips");
32  if( stripConditions == "Configurable" )
33  {
35  }
36  else if ( stripConditions == "Database" )
37  {
39  }
40  else
41  {
42  throw cms::Exception("CSCDigiProducer")
43  << "Bad option for strip conditions: "
44  << stripConditions;
45  }
47 
49  if ( ! rng.isAvailable()) {
50  throw cms::Exception("Configuration")
51  << "CSCDigitizer requires the RandomNumberGeneratorService\n"
52  "which is not present in the configuration file. You must add the service\n"
53  "in the configuration file or remove the modules that require it.";
54  }
55 
56  CLHEP::HepRandomEngine& engine = rng->getEngine();
57 
60 
61  //Name of Collection used for create the XF
62  collection_for_XF = ps.getParameter<std::string>("InputCollection");
63 
64 }
65 
66 
68 {
69  delete theStripConditions;
70 }
71 
72 
74 
76  e.getByLabel("mix", collection_for_XF, cf);
77 
78  std::auto_ptr<MixCollection<PSimHit> >
79  hits( new MixCollection<PSimHit>(cf.product()) );
80 
81  // Create empty output
82 
83  std::auto_ptr<CSCWireDigiCollection> pWireDigis(new CSCWireDigiCollection());
84  std::auto_ptr<CSCStripDigiCollection> pStripDigis(new CSCStripDigiCollection());
85  std::auto_ptr<CSCComparatorDigiCollection> pComparatorDigis(new CSCComparatorDigiCollection());
86  std::auto_ptr<DigiSimLinks> pWireDigiSimLinks(new DigiSimLinks() );
87  std::auto_ptr<DigiSimLinks> pStripDigiSimLinks(new DigiSimLinks() );
88 
89  //@@ DOES NOTHING IF NO HITS. Remove this for when there's real neutrons
90  if(hits->size() > 0)
91  {
92  // find the geometry & conditions for this event
94  eventSetup.get<MuonGeometryRecord>().get(geometryType,hGeom);
95  const CSCGeometry *pGeom = &*hGeom;
96 
97  theDigitizer.setGeometry( pGeom );
98 
99  // find the magnetic field
101  eventSetup.get<IdealMagneticFieldRecord>().get(magfield);
102 
103  theDigitizer.setMagneticField(&*magfield);
104 
105 
106  // set the particle table
108  eventSetup.getData( pdt );
110 
111  theStripConditions->initializeEvent(eventSetup);
112 
113  // run the digitizer
114  theDigitizer.doAction(*hits, *pWireDigis, *pStripDigis, *pComparatorDigis,
115  *pWireDigiSimLinks, *pStripDigiSimLinks);
116  }
117 
118 
119  // store them in the event
120  e.put(pWireDigis, "MuonCSCWireDigi");
121  e.put(pStripDigis, "MuonCSCStripDigi");
122  e.put(pComparatorDigis, "MuonCSCComparatorDigi");
123  e.put(pWireDigiSimLinks, "MuonCSCWireDigiSimLinks");
124  e.put(pStripDigiSimLinks, "MuonCSCStripDigiSimLinks");
125 }
126 
T getParameter(std::string const &) const
CSCDigiProducer(const edm::ParameterSet &ps)
CSCDigitizer::DigiSimLinks DigiSimLinks
CSCDigitizer theDigitizer
tuple magfield
Definition: HLT_ES_cff.py:2311
void setRandomEngine(CLHEP::HepRandomEngine &engine)
MuonDigiCollection< CSCDetId, CSCStripDigi > CSCStripDigiCollection
CSCStripConditions * theStripConditions
void setRandomEngine(CLHEP::HepRandomEngine &engine)
virtual void initializeEvent(const edm::EventSetup &es)
std::string geometryType
void getData(T &iHolder) const
Definition: EventSetup.h:67
MuonDigiCollection< CSCDetId, CSCComparatorDigi > CSCComparatorDigiCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void doAction(MixCollection< PSimHit > &simHits, CSCWireDigiCollection &wireDigis, CSCStripDigiCollection &stripDigis, CSCComparatorDigiCollection &comparators, DigiSimLinks &wireDigiSimLinks, DigiSimLinks &stripDigiSimLinks)
Definition: CSCDigitizer.cc:45
bool isAvailable() const
Definition: Service.h:47
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...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MuonDigiCollection< CSCDetId, CSCWireDigi > CSCWireDigiCollection
const T & get() const
Definition: EventSetup.h:55
void setParticleDataTable(const ParticleDataTable *pdt)
T const * product() const
Definition: Handle.h:74
virtual void produce(edm::Event &e, const edm::EventSetup &c)
std::string collection_for_XF
void setGeometry(const CSCGeometry *geom)
sets geometry
Definition: CSCDigitizer.h:57
virtual ~CSCDigiProducer()
void setMagneticField(const MagneticField *field)
sets the magnetic field