CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
trklet::ProducerKFout Class Reference

Converts KF output into TFP output A bit accurate emulation of the track transformation, the eta routing and splitting of the 96-bit track words into 64-bit packets. Also run is a bit accurate emulation of the track quality BDT, whose output is also added to the track word. More...

Inheritance diagram for trklet::ProducerKFout:
edm::stream::EDProducer<>

Public Member Functions

 ProducerKFout (const ParameterSet &)
 
 ~ProducerKFout () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void beginRun (const Run &, const EventSetup &) override
 
template<typename T >
unsigned int digitise (const T &bins, double value, double factor)
 
void endJob ()
 
void produce (Event &, const EventSetup &) override
 

Private Attributes

const DataFormatsdataFormats_
 
vector< double > dPhiBins_
 
vector< double > dZBins_
 
EDGetTokenT< StreamsStubedGetTokenStubs_
 
EDGetTokenT< StreamsTrackedGetTokenTracks_
 
EDGetTokenT< TTTrackRefMapedGetTokenTTTrackRefMap_
 
EDPutTokenT< StreamsTrackedPutTokenAccepted_
 
EDPutTokenT< StreamsTrackedPutTokenLost_
 
ESGetToken< DataFormats, DataFormatsRcdesGetTokenDataFormats_
 
ESGetToken< Setup, SetupRcdesGetTokenSetup_
 
ParameterSet iConfig_
 
int numWorkers_
 
int partialTrackWordBits_
 
const Setupsetup_
 
vector< int > tqBins_
 
double tqTanlScale_
 
double tqZ0Scale_
 
std::unique_ptr< L1TrackQualitytrackQualityModel_
 

Static Private Attributes

static constexpr double ap_fixed_rescale = 32.0
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Converts KF output into TFP output A bit accurate emulation of the track transformation, the eta routing and splitting of the 96-bit track words into 64-bit packets. Also run is a bit accurate emulation of the track quality BDT, whose output is also added to the track word.

Author
Christopher Brown
Date
2021, Aug

Definition at line 36 of file ProducerKFout.cc.

Constructor & Destructor Documentation

◆ ProducerKFout()

trklet::ProducerKFout::ProducerKFout ( const ParameterSet iConfig)
explicit

Definition at line 94 of file ProducerKFout.cc.

References dataFormats_, edGetTokenStubs_, edGetTokenTracks_, edGetTokenTTTrackRefMap_, edPutTokenAccepted_, edPutTokenLost_, esGetTokenDataFormats_, esGetTokenSetup_, edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, setup_, tqBins_, tqTanlScale_, tqZ0Scale_, and trackQualityModel_.

94  : iConfig_(iConfig) {
95  const string& labelKF = iConfig.getParameter<string>("LabelKF");
96  const string& labelAS = iConfig.getParameter<string>("LabelAS");
97  const string& branchStubs = iConfig.getParameter<string>("BranchAcceptedStubs");
98  const string& branchTracks = iConfig.getParameter<string>("BranchAcceptedTracks");
99  const string& branchLost = iConfig.getParameter<string>("BranchLostTracks");
100  // book in- and output ED products
101  edGetTokenStubs_ = consumes<StreamsStub>(InputTag(labelKF, branchStubs));
102  edGetTokenTracks_ = consumes<StreamsTrack>(InputTag(labelKF, branchTracks));
103  edGetTokenTTTrackRefMap_ = consumes<TTTrackRefMap>(InputTag(labelAS, branchTracks));
104  edPutTokenAccepted_ = produces<StreamsTrack>(branchTracks);
105  edPutTokenLost_ = produces<StreamsTrack>(branchLost);
106  // book ES products
107  esGetTokenSetup_ = esConsumes<Setup, SetupRcd, Transition::BeginRun>();
108  esGetTokenDataFormats_ = esConsumes<DataFormats, DataFormatsRcd, Transition::BeginRun>();
109  // initial ES products
110  setup_ = nullptr;
111  dataFormats_ = nullptr;
112 
113  trackQualityModel_ = std::make_unique<L1TrackQuality>(iConfig.getParameter<edm::ParameterSet>("TrackQualityPSet"));
114  edm::ParameterSet trackQualityPSset = iConfig.getParameter<edm::ParameterSet>("TrackQualityPSet");
115  tqBins_ = trackQualityPSset.getParameter<vector<int>>("tqemu_bins");
116  tqTanlScale_ = trackQualityPSset.getParameter<double>("tqemu_TanlScale");
117  tqZ0Scale_ = trackQualityPSset.getParameter<double>("tqemu_Z0Scale");
118  }
EDPutTokenT< StreamsTrack > edPutTokenAccepted_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
vector< int > tqBins_
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
std::unique_ptr< L1TrackQuality > trackQualityModel_
EDGetTokenT< StreamsStub > edGetTokenStubs_
EDPutTokenT< StreamsTrack > edPutTokenLost_
EDGetTokenT< TTTrackRefMap > edGetTokenTTTrackRefMap_
const DataFormats * dataFormats_
EDGetTokenT< StreamsTrack > edGetTokenTracks_
const Setup * setup_

