81 kPtSize = TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1,
83 kEtaSize = TTTrack_TrackWord::TrackBitWidths::kTanlSize,
130 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
131 etaEmulation.V = etaEmulationBits.range();
140 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
t.getTrackWord()(
141 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
142 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
143 ptEmulation.V = ptEmulationBits.range();
169 : processSimulatedTracks_(iConfig.getParameter<
bool>(
"processSimulatedTracks")),
170 processEmulatedTracks_(iConfig.getParameter<
bool>(
"processEmulatedTracks")),
171 l1VerticesToken_(processSimulatedTracks_
174 l1SelectedTracksToken_(
175 processSimulatedTracks_
178 l1VerticesEmulationToken_(
179 processEmulatedTracks_
182 l1SelectedTracksEmulationToken_(processEmulatedTracks_
184 "l1SelectedTracksEmulationInputTag"))
186 outputCollectionName_(iConfig.getParameter<
std::
string>(
"outputCollectionName")),
189 deltaZMaxEtaBounds_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMaxEtaBounds")),
190 deltaZMax_(cutSet_.getParameter<
std::
vector<double>>(
"deltaZMax")),
191 useDisplacedTracksDeltaZOverride_(iConfig.getParameter<double>(
"useDisplacedTracksDeltaZOverride")),
192 debug_(iConfig.getParameter<
int>(
"debug")) {
195 throw cms::Exception(
"You must process at least one of the track collections (simulated or emulated).");
199 throw cms::Exception(
"The number of deltaZ cuts does not match the number of eta bins!");
226 log <<
"The original selected track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) values are " 228 for (
const auto&
track : *l1SelectedTracksHandle) {
231 log <<
"\t---\n\tNumber of tracks in this selection = " << l1SelectedTracksHandle->size() <<
"\n\n";
234 log <<
"The original selected emulated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, chi2rphi, z0) " 236 for (
const auto&
track : *l1SelectedTracksEmulationHandle) {
239 log <<
"\t---\n\tNumber of tracks in this selection = " << l1SelectedTracksEmulationHandle->size() <<
"\n\n";
245 l1SelectedTracksHandle->
end(),
246 l1SelectedTracksEmulationHandle->
begin(),
247 l1SelectedTracksEmulationHandle->
end(),
248 std::back_inserter(inSimButNotEmu));
250 l1SelectedTracksEmulationHandle->
end(),
251 l1SelectedTracksHandle->
begin(),
252 l1SelectedTracksHandle->
end(),
253 std::back_inserter(inEmuButNotSim));
254 log <<
"The set of tracks selected via cuts on the simulated values which are not in the set of tracks selected " 255 "by cutting on the emulated values ... \n";
256 for (
const auto&
track : inSimButNotEmu) {
259 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 260 <<
"The set of tracks selected via cuts on the emulated values which are not in the set of tracks selected " 261 "by cutting on the simulated values ... \n";
262 for (
const auto&
track : inEmuButNotSim) {
265 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
268 log <<
"The selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, chi2rz, " 269 "chi2rphi, z0) values are ... \n";
270 for (
const auto&
track : *vTTTrackAssociatedOutput) {
273 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedOutput->size() <<
"\n\n";
276 log <<
"The emulation selected and leading vertex associated track collection (pt, eta, phi, nstub, bendchi2, " 277 "chi2rz, chi2rphi, z0) values are " 279 for (
const auto&
track : *vTTTrackAssociatedEmulationOutput) {
282 log <<
"\t---\n\tNumber of tracks in this selection = " << vTTTrackAssociatedEmulationOutput->size() <<
"\n\n";
288 vTTTrackAssociatedOutput->end(),
289 vTTTrackAssociatedEmulationOutput->begin(),
290 vTTTrackAssociatedEmulationOutput->end(),
291 std::back_inserter(inSimButNotEmu));
293 vTTTrackAssociatedEmulationOutput->end(),
294 vTTTrackAssociatedOutput->begin(),
295 vTTTrackAssociatedOutput->end(),
296 std::back_inserter(inEmuButNotSim));
297 log <<
"The set of vertex associated tracks selected via cuts on the simulated values which are not in the set of " 299 "by cutting on the emulated values ... \n";
300 for (
const auto&
track : inSimButNotEmu) {
303 log <<
"\t---\n\tNumber of tracks in this selection = " << inSimButNotEmu.size() <<
"\n\n" 304 <<
"The set of vertex associated tracks selected via cuts on the emulated values which are not in the set of " 306 "by cutting on the simulated values ... \n";
307 for (
const auto&
track : inEmuButNotSim) {
310 log <<
"\t---\n\tNumber of tracks in this selection = " << inEmuButNotSim.size() <<
"\n\n";
316 bool printEmulation)
const {
317 log <<
"\t(" <<
track.momentum().perp() <<
", " <<
track.momentum().eta() <<
", " <<
track.momentum().phi() <<
", " 318 <<
track.getStubRefs().size() <<
", " <<
track.stubPtConsistency() <<
", " <<
track.chi2ZRed() <<
", " 319 <<
track.chi2XYRed() <<
", " <<
track.z0() <<
")\n";
321 if (printEmulation) {
322 ap_uint<TrackBitWidths::kPtSize> ptEmulationBits =
track.getTrackWord()(
323 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
324 ap_ufixed<TrackBitWidths::kPtSize, TrackBitWidths::kPtMagSize> ptEmulation;
325 ptEmulation.V = ptEmulationBits.range();
327 ap_fixed<TrackBitWidths::kEtaSize, TrackBitWidths::kEtaMagSize> etaEmulation;
328 etaEmulation.V = etaEmulationBits.range();
329 double floatTkZ0 =
track.undigitizeSignedValue(
331 double floatTkPhi =
track.undigitizeSignedValue(
333 log <<
"\t\t(" << ptEmulation.to_double() <<
", " << etaEmulation.to_double() <<
", " << floatTkPhi <<
", " 334 <<
track.getNStubs() <<
", " <<
track.getBendChi2() <<
", " <<
track.getChi2RZ() <<
", " <<
track.getChi2RPhi()
335 <<
", " << floatTkZ0 <<
")\n";
341 auto vTTTrackAssociatedOutput = std::make_unique<TTTrackRefCollectionType>();
342 auto vTTTrackAssociatedEmulationOutput = std::make_unique<TTTrackRefCollectionType>();
359 size_t nOutputApproximate = l1SelectedTracksHandle->size();
360 leadingVertex = l1VerticesHandle->at(0);
362 edm::LogInfo(
"L1TrackVertexAssociationProducer") <<
"leading vertex z0 = " << leadingVertex.
z0();
364 vTTTrackAssociatedOutput->reserve(nOutputApproximate);
365 for (
const auto& trackword : *l1SelectedTracksHandle) {
368 if (deltaZSel(*trackword, leadingVertex)) {
369 vTTTrackAssociatedOutput->push_back(trackword);
377 size_t nOutputApproximateEmulation = l1SelectedTracksEmulationHandle->
size();
378 leadingEmulationVertex = l1VerticesEmulationHandle->at(0);
381 <<
"leading emulation vertex z0 = " << leadingEmulationVertex.
z0();
383 vTTTrackAssociatedEmulationOutput->reserve(nOutputApproximateEmulation);
384 for (
const auto& trackword : *l1SelectedTracksEmulationHandle) {
386 if (deltaZSelEmu(*trackword, leadingEmulationVertex)) {
387 vTTTrackAssociatedEmulationOutput->push_back(trackword);
395 l1SelectedTracksEmulationHandle,
396 vTTTrackAssociatedOutput,
397 vTTTrackAssociatedEmulationOutput);
405 edm::InputTag(
"l1tTrackSelectionProducer",
"Level1TTTracksSelected"));
407 edm::InputTag(
"l1tTrackSelectionProducer",
"Level1TTTracksSelectedEmulation"));
410 edm::InputTag(
"l1tVertexFinderEmulator",
"L1VerticesEmulation"));
411 desc.add<
std::string>(
"outputCollectionName",
"Level1TTTracksSelectedAssociated");
414 descCutSet.
add<std::vector<double>>(
"deltaZMaxEtaBounds", {0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4})
415 ->setComment(
"these values define the bin boundaries in |eta|");
416 descCutSet.
add<std::vector<double>>(
"deltaZMax", {0.37, 0.50, 0.60, 0.75, 1.00, 1.60})
418 "delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, " 422 desc.add<
double>(
"useDisplacedTracksDeltaZOverride", -1.0)
423 ->setComment(
"override the deltaZ cut value for displaced tracks");
424 desc.add<
bool>(
"processSimulatedTracks",
true)
425 ->setComment(
"return selected tracks after cutting on the floating point values");
426 desc.add<
bool>(
"processEmulatedTracks",
true)
427 ->setComment(
"return selected tracks after cutting on the bitwise emulated values");
428 desc.add<
int>(
"debug", 0)->setComment(
"Verbosity levels: 0, 1, 2, 3");
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
std::vector< double > deltaZMax_
void printTrackInfo(edm::LogInfo &log, const TTTrackType &track, bool printEmulation=false) const
bool operator()(const TTTrackType &t, const l1t::VertexWord &v) const
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
L1TrackVertexAssociationProducer(const edm::ParameterSet &)
TTTrackDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
TTTrackDeltaZMaxSelector(const edm::ParameterSet &cfg)
bool operator()(const TTTrackType &t, const l1t::Vertex &v) const
std::vector< double > deltaZMaxEtaBounds_
~L1TrackVertexAssociationProducer() override
const std::string outputCollectionName_
const bool processEmulatedTracks_
const edm::ParameterSet cutSet_
std::vector< Vertex > VertexCollection
const double useDisplacedTracksDeltaZOverride_
const edm::EDGetTokenT< l1t::VertexCollection > l1VerticesToken_
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksToken_
TTTrackWordDeltaZMaxSelector(const std::vector< double > &deltaZMaxEtaBounds, const std::vector< double > &deltaZMax)
ap_fixed< VertexBitWidths::kZ0Size, VertexBitWidths::kZ0MagSize, AP_RND_CONV, AP_SAT > vtxz0_t
edm::Handle< TTTrackCollectionType > TTTrackCollectionHandle
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Abs< T >::type abs(const T &t)
def template(fileName, svg, replaceme="REPLACEME")
#define DEFINE_FWK_MODULE(type)
std::vector< VertexWord > VertexWordCollection
ParameterDescriptionBase * add(U const &iLabel, T const &value)
TTTrackWordDeltaZMaxSelector(const edm::ParameterSet &cfg)
Log< level::Info, false > LogInfo
std::vector< double > deltaZMax_
size_type size() const
Size of the RefVector.
Class to store the L1 Track Trigger tracks.
const_iterator end() const
Termination of iteration.
void printDebugInfo(const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksHandle, const edm::Handle< TTTrackRefCollectionType > &l1SelectedTracksEmulationHandle, const TTTrackRefCollectionUPtr &vTTTrackAssociatedOutput, const TTTrackRefCollectionUPtr &vTTTrackAssociatedEmulationOutput) const
std::vector< double > deltaZMaxEtaBounds_
static constexpr double stepPhi0
std::vector< double > deltaZMax_
std::vector< double > deltaZMaxEtaBounds_
std::unique_ptr< TTTrackRefCollectionType > TTTrackRefCollectionUPtr
ap_uint< TrackBitWidths::kTanlSize > tanl_t
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< l1t::VertexWordCollection > l1VerticesEmulationToken_
edm::RefVector< TTTrackCollectionType > TTTrackRefCollectionType
const_iterator begin() const
Initialize an iterator over the RefVector.
TTTrack< Ref_Phase2TrackerDigi_ > TTTrackType
static constexpr double stepZ0
const edm::EDGetTokenT< TTTrackRefCollectionType > l1SelectedTracksEmulationToken_
const bool processSimulatedTracks_
std::vector< TTTrackType > TTTrackCollectionType