Go to the documentation of this file.00001 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecHitDProducer.h>
00002 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecHitDBuilder.h>
00003 #include <RecoLocalMuon/CSCRecHitD/src/CSCRecoConditions.h>
00004
00005 #include <FWCore/Framework/interface/Frameworkfwd.h>
00006 #include <FWCore/Framework/interface/EDProducer.h>
00007 #include <FWCore/Framework/interface/Event.h>
00008 #include <FWCore/Framework/interface/MakerMacros.h>
00009 #include <DataFormats/Common/interface/Handle.h>
00010 #include <FWCore/Framework/interface/ESHandle.h>
00011 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00012 #include <FWCore/Utilities/interface/Exception.h>
00013 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00014
00015 #include <Geometry/Records/interface/MuonGeometryRecord.h>
00016
00017 #include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h>
00018 #include <DataFormats/CSCDigi/interface/CSCStripDigiCollection.h>
00019 #include <DataFormats/CSCDigi/interface/CSCWireDigiCollection.h>
00020
00021 CSCRecHitDProducer::CSCRecHitDProducer( const edm::ParameterSet& ps ) :
00022 iRun( 0 ),
00023 useCalib( ps.getParameter<bool>("CSCUseCalibrations") ),
00024 useStaticPedestals( ps.getParameter<bool>("CSCUseStaticPedestals") ),
00025 useTimingCorrections(ps.getParameter<bool>("CSCUseTimingCorrections") ),
00026 useGasGainCorrections(ps.getParameter<bool>("CSCUseGasGainCorrections") ),
00027 stripDigiTag_( ps.getParameter<edm::InputTag>("stripDigiTag") ),
00028 wireDigiTag_( ps.getParameter<edm::InputTag>("wireDigiTag") )
00029
00030 {
00031 recHitBuilder_ = new CSCRecHitDBuilder( ps );
00032 recoConditions_ = new CSCRecoConditions( ps );
00033
00034 recHitBuilder_->setConditions( recoConditions_ );
00035
00036
00037 produces<CSCRecHit2DCollection>();
00038
00039 }
00040
00041 CSCRecHitDProducer::~CSCRecHitDProducer()
00042 {
00043 delete recHitBuilder_;
00044 delete recoConditions_;
00045 }
00046
00047
00048 void CSCRecHitDProducer::produce( edm::Event& ev, const edm::EventSetup& setup )
00049 {
00050
00051 edm::ESHandle<CSCGeometry> h;
00052 setup.get<MuonGeometryRecord>().get( h );
00053 const CSCGeometry* pgeom = &*h;
00054 recHitBuilder_->setGeometry( pgeom );
00055
00056
00057 if ( useCalib || useStaticPedestals || useTimingCorrections || useGasGainCorrections) {
00058 recoConditions_->initializeEvent( setup );
00059 }
00060
00061
00062 edm::Handle<CSCStripDigiCollection> stripDigis;
00063 edm::Handle<CSCWireDigiCollection> wireDigis;
00064 ev.getByLabel( stripDigiTag_, stripDigis);
00065 ev.getByLabel( wireDigiTag_, wireDigis);
00066
00067
00068 std::auto_ptr<CSCRecHit2DCollection> oc( new CSCRecHit2DCollection );
00069
00070
00071
00072 recHitBuilder_->build( stripDigis.product(), wireDigis.product(),*oc);
00073
00074
00075
00076 LogTrace("CSCRecHit")<< "CSCRecHitDProducer: putting rechit collection in event.";
00077 ev.put( oc );
00078
00079 }
00080
00081
00082 DEFINE_FWK_MODULE(CSCRecHitDProducer);
00083