CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PtAssignment Class Reference

#include <PtAssignment.h>

Public Member Functions

const PtAssignmentEngineAuxaux () const
 
void configure (const PtAssignmentEngine *pt_assign_engine, int verbose, int endcap, int sector, int bx, int ptLUTVersion, bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt, bool bugGMTPhi, bool promoteMode7)
 
void process (EMTFTrackCollection &best_tracks)
 

Private Attributes

bool bugGMTPhi_
 
int bx_
 
int endcap_
 
bool promoteMode7_
 
PtAssignmentEnginept_assign_engine_
 
int sector_
 
int verbose_
 

Detailed Description

Definition at line 10 of file PtAssignment.h.

Member Function Documentation

const PtAssignmentEngineAux & PtAssignment::aux ( ) const

Definition at line 148 of file PtAssignment.cc.

References PtAssignmentEngine::aux(), and pt_assign_engine_.

Referenced by process().

148  {
149  return pt_assign_engine_->aux();
150 }
const PtAssignmentEngineAux & aux() const
PtAssignmentEngine * pt_assign_engine_
Definition: PtAssignment.h:27
void PtAssignment::configure ( const PtAssignmentEngine pt_assign_engine,
int  verbose,
int  endcap,
int  sector,
int  bx,
int  ptLUTVersion,
bool  readPtLUTFile,
bool  fixMode15HighPt,
bool  bug9BitDPhi,
bool  bugMode7CLCT,
bool  bugNegPt,
bool  bugGMTPhi,
bool  promoteMode7 
)

Definition at line 6 of file PtAssignment.cc.

References bugGMTPhi_, bx_, PtAssignmentEngine::configure(), makeMuonMisalignmentScenario::endcap, endcap_, promoteMode7_, pt_assign_engine_, sector_, verbose, and verbose_.

Referenced by SectorProcessor::process_single_bx().

12  {
13  if (not(pt_assign_engine != nullptr))
14  { edm::LogError("L1T") << "pt_assign_engine == nullptr "; return; }
15 
16  pt_assign_engine_ = const_cast<PtAssignmentEngine*>(pt_assign_engine);
17 
18  verbose_ = verbose;
19  endcap_ = endcap;
20  sector_ = sector;
21  bx_ = bx;
22 
24  verbose_,
25  ptLUTVersion, readPtLUTFile, fixMode15HighPt,
26  bug9BitDPhi, bugMode7CLCT, bugNegPt
27  );
28 
29  bugGMTPhi_ = bugGMTPhi;
30  promoteMode7_ = promoteMode7;
31 }
bool verbose
void configure(int verbose, int ptLUTVersion, bool readPtLUTFile, bool fixMode15HighPt, bool bug9BitDPhi, bool bugMode7CLCT, bool bugNegPt)
PtAssignmentEngine * pt_assign_engine_
Definition: PtAssignment.h:27
bool promoteMode7_
Definition: PtAssignment.h:31
void PtAssignment::process ( EMTFTrackCollection best_tracks)

Definition at line 33 of file PtAssignment.cc.

