56 virtual void endJob();
60 std::vector<l1tmetemu::cos_lut_fixed_t>
cosLUT_;
66 bool cordicDebug_ =
false;
115 std::unique_ptr<std::vector<l1t::EtSum>>
METCollection(
new std::vector<l1t::EtSum>(0));
126 if (!L1TTTrackHandle.
isValid()) {
127 LogError(
"L1TrackerEtMissEmulatorProducer") <<
"\nWarning: L1TTTrackCollection not found in the event. Exit\n";
131 if (!L1TTTrackAssociatedHandle.
isValid()) {
132 LogError(
"L1TrackerEtMissEmulatorProducer")
133 <<
"\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n";
139 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};
140 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};
141 int link_totals[
l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
145 int num_assoc_tracks{0};
147 for (
const auto&
track : *L1TTTrackHandle) {
148 if (
std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(),
track) !=
149 L1TTTrackAssociatedHandle->end()) {
150 bool EtaSector = (
track->getTanlWord() & (1 << (TTTrack_TrackWord::TrackBitWidths::kTanlSize - 1)));
152 ap_uint<TTTrack_TrackWord::TrackBitWidths::kRinvSize - 1> ptEmulationBits =
track->getTrackWord()(
153 TTTrack_TrackWord::TrackBitLocations::kRinvMSB - 1, TTTrack_TrackWord::TrackBitLocations::kRinvLSB);
155 ptEmulation.V = ptEmulationBits.range();
163 <<
"Track to Vertex ID: " << num_assoc_tracks <<
"\n" 164 <<
"Phi Sector: " <<
track->phiSector() <<
" pT: " <<
track->getRinvWord()
165 <<
" Phi: " <<
track->getPhiWord() <<
" TanL: " <<
track->getTanlWord() <<
" Z0: " <<
track->getZ0Word()
166 <<
" Chi2rphi: " <<
track->getChi2RPhiWord() <<
" Chi2rz: " <<
track->getChi2RZWord()
167 <<
" bendChi2: " <<
track->getBendChi2Word() <<
" Emu pT " << ptEmulation.to_double() <<
"\n" 168 <<
"--------------------------------------------------------------\n";
173 <<
"========================Phi debug=================================\n" 174 <<
"Emu pT: " << ptEmulation.to_double() <<
" float pT: " <<
track->momentum().perp() <<
"\n" 175 <<
"Int Phi: " << globalPhi <<
" Float Phi: " <<
track->phi() <<
" Float Cos(Phi): " <<
cos(
track->phi())
176 <<
" Float Sin(Phi): " <<
sin(
track->phi())
177 <<
" Float Px: " <<
track->momentum().perp() *
cos(
track->phi())
178 <<
" Float Py: " <<
track->momentum().perp() *
sin(
track->phi()) <<
"\n";
186 sector_totals[
track->phiSector()] += 1;
193 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 1 <<
"\n" 194 <<
"Emu Phi: " << globalPhi <<
" Emu Cos(Phi): " <<
cosLUT_[globalPhi]
203 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 2 <<
"\n" 213 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 3 <<
"\n" 224 <<
"Sector: " <<
track->phiSector() <<
" Quadrant: " << 4 <<
"\n" 233 int link_number = (
track->phiSector() * 2) + ((EtaSector) ? 0 : 1);
234 link_totals[link_number] += 1;
235 sumPx[link_number] += temppx;
236 sumPy[link_number] += temppy;
240 << std::setprecision(8) <<
"Sector: " <<
track->phiSector() <<
" Eta sector: " << EtaSector <<
"\n" 241 <<
"Track Ref Pt: " <<
track->momentum().perp() <<
" Track Ref Px: " <<
track->momentum().x()
242 <<
" Track Ref Py: " <<
track->momentum().y() <<
"\n" 243 <<
"Track Pt: " << ptEmulation <<
" Track phi: " << globalPhi <<
" Track Px: " << temppx
244 <<
" Track Py: " << temppy <<
"\n" 245 <<
"Sector Sum Px: " << sumPx[link_number] <<
" Sector Sum Py: " << sumPy[link_number] <<
"\n";
255 GlobalPx += sumPx[
i];
256 GlobalPy += sumPy[
i];
264 edm::LogVerbatim(
"L1TrackerEtMissEmulatorProducer") <<
"====Sector Pt====\n";
268 <<
"Sector " <<
i <<
"\n" 269 <<
"Px: " << sumPx[
i] <<
" | Py: " << sumPy[
i] <<
" | Link Totals: " << link_totals[
i]
270 <<
" | Sector Totals: " << sector_totals[(
int)(
i / 2)] <<
"\n";
274 <<
"====Global Pt====\n" 275 <<
"Global Px: " << GlobalPx <<
"| Global Py: " << GlobalPy <<
"\n";
282 <<
"Word MET: " << EtMiss.
Et.to_string(2) <<
" | Word MET phi: " << EtMiss.
Phi.to_string(2) <<
"\n" 283 <<
"# Tracks Associated to Vertex: " << num_assoc_tracks <<
"\n" 284 <<
"========================================================\n";
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
ap_fixed< kMETSize+kEtExtra, kMETMagSize+kEtExtra, AP_RND_CONV, AP_SAT > Et_t
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
~L1TrackerEtMissEmulatorProducer() override
ap_int< TTTrack_TrackWord::TrackBitWidths::kPhiSize+kGlobalPhiExtra > global_phi_t
std::vector< l1tmetemu::global_phi_t > phiQuadrants_
void printLUT(std::vector< T > lut, std::string module="", std::string name="")
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)
const unsigned int kNQuadrants
std::vector< reco::MET > METCollection
collection of MET objects
const unsigned int kNSector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void addDefault(ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
const double kMaxCosLUTPhi
const edm::EDGetTokenT< L1TTTrackRefCollectionType > vtxAssocTrackToken_
L1TrackerEtMissEmulatorProducer(const edm::ParameterSet &)
const double kStepMETwordPhi
Cos< T >::type cos(const T &t)
const edm::EDGetTokenT< L1TTTrackRefCollectionType > trackToken_
#define DEFINE_FWK_MODULE(type)
std::vector< l1tmetemu::global_phi_t > phiShifts_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Class to store the L1 Track Trigger tracks.
static constexpr double stepPhi0
std::vector< global_phi_t > generatePhiSliceLUT(unsigned int N)
std::vector< l1tmetemu::cos_lut_fixed_t > cosLUT_
const unsigned int kPtMagSize
std::vector< cos_lut_fixed_t > generateCosLUT(unsigned int size)
edm::RefVector< L1TTTrackCollectionType > L1TTTrackRefCollectionType
std::string L1MetCollectionName_
std::vector< L1TTTrackType > L1TTTrackCollectionType