56 virtual void endJob();
60 std::vector<l1tmetemu::cos_lut_fixed_t>
cosLUT_;
66 bool cordicDebug_ =
false;
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
235 int link_number = (
track->phiSector() * 2) + ((EtaSector) ? 0 : 1);
236 link_totals[link_number] += 1;
237 sumPx[link_number] += temppx;
238 sumPy[link_number] += temppy;
242 << std::setprecision(8) <<
"Sector: " <<
track->phiSector() <<
" Eta sector: " << EtaSector <<
"\n" 243 <<
"Track Ref Pt: " <<
track->momentum().perp() <<
" Track Ref Px: " <<
track->momentum().x()
244 <<
" Track Ref Py: " <<
track->momentum().y() <<
"\n" 245 <<
"Track Pt: " << ptEmulation <<
" Track phi: " << globalPhi <<
" Track Px: " << temppx
246 <<
" Track Py: " << temppy <<
"\n" 247 <<
"Sector Sum Px: " << sumPx[link_number] <<
" Sector Sum Py: " << sumPy[link_number] <<
"\n";
257 GlobalPx += sumPx[
i];
258 GlobalPy += sumPy[
i];
266 edm::LogVerbatim(
"L1TrackerEtMissEmulatorProducer") <<
"====Sector Pt====\n";
270 <<
"Sector " <<
i <<
"\n" 271 <<
"Px: " << sumPx[
i] <<
" | Py: " << sumPy[
i] <<
" | Link Totals: " << link_totals[
i]
272 <<
" | Sector Totals: " << sector_totals[(
int)(
i / 2)] <<
"\n";
276 <<
"====Global Pt====\n" 277 <<
"Global Px: " << GlobalPx <<
"| Global Py: " << GlobalPy <<
"\n";
284 <<
"Word MET: " << EtMiss.
Et.to_string(2) <<
" | Word MET phi: " << EtMiss.
Phi.to_string(2) <<
"\n" 285 <<
"# Tracks Associated to Vertex: " << num_assoc_tracks <<
"\n" 286 <<
"========================================================\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 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)
const unsigned int kCosLUTShift
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Class to store the L1 Track Trigger tracks.
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()
edm::RefVector< L1TTTrackCollectionType > L1TTTrackRefCollectionType
std::string L1MetCollectionName_
std::vector< L1TTTrackType > L1TTTrackCollectionType