References funct::abs(), l1t::EMTFPtLUT::address, aux(), bugGMTPhi_, PtAssignmentEngine::calculate_address(), PtAssignmentEngine::calculate_pt(), gather_cfg::cout, l1t::EMTFPtLUT::delta_ph, l1t::EMTFTrack::Endcap(), endcap_, PtAssignmentEngineAux::getGMTCharge(), PtAssignmentEngineAux::getGMTEta(), PtAssignmentEngineAux::getGMTPhi(), PtAssignmentEngineAux::getGMTPhiV2(), PtAssignmentEngineAux::getGMTPt(), PtAssignmentEngineAux::getGMTQuality(), l1t::EMTFTrack::Hits(), mps_fire::i, l1t::EMTFTrack::Mode(), emtf::NUM_STATION_PAIRS, l1t::EMTFTrack::Phi_fp(), hitfit::phidiff(), promoteMode7_, EnergyCorrector::pt, pt_assign_engine_, l1t::EMTFTrack::PtLUT(), PtAssignmentEngine::scale_pt(), l1t::EMTFTrack::set_charge(), l1t::EMTFTrack::set_gmt_charge(), l1t::EMTFTrack::set_gmt_charge_valid(), l1t::EMTFTrack::set_gmt_eta(), l1t::EMTFTrack::set_gmt_phi(), l1t::EMTFTrack::set_gmt_pt(), l1t::EMTFTrack::set_gmt_quality(), l1t::EMTFTrack::set_pt(), l1t::EMTFTrack::set_pt_XML(), l1t::EMTFTrack::set_PtLUT(), l1t::EMTFPtLUT::sign_ph, l1t::EMTFTrack::Theta_fp(), HiIsolationCommonParameters_cff::track, and verbose_.

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), SectorProcessor::process_single_bx(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

35  {
36  using address_t = PtAssignmentEngine::address_t;
37 
38  EMTFTrackCollection::iterator best_tracks_it = best_tracks.begin();
39  EMTFTrackCollection::iterator best_tracks_end = best_tracks.end();
40 
41  for (; best_tracks_it != best_tracks_end; ++best_tracks_it) {
42  EMTFTrack& track = *best_tracks_it; // pass by reference
43 
44  // Assign GMT eta and phi
45  int gmt_phi = aux().getGMTPhi(track.Phi_fp());
46 
47  if (!bugGMTPhi_) {
48  gmt_phi = aux().getGMTPhiV2(track.Phi_fp());
49  }
50 
51  int gmt_eta = aux().getGMTEta(track.Theta_fp(), track.Endcap()); // Convert to integer eta using FW LUT
52 
53  // Notes from Alex (2016-09-28):
54  //
55  // When using two's complement, you get two eta bins with zero coordinate.
56  // This peculiarity is created because positive and negative endcaps are
57  // processed by separate processors, so each of them gets its own zero bin.
58  // With simple inversion, the eta scale becomes uniform, one bin for one
59  // eta value.
60  bool use_ones_complem_gmt_eta = true;
61  if (use_ones_complem_gmt_eta) {
62  gmt_eta = (gmt_eta < 0) ? ~(-gmt_eta) : gmt_eta;
63  }
64 
65  // Assign pT
66  address_t address = 0;
67  float xmlpt = 0.;
68  float pt = 0.;
69  int gmt_pt = 0;
70  if (track.Mode() != 1) {
71  address = pt_assign_engine_->calculate_address(track);
72  xmlpt = pt_assign_engine_->calculate_pt(address);
73 
74  // Check address packing / unpacking
75  if (not( fabs(xmlpt - pt_assign_engine_->calculate_pt(track)) < 0.001 ) )
76  { edm::LogWarning("L1T") << "EMTF pT assignment mismatch: xmlpt = " << xmlpt
77  << ", pt_assign_engine_->calculate_pt(track)) = "
78  << pt_assign_engine_->calculate_pt(track); }
79 
80  pt = (xmlpt < 0.) ? 1. : xmlpt; // Matt used fabs(-1) when mode is invalid
81  pt *= pt_assign_engine_->scale_pt(pt, track.Mode()); // Multiply by some factor to achieve 90% efficiency at threshold
82 
83  gmt_pt = aux().getGMTPt(pt); // Encode integer pT in GMT format
84  } // End if (track.Mode() != 1)
85  else {
86  gmt_pt = 10 - (abs(gmt_eta) / 32);
87  }
88 
89  pt = (gmt_pt <= 0) ? 0 : (gmt_pt-1) * 0.5; // Decode integer pT (result is in 0.5 GeV step)
90 
91  int gmt_quality = 0;
92  if (track.Mode() != 1) {
93  gmt_quality = aux().getGMTQuality(track.Mode(), track.Theta_fp(), promoteMode7_);
94  }
95  else { // Special quality for single-hit tracks from ME1/1
96  gmt_quality = track.Hits().front().Pattern() / 4;
97  }
98 
99  std::pair<int, int> gmt_charge = std::make_pair(0, 0);
100  if (track.Mode() != 1) {
101  std::vector<int> phidiffs;
102  for (int i = 0; i < emtf::NUM_STATION_PAIRS; ++i) {
103  int phidiff = (track.PtLUT().sign_ph[i] == 1) ? track.PtLUT().delta_ph[i] : -track.PtLUT().delta_ph[i];
104  phidiffs.push_back(phidiff);
105  }
106  gmt_charge = aux().getGMTCharge(track.Mode(), phidiffs);
107  }
108  else { // Special charge assignment for single-hit tracks from ME1/1
109  int CLCT = track.Hits().front().Pattern();
110  if (CLCT != 10) {
111  if (endcap_ == 1)
112  gmt_charge = std::make_pair( (CLCT % 2) == 0 ? 0 : 1, 1);
113  else
114  gmt_charge = std::make_pair( (CLCT % 2) == 0 ? 1 : 0, 1);
115  }
116  }
117 
118  // _________________________________________________________________________
119  // Output
120 
121  EMTFPtLUT tmp_LUT = track.PtLUT();
122  tmp_LUT.address = address;
123 
124  track.set_PtLUT ( tmp_LUT );
125  track.set_pt_XML ( xmlpt );
126  track.set_pt ( pt );
127  track.set_charge ( (gmt_charge.second == 1) ? ((gmt_charge.first == 1) ? -1 : +1) : 0 );
128 
129  track.set_gmt_pt ( gmt_pt );
130  track.set_gmt_phi ( gmt_phi );
131  track.set_gmt_eta ( gmt_eta );
132  track.set_gmt_quality ( gmt_quality );
133  track.set_gmt_charge ( gmt_charge.first );
134  track.set_gmt_charge_valid ( gmt_charge.second );
135  }
136 
137  if (verbose_ > 0) { // debug
138  for (const auto& track: best_tracks) {
139  std::cout << "track: " << track.Winner() << " pt address: " << track.PtLUT().address
140  << " GMT pt: " << track.GMT_pt() << " pt: " << track.Pt() << " mode: " << track.Mode()
141  << " GMT charge: " << track.GMT_charge() << " quality: " << track.GMT_quality()
142  << " eta: " << track.GMT_eta() << " phi: " << track.GMT_phi()
143  << std::endl;
144  }
145  }
146 }
int Theta_fp() const
Definition: EMTFTrack.h:138
virtual address_t calculate_address(const EMTFTrack &track) const
int GMT_eta() const
Definition: EMTFTrack.h:146
int NUM_STATION_PAIRS
Definition: Common.h:61
void set_gmt_eta(int bits)
Definition: EMTFTrack.h:112
virtual float calculate_pt(const address_t &address) const
uint16_t sign_ph[6]
Definition: EMTFTrack.h:25
int Endcap() const
Definition: EMTFTrack.h:119
float Pt() const
Definition: EMTFTrack.h:133
int getGMTPhiV2(int phi) const
int Phi_fp() const
Definition: EMTFTrack.h:141
void set_charge(int bits)
Definition: EMTFTrack.h:95
int getGMTEta(int theta, int endcap) const
int Winner() const
Definition: EMTFTrack.h:128
int GMT_charge() const
Definition: EMTFTrack.h:148
int GMT_quality() const
Definition: EMTFTrack.h:147
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:230
uint16_t delta_ph[6]
Definition: EMTFTrack.h:23
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:85
const PtAssignmentEngineAux & aux() const
void set_gmt_phi(int bits)
Definition: EMTFTrack.h:111
void set_pt(float val)
Definition: EMTFTrack.h:99
void set_gmt_quality(int bits)
Definition: EMTFTrack.h:113
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PtAssignmentEngine * pt_assign_engine_
Definition: PtAssignment.h:27
virtual float scale_pt(const float pt, const int mode=15) const
bool promoteMode7_
Definition: PtAssignment.h:31
std::pair< int, int > getGMTCharge(int mode, const std::vector< int > &phidiffs) const
int GMT_phi() const
Definition: EMTFTrack.h:145
void set_gmt_charge(int bits)
Definition: EMTFTrack.h:114
EMTFHitCollection Hits() const
Definition: EMTFTrack.h:77
uint64_t address
Definition: EMTFTrack.h:18
void set_pt_XML(float val)
Definition: EMTFTrack.h:100
int getGMTQuality(int mode, int theta, bool promoteMode7) const
int GMT_pt() const
Definition: EMTFTrack.h:144
int getGMTPhi(int phi) const
int Mode() const
Definition: EMTFTrack.h:122
void set_gmt_charge_valid(int bits)
Definition: EMTFTrack.h:115
int getGMTPt(float pt) const
EMTFPtLUT PtLUT() const
Definition: EMTFTrack.h:86
void set_gmt_pt(int bits)
Definition: EMTFTrack.h:110

Member Data Documentation

bool PtAssignment::bugGMTPhi_
private

Definition at line 31 of file PtAssignment.h.

Referenced by configure(), and process().

int PtAssignment::bx_
private

Definition at line 29 of file PtAssignment.h.

Referenced by configure().

int PtAssignment::endcap_
private

Definition at line 29 of file PtAssignment.h.

Referenced by configure(), and process().

bool PtAssignment::promoteMode7_
private

Definition at line 31 of file PtAssignment.h.

Referenced by configure(), and process().

PtAssignmentEngine* PtAssignment::pt_assign_engine_
private

Definition at line 27 of file PtAssignment.h.

Referenced by aux(), configure(), and process().

int PtAssignment::sector_
private

Definition at line 29 of file PtAssignment.h.

Referenced by configure().

int PtAssignment::verbose_
private

Definition at line 29 of file PtAssignment.h.

Referenced by configure(), and process().