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>
34 
36 public:
38  ~HLTScoutingTrackProducer() override;
39 
40  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
41 
42 private:
43  void produce(edm::StreamID sid, edm::Event& iEvent, edm::EventSetup const& setup) const final;
44 
47 
48  const int mantissaPrecision;
49  const double vtxMinDist;
50 };
51 
52 //
53 // constructors and destructor
54 //
56  : otherTrackCollection_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("OtherTracks"))),
57  vertexCollection_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexCollection"))),
58  mantissaPrecision(iConfig.getParameter<int>("mantissaPrecision")),
59  vtxMinDist(iConfig.getParameter<double>("vtxMinDist")) {
60  //register products
61  produces<Run3ScoutingTrackCollection>();
62 }
63 
65 
66 // ------------ method called to produce the data ------------
68  using namespace edm;
69 
70  std::unique_ptr<Run3ScoutingTrackCollection> outTrack(new Run3ScoutingTrackCollection());
71 
72  Handle<reco::TrackCollection> otherTrackCollection;
74 
75  if (iEvent.getByToken(otherTrackCollection_, otherTrackCollection)) {
76  //match tracks to vertices
77  for (auto& trk : *otherTrackCollection) {
78  int vtxInd = -1;
79  double min_dist = vtxMinDist;
80  int vtxIt = 0;
81 
82  if (iEvent.getByToken(vertexCollection_, vertexCollection)) {
83  for (auto& vrt : *vertexCollection) {
84  double min_dist_tmp = pow(trk.dz(vrt.position()), 2); // hltPixelVertices only clustered in Z
85 
86  if (min_dist_tmp < min_dist) {
87  min_dist = min_dist_tmp;
88  vtxInd = vtxIt;
89  }
90 
91  vtxIt++;
92  }
93  }
94 
95  //fill track information
100  trk.ndof(),
101  trk.charge(),
104  trk.hitPattern().numberOfValidPixelHits(),
105  trk.hitPattern().trackerLayersWithMeasurement(),
106  trk.hitPattern().numberOfValidStripHits(),
126  vtxInd,
130  }
131  }
132 
133  iEvent.put(std::move(outTrack));
134 }
135 
136 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
139  desc.add<edm::InputTag>("OtherTracks", edm::InputTag("hltPixelTracksL3MuonNoVtx"));
140  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
141 
142  desc.add<int>("mantissaPrecision", 10); //default float16, change to 23 for float32
143  desc.add<double>("vtxMinDist", 0.01);
144  descriptions.add("hltScoutingTrackProducer", desc);
145 }
146 
147 // declare this class as a framework plugin
edm::StreamID
Definition: StreamID.h:30
HLTScoutingTrackProducer::otherTrackCollection_
const edm::EDGetTokenT< reco::TrackCollection > otherTrackCollection_
Definition: HLTScoutingTrackProducer.cc:45
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::EDGetTokenT< reco::TrackCollection >
Run3ScoutingVertex.h
TrackBase.h
edm
HLT enums.
Definition: AlignableModifier.h:19
AssociationMap.h
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTScoutingTrackProducer::HLTScoutingTrackProducer
HLTScoutingTrackProducer(const edm::ParameterSet &)
Definition: HLTScoutingTrackProducer.cc:55
getRef.h
HLTScoutingTrackProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HLTScoutingTrackProducer.cc:137
HLTScoutingTrackProducer::produce
void produce(edm::StreamID sid, edm::Event &iEvent, edm::EventSetup const &setup) const final
Definition: HLTScoutingTrackProducer.cc:67
HLT_2018_cff.mantissaPrecision
mantissaPrecision
Definition: HLT_2018_cff.py:88452
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle< reco::TrackCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
MakerMacros.h
Track.h
TrackFwd.h
libminifloat.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MuonFwd.h
HLTScoutingTrackProducer::vtxMinDist
const double vtxMinDist
Definition: HLTScoutingTrackProducer.cc:49
Run3ScoutingTrackCollection
std::vector< Run3ScoutingTrack > Run3ScoutingTrackCollection
Definition: Run3ScoutingTrack.h:190
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
Vertex.h
HLTScoutingTrackProducer::vertexCollection_
const edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
Definition: HLTScoutingTrackProducer.cc:46
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
MiniFloatConverter::reduceMantissaToNbitsRounding
static float reduceMantissaToNbitsRounding(const float &f)
Definition: libminifloat.h:102
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
Run3ScoutingTrack.h
HLTScoutingTrackProducer
Definition: HLTScoutingTrackProducer.cc:35
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
HitPattern.h
HLTScoutingTrackProducer::mantissaPrecision
const int mantissaPrecision
Definition: HLTScoutingTrackProducer.cc:48
ValueMap.h
VertexFwd.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
RecoChargedCandidate.h
Frameworkfwd.h
spclusmultinvestigator_cfi.vertexCollection
vertexCollection
Definition: spclusmultinvestigator_cfi.py:4
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
RecoChargedCandidateFwd.h
Run3ScoutingMuon.h
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
HLTScoutingTrackProducer::~HLTScoutingTrackProducer
~HLTScoutingTrackProducer() override