14 #include "TLorentzVector.h" 42 muonsToken{consumes<std::vector<reco::Muon>>(iConfig.getParameter<
edm::InputTag>(
"matchMuons"))},
43 PrimVtxToken{consumes<reco::VertexCollection>(iConfig.getParameter<
edm::InputTag>(
"PrimaryVertex"))},
45 matchInDr{iConfig.getParameter<
double>(
"requiredDr")},
47 debug{iConfig.getParameter<
bool>(
"debug")},
48 minPt{iConfig.getParameter<
double>(
"minPt")},
49 maxEta{iConfig.getParameter<
double>(
"maxEta")},
50 maxDxy{iConfig.getParameter<
double>(
"maxDxy")},
51 maxDz{iConfig.getParameter<
double>(
"maxDz")} {
52 produces<reco::TrackCollection>(
"").setBranchAlias(
"");
65 <<
"Input track collection is not valid.\n Returning empty output track collection.";
73 <<
"Input muon collection is not valid.\n Returning empty output track collection.";
81 <<
"Input vertex collection is not valid.\n Returning empty output track collection.";
89 std::vector<reco::Track> selTracks;
91 unsigned int tMuon = 0;
97 double chiNdof =
track.normalizedChi2();
112 for (
const auto &
m : *
muons) {
113 if (
m.isTrackerMuon()) {
130 if (
track.validFraction() < 1.0)
133 if (chiNdof < fitProb) {
139 edm::LogPrint(
"SingleLongTrackProducer") <<
" deltaR2 (general) track to matched Track: " << dR2min;
141 edm::LogPrint(
"SingleLongTrackProducer") <<
"chi2Ndof:" << chiNdof <<
" best Track: " << fitProb;
144 selTracks.push_back(bestTrack);
148 <<
" number of Tracker Muons: " << tMuon <<
", thereof " << selTracks.size() <<
" tracks passed preselection.";
151 bool hitIsNotValid{
false};
153 for (
const auto &
track : selTracks) {
159 auto hb =
track.recHitsBegin();
161 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
166 hitIsNotValid =
true;
176 if (hitIsNotValid ==
true)
183 auto hb =
track.recHitsBegin();
185 for (
unsigned int h = 0;
h <
track.recHitsSize();
h++) {
193 edm::LogPrint(
"SingleLongTrackProducer") <<
"hit not valid: " <<
h;
200 edm::LogPrint(
"SingleLongTrackProducer") <<
"hit not valid: " <<
h;
213 <<
"found tracks with " << deref <<
"missing valid hits and " << deref2 <<
" missing hit pattern";
217 auto const &moduleType = moduleDescription().moduleName();
218 auto const &
moduleLabel = moduleDescription().moduleLabel();
220 <<
" output track size: " <<
goodTracks.get()->size();
232 ->setComment(
"input primary vertex collection");
233 desc.add<
int>(
"minNumberOfLayers", 10)->setComment(
"minimum number of layers");
234 desc.add<
double>(
"requiredDr", 0.01)->setComment(
"matching muons deltaR. If negative do not match");
235 desc.add<
bool>(
"onlyValidHits",
true)->setComment(
"use only valid hits");
236 desc.add<
bool>(
"debug",
false)->setComment(
"verbose?");
237 desc.add<
double>(
"minPt", 15.0)->setComment(
"minimum pT");
238 desc.add<
double>(
"maxEta", 2.2)->setComment(
"maximum pseudorapidity (absolute value)");
239 desc.add<
double>(
"maxDxy", 0.02)->setComment(
"maximum transverse impact parameter");
240 desc.add<
double>(
"maxDz", 0.5)->setComment(
"maximum longitudinal impact parameter");
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
const edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
int trackerLayersWithMeasurement() const
SingleLongTrackProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< std::vector< reco::Muon > > muonsToken
std::vector< Track > TrackCollection
collection of Tracks
Log< level::Error, false > LogError
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
static bool validHitFilter(uint16_t pattern)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
Log< level::Warning, true > LogPrint
~SingleLongTrackProducer() override=default
uint16_t getHitPattern(HitCategory category, int position) const
const edm::EDGetTokenT< reco::VertexCollection > PrimVtxToken
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void produce(edm::Event &, const edm::EventSetup &) override
const int minNumberOfLayers
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.