76 kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1,
78 kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize,
112 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
t.getTrackWord()(
113 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
114 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
115 ptEmulation.V = ptEmulationBits.range();
116 return ptEmulation.to_double() >=
ptMin_;
137 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
138 etaEmulation.V = etaEmulationBits.range();
158 double floatZ0 =
t.undigitizeSignedValue(
191 for (
const auto& stub :
t.getStubRefs()) {
192 DetId detId(stub->getDetId());
287 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
288 etaEmulation.V = etaEmulationBits.range();
338 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
341 ptMin_(cutSet_.getParameter<double>(
"ptMin")),
342 absEtaMax_(cutSet_.getParameter<double>(
"absEtaMax")),
343 absZ0Max_(cutSet_.getParameter<double>(
"absZ0Max")),
344 bendChi2Max_(cutSet_.getParameter<double>(
"reducedBendChi2Max")),
345 reducedChi2RZMax_(cutSet_.getParameter<double>(
"reducedChi2RZMax")),
346 reducedChi2RPhiMax_(cutSet_.getParameter<double>(
"reducedChi2RPhiMax")),
347 nStubsMin_(cutSet_.getParameter<
int>(
"nStubsMin")),
348 nPSStubsMin_(cutSet_.getParameter<
int>(
"nPSStubsMin")),
349 deltaZMaxEtaBounds_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMaxEtaBounds")),
350 deltaZMax_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMax")),
352 useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>(
"useDisplacedTracksDeltaZOverride")),
353 processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
354 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
355 debug_(iConfig.getParameter<
int>(
"debug")) {
358 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
362 throw cms::Exception(
"The number of deltaZ cuts does not match the number of eta bins!");
374 if (iConfig.
exists(
"l1VerticesInputTag")) {
382 if (iConfig.
exists(
"l1VerticesEmulationInputTag")) {
403 log <<
"The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
404 for (
const auto&
track : *l1TracksHandle) {
407 log <<
"\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() <<
"\n\n";
409 log <<
"The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
410 for (
const auto&
track : *vTTTrackOutput) {
413 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() <<
"\n\n";
416 log <<
"The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 418 for (
const auto&
track : *vTTTrackEmulationOutput) {
421 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() <<
"\n\n";
427 vTTTrackOutput->end(),
428 vTTTrackEmulationOutput->begin(),
429 vTTTrackEmulationOutput->end(),
430 std::back_inserter(inSimButNotEmu));
432 vTTTrackEmulationOutput->end(),
433 vTTTrackOutput->begin(),
434 vTTTrackOutput->end(),
435 std::back_inserter(inEmuButNotSim));
436 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 437 "by cutting on the emulated values ... \n";
438 for (
const auto&
track : inSimButNotEmu) {
441 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 442 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 443 "by cutting on the simulated values ... \n";
444 for (
const auto&
track : inEmuButNotSim) {
447 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
450 log <<
"The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, " 451 "chi2rphi, z0) values are ... \n";
452 for (
const auto&
track : *vTTTrackAssociatedOutput) {
455 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() <<
"\n\n";
458 log <<
"The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, " 459 "chi2rz, chi2rphi, z0) values are " 461 for (
const auto&
track : *vTTTrackAssociatedEmulationOutput) {
464 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() <<
"\n\n";
470 vTTTrackAssociatedOutput->end(),
471 vTTTrackAssociatedEmulationOutput->begin(),
472 vTTTrackAssociatedEmulationOutput->end(),
473 std::back_inserter(inSimButNotEmu));
475 vTTTrackAssociatedEmulationOutput->end(),
476 vTTTrackAssociatedOutput->begin(),
477 vTTTrackAssociatedOutput->end(),
478 std::back_inserter(inEmuButNotSim));
479 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 480 "by cutting on the emulated values ... \n";
481 for (
const auto&
track : inSimButNotEmu) {
484 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 485 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 486 "by cutting on the simulated values ... \n";
487 for (
const auto&
track : inEmuButNotSim) {
490 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
495 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 496 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 497 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
499 if (printEmulation) {
500 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
501 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
502 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
503 ptEmulation.V = ptEmulationBits.range();
505 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
506 etaEmulation.V = etaEmulationBits.range();
507 double floatTkZ0 =
track.undigitizeSignedValue(
509 double floatTkPhi =
track.undigitizeSignedValue(
511 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " << floatTkPhi <<
", " 512 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
513 <<
", " << floatTkZ0 <<
")\n";
519 auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
520 auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollection>();
521 auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
522 auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollection>();
535 size_t nOutputApproximate = l1TracksHandle->size();
539 leadingVertex = l1VerticesHandle->at(0);
541 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading vertex z0 = " << leadingVertex.
z0();
544 vTTTrackOutput->reserve(nOutputApproximate);
545 vTTTrackAssociatedOutput->reserve(nOutputApproximate);
550 leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
552 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading emulation vertex z0 = " << leadingEmulationVertex.
z0();
555 vTTTrackEmulationOutput->reserve(nOutputApproximate);
556 vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
567 for (
size_t i = 0;
i < nOutputApproximate;
i++) {
568 const auto&
track = l1TracksHandle->at(
i);
572 vTTTrackOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
574 vTTTrackAssociatedOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
580 vTTTrackEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
582 vTTTrackAssociatedEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
590 vTTTrackEmulationOutput,
591 vTTTrackAssociatedOutput,
592 vTTTrackAssociatedEmulationOutput);
617 edm::InputTag(
"l1tVertexFinderEmulator",
"l1verticesEmulation"));
618 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelected");
621 descCutSet.
add<
double>(
"ptMin", 2.0)->
setComment(
"pt must be greater than this value, [GeV]");
622 descCutSet.
add<
double>(
"absEtaMax", 2.4)->
setComment(
"absolute value of eta must be less than this value");
623 descCutSet.
add<
double>(
"absZ0Max", 15.0)->
setComment(
"z0 must be less than this value, [cm]");
624 descCutSet.
add<
int>(
"nStubsMin", 4)->setComment(
"number of stubs must be greater than or equal to this value");
625 descCutSet.
add<
int>(
"nPSStubsMin", 0)
626 ->setComment(
"number of stubs in the PS Modules must be greater than or equal to this value");
628 descCutSet.
add<
double>(
"reducedBendChi2Max", 2.25)->
setComment(
"bend chi2 must be less than this value");
629 descCutSet.
add<
double>(
"reducedChi2RZMax", 5.0)->
setComment(
"chi2rz/dof must be less than this value");
630 descCutSet.
add<
double>(
"reducedChi2RPhiMax", 20.0)->
setComment(
"chi2rphi/dof must be less than this value");
632 descCutSet.
add<std::vector<double>>(
"deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
633 ->setComment(
"these values define the bin boundaries in |eta|");
634 descCutSet.
add<std::vector<double>>(
"deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
636 "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, " 640 desc.add<
double>(
"useDisplacedTracksDeltaZOverride", -1.0)
641 ->setComment(
"override the deltaZ cut value for displaced tracks");
642 desc.add<
bool>(
"processSimulatedTracks",
true)
643 ->setComment(
"return selected tracks after cutting on the floating point values");
644 desc.add<
bool>(
"processEmulatedTracks",
true)
645 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
646 desc.add<
int>(
"debug", 0)->setComment(
"Verbosity levels: 0, 1, 2, 3");
TTTrackWordAbsZ0MaxSelector(double absZ0Max)
L1TrackSelectionProducer(const edm::ParameterSet &)
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
TTTrackAbsZ0MaxSelector(const edm::ParameterSet &cfg)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
bool operator()(const L1Track &t) const
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
edm::Handle< TTTrackCollection > TTTrackCollectionHandle
bool operator()(const L1Track &t) const
~L1TrackSelectionProducer() override
std::vector< double > deltaZMax_
TTTrackChi2RZMaxSelector(double reducedChi2RZMax)
bool operator()(const L1Track &t) const
TTTrackDeltaZMaxSelector(const edm::ParameterSet &cfg)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
TTTrackDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
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_
bool operator()(const L1Track &t) const
TTTrackWordNStubsMinSelector(const edm::ParameterSet &cfg)
AndSelector< TTTrackWordPtMinSelector, TTTrackWordAbsEtaMaxSelector, TTTrackWordAbsZ0MaxSelector, TTTrackWordNStubsMinSelector > TTTrackWordPtMinEtaMaxZ0MaxNStubsMinSelector
void printDebugInfo(const TTTrackCollectionHandle &l1TracksHandle, const TTTrackRefCollectionUPtr &vTTTrackOutput, const TTTrackRefCollectionUPtr &vTTTrackEmulationOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedEmulationOutput) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
AndSelector< TTTrackPtMinSelector, TTTrackAbsEtaMaxSelector, TTTrackAbsZ0MaxSelector, TTTrackNStubsMinSelector > TTTrackPtMinEtaMaxZ0MaxNStubsMinSelector
bool processSimulatedTracks_
std::vector< double > deltaZMax_
TTTrackWordChi2RPhiMaxSelector(const edm::ParameterSet &cfg)
TTTrackNPSStubsMinSelector(const edm::ParameterSet &cfg, const TrackerTopology &tTopo)
std::vector< double > deltaZMax_
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)
const double useDisplacedTracksDeltaZOverride_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TTTrackNPSStubsMinSelector(double nStubsMin, const TrackerTopology &tTopo)
TTTrackNStubsMinSelector(double nStubsMin)
std::vector< double > deltaZMaxEtaBounds_
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
bool operator()(const L1Track &t) const
TTTrackBendChi2MaxSelector(const edm::ParameterSet &cfg)
bool operator()(const L1Track &t) const
TTTrackChi2RPhiMaxSelector(double reducedChi2RPhiMax)
bool operator()(const L1Track &t) const
std::vector< double > deltaZMaxEtaBounds_
const std::string outputCollectionName_
TTTrackWordChi2RZMaxSelector(double reducedChi2RZMax)
TTTrackNStubsMinSelector(const edm::ParameterSet &cfg)
edm::EDGetTokenT< l1t::VertexCollection > l1VerticesToken_
Abs< T >::type abs(const T &t)
bool operator()(const L1Track &t) const
edm::Ref< TTTrackCollection > TTTrackRef
def template(fileName, svg, replaceme="REPLACEME")
#define DEFINE_FWK_MODULE(type)
bool operator()(const L1Track &t, const l1t::Vertex &v) const
const edm::ParameterSet cutSet_
static constexpr auto TOB
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< L1Track > TTTrackCollection
bool processEmulatedTracks_
TTTrackWordNStubsMinSelector(double nStubsMin)
TTTrackWordChi2RZMaxSelector(const edm::ParameterSet &cfg)
Log< level::Info, false > LogInfo
bool operator()(const L1Track &t) const
const TrackerTopology & tTopo_
TTTrackChi2RPhiMaxSelector(const edm::ParameterSet &cfg)
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
static constexpr double stepPhi0
bool operator()(const L1Track &t, const l1t::VertexWord &v) const
edm::RefVector< TTTrackCollection > TTTrackRefCollection
TTTrackAbsZ0MaxSelector(double absZ0Max)
TTTrackChi2RZMaxSelector(const edm::ParameterSet &cfg)
edm::EDGetTokenT< l1t::VertexWordCollection > l1VerticesEmulationToken_
TTTrackWordAbsEtaMaxSelector(double absEtaMax)
ap_uint< TrackBitWidths::kTanlSize > tanl_t
TTTrackWordChi2RPhiMaxSelector(double reducedChi2RPhiMax)
bool operator()(const L1Track &t) const
double reducedChi2RPhiMax_
unsigned int tidRing(const DetId &id) const
std::vector< double > deltaZMaxEtaBounds_
bool operator()(const L1Track &t) const
TTTrackWordBendChi2MaxSelector(double bendChi2Max)
static constexpr double stepZ0
TTTrackWordDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
static constexpr auto TID
TTTrackWordAbsEtaMaxSelector(const edm::ParameterSet &cfg)
TTTrackAbsEtaMaxSelector(double absEtaMax)
TTTrackBendChi2MaxSelector(double bendChi2Max)
const edm::EDGetTokenT< TTTrackCollection > l1TracksToken_
TTTrackWordBendChi2MaxSelector(const edm::ParameterSet &cfg)
TTTrackWordDeltaZMaxSelector(const edm::ParameterSet &cfg)