00001 #include "CSCTFTrackProducer.h"
00002
00003 #include "L1Trigger/CSCTrackFinder/src/CSCTFTrackBuilder.h"
00004
00005 #include <vector>
00006 #include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
00007 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00008 #include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h"
00009 #include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h"
00010 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
00011
00012 #include "L1Trigger/CSCCommonTrigger/interface/CSCTriggerGeometry.h"
00013 #include "Geometry/Records/interface/MuonGeometryRecord.h"
00014
00015 #include "DataFormats/Common/interface/Handle.h"
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/Framework/interface/EventSetup.h"
00018 #include "FWCore/Framework/interface/ESHandle.h"
00019
00020 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
00021 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
00022 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
00023 #include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
00024
00025 CSCTFTrackProducer::CSCTFTrackProducer(const edm::ParameterSet& pset)
00026 {
00027 input_module = pset.getUntrackedParameter<edm::InputTag>("SectorReceiverInput");
00028 dt_producer = pset.getUntrackedParameter<edm::InputTag>("DTproducer");
00029 sp_pset = pset.getParameter<edm::ParameterSet>("SectorProcessor");
00030 useDT = pset.getParameter<bool>("useDT");
00031 TMB07 = pset.getParameter<bool>("isTMB07");
00032 m_scalesCacheID = 0ULL ;
00033 m_ptScaleCacheID = 0ULL ;
00034 my_builder = 0 ;
00035 produces<L1CSCTrackCollection>();
00036 produces<CSCTriggerContainer<csctf::TrackStub> >();
00037 }
00038
00039 CSCTFTrackProducer::~CSCTFTrackProducer()
00040 {
00041 delete my_builder;
00042 my_builder = 0;
00043 }
00044
00045 void CSCTFTrackProducer::beginJob(const edm::EventSetup& es){
00046
00047 }
00048
00049 void CSCTFTrackProducer::produce(edm::Event & e, const edm::EventSetup& c)
00050 {
00051
00052
00053 if( c.get< L1MuTriggerScalesRcd >().cacheIdentifier() != m_scalesCacheID ||
00054 c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID )
00055 {
00056 if(my_builder) delete my_builder ;
00057
00058 edm::ESHandle< L1MuTriggerScales > scales ;
00059 c.get< L1MuTriggerScalesRcd >().get( scales ) ;
00060
00061 edm::ESHandle< L1MuTriggerPtScale > ptScale ;
00062 c.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
00063
00064 my_builder = new CSCTFTrackBuilder(sp_pset,TMB07,
00065 scales.product(),ptScale.product());
00066 my_builder->initialize(c);
00067
00068 m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier() ;
00069 m_ptScaleCacheID = c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() ;
00070 }
00071
00072
00073 edm::ESHandle<CSCGeometry> pDD;
00074
00075 c.get<MuonGeometryRecord>().get( pDD );
00076 CSCTriggerGeometry::setGeometry(pDD);
00077
00078 edm::Handle<CSCCorrelatedLCTDigiCollection> LCTs;
00079 edm::Handle<L1MuDTChambPhContainer> dttrig;
00080 std::auto_ptr<L1CSCTrackCollection> track_product(new L1CSCTrackCollection);
00081 std::auto_ptr<CSCTriggerContainer<csctf::TrackStub> > dt_stubs(new CSCTriggerContainer<csctf::TrackStub>);
00082
00083 e.getByLabel(input_module.label(),input_module.instance(), LCTs);
00084 if(useDT)
00085 e.getByLabel(dt_producer.label(),dt_producer.instance(), dttrig);
00086
00087 my_builder->buildTracks(LCTs.product(), (useDT?dttrig.product():0), track_product.get(), dt_stubs.get());
00088
00089 e.put(track_product);
00090 e.put(dt_stubs);
00091 }