85 for (
unsigned int i = 0;
i <
bins.size() - 1;
i++) {
94 ProducerKFout::ProducerKFout(
const ParameterSet& iConfig) : 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");
133 float temp_dphi = 0.0;
141 temp_dphi = std::floor(temp_dphi);
183 temp.emplace_back(std::make_shared<TrackKFOut>());
184 temp_collection.push_back(
temp);
186 outTrackStreams.push_back(temp_collection);
192 for (
int iLink = 0; iLink <
numWorkers_; iLink++) {
195 temp.emplace_back(std::make_shared<TrackKFOut>());
196 temp_collection.push_back(
temp);
198 inTrackStreams.push_back(temp_collection);
204 float tempTQMVAPreSig = 0.0;
206 std::vector<ap_fixed<10, 5>> trackQuality_inputs = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
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);
224 double tempchi2rphi = 0;
225 double tempchi2rz = 0;
228 int temp_ninterior = 0;
232 const auto& stub = streamsStubs[
setup_->
numLayers() * iLink + iStub].at(iTrack);
235 if (!stub.first.isNonnull()) {
245 double phiSquared =
pow(inStub.
phi(), 2);
246 double zSquared =
pow(inStub.
z(), 2);
253 double tempRphi = phiSquared * tempv0;
254 double tempRz = zSquared * tempv1;
256 tempchi2rphi += tempRphi;
257 tempchi2rz += tempRz;
263 TTBV extraMVA(0, TTTrack_TrackWord::TrackBitWidths::kMVAOtherSize,
false);
264 TTBV bendChi2(0, TTTrack_TrackWord::TrackBitWidths::kBendChi2Size,
false);
266 TTTrack_TrackWord::TrackBitWidths::kChi2RPhiSize,
269 TTTrack_TrackWord::TrackBitWidths::kChi2RZSize,
271 TTBV d0(0, TTTrack_TrackWord::TrackBitWidths::kD0Size,
false);
273 temp_z0,
dataFormats_->
base(Variable::zT, Process::kf), TTTrack_TrackWord::TrackBitWidths::kZ0Size,
true);
276 TTTrack_TrackWord::TrackBitWidths::kTanlSize,
280 TTTrack_TrackWord::TrackBitWidths::kPhiSize,
284 TTTrack_TrackWord::TrackBitWidths::kRinvSize + 1,
286 invR.
resize(TTTrack_TrackWord::TrackBitWidths::kRinvSize);
289 trackQuality_inputs = {
302 TTTrack_TrackWord::TrackBitWidths::kMVAQualitySize,
325 (std::make_shared<TrackKFOut>(temp_track));
330 int buffered_tracks[] = {0, 0};
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;
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());
362 for (
int iLink = 0; iLink < (
int)outputStreamsTracks.size(); iLink++) {
364 int numLinkTracks = (
int)outputStreamsTracks[iLink].size();
365 if (numLinkTracks == 0)
367 if ((numLinkTracks % 2 != 0)) {
368 sortedPartialTracks[iLink].push_back(nullBitTrack);
369 outputStreamsTracks[iLink].emplace_back(
370 outputStreamsTracks[iLink][numLinkTracks++]);
372 for (
int iTrack = 0; iTrack < (
int)(sortedPartialTracks[iLink].size()); iTrack++) {
376 for (
auto&
it : ttTrackRefMap) {
377 if (
it.second == outputStreamsTracks[iLink][(
int)(iTrack - 1) / 3].
first)
381 accepted[iLink].emplace_back(
382 std::make_pair(trackRef,
387 lost[iLink].emplace_back(
388 std::make_pair(trackRef,
EDPutTokenT< StreamsTrack > edPutTokenAccepted_
std::vector< std::vector< std::vector< std::shared_ptr< TrackKFOut > > > > TrackKFOutSAPtrCollectionss
constexpr int32_t ceil(float num)
static constexpr std::array< double, 1<< TTTrack_TrackWord::TrackBitWidths::kMVAQualitySize > getTqMVAPreSigBins()
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RPhiSize > chi2RPhiBins
T getParameter(std::string const &) const
ESGetToken< Setup, SetupRcd > esGetTokenSetup_
std::vector< StreamTrack > StreamsTrack
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::map< TTTrackRef, TTTrackRef > TTTrackRefMap
int kfoutchi2rzConv() const
double chosenRofZ() const
Bit vector used by Track Trigger emulators. Mainly used to convert integers into arbitrary (within ma...
vector< double > dPhiBins_
Class to process and provide run-time constants used by Track Trigger emulators.
std::vector< StreamStub > StreamsStub
int tfpNumChannel() const
T const * product() const
std::vector< std::vector< std::shared_ptr< TrackKFOut > > > TrackKFOutSAPtrCollections
int partialTrackWordBits_
ESGetToken< DataFormats, DataFormatsRcd > esGetTokenDataFormats_
std::unique_ptr< L1TrackQuality > trackQualityModel_
int numSectorsEta() const
static constexpr double ap_fixed_rescale
int kfoutchi2rphiConv() const
EDGetTokenT< StreamsStub > edGetTokenStubs_
double baseSector() const
const unsigned int kValidSize
EDPutTokenT< StreamsTrack > edPutTokenLost_
bool configurationSupported() const
#define DEFINE_FWK_MODULE(type)
ProcessHistory const & processHistory() const
void beginRun(const Run &, const EventSetup &) override
int weightBinFraction() const
double hybridChosenRofPhi() const
std::vector< TrackKFOutSAPtr > TrackKFOutSAPtrCollection
void checkHistory(const edm::ProcessHistory &processHistory) const
static constexpr float d0
void produce(Event &, const EventSetup &) override
static constexpr int kTrackWordSize
~ProducerKFout() override
static constexpr std::array< double, 1<< TrackBitWidths::kChi2RZSize > chi2RZBins
EDGetTokenT< TTTrackRefMap > edGetTokenTTTrackRefMap_
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.
const DataFormats * dataFormats_
EDGetTokenT< StreamsTrack > edGetTokenTracks_
Power< A, B >::type pow(const A &a, const B &b)
int dphiTruncation() const
unsigned int digitise(const T &bins, double value, double factor)