76 kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1,
78 kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize,
110 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
t.getTrackWord()(
111 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
112 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
113 ptEmulation.V = ptEmulationBits.range();
114 return ptEmulation.to_double() >=
ptMin_;
135 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
136 etaEmulation.V = etaEmulationBits.range();
156 double floatZ0 =
t.undigitizeSignedValue(
189 for (
const auto& stub :
t.getStubRefs()) {
288 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
291 ptMin_(cutSet_.getParameter<double>(
"ptMin")),
292 absEtaMax_(cutSet_.getParameter<double>(
"absEtaMax")),
293 absZ0Max_(cutSet_.getParameter<double>(
"absZ0Max")),
294 bendChi2Max_(cutSet_.getParameter<double>(
"reducedBendChi2Max")),
295 reducedChi2RZMax_(cutSet_.getParameter<double>(
"reducedChi2RZMax")),
296 reducedChi2RPhiMax_(cutSet_.getParameter<double>(
"reducedChi2RPhiMax")),
297 nStubsMin_(cutSet_.getParameter<
int>(
"nStubsMin")),
298 nPSStubsMin_(cutSet_.getParameter<
int>(
"nPSStubsMin")),
299 processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
300 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
301 debug_(iConfig.getParameter<
int>(
"debug")) {
304 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
325 log <<
"The original track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
326 for (
const auto&
track : *l1TracksHandle) {
329 log <<
"\t---\n\tNumber of tracks in this selection = " << l1TracksHandle->size() <<
"\n\n";
331 log <<
"The selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are ... \n";
332 for (
const auto&
track : *vTTTrackOutput) {
335 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackOutput->size() <<
"\n\n";
338 log <<
"The emulation selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 340 for (
const auto&
track : *vTTTrackEmulationOutput) {
343 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackEmulationOutput->size() <<
"\n\n";
349 vTTTrackOutput->end(),
350 vTTTrackEmulationOutput->begin(),
351 vTTTrackEmulationOutput->end(),
352 std::back_inserter(inSimButNotEmu));
354 vTTTrackEmulationOutput->end(),
355 vTTTrackOutput->begin(),
356 vTTTrackOutput->end(),
357 std::back_inserter(inEmuButNotSim));
358 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 359 "by cutting on the emulated values ... \n";
360 for (
const auto&
track : inSimButNotEmu) {
363 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 364 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 365 "by cutting on the simulated values ... \n";
366 for (
const auto&
track : inEmuButNotSim) {
369 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
374 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 375 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 376 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
378 if (printEmulation) {
379 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
380 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
381 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
382 ptEmulation.V = ptEmulationBits.range();
384 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
385 etaEmulation.V = etaEmulationBits.range();
386 double floatTkZ0 =
track.undigitizeSignedValue(
388 double floatTkPhi =
track.undigitizeSignedValue(
390 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " << floatTkPhi <<
", " 391 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
392 <<
", " << floatTkZ0 <<
")\n";
398 auto vTTTrackOutput = std::make_unique<TTTrackRefCollection>();
399 auto vTTTrackEmulationOutput = std::make_unique<TTTrackRefCollection>();
407 size_t nOutputApproximate = l1TracksHandle->size();
409 vTTTrackOutput->reserve(nOutputApproximate);
412 vTTTrackEmulationOutput->reserve(nOutputApproximate);
421 for (
size_t i = 0;
i < nOutputApproximate;
i++) {
422 const auto&
track = l1TracksHandle->at(
i);
426 vTTTrackOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
431 vTTTrackEmulationOutput->push_back(
TTTrackRef(l1TracksHandle,
i));
436 printDebugInfo(l1TracksHandle, vTTTrackOutput, vTTTrackEmulationOutput);
453 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelected");
456 descCutSet.
add<
double>(
"ptMin", 2.0)->
setComment(
"pt must be greater than this value, [GeV]");
457 descCutSet.
add<
double>(
"absEtaMax", 2.4)->
setComment(
"absolute value of eta must be less than this value");
458 descCutSet.
add<
double>(
"absZ0Max", 15.0)->
setComment(
"z0 must be less than this value, [cm]");
459 descCutSet.
add<
int>(
"nStubsMin", 4)->setComment(
"number of stubs must be greater than or equal to this value");
460 descCutSet.
add<
int>(
"nPSStubsMin", 0)
461 ->setComment(
"number of stubs in the PS Modules must be greater than or equal to this value");
463 descCutSet.
add<
double>(
"reducedBendChi2Max", 2.25)->
setComment(
"bend chi2 must be less than this value");
464 descCutSet.
add<
double>(
"reducedChi2RZMax", 5.0)->
setComment(
"chi2rz/dof must be less than this value");
465 descCutSet.
add<
double>(
"reducedChi2RPhiMax", 20.0)->
setComment(
"chi2rphi/dof must be less than this value");
469 desc.add<
bool>(
"processSimulatedTracks",
true)
470 ->setComment(
"return selected tracks after cutting on the floating point values");
471 desc.add<
bool>(
"processEmulatedTracks",
true)
472 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
473 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
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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
AndSelector< TTTrackPtMinSelector, TTTrackAbsEtaMaxSelector, TTTrackAbsZ0MaxSelector, TTTrackNStubsMinSelector > TTTrackPtMinEtaMaxZ0MaxNStubsMinSelector
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)
TTTrackNStubsMinSelector(double nStubsMin)
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
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
edm::Ref< TTTrackCollection > TTTrackRef
def template(fileName, svg, replaceme="REPLACEME")
#define DEFINE_FWK_MODULE(type)
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)
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
void printDebugInfo(const TTTrackCollectionHandle &l1TracksHandle, const TTTrackRefCollectionUPtr &vTTTrackOutput, const TTTrackRefCollectionUPtr &vTTTrackEmulationOutput) const
edm::RefVector< TTTrackCollection > TTTrackRefCollection
TTTrackAbsZ0MaxSelector(double absZ0Max)
TTTrackChi2RZMaxSelector(const edm::ParameterSet &cfg)
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
bool operator()(const L1Track &t) const
TTTrackWordBendChi2MaxSelector(double bendChi2Max)
static constexpr double stepZ0
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)