CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoLocalMuon/CSCSegment/src/CSCSegmentProducer.cc

Go to the documentation of this file.
00001 
00005 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentProducer.h>
00006 #include <RecoLocalMuon/CSCSegment/src/CSCSegmentBuilder.h>
00007 
00008 #include <DataFormats/Common/interface/Handle.h>
00009 #include <FWCore/Framework/interface/ESHandle.h>
00010 #include <FWCore/MessageLogger/interface/MessageLogger.h> 
00011 
00012 #include <Geometry/Records/interface/MuonGeometryRecord.h>
00013 
00014 #include <DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h>
00015 #include <DataFormats/CSCRecHit/interface/CSCSegmentCollection.h>
00016 #include <DataFormats/CSCRecHit/interface/CSCSegment.h>
00017 
00018 CSCSegmentProducer::CSCSegmentProducer(const edm::ParameterSet& pas) : iev(0) {
00019         
00020     inputObjectsTag = pas.getParameter<edm::InputTag>("inputObjects");
00021     segmentBuilder_ = new CSCSegmentBuilder(pas); // pass on the PS
00022 
00023         // register what this produces
00024     produces<CSCSegmentCollection>();
00025 }
00026 
00027 CSCSegmentProducer::~CSCSegmentProducer() {
00028 
00029     LogDebug("CSCSegment|CSC") << "deleting CSCSegmentBuilder after " << iev << " events w/csc data.";
00030     delete segmentBuilder_;
00031 }
00032 
00033 void CSCSegmentProducer::produce(edm::Event& ev, const edm::EventSetup& setup) {
00034 
00035     LogDebug("CSCSegment|CSC") << "start producing segments for " << ++iev << "th event with csc data";
00036         
00037     // find the geometry (& conditions?) for this event & cache it in the builder
00038   
00039     edm::ESHandle<CSCGeometry> h;
00040     setup.get<MuonGeometryRecord>().get(h);
00041     const CSCGeometry* pgeom = &*h;
00042     segmentBuilder_->setGeometry(pgeom);
00043         
00044     // get the collection of CSCRecHit2D
00045     edm::Handle<CSCRecHit2DCollection> cscRecHits;
00046     ev.getByLabel(inputObjectsTag, cscRecHits);  
00047 
00048     // create empty collection of Segments
00049     std::auto_ptr<CSCSegmentCollection> oc( new CSCSegmentCollection );
00050 
00051         // fill the collection
00052     segmentBuilder_->build(cscRecHits.product(), *oc); //@@ FILL oc
00053 
00054     // put collection in event
00055     ev.put(oc);
00056 }