◆ ~ProducerKFout()

trklet::ProducerKFout::~ProducerKFout ( )
inlineoverride

Definition at line 39 of file ProducerKFout.cc.

39 {}

Member Function Documentation

◆ beginRun()

void trklet::ProducerKFout::beginRun ( const Run iRun,
const EventSetup iSetup 
)
overrideprivate

Definition at line 120 of file ProducerKFout.cc.

References trackerTFP::DataFormats::base(), reco::ceil(), tt::Setup::checkHistory(), tt::Setup::configurationSupported(), dataFormats_, HLT_2024v13_cff::dPhi, dPhiBins_, tt::Setup::dphiTruncation(), l1ctLayer1_cff::dZ, dZBins_, tt::Setup::dzTruncation(), esGetTokenDataFormats_, esGetTokenSetup_, edm::EventSetup::getData(), edm::ParameterSet::getParameter(), mps_fire::i, iConfig_, tt::Setup::kfNumWorker(), numWorkers_, partialTrackWordBits_, funct::pow(), edm::Run::processHistory(), TTBV::S_, setup_, tt::Setup::weightBinFraction(), and trackerTFP::DataFormats::width().

120  {
121  // helper class to store configurations
122  setup_ = &iSetup.getData(esGetTokenSetup_);
124  return;
125  // check process history if desired
126  if (iConfig_.getParameter<bool>("CheckHistory"))
128  // helper class to extract structured data from tt::Frames
130 
131  // Calculate 1/dz**2 and 1/dphi**2 bins for v0 and v1 weightings
132 
133  float temp_dphi = 0.0;
134  float temp_dz = 0.0;
135  for (int i = 0;
136  i < pow(2, dataFormats_->width(Variable::dPhi, Process::kfin)) / pow(2, setup_->weightBinFraction());
137  i++) {
138  temp_dphi =
139  pow(dataFormats_->base(Variable::dPhi, Process::kfin) * (i + 1) * pow(2, setup_->weightBinFraction()), -2);
140  temp_dphi = temp_dphi / setup_->dphiTruncation();
141  temp_dphi = std::floor(temp_dphi);
142  dPhiBins_.push_back(temp_dphi * setup_->dphiTruncation());
143  }
144  for (int i = 0; i < pow(2, dataFormats_->width(Variable::dZ, Process::kfin)) / pow(2, setup_->weightBinFraction());
145  i++) {
146  temp_dz =
147  pow(dataFormats_->base(Variable::dZ, Process::kfin) * (i + 1) * pow(2, setup_->weightBinFraction()), -2);
148  temp_dz = temp_dz * setup_->dzTruncation();
149  temp_dz = std::ceil(temp_dz);
150  dZBins_.push_back(temp_dz / setup_->dzTruncation());
151  }
154  }
constexpr int32_t ceil(float num)
double base(Variable v, Process p) const
Definition: DataFormats.h:492
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
vector< double > dPhiBins_
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
int width(Variable v, Process p) const
Definition: DataFormats.h:490
int kfNumWorker() const
Definition: Setup.h:491
bool configurationSupported() const
Definition: Setup.h:60
ProcessHistory const & processHistory() const
Definition: Run.cc:115
int weightBinFraction() const
Definition: Setup.h:513
void checkHistory(const edm::ProcessHistory &processHistory) const
Definition: Setup.cc:242
int dzTruncation() const
Definition: Setup.h:515
vector< double > dZBins_
static constexpr int S_
Definition: TTBV.h:22
const DataFormats * dataFormats_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const Setup * setup_
int dphiTruncation() const
Definition: Setup.h:517

