110 std::unique_ptr<std::vector<l1t::EtSum>>
METCollection(
new std::vector<l1t::EtSum>(0));
121 if (!L1TTTrackHandle.
isValid()) {
122 LogError(
"L1TrackerEtMissEmulatorProducer") <<
"\nWarning: L1TTTrackCollection not found in the event. Exit\n";
126 if (!L1TTTrackAssociatedHandle.
isValid()) {
127 LogError(
"L1TrackerEtMissEmulatorProducer")
128 <<
"\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n";
134 l1tmetemu::Et_t sumPx[
l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
135 l1tmetemu::Et_t sumPy[
l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
136 int link_totals[
l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
140 int num_assoc_tracks{0};
142 for (
const auto&
track : *L1TTTrackHandle) {
143 if (
std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(),
track) !=
144 L1TTTrackAssociatedHandle->end()) {
145 bool EtaSector = (
track->getTanlWord() & (1 << (TTTrack_TrackWord::TrackBitWidths::kTanlSize - 1)));
147 ap_uint<TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1> ptEmulationBits =
track->getTrackWord()(
148 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
150 ptEmulation.V = ptEmulationBits.range();
158 <<
"Track to Vertex ID: " << num_assoc_tracks <<
"\n" 159 <<
"Phi Sector: " <<
track->phiSector() <<
" pT: " <<
track->getRinvWord()
160 <<
" Phi: " <<
track->getPhiWord() <<
" TanL: " <<
track->getTanlWord() <<
" Z0: " <<
track->getZ0Word()
161 <<
" Chi2rphi: " <<
track->getChi2RPhiWord() <<
" Chi2rz: " <<
track->getChi2RZWord()
162 <<
" bendChi2: " <<
track->getBendChi2Word() <<
" Emu pT " << ptEmulation.to_double() <<
"\n" 163 <<
"--------------------------------------------------------------\n";
168 <<
"========================Phi debug=================================\n" 169 <<
"Emu pT: " << ptEmulation.to_double() <<
" float pT: " <<
track->momentum().perp() <<
"\n" 170 <<
"Int Phi: " << globalPhi <<
" Float Phi: " <<
track->phi() <<
" Float Cos(Phi): " <<
cos(
track->phi())
171 <<
" Float Sin(Phi): " <<
sin(
track->phi())
172 <<
" Float Px: " <<
track->momentum().perp() *
cos(
track->phi())
173 <<
" Float Py: " <<
track->momentum().perp() *
sin(
track->phi()) <<
"\n";
181 sector_totals[
track->phiSector()] += 1;
189 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 1 <<
"\n" 200 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 2 <<
"\n" 201 <<
"Emu Phi: " << globalPhi <<
" Emu Cos(Phi): -" 212 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 3 <<
"\n" 213 <<
"Emu Phi: " << globalPhi <<
" Emu Cos(Phi): -" 225 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 4 <<
"\n" 226 <<
" Emu Phi: " << globalPhi
232 int link_number = (
track->phiSector() * 2) + ((EtaSector) ? 0 : 1);
233 link_totals[link_number] += 1;
234 sumPx[link_number] += temppx;
235 sumPy[link_number] += temppy;
239 << std::setprecision(8) <<
"Sector: " <<
track->phiSector() <<
" Eta sector: " << EtaSector <<
"\n" 240 <<
"Track Ref Pt: " <<
track->momentum().perp() <<
" Track Ref Px: " <<
track->momentum().x()
241 <<
" Track Ref Py: " <<
track->momentum().y() <<
"\n" 242 <<
"Track Pt: " << ptEmulation <<
" Track phi: " << globalPhi <<
" Track Px: " << temppx
243 <<
" Track Py: " << temppy <<
"\n" 244 <<
"Sector Sum Px: " << sumPx[link_number] <<
" Sector Sum Py: " << sumPy[link_number] <<
"\n";
254 GlobalPx += sumPx[
i];
255 GlobalPy += sumPy[
i];
263 edm::LogVerbatim(
"L1TrackerEtMissEmulatorProducer") <<
"====Sector Pt====\n";
267 <<
"Sector " <<
i <<
"\n" 268 <<
"Px: " << sumPx[
i] <<
" | Py: " << sumPy[
i] <<
" | Link Totals: " << link_totals[
i]
269 <<
" | Sector Totals: " << sector_totals[(
int)(
i / 2)] <<
"\n";
273 <<
"====Global Pt====\n" 274 <<
"Global Px: " << GlobalPx <<
"| Global Py: " << GlobalPy <<
"\n";
281 <<
"Word MET: " << EtMiss.
Et.to_string(2) <<
" | Word MET phi: " << EtMiss.
Phi.to_string(2) <<
"\n" 282 <<
"# Tracks Associated to Vertex: " << num_assoc_tracks <<
"\n" 283 <<
"========================================================\n";
Log< level::Info, true > LogVerbatim
ap_fixed< kMETSize+kEtExtra, kMETMagSize+kEtExtra, AP_RND_CONV, AP_SAT > Et_t
ap_int< TTTrack_TrackWord::TrackBitWidths::kPhiSize+kGlobalPhiExtra > global_phi_t
std::vector< l1tmetemu::global_phi_t > phiQuadrants_
Sin< T >::type sin(const T &t)
EtMiss cordicSqrt(Et_t x, Et_t y, int cordicSteps, std::vector< l1tmhtemu::MHTphi_t > atanLUT, std::vector< Et_t > magNormalisationLUT)
global_phi_t localToGlobalPhi(TTTrack_TrackWord::phi_t local_phi, global_phi_t sector_shift)
const double kStepMETwordEt
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< reco::MET > METCollection
collection of MET objects
const unsigned int kNSector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const edm::EDGetTokenT< L1TTTrackRefCollectionType > vtxAssocTrackToken_
const double kStepMETwordPhi
Cos< T >::type cos(const T &t)
const edm::EDGetTokenT< L1TTTrackRefCollectionType > trackToken_
std::vector< l1tmetemu::global_phi_t > phiShifts_
const unsigned int kCosLUTShift
std::vector< l1tmetemu::cos_lut_fixed_t > cosLUT_
const unsigned int kPtMagSize
std::string L1MetCollectionName_