77 kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1,
79 kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize,
111 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
t.getTrackWord()(
112 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
113 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
114 ptEmulation.V = ptEmulationBits.range();
115 return ptEmulation.to_double() >=
ptMin_;
136 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
137 etaEmulation.V = etaEmulationBits.range();
157 double floatZ0 =
t.undigitizeSignedValue(
190 for (
const auto& stub :
t.getStubRefs()) {
407 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
410 ptMin_(cutSet_.getParameter<double>(
"ptMin")),
411 absEtaMax_(cutSet_.getParameter<double>(
"absEtaMax")),
412 absZ0Max_(cutSet_.getParameter<double>(
"absZ0Max")),
413 promptMVAMin_(cutSet_.getParameter<double>(
"promptMVAMin")),
414 bendChi2Max_(cutSet_.getParameter<double>(
"reducedBendChi2Max")),
415 reducedChi2RZMax_(cutSet_.getParameter<double>(
"reducedChi2RZMax")),
416 reducedChi2RPhiMax_(cutSet_.getParameter<double>(
"reducedChi2RPhiMax")),
417 reducedChi2RZMaxNstub4_(cutSet_.getParameter<double>(
"reducedChi2RZMaxNstub4")),
418 reducedChi2RZMaxNstub5_(cutSet_.getParameter<double>(
"reducedChi2RZMaxNstub5")),
419 reducedChi2RPhiMaxNstub4_(cutSet_.getParameter<double>(
"reducedChi2RPhiMaxNstub4")),
420 reducedChi2RPhiMaxNstub5_(cutSet_.getParameter<double>(
"reducedChi2RPhiMaxNstub5")),
421 reducedBendChi2MaxNstub4_(cutSet_.getParameter<double>(
"reducedBendChi2MaxNstub4")),
422 reducedBendChi2MaxNstub5_(cutSet_.getParameter<double>(
"reducedBendChi2MaxNstub5")),
423 nStubsMin_(cutSet_.getParameter<
int>(
"nStubsMin")),
424 nPSStubsMin_(cutSet_.getParameter<
int>(
"nPSStubsMin")),
425 processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
426 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
427 debug_(iConfig.getParameter<
int>(
"debug")) {
430 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
451 log <<
"The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
452 for (
const auto&
track : *l1TracksHandle) {
455 log <<
"\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() <<
"\n\n";
457 log <<
"The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
458 for (
const auto&
track : *vTTTrackOutput) {
461 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() <<
"\n\n";
464 log <<
"The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 466 for (
const auto&
track : *vTTTrackEmulationOutput) {
469 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() <<
"\n\n";
475 vTTTrackOutput->end(),
476 vTTTrackEmulationOutput->begin(),
477 vTTTrackEmulationOutput->end(),
478 std::back_inserter(inSimButNotEmu));
480 vTTTrackEmulationOutput->end(),
481 vTTTrackOutput->begin(),
482 vTTTrackOutput->end(),
483 std::back_inserter(inEmuButNotSim));
484 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 485 "by cutting on the emulated values ... \n";
486 for (
const auto&
track : inSimButNotEmu) {
489 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 490 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 491 "by cutting on the simulated values ... \n";
492 for (
const auto&
track : inEmuButNotSim) {
495 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
500 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 501 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 502 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
504 if (printEmulation) {
505 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
506 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
507 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
508 ptEmulation.V = ptEmulationBits.range();
510 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
511 etaEmulation.V = etaEmulationBits.range();
512 double floatTkZ0 =
track.undigitizeSignedValue(
514 double floatTkPhi =
track.undigitizeSignedValue(
516 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " << floatTkPhi <<
", " 517 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
518 <<
", " << floatTkZ0 <<
")\n";
524 auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
525 auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
533 size_t nOutputApproximate = l1TracksHandle->size();
535 vTTTrackOutput->reserve(nOutputApproximate);
538 vTTTrackEmulationOutput->reserve(nOutputApproximate);
555 for (
size_t i = 0;
i < nOutputApproximate;
i++) {
556 const auto&
track = l1TracksHandle->at(
i);
560 chi2NstubSel(
track)) {
561 vTTTrackOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
566 vTTTrackEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
571 printDebugInfo(l1TracksHandle, vTTTrackOutput, vTTTrackEmulationOutput);
588 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelected");
591 descCutSet.
add<
double>(
"ptMin", 2.0)->
setComment(
"pt must be greater than this value, [GeV]");
592 descCutSet.
add<
double>(
"absEtaMax", 2.4)->
setComment(
"absolute value of eta must be less than this value");
593 descCutSet.
add<
double>(
"absZ0Max", 15.0)->
setComment(
"z0 must be less than this value, [cm]");
594 descCutSet.
add<
int>(
"nStubsMin", 4)->setComment(
"number of stubs must be greater than or equal to this value");
595 descCutSet.
add<
int>(
"nPSStubsMin", 0)
596 ->setComment(
"number of stubs in the PS Modules must be greater than or equal to this value");
598 descCutSet.
add<
double>(
"promptMVAMin", -1.0)->
setComment(
"MVA must be greater than this value");
599 descCutSet.
add<
double>(
"reducedBendChi2Max", 2.25)->
setComment(
"bend chi2 must be less than this value");
600 descCutSet.
add<
double>(
"reducedChi2RZMax", 5.0)->
setComment(
"chi2rz/dof must be less than this value");
601 descCutSet.
add<
double>(
"reducedChi2RPhiMax", 20.0)->
setComment(
"chi2rphi/dof must be less than this value");
602 descCutSet.
add<
double>(
"reducedChi2RZMaxNstub4", 999.9)
603 ->
setComment(
"chi2rz/dof must be less than this value in nstub==4");
604 descCutSet.
add<
double>(
"reducedChi2RZMaxNstub5", 999.9)
605 ->
setComment(
"chi2rz/dof must be less than this value in nstub>4");
606 descCutSet.
add<
double>(
"reducedChi2RPhiMaxNstub4", 999.9)
607 ->
setComment(
"chi2rphi/dof must be less than this value in nstub==4");
608 descCutSet.
add<
double>(
"reducedChi2RPhiMaxNstub5", 999.9)
609 ->
setComment(
"chi2rphi/dof must be less than this value in nstub>4");
610 descCutSet.
add<
double>(
"reducedBendChi2MaxNstub4", 999.9)
611 ->
setComment(
"bend chi2 must be less than this value in nstub==4");
612 descCutSet.
add<
double>(
"reducedBendChi2MaxNstub5", 999.9)
613 ->
setComment(
"bend chi2 must be less than this value in nstub>4");
617 desc.add<
bool>(
"processSimulatedTracks",
true)
618 ->setComment(
"return selected tracks after cutting on the floating point values");
619 desc.add<
bool>(
"processEmulatedTracks",
true)
620 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
621 desc.add<
int>(
"debug", 0)->setComment(
"Verbosity levels: 0, 1, 2, 3");
TTTrackWordAbsZ0MaxSelector(double absZ0Max)
L1TrackSelectionProducer(const edm::ParameterSet &)
bool operator()(const L1Track &t) const
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
AndSelector< TTTrackChi2RZMaxNstubSelector, TTTrackChi2RPhiMaxNstubSelector, TTTrackBendChi2MaxNstubSelector > TTTrackChi2MaxNstubSelector
TTTrackAbsZ0MaxSelector(const edm::ParameterSet &cfg)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
TTTrackBendChi2MaxNstubSelector(double reducedBendChi2MaxNstub4, double reducedBendChi2MaxNstub5)
bool operator()(const L1Track &t) const
const double promptMVAMin_
unsigned int tobLayer(const DetId &id) const
edm::Handle< TTTrackCollection > TTTrackCollectionHandle
bool operator()(const L1Track &t) const
~L1TrackSelectionProducer() override
TTTrackChi2RZMaxSelector(double reducedChi2RZMax)
bool operator()(const L1Track &t) const
TTTrackWordBendChi2MaxNstubSelector(double reducedBendChi2MaxNstub4, double reducedBendChi2MaxNstub5)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
TTTrackWordChi2RZMaxNstubSelector(const edm::ParameterSet &cfg)
double reducedChi2RPhiMaxNstub4_
double reducedChi2RPhiMax_
AndSelector< TTTrackBendChi2MaxSelector, TTTrackChi2RZMaxSelector, TTTrackChi2RPhiMaxSelector > TTTrackBendChi2Chi2RZChi2RPhiMaxSelector
bool operator()(const L1Track &t) const
TTTrackWordAbsZ0MaxSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
AndSelector< TTTrackWordBendChi2MaxSelector, TTTrackWordChi2RZMaxSelector, TTTrackWordChi2RPhiMaxSelector > TTTrackWordBendChi2Chi2RZChi2RPhiMaxSelector
const double bendChi2Max_
const double reducedBendChi2MaxNstub4_
bool operator()(const L1Track &t) const
TTTrackWordNStubsMinSelector(const edm::ParameterSet &cfg)
double reducedBendChi2MaxNstub5_
AndSelector< TTTrackWordPtMinSelector, TTTrackWordAbsEtaMaxSelector, TTTrackWordAbsZ0MaxSelector, TTTrackWordNStubsMinSelector > TTTrackWordPtMinEtaMaxZ0MaxNStubsMinSelector
AndSelector< TTTrackPtMinSelector, TTTrackAbsEtaMaxSelector, TTTrackAbsZ0MaxSelector, TTTrackNStubsMinSelector > TTTrackPtMinEtaMaxZ0MaxNStubsMinSelector
bool operator()(const L1Track &t) const
double reducedChi2RZMaxNstub5_
TTTrackWordBendChi2MaxNstubSelector(const edm::ParameterSet &cfg)
bool processSimulatedTracks_
TTTrackWordChi2RPhiMaxSelector(const edm::ParameterSet &cfg)
TTTrackNPSStubsMinSelector(const edm::ParameterSet &cfg, const TrackerTopology &tTopo)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< TTTrackRefCollection > TTTrackRefCollectionUPtr
TTTrackWordPtMinSelector(double ptMin)
TTTrackPtMinSelector(double ptMin)
const double reducedChi2RZMax_
TTTrackAbsEtaMaxSelector(const edm::ParameterSet &cfg)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TTTrackNPSStubsMinSelector(double nStubsMin, const TrackerTopology &tTopo)
bool operator()(const L1Track &t) const
AndSelector< TTTrackWordChi2RZMaxNstubSelector, TTTrackWordChi2RPhiMaxNstubSelector, TTTrackWordBendChi2MaxNstubSelector > TTTrackWordChi2MaxNstubSelector
TTTrackNStubsMinSelector(double nStubsMin)
double reducedBendChi2MaxNstub4_
double reducedChi2RPhiMaxNstub5_
bool operator()(const L1Track &t) const
TTTrackBendChi2MaxSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
TTTrackChi2RPhiMaxSelector(double reducedChi2RPhiMax)
TTTrackChi2RPhiMaxNstubSelector(double reducedChi2RPhiMaxNstub4, double reducedChi2RPhiMaxNstub5)
bool operator()(const L1Track &t) const
TTTrackChi2RPhiMaxNstubSelector(const edm::ParameterSet &cfg)
const std::string outputCollectionName_
TTTrackWordChi2RZMaxSelector(double reducedChi2RZMax)
TTTrackNStubsMinSelector(const edm::ParameterSet &cfg)
Abs< T >::type abs(const T &t)
bool operator()(const L1Track &t) const
const double reducedChi2RPhiMaxNstub4_
edm::Ref< TTTrackCollection > TTTrackRef
def template(fileName, svg, replaceme="REPLACEME")
#define DEFINE_FWK_MODULE(type)
TTTrackChi2RZMaxNstubSelector(const edm::ParameterSet &cfg)
const edm::ParameterSet cutSet_
static constexpr auto TOB
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
TTTrackWordChi2RPhiMaxNstubSelector(const edm::ParameterSet &cfg)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double reducedChi2RPhiMaxNstub4_
std::vector< L1Track > TTTrackCollection
bool processEmulatedTracks_
TTTrackWordChi2RPhiMaxNstubSelector(double reducedChi2RPhiMaxNstub4, double reducedChi2RPhiMaxNstub5)
double reducedBendChi2MaxNstub4_
TTTrackBendChi2MaxNstubSelector(const edm::ParameterSet &cfg)
TTTrackWordNStubsMinSelector(double nStubsMin)
TTTrackWordChi2RZMaxSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
TTTrackWordPromptMVAMinSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
const TrackerTopology & tTopo_
TTTrackChi2RPhiMaxSelector(const edm::ParameterSet &cfg)
const double reducedChi2RPhiMaxNstub5_
TTTrackChi2RZMaxNstubSelector(double reducedChi2RZMaxNstub4, double reducedChi2RZMaxNstub5)
const double reducedChi2RPhiMax_
bool operator()(const L1Track &t) const
Class to store the L1 Track Trigger tracks.
TTTrackPtMinSelector(const edm::ParameterSet &cfg)
TTTrackWordPtMinSelector(const edm::ParameterSet &cfg)
void printTrackInfo(edm::LogInfo &log, const L1Track &track, bool printEmulation=false) const
bool operator()(const L1Track &t) const
bool operator()(const L1Track &t) const
bool operator()(const L1Track &t) const
TTTrackWordPromptMVAMinSelector(double promptMVAMin)
static constexpr double stepPhi0
bool operator()(const L1Track &t) const
void printDebugInfo(const TTTrackCollectionHandle &l1TracksHandle, const TTTrackRefCollectionUPtr &vTTTrackOutput, const TTTrackRefCollectionUPtr &vTTTrackEmulationOutput) const
edm::RefVector< TTTrackCollection > TTTrackRefCollection
TTTrackAbsZ0MaxSelector(double absZ0Max)
TTTrackChi2RZMaxSelector(const edm::ParameterSet &cfg)
double reducedBendChi2MaxNstub5_
double reducedChi2RZMaxNstub4_
TTTrackWordAbsEtaMaxSelector(double absEtaMax)
TTTrackPromptMVAMinSelector(double promptMVAMin)
ap_uint< TrackBitWidths::kTanlSize > tanl_t
TTTrackWordChi2RPhiMaxSelector(double reducedChi2RPhiMax)
bool operator()(const L1Track &t) const
bool operator()(const L1Track &t) const
double reducedChi2RPhiMax_
unsigned int tidRing(const DetId &id) const
TTTrackPromptMVAMinSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
TTTrackWordChi2RZMaxNstubSelector(double reducedChi2RZMaxNstub4, double reducedChi2RZMaxNstub5)
TTTrackWordBendChi2MaxSelector(double bendChi2Max)
static constexpr double stepZ0
static constexpr auto TID
TTTrackWordAbsEtaMaxSelector(const edm::ParameterSet &cfg)
const double reducedBendChi2MaxNstub5_
TTTrackAbsEtaMaxSelector(double absEtaMax)
const double reducedChi2RZMaxNstub5_
double reducedChi2RZMaxNstub5_
TTTrackBendChi2MaxSelector(double bendChi2Max)
double reducedChi2RPhiMaxNstub5_
double reducedChi2RZMaxNstub4_
const double reducedChi2RZMaxNstub4_
const edm::EDGetTokenT< TTTrackCollection > l1TracksToken_
TTTrackWordBendChi2MaxSelector(const edm::ParameterSet &cfg)