CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1TkHTMissEmulatorProducer Class Reference
Inheritance diagram for L1TkHTMissEmulatorProducer:
edm::stream::EDProducer<>

Public Member Functions

 L1TkHTMissEmulatorProducer (const edm::ParameterSet &)
 
 ~L1TkHTMissEmulatorProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

int aSteps = 8
 
std::vector< l1tmhtemu::MHTphi_tatanLUT_
 
std::vector< l1tmhtemu::phi_tcosLUT_
 
int cosLUTbins
 
bool debug_ = false
 
bool displaced_
 
l1tmhtemu::eta_t jetMaxEta_
 
l1tmhtemu::pt_t jetMinPt_
 
const edm::EDGetTokenT< TkJetWordCollectionjetToken_
 
std::string L1MHTCollectionName_
 
std::vector< l1tmhtemu::Et_tmagNormalisationLUT_
 
l1tmhtemu::ntracks_t minNtracksHighPt_
 
l1tmhtemu::ntracks_t minNtracksLowPt_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 32 of file L1TkHTMissEmulatorProducer.cc.

Constructor & Destructor Documentation

◆ L1TkHTMissEmulatorProducer()

L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 64 of file L1TkHTMissEmulatorProducer.cc.

References aSteps, atanLUT_, cosLUT_, cosLUTbins, debug_, displaced_, nano_mu_digi_cff::float, l1tmhtemu::generateaTanLUT(), l1tmhtemu::generateCosLUT(), l1tmhtemu::generatemagNormalisationLUT(), edm::ParameterSet::getParameter(), createfilelist::int, jetMaxEta_, jetMinPt_, l1tmhtemu::kInternalEtaWidth, l1tmhtemu::kInternalPtWidth, l1tmhtemu::kMaxCosLUTPhi, l1tmhtemu::kStepEta, l1tmhtemu::kStepPhi, l1tmhtemu::kStepPt, L1MHTCollectionName_, magNormalisationLUT_, minNtracksHighPt_, minNtracksLowPt_, and AlCaHLTBitMon_QueryRunRegistry::string.

65  : jetToken_(consumes<TkJetWordCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetEmulationInputTag"))) {
66  debug_ = iConfig.getParameter<bool>("debug");
67  displaced_ = iConfig.getParameter<bool>("displaced");
68 
69  jetMinPt_ = l1tmhtemu::digitizeSignedValue<l1tmhtemu::pt_t>(
70  (float)iConfig.getParameter<double>("jet_minPt"), l1tmhtemu::kInternalPtWidth, l1tmhtemu::kStepPt);
71  jetMaxEta_ = l1tmhtemu::digitizeSignedValue<l1tmhtemu::eta_t>(
72  (float)iConfig.getParameter<double>("jet_maxEta"), l1tmhtemu::kInternalEtaWidth, l1tmhtemu::kStepEta);
73  minNtracksHighPt_ = (l1tmhtemu::ntracks_t)iConfig.getParameter<int>("jet_minNtracksHighPt");
74  minNtracksLowPt_ = (l1tmhtemu::ntracks_t)iConfig.getParameter<int>("jet_minNtracksLowPt");
75 
78 
81 
82  // Name of output ED Product
83  L1MHTCollectionName_ = (std::string)iConfig.getParameter<std::string>("L1MHTCollectionName");
84 
85  produces<std::vector<EtSum>>(L1MHTCollectionName_);
86 
87  if (debug_) {
88  edm::LogVerbatim("L1TrackerHTMissEmulatorProducer")
89  << "-------------------------------------------------------------------------\n"
90  << "====BITWIDTHS====\n"
91  << "pt: " << l1t::TkJetWord::TkJetBitWidths::kPtSize << " eta: " << l1t::TkJetWord::TkJetBitWidths::kGlbEtaSize
92  << " phi:" << l1t::TkJetWord::TkJetBitWidths::kGlbPhiSize << "\n"
93  << "====CUT AP_INTS====\n"
94  << "minpt: " << jetMinPt_ << " maxeta: " << jetMaxEta_ << " minNtracksHighPt: " << minNtracksHighPt_
95  << " minNtracksLowPt: " << minNtracksLowPt_ << "\n"
96  << "====CUT AP_INTS TO FLOATS====\n"
97  << "minpt: " << (float)jetMinPt_ * l1tmhtemu::kStepPt << " maxeta: " << (float)jetMaxEta_ * l1tmhtemu::kStepEta
98  << " minNtracksHighPt: " << (int)minNtracksHighPt_ << " minNtracksLowPt: " << (int)minNtracksLowPt_ << "\n"
99  << "-------------------------------------------------------------------------\n";
100  }
101 }
std::vector< l1tmhtemu::MHTphi_t > atanLUT_
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< TkJetWordCollection > jetToken_
ap_uint< 5 > ntracks_t
std::vector< MHTphi_t > generateaTanLUT(int cordicSteps)
const float kMaxCosLUTPhi
std::vector< l1tmhtemu::Et_t > magNormalisationLUT_
const unsigned int kInternalPtWidth
const unsigned int kInternalEtaWidth
std::vector< l1tmhtemu::phi_t > cosLUT_
std::vector< phi_t > generateCosLUT(unsigned int size)
std::vector< Et_t > generatemagNormalisationLUT(int cordicSteps)

