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();
118 return ptEmulation.to_double() >=
ptMin_;
139 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
140 etaEmulation.V = etaEmulationBits.range();
189 for (
const auto& stub :
t.getStubRefs()) {
190 DetId detId(stub->getDetId());
330 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
333 ptMin_(cutSet_.getParameter<double>(
"ptMin")),
334 absEtaMax_(cutSet_.getParameter<double>(
"absEtaMax")),
335 absZ0Max_(cutSet_.getParameter<double>(
"absZ0Max")),
336 bendChi2Max_(cutSet_.getParameter<double>(
"reducedBendChi2Max")),
337 reducedChi2RZMax_(cutSet_.getParameter<double>(
"reducedChi2RZMax")),
338 reducedChi2RPhiMax_(cutSet_.getParameter<double>(
"reducedChi2RPhiMax")),
339 nStubsMin_(cutSet_.getParameter<
int>(
"nStubsMin")),
340 nPSStubsMin_(cutSet_.getParameter<
int>(
"nPSStubsMin")),
341 deltaZMaxEtaBounds_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMaxEtaBounds")),
342 deltaZMax_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMax")),
344 useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>(
"useDisplacedTracksDeltaZOverride")),
345 processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
346 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
347 debug_(iConfig.getParameter<
int>(
"debug")) {
350 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
354 throw cms::Exception(
"The number of deltaZ cuts does not match the number of eta bins!");
366 if (iConfig.
exists(
"l1VerticesInputTag")) {
374 if (iConfig.
exists(
"l1VerticesEmulationInputTag")) {
395 log <<
"The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
396 for (
const auto&
track : *l1TracksHandle) {
399 log <<
"\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() <<
"\n\n";
401 log <<
"The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
402 for (
const auto&
track : *vTTTrackOutput) {
405 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() <<
"\n\n";
408 log <<
"The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 410 for (
const auto&
track : *vTTTrackEmulationOutput) {
413 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() <<
"\n\n";
419 vTTTrackOutput->end(),
420 vTTTrackEmulationOutput->begin(),
421 vTTTrackEmulationOutput->end(),
422 std::back_inserter(inSimButNotEmu));
424 vTTTrackEmulationOutput->end(),
425 vTTTrackOutput->begin(),
426 vTTTrackOutput->end(),
427 std::back_inserter(inEmuButNotSim));
428 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 429 "by cutting on the emulated values ... \n";
430 for (
const auto&
track : inSimButNotEmu) {
433 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 434 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 435 "by cutting on the simulated values ... \n";
436 for (
const auto&
track : inEmuButNotSim) {
439 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
442 log <<
"The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, " 443 "chi2rphi, z0) values are ... \n";
444 for (
const auto&
track : *vTTTrackAssociatedOutput) {
447 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() <<
"\n\n";
450 log <<
"The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, " 451 "chi2rz, chi2rphi, z0) values are " 453 for (
const auto&
track : *vTTTrackAssociatedEmulationOutput) {
456 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() <<
"\n\n";
462 vTTTrackAssociatedOutput->end(),
463 vTTTrackAssociatedEmulationOutput->begin(),
464 vTTTrackAssociatedEmulationOutput->end(),
465 std::back_inserter(inSimButNotEmu));
467 vTTTrackAssociatedEmulationOutput->end(),
468 vTTTrackAssociatedOutput->begin(),
469 vTTTrackAssociatedOutput->end(),
470 std::back_inserter(inEmuButNotSim));
471 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 472 "by cutting on the emulated values ... \n";
473 for (
const auto&
track : inSimButNotEmu) {
476 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 477 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 478 "by cutting on the simulated values ... \n";
479 for (
const auto&
track : inEmuButNotSim) {
482 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
487 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 488 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 489 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
491 if (printEmulation) {
492 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
493 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
494 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
495 ptEmulation.V = ptEmulationBits.range();
497 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
498 etaEmulation.V = etaEmulationBits.range();
499 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " <<
track.getPhi() <<
", " 500 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
501 <<
", " <<
track.getZ0() <<
")\n";
507 auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
508 auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollection>();
509 auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
510 auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollection>();
523 size_t nOutputApproximate = l1TracksHandle->size();
527 leadingVertex = l1VerticesHandle->at(0);
529 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading vertex z0 = " << leadingVertex.
z0();
532 vTTTrackOutput->reserve(nOutputApproximate);
533 vTTTrackAssociatedOutput->reserve(nOutputApproximate);
538 leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
540 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading emulation vertex z0 = " << leadingEmulationVertex.
z0();
543 vTTTrackEmulationOutput->reserve(nOutputApproximate);
544 vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
555 for (
size_t i = 0;
i < nOutputApproximate;
i++) {
556 const auto&
track = l1TracksHandle->at(
i);
560 vTTTrackOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
562 vTTTrackAssociatedOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
568 vTTTrackEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
570 vTTTrackAssociatedEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
578 vTTTrackEmulationOutput,
579 vTTTrackAssociatedOutput,
580 vTTTrackAssociatedEmulationOutput);
605 edm::InputTag(
"l1tVertexFinderEmulator",
"l1verticesEmulation"));
606 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelected");
609 descCutSet.
add<
double>(
"ptMin", 2.0)->
setComment(
"pt must be greater than this value, [GeV]");
610 descCutSet.
add<
double>(
"absEtaMax", 2.4)->
setComment(
"absolute value of eta must be less than this value");
611 descCutSet.
add<
double>(
"absZ0Max", 15.0)->
setComment(
"z0 must be less than this value, [cm]");
612 descCutSet.
add<
int>(
"nStubsMin", 4)->setComment(
"number of stubs must be greater than or equal to this value");
613 descCutSet.
add<
int>(
"nPSStubsMin", 0)
614 ->setComment(
"number of stubs in the PS Modules must be greater than or equal to this value");
616 descCutSet.
add<
double>(
"reducedBendChi2Max", 2.25)->
setComment(
"bend chi2 must be less than this value");
617 descCutSet.
add<
double>(
"reducedChi2RZMax", 5.0)->
setComment(
"chi2rz/dof must be less than this value");
618 descCutSet.
add<
double>(
"reducedChi2RPhiMax", 20.0)->
setComment(
"chi2rphi/dof must be less than this value");
620 descCutSet.
add<std::vector<double>>(
"deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
621 ->setComment(
"these values define the bin boundaries in |eta|");
622 descCutSet.
add<std::vector<double>>(
"deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
624 "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, " 628 desc.add<
double>(
"useDisplacedTracksDeltaZOverride", -1.0)
629 ->setComment(
"override the deltaZ cut value for displaced tracks");
630 desc.add<
bool>(
"processSimulatedTracks",
true)
631 ->setComment(
"return selected tracks after cutting on the floating point values");
632 desc.add<
bool>(
"processEmulatedTracks",
true)
633 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
634 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)
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_
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 getData(T &iHolder) const
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
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)
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)