Go to the documentation of this file.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 directProd = pset.getUntrackedParameter<edm::InputTag>("DtDirectProd");
00030 sp_pset = pset.getParameter<edm::ParameterSet>("SectorProcessor");
00031 useDT = pset.getParameter<bool>("useDT");
00032 readDtDirect = pset.getParameter<bool>("readDtDirect");
00033 TMB07 = pset.getParameter<bool>("isTMB07");
00034 my_dtrc = new CSCTFDTReceiver();
00035 m_scalesCacheID = 0ULL ;
00036 m_ptScaleCacheID = 0ULL ;
00037 my_builder = 0 ;
00038 produces<L1CSCTrackCollection>();
00039 produces<CSCTriggerContainer<csctf::TrackStub> >();
00040 }
00041
00042 CSCTFTrackProducer::~CSCTFTrackProducer()
00043 {
00044 delete my_dtrc;
00045 my_dtrc = NULL;
00046
00047 delete my_builder;
00048 my_builder = 0;
00049 }
00050
00051 void CSCTFTrackProducer::beginJob(){
00052
00053 }
00054
00055 void CSCTFTrackProducer::produce(edm::Event & e, const edm::EventSetup& c)
00056 {
00057
00058
00059 if( c.get< L1MuTriggerScalesRcd >().cacheIdentifier() != m_scalesCacheID ||
00060 c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID )
00061 {
00062 if(my_builder) delete my_builder ;
00063
00064 edm::ESHandle< L1MuTriggerScales > scales ;
00065 c.get< L1MuTriggerScalesRcd >().get( scales ) ;
00066
00067 edm::ESHandle< L1MuTriggerPtScale > ptScale ;
00068 c.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
00069
00070 my_builder = new CSCTFTrackBuilder(sp_pset,TMB07,
00071 scales.product(),ptScale.product());
00072 my_builder->initialize(c);
00073
00074 m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier() ;
00075 m_ptScaleCacheID = c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() ;
00076 }
00077
00078
00079 edm::ESHandle<CSCGeometry> pDD;
00080
00081 c.get<MuonGeometryRecord>().get( pDD );
00082 CSCTriggerGeometry::setGeometry(pDD);
00083
00084 edm::Handle<CSCCorrelatedLCTDigiCollection> LCTs;
00085 std::auto_ptr<L1CSCTrackCollection> track_product(new L1CSCTrackCollection);
00086 e.getByLabel(input_module.label(),input_module.instance(), LCTs);
00087 std::auto_ptr<CSCTriggerContainer<csctf::TrackStub> > dt_stubs(new CSCTriggerContainer<csctf::TrackStub>);
00088
00089
00091 CSCTriggerContainer<csctf::TrackStub> emulStub;
00092 if(readDtDirect == false)
00093 {
00094 edm::Handle<L1MuDTChambPhContainer> dttrig;
00095 e.getByLabel(dt_producer.label(),dt_producer.instance(), dttrig);
00096 emulStub = my_dtrc->process(dttrig.product());
00097 } else {
00098 edm::Handle<CSCTriggerContainer<csctf::TrackStub> > stubsFromDaq;
00099
00100 e.getByLabel(directProd.label(),directProd.instance(), stubsFromDaq);
00101 const CSCTriggerContainer<csctf::TrackStub>* stubPointer = stubsFromDaq.product();
00102 emulStub.push_many(*stubPointer);
00103 }
00104
00105 my_builder->buildTracks(LCTs.product(), (useDT?&emulStub:0), track_product.get(), dt_stubs.get());
00106
00107 e.put(track_product);
00108 e.put(dt_stubs);
00109 }