CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DiscretePF2Firmware.h
Go to the documentation of this file.
1 #ifndef L1Trigger_Phase2L1ParticleFlow_DISCRETEPF2FIRMWARE_H
2 #define L1Trigger_Phase2L1ParticleFlow_DISCRETEPF2FIRMWARE_H
3 
5 
6 #include "../firmware/data.h"
7 #include <vector>
8 
9 namespace dpf2fw {
10 
11  // convert inputs from discrete to firmware
13  out.hwPt = in.hwPt;
14  out.hwPtErr = in.hwCaloPtErr;
15  out.hwEta = in.hwEta; // @calo
16  out.hwPhi = in.hwPhi; // @calo
17  out.hwZ0 = in.hwZ0;
18  out.hwTightQuality = (in.hwStubs >= 6 && in.hwChi2 < 500);
19  }
20 
22  TkObj out;
23  convert(in, out);
24  return out;
25  }
26 
28  out.hwPt = in.hwPt;
29  out.hwEmPt = in.hwEmPt;
30  out.hwEta = in.hwEta;
31  out.hwPhi = in.hwPhi;
32  out.hwIsEM = in.isEM;
33  }
35  out.hwPt = in.hwPt;
36  out.hwPtErr = in.hwPtErr;
37  out.hwEta = in.hwEta;
38  out.hwPhi = in.hwPhi;
39  }
40  inline void convert(const l1tpf_impl::Muon &in, MuObj &out) {
41  out.hwPt = in.hwPt;
42  out.hwPtErr = 0; // does not exist in input
43  out.hwEta = in.hwEta; // @calo
44  out.hwPhi = in.hwPhi; // @calo
45  }
46 
47  template <unsigned int NMAX, typename In, typename Out>
48  void convert(const std::vector<In> &in, Out out[NMAX]) {
49  for (unsigned int i = 0, n = std::min<unsigned int>(NMAX, in.size()); i < n; ++i) {
50  convert(in[i], out[i]);
51  }
52  for (unsigned int i = in.size(); i < NMAX; ++i) {
53  clear(out[i]);
54  }
55  }
56 
57  template <typename In, typename Out>
58  void convert(unsigned int NMAX, const std::vector<In> &in, Out out[]) {
59  for (unsigned int i = 0, n = std::min<unsigned int>(NMAX, in.size()); i < n; ++i) {
60  convert(in[i], out[i]);
61  }
62  for (unsigned int i = in.size(); i < NMAX; ++i) {
63  clear(out[i]);
64  }
65  }
66 
67 } // namespace dpf2fw
68 
69 #endif
Definition: data.h:158
pt_t hwPt
Definition: data.h:133
void convert(const l1tpf_impl::PropagatedTrack &in, TkObj &out)
activeDets clear()
bool hwIsEM
Definition: data.h:122
pt_t hwPt
Definition: data.h:144
etaphi_t hwEta
Definition: data.h:160
etaphi_t hwEta
Definition: data.h:134
pt_t hwEmPt
Definition: data.h:121
pt_t hwPtErr
Definition: data.h:133
pt_t hwPt
Definition: data.h:159
pt_t hwPtErr
Definition: data.h:159
bool hwTightQuality
Definition: data.h:147
etaphi_t hwPhi
Definition: data.h:118
pt_t hwPt
Definition: data.h:117
pt_t hwPtErr
Definition: data.h:144
z0_t hwZ0
Definition: data.h:146
etaphi_t hwPhi
Definition: data.h:134
etaphi_t hwEta
Definition: data.h:118
TkObj transformConvert(const l1tpf_impl::PropagatedTrack &in)
etaphi_t hwPhi
Definition: data.h:145
etaphi_t hwPhi
Definition: data.h:160
etaphi_t hwEta
Definition: data.h:145
Definition: data.h:143