CMS 3D CMS Logo

L1TMuonBarrelKalmanTrackProducer.cc
Go to the documentation of this file.
1 #include <memory>
4 
7 
10 
11 
16 
17 //
18 // class declaration
19 //
20 
22  public:
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28  private:
29  void beginStream(edm::StreamID) override;
30  void produce(edm::Event&, const edm::EventSetup&) override;
31  void endStream() override;
33  std::vector<int> bx_;
36 
37 
38 
39 
40 
41 };
43  src_(consumes<std::vector<L1MuKBMTCombinedStub> >(iConfig.getParameter<edm::InputTag>("src"))),
44  bx_(iConfig.getParameter<std::vector<int> >("bx")),
45  algo_(new L1TMuonBarrelKalmanAlgo(iConfig.getParameter<edm::ParameterSet>("algoSettings"))),
46  trackFinder_(new L1TMuonBarrelKalmanTrackFinder(iConfig.getParameter<edm::ParameterSet>("trackFinderSettings")))
47 {
48  produces <L1MuKBMTrackBxCollection>();
49  produces <l1t::RegionalMuonCandBxCollection>("BMTF");
50 
51 }
52 
53 
55 {
56 
57  if (algo_!=nullptr)
58  delete algo_;
59 
60  if (trackFinder_!=nullptr)
61  delete trackFinder_;
62 
63  // do anything here that needs to be done at destruction time
64  // (e.g. close files, deallocate resources etc.)
65 
66 }
67 
68 
69 
70 
71 //
72 // member functions
73 //
74 
75 // ------------ method called to produce the data ------------
76 void
78 {
79  using namespace edm;
81  iEvent.getByToken(src_,stubHandle);
82 
84  for (uint i=0;i<stubHandle->size();++i) {
85  L1MuKBMTCombinedStubRef r(stubHandle,i);
86  stubs.push_back(r);
87  }
88 
89 
90  std::unique_ptr<l1t::RegionalMuonCandBxCollection> outBMTF(new l1t::RegionalMuonCandBxCollection());
91  std::unique_ptr<L1MuKBMTrackBxCollection> out(new L1MuKBMTrackBxCollection());
92  outBMTF->setBXRange(bx_.front(),bx_.back());
93  out->setBXRange(bx_.front(),bx_.back());
94  for (const auto& bx : bx_) {
96  for (const auto& track :tmp) {
97  out->push_back(bx,track);
98  algo_->addBMTFMuon(bx,track,outBMTF);
99  }
100  }
101  iEvent.put(std::move(outBMTF),"BMTF");
102  iEvent.put(std::move(out));
103 
104 }
105 
106 // ------------ method called once each stream before processing any runs, lumis or events ------------
107 void
109 {
110 }
111 
112 // ------------ method called once each stream after processing all runs, lumis and events ------------
113 void
115 }
116 
117 void
119  //The following says we do not know what parameters are allowed so do no validation
120  // Please change this to state exactly what you do use, even if it is no parameters
122  desc.setUnknown();
123  descriptions.addDefault(desc);
124 }
125 
126 //define this as a plug-in
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
L1MuKBMTrackCollection process(L1TMuonBarrelKalmanAlgo *, const L1MuKBMTCombinedStubRefVector &stubs, int bx)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void produce(edm::Event &, const edm::EventSetup &) override
L1TMuonBarrelKalmanTrackFinder * trackFinder_
L1TMuonBarrelKalmanTrackProducer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< L1MuKBMTCombinedStub > > src_
std::vector< edm::Ref< L1MuKBMTCombinedStubCollection > > L1MuKBMTCombinedStubRefVector
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
BXVector< L1MuKBMTrack > L1MuKBMTrackBxCollection
Definition: L1MuKBMTrack.h:17
def uint(string)
void addBMTFMuon(int, const L1MuKBMTrack &, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HLT enums.
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
def move(src, dest)
Definition: eostools.py:511