◆ ~L1TkHTMissEmulatorProducer()

L1TkHTMissEmulatorProducer::~L1TkHTMissEmulatorProducer ( )
overridedefault

Member Function Documentation

◆ beginJob()

void L1TkHTMissEmulatorProducer::beginJob ( void  )
privatevirtual

Definition at line 263 of file L1TkHTMissEmulatorProducer.cc.

263 {}

◆ endJob()

void L1TkHTMissEmulatorProducer::endJob ( void  )
privatevirtual

Definition at line 265 of file L1TkHTMissEmulatorProducer.cc.

265 {}

◆ produce()

void L1TkHTMissEmulatorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 103 of file L1TkHTMissEmulatorProducer.cc.

References aSteps, atanLUT_, l1tmhtemu::cordicSqrt(), funct::cos(), cosLUT_, cosLUTbins, debug_, displaced_, l1tmhtemu::EtMiss::Et, nano_mu_digi_cff::float, iEvent, createfilelist::int, edm::HandleBase::isValid(), jetMaxEta_, jetMinPt_, jetToken_, l1tmhtemu::kInternalEtaWidth, l1tmhtemu::kInternalPhiWidth, l1tmhtemu::kInternalPtWidth, l1tmhtemu::kMHTPhiBins, L1Analysis::kMissingHt, l1tmhtemu::kStepEta, l1tmhtemu::kStepMHTPhi, l1tmhtemu::kStepPhi, l1tmhtemu::kStepPt, L1MHTCollectionName_, M_PI, magNormalisationLUT_, eostools::move(), or, phi, l1tmhtemu::EtMiss::Phi, funct::sin(), and mathSSE::sqrt().