◆ digitise()

template<typename T >
unsigned int trklet::ProducerKFout::digitise ( const T bins,
double  value,
double  factor 
)
inlineprivate

Definition at line 83 of file ProducerKFout.cc.

References newFWLiteAna::bin, trigObjTnPSource_cfi::bins, and mps_fire::i.

Referenced by produce().

83  {
84  unsigned int bin = 0;
85  for (unsigned int i = 0; i < bins.size() - 1; i++) {
86  if (value * factor > bins[i] && value * factor <= bins[i + 1])
87  break;
88  bin++;
89  }
90  return bin;
91  }
Definition: value.py:1

◆ endJob()

void trklet::ProducerKFout::endJob ( void  )
inlineprivate

Definition at line 44 of file ProducerKFout.cc.

44 {}

◆ produce()

void trklet::ProducerKFout::produce ( Event iEvent,
const EventSetup iSetup 
)
overrideprivate

Definition at line 156 of file ProducerKFout.cc.

References ap_fixed_rescale, trackerTFP::DataFormats::base(), tt::Setup::baseSector(), cms::cuda::bs, TTTrack_TrackWord::chi2RPhiBins, TTTrack_TrackWord::chi2RZBins, tt::Setup::chosenRofZ(), tt::Setup::configurationSupported(), trackerTFP::TrackKF::cot(), trackerTFP::TrackKF::cotGlobal(), d0, dataFormats_, digitise(), trackerTFP::StubKF::dPhi(), HLT_2024v13_cff::dPhi, dPhiBins_, l1ctLayer1_cff::dZ, trackerTFP::StubKF::dZ(), dZBins_, edGetTokenStubs_, edGetTokenTracks_, edGetTokenTTTrackRefMap_, edPutTokenAccepted_, edPutTokenLost_, dqmdumpme::first, L1TrackQuality::getTqMVAPreSigBins(), trackerTFP::hitPattern, tt::Setup::hybridChosenRofPhi(), iEvent, createfilelist::int, trackerTFP::TrackKF::inv2R(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, tt::Setup::kfNumWorker(), tt::Setup::kfoutchi2rphiConv(), tt::Setup::kfoutchi2rzConv(), TTTrack_TrackWord::kTrackWordSize, l1tmhtemu::kValidSize, eostools::move(), tt::Setup::numFramesIO(), tt::Setup::numLayers(), tt::Setup::numRegions(), tt::Setup::numSectorsEta(), numWorkers_, partialTrackWordBits_, trackerTFP::StubKF::phi(), trackerTFP::phi0, trackerTFP::TrackKF::phiT(), funct::pow(), edm::Handle< T >::product(), TTBV::resize(), TTBV::S_, trackerTFP::TrackKF::sectorEta(), trackerTFP::TrackKF::sectorPhi(), TTBV::set(), setup_, mergeAndRegister::slice, groupFilesInBlocks::temp, tt::Setup::tfpNumChannel(), tqTanlScale_, tqZ0Scale_, HLT_2024v13_cff::track, trackQualityModel_, pileupReCalc_HLTpaths::trunc, tt::Setup::weightBinFraction(), trackerTFP::StubKF::z(), and trackerTFP::TrackKF::zT().

156  {
157  // empty KFout product
160  // read in KF Product and produce KFout product
162  Handle<StreamsStub> handleStubs;
163  iEvent.getByToken<StreamsStub>(edGetTokenStubs_, handleStubs);
164  const StreamsStub& streamsStubs = *handleStubs.product();
165  Handle<StreamsTrack> handleTracks;
166  iEvent.getByToken<StreamsTrack>(edGetTokenTracks_, handleTracks);
167  const StreamsTrack& streamsTracks = *handleTracks.product();
168  Handle<TTTrackRefMap> handleTTTrackRefMap;
169  iEvent.getByToken<TTTrackRefMap>(edGetTokenTTTrackRefMap_, handleTTTrackRefMap);
170  const TTTrackRefMap& ttTrackRefMap = *handleTTTrackRefMap.product();
171  // 18 Output Links (First Vector) each has a vector of tracks per event (second vector) each track is 3 32 bit TTBV partial tracks
172  vector<vector<TTBV>> sortedPartialTracks(setup_->numRegions() * setup_->tfpNumChannel(), vector<TTBV>(0));
173 
174  TrackKFOutSAPtrCollectionss inTrackStreams;
175  TrackKFOutSAPtrCollectionss outTrackStreams;
176 
177  // Setup empty collections for input tracks to be routed
178  for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++) {
179  TrackKFOutSAPtrCollections temp_collection;
180  for (int iLink = 0; iLink < setup_->tfpNumChannel(); iLink++) {
182  for (int iTrack = 0; iTrack < setup_->numFramesIO(); iTrack++)
183  temp.emplace_back(std::make_shared<TrackKFOut>());
184  temp_collection.push_back(temp);
185  }
186  outTrackStreams.push_back(temp_collection);
187  }
188 
189  // Setup empty collections for output tracks from routing
190  for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++) {
191  TrackKFOutSAPtrCollections temp_collection;
192  for (int iLink = 0; iLink < numWorkers_; iLink++) {
194  for (int iTrack = 0; iTrack < setup_->numFramesIO(); iTrack++)
195  temp.emplace_back(std::make_shared<TrackKFOut>());
196  temp_collection.push_back(temp);
197  }
198  inTrackStreams.push_back(temp_collection);
199  }
200 
201  StreamsTrack outputStreamsTracks(setup_->numRegions() * setup_->tfpNumChannel());
202 
203  // Setup containers for track quality
204  float tempTQMVAPreSig = 0.0;
205  // Due to ap_fixed implementation in CMSSW this 10,5 must be specified at compile time, TODO make this a changeable parameter
206  std::vector<ap_fixed<10, 5>> trackQuality_inputs = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
207 
208  for (int iLink = 0; iLink < (int)streamsTracks.size(); iLink++) {
209  for (int iTrack = 0; iTrack < (int)streamsTracks[iLink].size(); iTrack++) {
210  const auto& track = streamsTracks[iLink].at(iTrack);
211  TrackKF inTrack(track, dataFormats_);
212 
213  double temp_z0 = inTrack.zT() - ((inTrack.cot() * setup_->chosenRofZ()));
214 
215  // Correction to Phi calcuation depending if +ve/-ve phi sector
216  const double baseSectorCorr = inTrack.sectorPhi() ? -setup_->baseSector() : setup_->baseSector();
217 
218  double temp_phi0 = inTrack.phiT() - ((inTrack.inv2R()) * setup_->hybridChosenRofPhi()) + baseSectorCorr;
219 
220  double temp_tanL = inTrack.cotGlobal();
221 
223 
224  double tempchi2rphi = 0;
225  double tempchi2rz = 0;
226 
227  int temp_nstub = 0;
228  int temp_ninterior = 0;
229  bool counter = false;
230 
231  for (int iStub = 0; iStub < setup_->numLayers() - 1; iStub++) {
232  const auto& stub = streamsStubs[setup_->numLayers() * iLink + iStub].at(iTrack);
233  StubKF inStub(stub, dataFormats_, iStub);
234 
235  if (!stub.first.isNonnull()) {
236  if (counter)
237  temp_ninterior += 1;
238  continue;
239  }
240 
241  counter = true;
242 
243  hitPattern.set(iStub);
244  temp_nstub += 1;
245  double phiSquared = pow(inStub.phi(), 2);
246  double zSquared = pow(inStub.z(), 2);
247 
248  double tempv0 = dPhiBins_[(inStub.dPhi() / (dataFormats_->base(Variable::dPhi, Process::kfin) *
249  pow(2, setup_->weightBinFraction())))];
250  double tempv1 = dZBins_[(
251  inStub.dZ() / (dataFormats_->base(Variable::dZ, Process::kfin) * pow(2, setup_->weightBinFraction())))];
252 
253  double tempRphi = phiSquared * tempv0;
254  double tempRz = zSquared * tempv1;
255 
256  tempchi2rphi += tempRphi;
257  tempchi2rz += tempRz;
258  } // Iterate over track stubs
259 
260  // Create bit vectors for eacch output, including digitisation of chi2
261  // TODO implement extraMVA, bendChi2, d0
263  TTBV extraMVA(0, TTTrack_TrackWord::TrackBitWidths::kMVAOtherSize, false);
264  TTBV bendChi2(0, TTTrack_TrackWord::TrackBitWidths::kBendChi2Size, false);
265  TTBV chi2rphi(digitise(TTTrack_TrackWord::chi2RPhiBins, tempchi2rphi, (double)setup_->kfoutchi2rphiConv()),
266  TTTrack_TrackWord::TrackBitWidths::kChi2RPhiSize,
267  false);
268  TTBV chi2rz(digitise(TTTrack_TrackWord::chi2RZBins, tempchi2rz, (double)setup_->kfoutchi2rzConv()),
269  TTTrack_TrackWord::TrackBitWidths::kChi2RZSize,
270  false);
271  TTBV d0(0, TTTrack_TrackWord::TrackBitWidths::kD0Size, false);
272  TTBV z0(
273  temp_z0, dataFormats_->base(Variable::zT, Process::kf), TTTrack_TrackWord::TrackBitWidths::kZ0Size, true);
274  TTBV tanL(temp_tanL,
275  dataFormats_->base(Variable::cot, Process::kf),
276  TTTrack_TrackWord::TrackBitWidths::kTanlSize,
277  true);
278  TTBV phi0(temp_phi0,
279  dataFormats_->base(Variable::phiT, Process::kf),
280  TTTrack_TrackWord::TrackBitWidths::kPhiSize,
281  true);
282  TTBV invR(-inTrack.inv2R(),
283  dataFormats_->base(Variable::inv2R, Process::kf),
284  TTTrack_TrackWord::TrackBitWidths::kRinvSize + 1,
285  true);
286  invR.resize(TTTrack_TrackWord::TrackBitWidths::kRinvSize);
287 
288  // Create input vector for BDT
289  trackQuality_inputs = {
290  (std::trunc(tanL.val() / tqTanlScale_)) / ap_fixed_rescale,
292  0,
293  temp_nstub,
294  temp_ninterior,
297 
298  // Run BDT emulation and package output into 3 bits
299  // output needs sigmoid transformation applied
300  tempTQMVAPreSig = trackQualityModel_->runEmulatedTQ(trackQuality_inputs);
301  TTBV tqMVA(digitise(L1TrackQuality::getTqMVAPreSigBins(), tempTQMVAPreSig, 1.0),
302  TTTrack_TrackWord::TrackBitWidths::kMVAQualitySize,
303  false);
304 
305  // Build 32 bit partial tracks for outputting in 64 bit packets
306  // 12 + 3 + 7 + 3 + 6
307  TTBV partialTrack3((d0 + bendChi2 + hitPattern + tqMVA + extraMVA), partialTrackWordBits_, false);
308  // 16 + 12 + 4
309  TTBV partialTrack2((tanL + z0 + chi2rz), partialTrackWordBits_, false);
310  // 1 + 15 + 12 + 4
311  TTBV partialTrack1((trackValid + invR + phi0 + chi2rphi), partialTrackWordBits_, false);
312 
313  int sortKey = (inTrack.sectorEta() < (int)(setup_->numSectorsEta() / 2)) ? 0 : 1;
314  // Set correct bit to valid for track valid
315  TrackKFOut temp_track(partialTrack1.set((partialTrackWordBits_ - 1)),
316  partialTrack2,
317  partialTrack3,
318  sortKey,
319  track,
320  iTrack,
321  iLink,
322  true);
323 
324  inTrackStreams[iLink / setup_->kfNumWorker()][iLink % setup_->kfNumWorker()][iTrack] =
325  (std::make_shared<TrackKFOut>(temp_track));
326  } // Iterate over Tracks
327  } // Iterate over Links
328  // Route Tracks in eta based on their sort key
329  for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++) {
330  int buffered_tracks[] = {0, 0};
331  for (int iTrack = 0; iTrack < setup_->numFramesIO() * ((double)TTBV::S_ / TTTrack_TrackWord::kTrackWordSize);
332  iTrack++) {
333  for (int iWorker = 0; iWorker < setup_->kfNumWorker(); iWorker++) {
334  for (int iLink = 0; iLink < setup_->tfpNumChannel(); iLink++) {
335  if ((inTrackStreams[iRegion][iWorker][iTrack]->sortKey() == iLink) &&
336  (inTrackStreams[iRegion][iWorker][iTrack]->dataValid() == true)) {
337  outTrackStreams[iRegion][iLink][buffered_tracks[iLink]] = inTrackStreams[iRegion][iWorker][iTrack];
338  buffered_tracks[iLink] = buffered_tracks[iLink] + 1;
339  }
340  }
341  }
342  }
343  }
344 
345  // Pack output of router onto each link, with correct partial tracks in correct places
346  for (int iRegion = 0; iRegion < setup_->numRegions(); iRegion++) {
347  for (int iLink = 0; iLink < setup_->tfpNumChannel(); iLink++) {
348  for (int iTrack = 0; iTrack < (int)outTrackStreams[iRegion][iLink].size(); iTrack++) {
349  sortedPartialTracks[2 * iRegion + iLink].push_back(
350  outTrackStreams[iRegion][iLink][iTrack]->PartialTrack1());
351  sortedPartialTracks[2 * iRegion + iLink].push_back(
352  outTrackStreams[iRegion][iLink][iTrack]->PartialTrack2());
353  sortedPartialTracks[2 * iRegion + iLink].push_back(
354  outTrackStreams[iRegion][iLink][iTrack]->PartialTrack3());
355  outputStreamsTracks[2 * iRegion + iLink].emplace_back(outTrackStreams[iRegion][iLink][iTrack]->track());
356  }
357  }
358  }
359  // Fill products and match up tracks
360  // store products
361  const TTBV nullBitTrack(0, partialTrackWordBits_, false);
362  for (int iLink = 0; iLink < (int)outputStreamsTracks.size(); iLink++) {
363  // Iterate through partial tracks
364  int numLinkTracks = (int)outputStreamsTracks[iLink].size();
365  if (numLinkTracks == 0)
366  continue; // Don't fill links if no tracks
367  if ((numLinkTracks % 2 != 0)) {
368  sortedPartialTracks[iLink].push_back(nullBitTrack); //Pad out final set of bits
369  outputStreamsTracks[iLink].emplace_back(
370  outputStreamsTracks[iLink][numLinkTracks++]); //Pad out with final repeated track
371  } //If there is an odd number of tracks
372  for (int iTrack = 0; iTrack < (int)(sortedPartialTracks[iLink].size()); iTrack++) {
373  if (iTrack % 2 != 1) // Write to links every other partial track, 3 partial tracks per full TTTrack
374  continue;
375  TTTrackRef trackRef;
376  for (auto& it : ttTrackRefMap) { //Iterate through ttTrackRefMap to find TTTrackRef Key by a TTTrack Value
377  if (it.second == outputStreamsTracks[iLink][(int)(iTrack - 1) / 3].first)
378  trackRef = it.first;
379  }
380  if ((int)iTrack / 3 <= setup_->numFramesIO() * ((double)TTBV::S_ / TTTrack_TrackWord::kTrackWordSize))
381  accepted[iLink].emplace_back(
382  std::make_pair(trackRef,
383  (sortedPartialTracks[iLink][iTrack - 1].slice(partialTrackWordBits_) +
384  sortedPartialTracks[iLink][iTrack].slice(partialTrackWordBits_))
385  .bs()));
386  else
387  lost[iLink].emplace_back(
388  std::make_pair(trackRef,
389  (sortedPartialTracks[iLink][iTrack - 1].slice(partialTrackWordBits_) +
390  sortedPartialTracks[iLink][iTrack].slice(partialTrackWordBits_))
391  .bs()));
392  } //Iterate through sorted partial tracks
393  } // Iterate through links
394  } // Config Supported
395  // store products
396  iEvent.emplace(edPutTokenAccepted_, std::move(accepted));
397  iEvent.emplace(edPutTokenLost_, std::move(lost));
398  }
size
Write out results.
EDPutTokenT< StreamsTrack > edPutTokenAccepted_
std::vector< std::vector< std::vector< std::shared_ptr< TrackKFOut > > > > TrackKFOutSAPtrCollectionss
Definition: DataFormats.h:1031
double base(Variable v, Process p) const
Definition: DataFormats.h:492
static constexpr std::array< double, 1<< TTTrack_TrackWord::TrackBitWidths::kMVAQualitySize > getTqMVAPreSigBins()
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RPhiSize > chi2RPhiBins
std::vector< StreamTrack > StreamsTrack
Definition: TTTypes.h:67
std::map< TTTrackRef, TTTrackRef > TTTrackRefMap
Definition: TTTypes.h:69
int kfoutchi2rzConv() const
Definition: Setup.h:511
double chosenRofZ() const
Definition: Setup.h:417
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
Definition: TTBV.h:20
vector< double > dPhiBins_
std::vector< StreamStub > StreamsStub
Definition: TTTypes.h:66
int tfpNumChannel() const
Definition: Setup.h:408
T const * product() const
Definition: Handle.h:70
std::vector< std::vector< std::shared_ptr< TrackKFOut > > > TrackKFOutSAPtrCollections
Definition: DataFormats.h:1030
TTBV & resize(int size)
Definition: TTBV.h:237
std::unique_ptr< L1TrackQuality > trackQualityModel_
int numSectorsEta() const
Definition: Setup.h:415
int iEvent
Definition: GenABIO.cc:224
static constexpr double ap_fixed_rescale
int kfoutchi2rphiConv() const
Definition: Setup.h:509
int kfNumWorker() const
Definition: Setup.h:491
EDGetTokenT< StreamsStub > edGetTokenStubs_
double baseSector() const
Definition: Setup.h:424
const unsigned int kValidSize
EDPutTokenT< StreamsTrack > edPutTokenLost_
bool configurationSupported() const
Definition: Setup.h:60
int weightBinFraction() const
Definition: Setup.h:513
int numLayers() const
Definition: Setup.h:215
double hybridChosenRofPhi() const
Definition: Setup.h:266
std::vector< TrackKFOutSAPtr > TrackKFOutSAPtrCollection
Definition: DataFormats.h:1029
static constexpr float d0
static constexpr int kTrackWordSize
int numRegions() const
Definition: Setup.h:349
vector< double > dZBins_
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RZSize > chi2RZBins
EDGetTokenT< TTTrackRefMap > edGetTokenTTTrackRefMap_
static constexpr int S_
Definition: TTBV.h:22
const DataFormats * dataFormats_
EDGetTokenT< StreamsTrack > edGetTokenTracks_
int numFramesIO() const
Definition: Setup.h:157
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
def move(src, dest)
Definition: eostools.py:511
const Setup * setup_
unsigned int digitise(const T &bins, double value, double factor)

