-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scouting - add track collection #22401
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#ifndef DataFormats_ScoutingTrack_h | ||
#define DataFormats_ScoutingTrack_h | ||
|
||
#include <vector> | ||
|
||
//class for holding track information, for use in data scouting | ||
class ScoutingTrack | ||
{ | ||
public: | ||
//constructor with values for all data fields | ||
ScoutingTrack(float tk_pt, float tk_eta, float tk_phi, float tk_chi2, float tk_ndof, int tk_charge, float tk_dxy, float tk_dz, int tk_nValidPixelHits, int tk_nTrackerLayersWithMeasurement, int tk_nValidStripHits, float tk_qoverp, float tk_lambda, float tk_dxy_Error, float tk_dz_Error, float tk_qoverp_Error, float tk_lambda_Error, float tk_phi_Error, float tk_dsz, float tk_dsz_Error): | ||
tk_pt_(tk_pt), tk_eta_(tk_eta), tk_phi_(tk_phi), tk_chi2_(tk_chi2), tk_ndof_(tk_ndof), tk_charge_(tk_charge), tk_dxy_(tk_dxy), tk_dz_(tk_dz), tk_nValidPixelHits_(tk_nValidPixelHits), tk_nTrackerLayersWithMeasurement_(tk_nTrackerLayersWithMeasurement), tk_nValidStripHits_(tk_nValidStripHits), tk_qoverp_(tk_qoverp), tk_lambda_(tk_lambda), tk_dxy_Error_(tk_dxy_Error), tk_dz_Error_(tk_dz_Error), tk_qoverp_Error_(tk_qoverp_Error), tk_lambda_Error_(tk_lambda_Error), tk_phi_Error_(tk_phi_Error), tk_dsz_(tk_dsz), tk_dsz_Error_(tk_dsz_Error) {} | ||
//default constructor | ||
ScoutingTrack():tk_pt_(0), tk_eta_(0), tk_phi_(0), tk_chi2_(0), tk_ndof_(0), tk_charge_(0), tk_dxy_(0), tk_dz_(0), tk_nValidPixelHits_(0), tk_nTrackerLayersWithMeasurement_(0), tk_nValidStripHits_(0), tk_qoverp_(0), tk_lambda_(0), tk_dxy_Error_(0), tk_dz_Error_(0), tk_qoverp_Error_(0), tk_lambda_Error_(0), tk_phi_Error_(0), tk_dsz_(0), tk_dsz_Error_(0) {} | ||
|
||
//accessor functions | ||
float tk_pt() const { return tk_pt_; } | ||
float tk_eta() const { return tk_eta_; } | ||
float tk_phi() const { return tk_phi_; } | ||
float tk_chi2() const { return tk_chi2_; } | ||
float tk_ndof() const { return tk_ndof_; } | ||
int tk_charge() const { return tk_charge_; } | ||
float tk_dxy() const { return tk_dxy_; } | ||
float tk_dz() const { return tk_dz_; } | ||
int tk_nValidPixelHits() const { return tk_nValidPixelHits_; } | ||
int tk_nTrackerLayersWithMeasurement() const { return tk_nTrackerLayersWithMeasurement_; } | ||
int tk_nValidStripHits() const { return tk_nValidStripHits_; } | ||
float tk_qoverp() const { return tk_qoverp_; } | ||
float tk_lambda() const { return tk_lambda_; } | ||
float tk_dxy_Error() const { return tk_dxy_Error_; } | ||
float tk_dz_Error() const { return tk_dz_Error_; } | ||
float tk_qoverp_Error() const { return tk_qoverp_Error_; } | ||
float tk_lambda_Error() const { return tk_lambda_Error_; } | ||
float tk_phi_Error() const { return tk_phi_Error_; } | ||
float tk_dsz() const { return tk_dsz_; } | ||
float tk_dsz_Error() const { return tk_dsz_Error_; } | ||
|
||
private: | ||
float tk_pt_; | ||
float tk_eta_; | ||
float tk_phi_; | ||
float tk_chi2_; | ||
float tk_ndof_; | ||
int tk_charge_; | ||
float tk_dxy_; | ||
float tk_dz_; | ||
int tk_nValidPixelHits_; | ||
int tk_nTrackerLayersWithMeasurement_; | ||
int tk_nValidStripHits_; | ||
float tk_qoverp_; | ||
float tk_lambda_; | ||
float tk_dxy_Error_; | ||
float tk_dz_Error_; | ||
float tk_qoverp_Error_; | ||
float tk_lambda_Error_; | ||
float tk_phi_Error_; | ||
float tk_dsz_; | ||
float tk_dsz_Error_; | ||
}; | ||
|
||
typedef std::vector<ScoutingTrack> ScoutingTrackCollection; | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: HLTrigger/Muon | ||
// Class: HLTScoutingTrackProducer | ||
// | ||
/**\class HLTScoutingTrackProducer HLTScoutingTrackProducer.cc HLTScoutingTrackProducer.cc | ||
|
||
Description: Producer for Scouting Tracks | ||
|
||
*/ | ||
// | ||
|
||
#include "HLTScoutingTrackProducer.h" | ||
#include "DataFormats/Math/interface/deltaR.h" | ||
#include "TMath.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the last two includes needed? |
||
|
||
// | ||
// constructors and destructor | ||
// | ||
HLTScoutingTrackProducer::HLTScoutingTrackProducer(const edm::ParameterSet& iConfig): | ||
OtherTrackCollection_(consumes<reco::TrackCollection> | ||
(iConfig.getParameter<edm::InputTag>("OtherTracks"))) | ||
{ | ||
//register products | ||
produces<ScoutingTrackCollection>(); | ||
} | ||
|
||
HLTScoutingTrackProducer::~HLTScoutingTrackProducer() = default; | ||
|
||
// ------------ method called to produce the data ------------ | ||
void HLTScoutingTrackProducer::produce(edm::StreamID sid, edm::Event & iEvent, | ||
edm::EventSetup const & setup) const | ||
{ | ||
using namespace edm; | ||
|
||
std::unique_ptr<ScoutingTrackCollection> outTrack(new ScoutingTrackCollection()); | ||
|
||
Handle<reco::TrackCollection> OtherTrackCollection; | ||
|
||
if(iEvent.getByToken(OtherTrackCollection_, OtherTrackCollection)){ | ||
// Produce tracks in event | ||
for (auto &trk : *OtherTrackCollection) { | ||
outTrack->emplace_back(trk.pt(), trk.eta(), trk.phi(),trk.chi2(), trk.ndof(), | ||
trk.charge(), trk.dxy(), trk.dz(), trk.hitPattern().numberOfValidPixelHits(), | ||
trk.hitPattern().trackerLayersWithMeasurement(), trk.hitPattern().numberOfValidStripHits(), | ||
trk.qoverp(), trk.lambda(), trk.dxyError(), trk.dzError(), | ||
trk.qoverpError(), | ||
trk.lambdaError(), | ||
trk.phiError(), | ||
trk.dsz(), | ||
trk.dszError() | ||
); | ||
|
||
} | ||
} | ||
|
||
iEvent.put(std::move(outTrack)); | ||
} | ||
|
||
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ | ||
void HLTScoutingTrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("OtherTracks", edm::InputTag("hltPixelTracksL3MuonNoVtx")); | ||
descriptions.add("hltScoutingTrackProducer", desc); | ||
} | ||
|
||
// declare this class as a framework plugin | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(HLTScoutingTrackProducer); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#ifndef HLTScoutingTrackProducer_h | ||
#define HLTScoutingTrackProducer_h | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is best to remove this file and put its content directly in the corresponding .cc file. |
||
// -*- C++ -*- | ||
// | ||
// Package: HLTrigger/Muon | ||
// Class: HLTScoutingTrackProducer | ||
// | ||
/**\class HLTScoutingTrackProducer HLTScoutingTrackProducer.h HLTScoutingTrackProducer.h | ||
|
||
Description: Producer for Scouting Tracks | ||
|
||
*/ | ||
// | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/global/EDProducer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "DataFormats/Common/interface/AssociationMap.h" | ||
#include "DataFormats/Common/interface/getRef.h" | ||
#include "DataFormats/Common/interface/ValueMap.h" | ||
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" | ||
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" | ||
#include "DataFormats/TrackReco/interface/HitPattern.h" | ||
#include "DataFormats/TrackReco/interface/Track.h" | ||
#include "DataFormats/TrackReco/interface/TrackFwd.h" | ||
|
||
#include "DataFormats/VertexReco/interface/Vertex.h" | ||
#include "DataFormats/VertexReco/interface/VertexFwd.h" | ||
|
||
#include "DataFormats/Scouting/interface/ScoutingMuon.h" | ||
#include "DataFormats/Scouting/interface/ScoutingTrack.h" | ||
#include "DataFormats/Scouting/interface/ScoutingVertex.h" | ||
|
||
#include "DataFormats/MuonReco/interface/MuonTrackLinks.h" | ||
#include "DataFormats/MuonReco/interface/MuonFwd.h" | ||
|
||
class HLTScoutingTrackProducer : public edm::global::EDProducer<> { | ||
|
||
public: | ||
explicit HLTScoutingTrackProducer(const edm::ParameterSet&); | ||
~HLTScoutingTrackProducer() override; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to declare the destructor |
||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
void produce(edm::StreamID sid, edm::Event & iEvent, edm::EventSetup const & setup) | ||
const final; | ||
|
||
const edm::EDGetTokenT<reco::TrackCollection> OtherTrackCollection_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CMS coding convention is to start member variables with a lower case letter |
||
|
||
|
||
}; | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version number should be 2