CMS 3D CMS Logo

HLTScoutingTrackProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTrigger/Muon
4 // Class: HLTScoutingTrackProducer
5 //
9 //
10 
11 #include <memory>
32 
34 public:
36  ~HLTScoutingTrackProducer() override;
37 
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39 
40 private:
41  void produce(edm::StreamID sid, edm::Event& iEvent, edm::EventSetup const& setup) const final;
42 
44 };
45 
46 //
47 // constructors and destructor
48 //
50  : otherTrackCollection_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("OtherTracks"))) {
51  //register products
52  produces<ScoutingTrackCollection>();
53 }
54 
56 
57 // ------------ method called to produce the data ------------
59  using namespace edm;
60 
61  std::unique_ptr<ScoutingTrackCollection> outTrack(new ScoutingTrackCollection());
62 
63  Handle<reco::TrackCollection> otherTrackCollection;
64 
65  if (iEvent.getByToken(otherTrackCollection_, otherTrackCollection)) {
66  // Produce tracks in event
67  for (auto& trk : *otherTrackCollection) {
68  outTrack->emplace_back(trk.pt(),
69  trk.eta(),
70  trk.phi(),
71  trk.chi2(),
72  trk.ndof(),
73  trk.charge(),
74  trk.dxy(),
75  trk.dz(),
76  trk.hitPattern().numberOfValidPixelHits(),
77  trk.hitPattern().trackerLayersWithMeasurement(),
78  trk.hitPattern().numberOfValidStripHits(),
79  trk.qoverp(),
80  trk.lambda(),
81  trk.dxyError(),
82  trk.dzError(),
83  trk.qoverpError(),
84  trk.lambdaError(),
85  trk.phiError(),
86  trk.dsz(),
87  trk.dszError());
88  }
89  }
90 
91  iEvent.put(std::move(outTrack));
92 }
93 
94 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
97  desc.add<edm::InputTag>("OtherTracks", edm::InputTag("hltPixelTracksL3MuonNoVtx"));
98  descriptions.add("hltScoutingTrackProducer", desc);
99 }
100 
101 // declare this class as a framework plugin
const edm::EDGetTokenT< reco::TrackCollection > otherTrackCollection_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< ScoutingTrack > ScoutingTrackCollection
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
~HLTScoutingTrackProducer() override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix
HLT enums.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLTScoutingTrackProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:511