85 for (
unsigned int i = 0;
i <
bins.size() - 1;
i++) {
93 ProducerKFout::ProducerKFout(
const ParameterSet& iConfig) : 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");
132 float temp_dphi = 0.0;
140 temp_dphi = std::floor(temp_dphi);
182 temp.emplace_back(std::make_shared<TrackKFOut>());
183 temp_collection.push_back(
temp);
185 outTrackStreams.push_back(temp_collection);
191 for (
int iLink = 0; iLink <
numWorkers_; iLink++) {
194 temp.emplace_back(std::make_shared<TrackKFOut>());
195 temp_collection.push_back(
temp);
197 inTrackStreams.push_back(temp_collection);
203 float tempTQMVA = 0.0;
205 std::vector<ap_fixed<10, 5>> trackQuality_inputs = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
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);
223 double tempchi2rphi = 0;
224 double tempchi2rz = 0;
227 int temp_ninterior = 0;
231 const auto& stub = streamsStubs[
setup_->
numLayers() * iLink + iStub].at(iTrack);
234 if (!stub.first.isNonnull()) {
244 double phiSquared =
pow(inStub.
phi(), 2);
245 double zSquared =
pow(inStub.
z(), 2);
252 double tempRphi = phiSquared * tempv0;
253 double tempRz = zSquared * tempv1;
255 tempchi2rphi += tempRphi;
256 tempchi2rz += tempRz;
262 TTBV extraMVA(0, TTTrack_TrackWord::TrackBitWidths::kMVAOtherSize,
false);
263 TTBV bendChi2(0, TTTrack_TrackWord::TrackBitWidths::kBendChi2Size,
false);
265 TTTrack_TrackWord::TrackBitWidths::kChi2RPhiSize,
268 TTTrack_TrackWord::TrackBitWidths::kChi2RZSize,
270 TTBV d0(0, TTTrack_TrackWord::TrackBitWidths::kD0Size,
false);
272 temp_z0,
dataFormats_->
base(Variable::zT, Process::kf), TTTrack_TrackWord::TrackBitWidths::kZ0Size,
true);
275 TTTrack_TrackWord::TrackBitWidths::kTanlSize,
279 TTTrack_TrackWord::TrackBitWidths::kPhiSize,
283 TTTrack_TrackWord::TrackBitWidths::kRinvSize + 1,
285 invR.
resize(TTTrack_TrackWord::TrackBitWidths::kRinvSize);
288 trackQuality_inputs = {
301 TTBV tqMVA(
digitise(
tqBins_, tempTQMVA, 1.0), TTTrack_TrackWord::TrackBitWidths::kMVAQualitySize,
false);
323 (std::make_shared<TrackKFOut>(temp_track));
328 int buffered_tracks[] = {0, 0};
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;
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());
361 for (
int iLink = 0; iLink < (
int)outputStreamsTracks.size(); iLink++) {
363 int numLinkTracks = (
int)outputStreamsTracks[iLink].size();
364 if (numLinkTracks == 0)
366 if ((numLinkTracks % 2 != 0)) {
367 sortedPartialTracks[iLink].push_back(nullBitTrack);
368 outputStreamsTracks[iLink].emplace_back(
369 outputStreamsTracks[iLink][numLinkTracks++]);
371 for (
int iTrack = 0; iTrack < (
int)(sortedPartialTracks[iLink].size()); iTrack++) {
375 for (
auto&
it : ttTrackRefMap) {
376 if (
it.second == outputStreamsTracks[iLink][(
int)(iTrack - 1) / 3].
first)
379 if ((
int)iTrack / 3 <=
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<< 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
~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)