CMS 3D CMS Logo

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
void convert(const l1tpf_impl::PropagatedTrack &in, TkObj &out)
void clear(HadCaloObj &c)
Definition: data.h:124
TkObj transformConvert(const l1tpf_impl::PropagatedTrack &in)
NOTE: this include is not standalone, since the path to DiscretePFInputs is different in CMSSW & Viva...
Definition: data.h:143