Member Data Documentation

◆ ap_fixed_rescale

constexpr double trklet::ProducerKFout::ap_fixed_rescale = 32.0
staticprivate

Definition at line 74 of file ProducerKFout.cc.

Referenced by produce().

◆ dataFormats_

const DataFormats* trklet::ProducerKFout::dataFormats_
private

Definition at line 65 of file ProducerKFout.cc.

Referenced by beginRun(), produce(), and ProducerKFout().

◆ dPhiBins_

vector<double> trklet::ProducerKFout::dPhiBins_
private

Definition at line 67 of file ProducerKFout.cc.

Referenced by beginRun(), and produce().

◆ dZBins_

vector<double> trklet::ProducerKFout::dZBins_
private

Definition at line 68 of file ProducerKFout.cc.

Referenced by beginRun(), and produce().

◆ edGetTokenStubs_

EDGetTokenT<StreamsStub> trklet::ProducerKFout::edGetTokenStubs_
private

Definition at line 47 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ edGetTokenTracks_

EDGetTokenT<StreamsTrack> trklet::ProducerKFout::edGetTokenTracks_
private

Definition at line 49 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ edGetTokenTTTrackRefMap_

EDGetTokenT<TTTrackRefMap> trklet::ProducerKFout::edGetTokenTTTrackRefMap_
private

