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 93 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_.

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

References trackerTFP::DataFormats::base(), reco::ceil(), tt::Setup::checkHistory(), tt::Setup::configurationSupported(), dataFormats_, HLT_2024v11_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().

119  {
120  // helper class to store configurations
121  setup_ = &iSetup.getData(esGetTokenSetup_);
123  return;
124  // check process history if desired
125  if (iConfig_.getParameter<bool>("CheckHistory"))
127  // helper class to extract structured data from tt::Frames
129 
130  // Calculate 1/dz**2 and 1/dphi**2 bins for v0 and v1 weightings
131 
132  float temp_dphi = 0.0;
133  float temp_dz = 0.0;
134  for (int i = 0;
135  i < pow(2, dataFormats_->width(Variable::dPhi, Process::kfin)) / pow(2, setup_->weightBinFraction());
136  i++) {
137  temp_dphi =
138  pow(dataFormats_->base(Variable::dPhi, Process::kfin) * (i + 1) * pow(2, setup_->weightBinFraction()), -2);
139  temp_dphi = temp_dphi / setup_->dphiTruncation();
140  temp_dphi = std::floor(temp_dphi);
141  dPhiBins_.push_back(temp_dphi * setup_->dphiTruncation());
142  }
143  for (int i = 0; i < pow(2, dataFormats_->width(Variable::dZ, Process::kfin)) / pow(2, setup_->weightBinFraction());
144  i++) {
145  temp_dz =
146  pow(dataFormats_->base(Variable::dZ, Process::kfin) * (i + 1) * pow(2, setup_->weightBinFraction()), -2);
147  temp_dz = temp_dz * setup_->dzTruncation();
148  temp_dz = std::ceil(temp_dz);
149  dZBins_.push_back(temp_dz / setup_->dzTruncation());
150  }
153  }
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  bin = i;
88  }
89  return bin;
90  }
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 155 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_2024v11_cff::dPhi, dPhiBins_, l1ctLayer1_cff::dZ, trackerTFP::StubKF::dZ(), dZBins_, edGetTokenStubs_, edGetTokenTracks_, edGetTokenTTTrackRefMap_, edPutTokenAccepted_, edPutTokenLost_, dqmdumpme::first, 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(), 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(), tqBins_, tqTanlScale_, tqZ0Scale_, HLT_2024v11_cff::track, trackQualityModel_, pileupReCalc_HLTpaths::trunc, tt::Setup::weightBinFraction(), trackerTFP::StubKF::z(), and trackerTFP::TrackKF::zT().

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