CMS 3D CMS Logo

CSCTFTrackProducer.cc
Go to the documentation of this file.
2 
4 
5 #include <vector>
11 
14 
19 
24 
26 {
27  input_module = consumes<CSCCorrelatedLCTDigiCollection>(pset.getUntrackedParameter<edm::InputTag>("SectorReceiverInput"));
28  dt_producer = consumes<L1MuDTChambPhContainer>(pset.getUntrackedParameter<edm::InputTag>("DTproducer"));
29  directProd = consumes<CSCTriggerContainer<csctf::TrackStub> >(pset.getUntrackedParameter<edm::InputTag>("DtDirectProd"));
30  sp_pset = pset.getParameter<edm::ParameterSet>("SectorProcessor");
31  useDT = pset.getParameter<bool>("useDT");
32  readDtDirect = pset.getParameter<bool>("readDtDirect");
33  TMB07 = pset.getParameter<bool>("isTMB07");
34  my_dtrc = new CSCTFDTReceiver();
35  m_scalesCacheID = 0ULL ;
36  m_ptScaleCacheID = 0ULL ;
38  produces<L1CSCTrackCollection>();
39  produces<CSCTriggerContainer<csctf::TrackStub> >();
40 }
41 
43 {
44  delete my_dtrc;
45  my_dtrc = nullptr;
46 
47  delete my_builder;
48  my_builder = nullptr;
49 }
50 
52  // my_builder->initialize(es);
53 }
54 
56 {
57  // Update CSCTFTrackBuilder only if the scales have changed. Use the
58  // EventSetup cacheIdentifier to tell when this has happened.
60  c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() != m_ptScaleCacheID )
61  {
62  if(my_builder) delete my_builder ;
63 
65  c.get< L1MuTriggerScalesRcd >().get( scales ) ;
66 
68  c.get< L1MuTriggerPtScaleRcd >().get( ptScale ) ;
69 
71  scales.product(),ptScale.product());
73 
74  m_scalesCacheID = c.get< L1MuTriggerScalesRcd >().cacheIdentifier() ;
75  m_ptScaleCacheID = c.get< L1MuTriggerPtScaleRcd >().cacheIdentifier() ;
76  }
77 
78  // set geometry pointer
80  c.get<MuonGeometryRecord>().get( pDD );
81 
83  std::unique_ptr<L1CSCTrackCollection> track_product(new L1CSCTrackCollection);
84  e.getByToken(input_module, LCTs);
85  std::unique_ptr<CSCTriggerContainer<csctf::TrackStub> > dt_stubs(new CSCTriggerContainer<csctf::TrackStub>);
86 
87  // Either emulate or directly read in DT stubs based on switch
90  if(readDtDirect == false)
91  {
93  e.getByToken(dt_producer, dttrig);
94  emulStub = my_dtrc->process(dttrig.product());
95  } else {
97  //e.getByLabel("csctfunpacker","DT",stubsFromDaq);
98  e.getByToken(directProd, stubsFromDaq);
99  const CSCTriggerContainer<csctf::TrackStub>* stubPointer = stubsFromDaq.product();
100  emulStub.push_many(*stubPointer);
101  }
102 
103  my_builder->buildTracks(LCTs.product(), (useDT?&emulStub:nullptr), track_product.get(), dt_stubs.get());
104 
105  e.put(std::move(track_product));
106  e.put(std::move(dt_stubs));
107 }
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
T getUntrackedParameter(std::string const &, T const &) const
CSCTFDTReceiver * my_dtrc
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void beginJob() override
void initialize(const edm::EventSetup &c)
unsigned long long m_scalesCacheID
#define nullptr
std::vector< L1CSCTrack > L1CSCTrackCollection
CSCTriggerContainer< csctf::TrackStub > process(const L1MuDTChambPhContainer *)
edm::EDGetTokenT< L1MuDTChambPhContainer > dt_producer
edm::EDGetTokenT< CSCTriggerContainer< csctf::TrackStub > > directProd
CSCTFTrackBuilder * my_builder
CSCTFTrackProducer(const edm::ParameterSet &)
unsigned long long m_ptScaleCacheID
void push_many(const std::vector< T > &data)
T const * product() const
Definition: Handle.h:81
void buildTracks(const CSCCorrelatedLCTDigiCollection *, const CSCTriggerContainer< csctf::TrackStub > *, L1CSCTrackCollection *, CSCTriggerContainer< csctf::TrackStub > *)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > input_module
~CSCTFTrackProducer() override
const T & get() const
Definition: EventSetup.h:58
const std::vector< double > ptScale
Definition: Utilities.cc:35
T const * product() const
Definition: ESHandle.h:86
edm::ParameterSet sp_pset
def move(src, dest)
Definition: eostools.py:510
void produce(edm::Event &e, const edm::EventSetup &c) override