Definition at line 51 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ edPutTokenAccepted_

EDPutTokenT<StreamsTrack> trklet::ProducerKFout::edPutTokenAccepted_
private

Definition at line 53 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ edPutTokenLost_

EDPutTokenT<StreamsTrack> trklet::ProducerKFout::edPutTokenLost_
private

Definition at line 55 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ esGetTokenDataFormats_

ESGetToken<DataFormats, DataFormatsRcd> trklet::ProducerKFout::esGetTokenDataFormats_
private

Definition at line 59 of file ProducerKFout.cc.

Referenced by beginRun(), and ProducerKFout().

◆ esGetTokenSetup_

ESGetToken<Setup, SetupRcd> trklet::ProducerKFout::esGetTokenSetup_
private

Definition at line 57 of file ProducerKFout.cc.

Referenced by beginRun(), and ProducerKFout().

◆ iConfig_

ParameterSet trklet::ProducerKFout::iConfig_
private

Definition at line 61 of file ProducerKFout.cc.

Referenced by beginRun().

◆ numWorkers_

int trklet::ProducerKFout::numWorkers_
private

Definition at line 77 of file ProducerKFout.cc.

Referenced by beginRun(), and produce().

◆ partialTrackWordBits_

int trklet::ProducerKFout::partialTrackWordBits_
private

Definition at line 79 of file ProducerKFout.cc.

Referenced by beginRun(), and produce().

◆ setup_

const Setup* trklet::ProducerKFout::setup_
private

◆ tqBins_

vector<int> trklet::ProducerKFout::tqBins_
private

Definition at line 71 of file ProducerKFout.cc.

Referenced by ProducerKFout().

◆ tqTanlScale_

double trklet::ProducerKFout::tqTanlScale_
private

Definition at line 72 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ tqZ0Scale_

double trklet::ProducerKFout::tqZ0Scale_
private

Definition at line 73 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().

◆ trackQualityModel_

std::unique_ptr<L1TrackQuality> trklet::ProducerKFout::trackQualityModel_
private

Definition at line 70 of file ProducerKFout.cc.

Referenced by produce(), and ProducerKFout().