103  {
104  using namespace edm;
105  std::unique_ptr<std::vector<l1t::EtSum>> MHTCollection(new std::vector<l1t::EtSum>(0));
106 
107  // L1 track-trigger jets
108  edm::Handle<TkJetWordCollection> L1TkJetsHandle;
109  iEvent.getByToken(jetToken_, L1TkJetsHandle);
110  std::vector<TkJetWord>::const_iterator jetIter;
111 
112  if (!L1TkJetsHandle.isValid() && !displaced_) {
113  LogError("TkHTMissEmulatorProducer") << "\nWarning: TkJetCollection not found in the event. Exit\n";
114  return;
115  }
116 
117  if (!L1TkJetsHandle.isValid() && displaced_) {
118  LogError("TkHTMissEmulatorProducer") << "\nWarning: TkJetExtendedCollection not found in the event. Exit\n";
119  return;
120  }
121 
122  // floats used for debugging
123  float sumPx_ = 0;
124  float sumPy_ = 0;
125  float HT_ = 0;
126 
127  l1tmhtemu::Et_t sumPx = 0;
128  l1tmhtemu::Et_t sumPy = 0;
129  l1tmhtemu::MHT_t HT = 0;
130 
131  // loop over jets
132  int jetn = 0;
133 
134  for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) {
135  // floats used for debugging
136  float tmp_jet_px_ = jetIter->pt() * cos(jetIter->glbphi());
137  float tmp_jet_py_ = jetIter->pt() * sin(jetIter->glbphi());
138  //float tmp_jet_et_ = jetIter->pt(); // FIXME Get Et from the emulated jets
139  float tmp_jet_pt_ = jetIter->pt();
140 
141  l1tmhtemu::pt_t tmp_jet_pt =
142  l1tmhtemu::digitizeSignedValue<l1tmhtemu::pt_t>(jetIter->pt(), l1tmhtemu::kInternalPtWidth, l1tmhtemu::kStepPt);
143  l1tmhtemu::eta_t tmp_jet_eta = l1tmhtemu::digitizeSignedValue<l1tmhtemu::eta_t>(
145  l1tmhtemu::phi_t tmp_jet_phi = l1tmhtemu::digitizeSignedValue<l1tmhtemu::phi_t>(
147  l1tmhtemu::ntracks_t tmp_jet_nt = l1tmhtemu::ntracks_t(jetIter->nt());
148 
149  l1tmhtemu::phi_t tmp_jet_cos_phi = l1tmhtemu::phi_t(-999);
150  l1tmhtemu::phi_t tmp_jet_sin_phi = l1tmhtemu::phi_t(-999);
151 
152  if (tmp_jet_phi >= 0) {
153  tmp_jet_cos_phi = cosLUT_[tmp_jet_phi];
154 
155  if (cosLUTbins / 2 + 1 - tmp_jet_phi >= 0)
156  tmp_jet_sin_phi = cosLUT_[cosLUTbins / 2 + 1 - tmp_jet_phi];
157  else
158  tmp_jet_sin_phi = cosLUT_[-1 * (cosLUTbins / 2 + 1 - tmp_jet_phi)];
159 
160  } else {
161  tmp_jet_cos_phi = cosLUT_[-1 * tmp_jet_phi];
162 
163  if (cosLUTbins / 2 + 1 - (-1 * tmp_jet_phi) >= 0)
164  tmp_jet_sin_phi = -1 * cosLUT_[cosLUTbins / 2 + 1 - (-1 * tmp_jet_phi)];
165  else
166  tmp_jet_sin_phi = -1 * cosLUT_[-1 * (cosLUTbins / 2 + 1 - (-1 * tmp_jet_phi))];
167  }
168 
169  l1tmhtemu::Et_t tmp_jet_px = tmp_jet_pt * tmp_jet_cos_phi;
170  l1tmhtemu::Et_t tmp_jet_py = tmp_jet_pt * tmp_jet_sin_phi;
171 
172  jetn++;
173 
174  if (debug_) {
175  edm::LogVerbatim("L1TrackerHTMissEmulatorProducer")
176  << "****JET EMULATION" << jetn << "****\n"
177  << "FLOATS ORIGINAL\n"
178  << "PT: " << jetIter->pt() << "| ETA: " << jetIter->glbeta() << "| PHI: " << jetIter->glbphi()
179  << "| NTRACKS: " << jetIter->nt() << "| COS(PHI): " << cos(jetIter->glbphi())
180  << "| SIN(PHI): " << sin(jetIter->glbphi()) << "| Px: " << jetIter->pt() * cos(jetIter->glbphi())
181  << "| Py: " << jetIter->pt() * sin(jetIter->glbphi()) << "\n"
182  << "AP_INTS RAW\n"
183  << "PT: " << jetIter->ptWord() << "| ETA: " << jetIter->glbEtaWord() << "| PHI: " << jetIter->glbPhiWord()
184  << "| NTRACKS: " << jetIter->ntWord() << "\n"
185  << "AP_INTS NEW\n"
186  << "PT: " << tmp_jet_pt << "| ETA: " << tmp_jet_eta << "| PHI: " << tmp_jet_phi << "| NTRACKS: " << tmp_jet_nt
187  << "| COS(PHI): " << tmp_jet_cos_phi << "| SIN(PHI): " << tmp_jet_sin_phi << "| Px: " << tmp_jet_px
188  << "| Py: " << tmp_jet_py << "\n"
189  << "AP_INTS NEW TO FLOATS\n"
190  << "PT: " << (float)tmp_jet_pt * l1tmhtemu::kStepPt << "| ETA: " << (float)tmp_jet_eta * l1tmhtemu::kStepEta
191  << "| PHI: " << (float)tmp_jet_phi * l1tmhtemu::kStepPhi << "| NTRACKS: " << (int)tmp_jet_nt
192  << "| COS(PHI): " << (float)tmp_jet_cos_phi * l1tmhtemu::kStepPhi
193  << "| SIN(PHI): " << (float)tmp_jet_sin_phi * l1tmhtemu::kStepPhi
194  << "| Px: " << (float)tmp_jet_px * l1tmhtemu::kStepPt * l1tmhtemu::kStepPhi
195  << "| Py: " << (float)tmp_jet_py * l1tmhtemu::kStepPt * l1tmhtemu::kStepPhi << "\n"
196  << "-------------------------------------------------------------------------\n";
197  }
198 
199  if (tmp_jet_pt < jetMinPt_)
200  continue;
201  if (tmp_jet_eta > jetMaxEta_ or tmp_jet_eta < -1 * jetMaxEta_)
202  continue;
203  if (tmp_jet_nt < minNtracksLowPt_ && tmp_jet_pt > 200)
204  continue;
205  if (tmp_jet_nt < minNtracksHighPt_ && tmp_jet_pt > 400)
206  continue;
207 
208  if (debug_) {
209  sumPx_ += tmp_jet_px_;
210  sumPy_ += tmp_jet_py_;
211  HT_ += tmp_jet_pt_;
212  }
213 
214  sumPx += tmp_jet_pt * tmp_jet_cos_phi;
215  sumPy += tmp_jet_pt * tmp_jet_sin_phi;
216  HT += tmp_jet_pt;
217 
218  } // end jet loop
219 
220  // define missing HT
221 
222  // Perform cordic sqrt, take x,y and converts to polar coordinate r,phi where
223  // r=sqrt(x**2+y**2) and phi = atan(y/x)
225  math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, EtMiss.Et);
226 
228 
229  if ((sumPx < 0) && (sumPy < 0))
230  phi = EtMiss.Phi - l1tmhtemu::kMHTPhiBins / 2;
231  else if ((sumPx >= 0) && (sumPy >= 0))
232  phi = (EtMiss.Phi) + l1tmhtemu::kMHTPhiBins / 2;
233  else if ((sumPx >= 0) && (sumPy < 0))
234  phi = EtMiss.Phi - l1tmhtemu::kMHTPhiBins / 2;
235  else if ((sumPx < 0) && (sumPy >= 0))
236  phi = EtMiss.Phi - 3 * l1tmhtemu::kMHTPhiBins / 2;
237 
238  if (debug_) {
239  edm::LogVerbatim("L1TrackerHTMissEmulatorProducer")
240  << "-------------------------------------------------------------------------\n"
241  << "====MHT FLOATS====\n"
242  << "sumPx: " << sumPx_ << "| sumPy: " << sumPy_ << "| ET: " << sqrt(sumPx_ * sumPx_ + sumPy_ * sumPy_)
243  << "| HT: " << HT_ << "| PHI: " << atan2(sumPy_, sumPx_) << "\n"
244  << "====MHT AP_INTS====\n"
245  << "sumPx: " << sumPx << "| sumPy: " << sumPy << "| ET: " << EtMiss.Et << "| HT: " << HT << "| PHI: " << phi
246  << "\n"
247  << "====MHT AP_INTS TO FLOATS====\n"
248  << "sumPx: " << (float)sumPx * l1tmhtemu::kStepPt * l1tmhtemu::kStepPhi
249  << "| sumPy: " << (float)sumPy * l1tmhtemu::kStepPt * l1tmhtemu::kStepPhi << "| ET: " << EtMiss.Et.to_double()
250  << "| HT: " << (float)HT * l1tmhtemu::kStepPt << "| PHI: " << (float)phi * l1tmhtemu::kStepMHTPhi - M_PI << "\n"
251  << "-------------------------------------------------------------------------\n";
252  }
253  //rescale HT to correct output range
254  HT = HT / (int)(1 / l1tmhtemu::kStepPt);
255 
256  EtSum L1HTSum(missingEt, EtSum::EtSumType::kMissingHt, (int)HT.range(), 0, (int)phi, (int)jetn);
257 
258  MHTCollection->push_back(L1HTSum);
260 
261 } //end producer
std::vector< l1tmhtemu::MHTphi_t > atanLUT_
Log< level::Info, true > LogVerbatim
const edm::EDGetTokenT< TkJetWordCollection > jetToken_
ap_uint< 5 > ntracks_t
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ap_uint< kMHTPhiSize > MHTphi_t
EtMiss cordicSqrt(Et_t x, Et_t y, int cordicSteps, std::vector< l1tmhtemu::MHTphi_t > atanLUT, std::vector< Et_t > magNormalisationLUT)
Log< level::Error, false > LogError
const unsigned int kInternalPhiWidth
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
ap_uint< kInternalPtWidth > pt_t
int iEvent
Definition: GenABIO.cc:224
const double kStepMHTPhi
std::vector< l1tmhtemu::Et_t > magNormalisationLUT_
ap_ufixed< kMHTSize, kMHTIntSize > MHT_t
T sqrt(T t)
Definition: SSEVec.h:19
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< pat::MHT > MHTCollection
Definition: MHT.h:39
#define M_PI
const unsigned int kInternalPtWidth
ap_int< kInternalEtaWidth > eta_t
const unsigned int kInternalEtaWidth
bool isValid() const
Definition: HandleBase.h:70
std::vector< l1tmhtemu::phi_t > cosLUT_
HLT enums.
const unsigned int kMHTPhiBins
Definition: HT.h:21
ap_int< kInternalPhiWidth > phi_t
ap_int< kHTSize > Et_t
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ aSteps

