#include <SimMuon/CSCDigitizer/src/CSCDigiProducer.h>
Public Types | |
typedef CSCDigitizer::DigiSimLinks | DigiSimLinks |
Public Member Functions | |
CSCDigiProducer (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
Produces the EDM products,. | |
virtual | ~CSCDigiProducer () |
Private Attributes | |
std::string | collection_for_XF |
std::string | geometryType |
CSCDigitizer | theDigitizer |
CSCStripConditions * | theStripConditions |
Definition at line 8 of file CSCDigiProducer.h.
Definition at line 11 of file CSCDigiProducer.h.
CSCDigiProducer::CSCDigiProducer | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 20 of file CSCDigiProducer.cc.
References collection_for_XF, Exception, geometryType, edm::ParameterSet::getParameter(), edm::Service< T >::isAvailable(), CSCStripConditions::setRandomEngine(), CSCDigitizer::setRandomEngine(), CSCDigitizer::setStripConditions(), theDigitizer, and theStripConditions.
00021 : theDigitizer(ps), 00022 theStripConditions(0) 00023 { 00024 produces<CSCWireDigiCollection>("MuonCSCWireDigi"); 00025 produces<CSCStripDigiCollection>("MuonCSCStripDigi"); 00026 produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi"); 00027 produces<DigiSimLinks>("MuonCSCWireDigiSimLinks"); 00028 produces<DigiSimLinks>("MuonCSCStripDigiSimLinks"); 00029 std::string stripConditions( ps.getParameter<std::string>("stripConditions") ); 00030 geometryType = ps.getParameter<std::string>("GeometryType"); 00031 edm::ParameterSet stripPSet = ps.getParameter<edm::ParameterSet>("strips"); 00032 if( stripConditions == "Configurable" ) 00033 { 00034 theStripConditions = new CSCConfigurableStripConditions(stripPSet); 00035 } 00036 else if ( stripConditions == "Database" ) 00037 { 00038 theStripConditions = new CSCDbStripConditions(stripPSet); 00039 } 00040 else 00041 { 00042 throw cms::Exception("CSCDigiProducer") 00043 << "Bad option for strip conditions: " 00044 << stripConditions; 00045 } 00046 theDigitizer.setStripConditions(theStripConditions); 00047 00048 edm::Service<edm::RandomNumberGenerator> rng; 00049 if ( ! rng.isAvailable()) { 00050 throw cms::Exception("Configuration") 00051 << "CSCDigitizer requires the RandomNumberGeneratorService\n" 00052 "which is not present in the configuration file. You must add the service\n" 00053 "in the configuration file or remove the modules that require it."; 00054 } 00055 00056 CLHEP::HepRandomEngine& engine = rng->getEngine(); 00057 00058 theDigitizer.setRandomEngine(engine); 00059 theStripConditions->setRandomEngine(engine); 00060 00061 //Name of Collection used for create the XF 00062 collection_for_XF = ps.getParameter<std::string>("InputCollection"); 00063 00064 }
CSCDigiProducer::~CSCDigiProducer | ( | ) | [virtual] |
Definition at line 67 of file CSCDigiProducer.cc.
References theStripConditions.
00068 { 00069 delete theStripConditions; 00070 }
void CSCDigiProducer::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Produces the EDM products,.
Implements edm::EDProducer.
Definition at line 73 of file CSCDigiProducer.cc.
References collection_for_XF, CSCDigitizer::doAction(), geometryType, edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventSetup::getData(), CSCStripConditions::initializeEvent(), volumeBasedMagneticField_1103l_cfi::magfield, edm::Handle< T >::product(), edm::Event::put(), CSCDigitizer::setGeometry(), CSCDigitizer::setMagneticField(), CSCDigitizer::setParticleDataTable(), theDigitizer, and theStripConditions.
00073 { 00074 00075 edm::Handle<CrossingFrame<PSimHit> > cf; 00076 e.getByLabel("mix", collection_for_XF, cf); 00077 00078 std::auto_ptr<MixCollection<PSimHit> > 00079 hits( new MixCollection<PSimHit>(cf.product()) ); 00080 00081 // Create empty output 00082 00083 std::auto_ptr<CSCWireDigiCollection> pWireDigis(new CSCWireDigiCollection()); 00084 std::auto_ptr<CSCStripDigiCollection> pStripDigis(new CSCStripDigiCollection()); 00085 std::auto_ptr<CSCComparatorDigiCollection> pComparatorDigis(new CSCComparatorDigiCollection()); 00086 std::auto_ptr<DigiSimLinks> pWireDigiSimLinks(new DigiSimLinks() ); 00087 std::auto_ptr<DigiSimLinks> pStripDigiSimLinks(new DigiSimLinks() ); 00088 00089 //@@ DOES NOTHING IF NO HITS. Remove this for when there's real neutrons 00090 if(hits->size() > 0) 00091 { 00092 // find the geometry & conditions for this event 00093 edm::ESHandle<CSCGeometry> hGeom; 00094 eventSetup.get<MuonGeometryRecord>().get(geometryType,hGeom); 00095 const CSCGeometry *pGeom = &*hGeom; 00096 00097 theDigitizer.setGeometry( pGeom ); 00098 00099 // find the magnetic field 00100 edm::ESHandle<MagneticField> magfield; 00101 eventSetup.get<IdealMagneticFieldRecord>().get(magfield); 00102 00103 theDigitizer.setMagneticField(&*magfield); 00104 00105 00106 // set the particle table 00107 edm::ESHandle < ParticleDataTable > pdt; 00108 eventSetup.getData( pdt ); 00109 theDigitizer.setParticleDataTable(&*pdt); 00110 00111 theStripConditions->initializeEvent(eventSetup); 00112 00113 // run the digitizer 00114 theDigitizer.doAction(*hits, *pWireDigis, *pStripDigis, *pComparatorDigis, 00115 *pWireDigiSimLinks, *pStripDigiSimLinks); 00116 } 00117 00118 00119 // store them in the event 00120 e.put(pWireDigis, "MuonCSCWireDigi"); 00121 e.put(pStripDigis, "MuonCSCStripDigi"); 00122 e.put(pComparatorDigis, "MuonCSCComparatorDigi"); 00123 e.put(pWireDigiSimLinks, "MuonCSCWireDigiSimLinks"); 00124 e.put(pStripDigiSimLinks, "MuonCSCStripDigiSimLinks"); 00125 }
std::string CSCDigiProducer::collection_for_XF [private] |
std::string CSCDigiProducer::geometryType [private] |
CSCDigitizer CSCDigiProducer::theDigitizer [private] |
Definition at line 22 of file CSCDigiProducer.h.
Referenced by CSCDigiProducer(), produce(), and ~CSCDigiProducer().