75 kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1,
77 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();
117 return ptEmulation.to_double() >=
ptMin_;
138 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
139 etaEmulation.V = etaEmulationBits.range();
188 for (
const auto& stub :
t.getStubRefs()) {
189 DetId detId(stub->getDetId());
329 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
332 ptMin_(cutSet_.getParameter<double>(
"ptMin")),
333 absEtaMax_(cutSet_.getParameter<double>(
"absEtaMax")),
334 absZ0Max_(cutSet_.getParameter<double>(
"absZ0Max")),
335 bendChi2Max_(cutSet_.getParameter<double>(
"reducedBendChi2Max")),
336 reducedChi2RZMax_(cutSet_.getParameter<double>(
"reducedChi2RZMax")),
337 reducedChi2RPhiMax_(cutSet_.getParameter<double>(
"reducedChi2RPhiMax")),
338 nStubsMin_(cutSet_.getParameter<
int>(
"nStubsMin")),
339 nPSStubsMin_(cutSet_.getParameter<
int>(
"nPSStubsMin")),
340 deltaZMaxEtaBounds_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMaxEtaBounds")),
341 deltaZMax_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMax")),
343 useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>(
"useDisplacedTracksDeltaZOverride")),
344 processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
345 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
346 debug_(iConfig.getParameter<
int>(
"debug")) {
349 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
353 throw cms::Exception(
"The number of deltaZ cuts does not match the number of eta bins!");
365 if (iConfig.
exists(
"l1VerticesInputTag")) {
373 if (iConfig.
exists(
"l1VerticesEmulationInputTag")) {
394 log <<
"The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
395 for (
const auto&
track : *l1TracksHandle) {
398 log <<
"\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() <<
"\n\n";
400 log <<
"The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
401 for (
const auto&
track : *vTTTrackOutput) {
404 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() <<
"\n\n";
407 log <<
"The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 409 for (
const auto&
track : *vTTTrackEmulationOutput) {
412 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() <<
"\n\n";
418 vTTTrackOutput->end(),
419 vTTTrackEmulationOutput->begin(),
420 vTTTrackEmulationOutput->end(),
421 std::back_inserter(inSimButNotEmu));
423 vTTTrackEmulationOutput->end(),
424 vTTTrackOutput->begin(),
425 vTTTrackOutput->end(),
426 std::back_inserter(inEmuButNotSim));
427 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 428 "by cutting on the emulated values ... \n";
429 for (
const auto&
track : inSimButNotEmu) {
432 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 433 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 434 "by cutting on the simulated values ... \n";
435 for (
const auto&
track : inEmuButNotSim) {
438 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
441 log <<
"The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, " 442 "chi2rphi, z0) values are ... \n";
443 for (
const auto&
track : *vTTTrackAssociatedOutput) {
446 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() <<
"\n\n";
449 log <<
"The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, " 450 "chi2rz, chi2rphi, z0) values are " 452 for (
const auto&
track : *vTTTrackAssociatedEmulationOutput) {
455 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() <<
"\n\n";
461 vTTTrackAssociatedOutput->end(),
462 vTTTrackAssociatedEmulationOutput->begin(),
463 vTTTrackAssociatedEmulationOutput->end(),
464 std::back_inserter(inSimButNotEmu));
466 vTTTrackAssociatedEmulationOutput->end(),
467 vTTTrackAssociatedOutput->begin(),
468 vTTTrackAssociatedOutput->end(),
469 std::back_inserter(inEmuButNotSim));
470 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 471 "by cutting on the emulated values ... \n";
472 for (
const auto&
track : inSimButNotEmu) {
475 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 476 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 477 "by cutting on the simulated values ... \n";
478 for (
const auto&
track : inEmuButNotSim) {
481 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
486 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 487 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 488 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
490 if (printEmulation) {
491 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
492 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
493 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
494 ptEmulation.V = ptEmulationBits.range();
496 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
497 etaEmulation.V = etaEmulationBits.range();
498 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " <<
track.getPhi() <<
", " 499 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
500 <<
", " <<
track.getZ0() <<
")\n";
506 auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
507 auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollection>();
508 auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
509 auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollection>();
522 size_t nOutputApproximate = l1TracksHandle->size();
526 leadingVertex = l1VerticesHandle->at(0);
528 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading vertex z0 = " << leadingVertex.
z0();
531 vTTTrackOutput->reserve(nOutputApproximate);
532 vTTTrackAssociatedOutput->reserve(nOutputApproximate);
537 leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
539 edm::LogInfo(
"L1TrackSelectionProducer") <<
"leading emulation vertex z0 = " << leadingEmulationVertex.
z0();
542 vTTTrackEmulationOutput->reserve(nOutputApproximate);
543 vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximate);
554 for (
size_t i = 0;
i < nOutputApproximate;
i++) {
555 const auto&
track = l1TracksHandle->at(
i);
559 vTTTrackOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
561 vTTTrackAssociatedOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
567 vTTTrackEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
569 vTTTrackAssociatedEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
577 vTTTrackEmulationOutput,
578 vTTTrackAssociatedOutput,
579 vTTTrackAssociatedEmulationOutput);
604 edm::InputTag(
"L1VertexFinderEmulator",
"l1verticesEmulation"));
605 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelected");
608 descCutSet.
add<
double>(
"ptMin", 2.0)->
setComment(
"pt must be greater than this value, [GeV]");
609 descCutSet.
add<
double>(
"absEtaMax", 2.4)->
setComment(
"absolute value of eta must be less than this value");
610 descCutSet.
add<
double>(
"absZ0Max", 15.0)->
setComment(
"z0 must be less than this value, [cm]");
611 descCutSet.
add<
int>(
"nStubsMin", 4)->setComment(
"number of stubs must be greater than or equal to this value");
612 descCutSet.
add<
int>(
"nPSStubsMin", 0)
613 ->setComment(
"number of stubs in the PS Modules must be greater than or equal to this value");
615 descCutSet.
add<
double>(
"reducedBendChi2Max", 2.25)->
setComment(
"bend chi2 must be less than this value");
616 descCutSet.
add<
double>(
"reducedChi2RZMax", 5.0)->
setComment(
"chi2rz/dof must be less than this value");
617 descCutSet.
add<
double>(
"reducedChi2RPhiMax", 20.0)->
setComment(
"chi2rphi/dof must be less than this value");
619 descCutSet.
add<std::vector<double>>(
"deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
620 ->setComment(
"these values define the bin boundaries in |eta|");
621 descCutSet.
add<std::vector<double>>(
"deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
623 "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, " 627 desc.add<
double>(
"useDisplacedTracksDeltaZOverride", -1.0)
628 ->setComment(
"override the deltaZ cut value for displaced tracks");
629 desc.add<
bool>(
"processSimulatedTracks",
true)
630 ->setComment(
"return selected tracks after cutting on the floating point values");
631 desc.add<
bool>(
"processEmulatedTracks",
true)
632 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
633 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
#define DEFINE_FWK_MODULE(type)
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
std::vector< TTTrackRef > TTTrackRefCollection
def template(fileName, svg, replaceme="REPLACEME")
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
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)