int L1TkHTMissEmulatorProducer::aSteps = 8
private

Definition at line 48 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ atanLUT_

std::vector<l1tmhtemu::MHTphi_t> L1TkHTMissEmulatorProducer::atanLUT_
private

Definition at line 56 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ cosLUT_

std::vector<l1tmhtemu::phi_t> L1TkHTMissEmulatorProducer::cosLUT_
private

Definition at line 55 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ cosLUTbins

int L1TkHTMissEmulatorProducer::cosLUTbins
private

Definition at line 47 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ debug_

bool L1TkHTMissEmulatorProducer::debug_ = false
private

Definition at line 44 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ displaced_

bool L1TkHTMissEmulatorProducer::displaced_
private

Definition at line 45 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ jetMaxEta_

l1tmhtemu::eta_t L1TkHTMissEmulatorProducer::jetMaxEta_
private

Definition at line 51 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ jetMinPt_

l1tmhtemu::pt_t L1TkHTMissEmulatorProducer::jetMinPt_
private

Definition at line 50 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ jetToken_

const edm::EDGetTokenT<TkJetWordCollection> L1TkHTMissEmulatorProducer::jetToken_
private

Definition at line 61 of file L1TkHTMissEmulatorProducer.cc.

Referenced by produce().

◆ L1MHTCollectionName_

std::string L1TkHTMissEmulatorProducer::L1MHTCollectionName_
private

Definition at line 59 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ magNormalisationLUT_

std::vector<l1tmhtemu::Et_t> L1TkHTMissEmulatorProducer::magNormalisationLUT_
private

Definition at line 57 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer(), and produce().

◆ minNtracksHighPt_

l1tmhtemu::ntracks_t L1TkHTMissEmulatorProducer::minNtracksHighPt_
private

Definition at line 52 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer().

◆ minNtracksLowPt_

l1tmhtemu::ntracks_t L1TkHTMissEmulatorProducer::minNtracksLowPt_
private

Definition at line 53 of file L1TkHTMissEmulatorProducer.cc.

Referenced by L1TkHTMissEmulatorProducer().