3 using namespace l1tpf_impl;
7 coeFileName(iConfig.getUntrackedParameter<std::
string>(
"coeFileName",
"")),
9 ntracksmax(iConfig.getUntrackedParameter<unsigned int>(
"ntracksmax")),
10 phiSlices(iConfig.getParameter<std::
vector<edm::
ParameterSet>>(
"regions")[0].getParameter<uint32_t>(
"phiSlices")),
11 debug_(iConfig.getUntrackedParameter<int>(
"debug", 0)) {
20 char depth_width[256];
23 "; of depth=%i, and width=%i. In this case, values are specified\n",
26 std::vector<std::string> vheader = {
"; Sample memory initialization file for Dual Port Block Memory,\n",
31 "; This .COE file specifies the contents for a block memory\n",
33 "; in binary format.\n",
34 "memory_initialization_radix=2;\n",
35 "memory_initialization_vector=\n"};
36 for (uint32_t
i = 0;
i < vheader.size(); ++
i)
37 fprintf(
file,
"%s", vheader[
i].c_str());
42 bool has_track =
false;
43 for (
unsigned int irow = 0; irow <
ntracksmax; irow++) {
44 for (
unsigned int icol = 0; icol < regions.size(); icol++) {
45 if (regions[icol].
track.size() <= irow)
52 current_track = regions[icol].track[irow];
57 int offset = std::accumulate(track_word_block_sizes.begin(), track_word_block_sizes.begin() + iblock, 0);
60 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwPt, ibit));
66 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwVtxPhi, ibit));
69 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwVtxEta, ibit));
72 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwZ0, ibit));
75 bset_.set(ibit + offset,
false);
78 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwChi2, ibit));
81 bset_.set(ibit + offset,
false);
84 bset_.set(ibit + offset, getBit<uint16_t>(current_track.
hwStubs, ibit));
87 bset_.set(ibit + offset,
false);
98 if (
debug_ && print && irow == 0 && icol == 0) {
99 printf(
"region: eta=[%f,%f] phi=%f+/-%f\n",
102 regions[icol].phiCenter,
103 regions[icol].phiHalfWidth);
104 printf(
"l1t::PFTrack (pT,eta,phi) [float] = (%f,%f,%f)\n",
105 current_track.
src->
p4().Pt(),
106 current_track.
src->
p4().Eta(),
107 current_track.
src->
p4().Phi());
108 printf(
"l1t::PFTrack (pT,eta,phi) [int] = (%i,%i,%i)\n",
112 printf(
"l1tpf_impl::PropagatedTrack (1/pT,eta,phi) [int,10] = (%i,%i,%i)\n",
116 printf(
"l1tpf_impl::PropagatedTrack (1/pT,eta,phi) [int,2] = (%s,%s,%s)\n",
117 std::bitset<16>(current_track.
hwPt).to_string().c_str(),
118 std::bitset<32>(current_track.
hwVtxEta).to_string().c_str(),
119 std::bitset<32>(current_track.
hwVtxPhi).to_string().c_str());
128 fprintf(
file, (irow == ntracksmax - 1) ?
";\n" :
",\n");
static constexpr unsigned int tracksize
const std::vector< uint32_t > track_word_block_sizes
const LorentzVector & p4() const final
four-momentum Lorentz vector
COEFile(const edm::ParameterSet &)
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
boost::dynamic_bitset bset_
void writeTracksToFile(const std::vector< Region > ®ions, bool print=false)