CMS 3D CMS Logo

linpuppi_ref.h
Go to the documentation of this file.
1 #ifndef LINPUPPI_REF_H
2 #define LINPUPPI_REF_H
3 
5 #include "linpuppi_bits.h"
6 
7 #include <vector>
8 
9 namespace edm {
10  class ParameterSet;
12 } // namespace edm
13 
14 namespace l1ct {
15 
17  public:
19 
20  LinPuppiEmulator(unsigned int nTrack,
21  unsigned int nIn,
22  unsigned int nOut,
23  unsigned int nVtx,
24  unsigned int dR2Min,
25  unsigned int dR2Max,
26  unsigned int iptMax,
27  unsigned int dzCut,
28  double ptSlopeNe,
29  double ptSlopePh,
30  double ptZeroNe,
31  double ptZeroPh,
32  double alphaSlope,
33  double alphaZero,
34  double alphaCrop,
35  double priorNe,
36  double priorPh,
37  pt_t ptCut,
38  unsigned int nFinalSort = 0,
40  : nTrack_(nTrack),
41  nIn_(nIn),
42  nOut_(nOut),
43  nVtx_(nVtx),
44  dR2Min_(dR2Min),
45  dR2Max_(dR2Max),
46  iptMax_(iptMax),
47  dzCut_(dzCut),
48  absEtaBins_(),
49  ptSlopeNe_(1, ptSlopeNe),
50  ptSlopePh_(1, ptSlopePh),
51  ptZeroNe_(1, ptZeroNe),
52  ptZeroPh_(1, ptZeroPh),
53  alphaSlope_(1, alphaSlope),
54  alphaZero_(1, alphaZero),
56  priorNe_(1, priorNe),
57  priorPh_(1, priorPh),
58  ptCut_(1, ptCut),
61  debug_(false),
62  fakePuppi_(false) {}
63 
64  LinPuppiEmulator(unsigned int nTrack,
65  unsigned int nIn,
66  unsigned int nOut,
67  unsigned int nVtx,
68  unsigned int dR2Min,
69  unsigned int dR2Max,
70  unsigned int iptMax,
71  unsigned int dzCut,
73  double ptSlopeNe_0,
74  double ptSlopeNe_1,
75  double ptSlopePh_0,
76  double ptSlopePh_1,
77  double ptZeroNe_0,
78  double ptZeroNe_1,
79  double ptZeroPh_0,
80  double ptZeroPh_1,
81  double alphaSlope_0,
82  double alphaSlope_1,
83  double alphaZero_0,
84  double alphaZero_1,
85  double alphaCrop_0,
86  double alphaCrop_1,
87  double priorNe_0,
88  double priorNe_1,
89  double priorPh_0,
90  double priorPh_1,
91  pt_t ptCut_0,
92  pt_t ptCut_1,
93  unsigned int nFinalSort = 0,
95 
96  LinPuppiEmulator(unsigned int nTrack,
97  unsigned int nIn,
98  unsigned int nOut,
99  unsigned int nVtx,
100  unsigned int dR2Min,
101  unsigned int dR2Max,
102  unsigned int iptMax,
103  unsigned int dzCut,
104  const std::vector<glbeta_t> &absEtaBins,
105  const std::vector<double> &ptSlopeNe,
106  const std::vector<double> &ptSlopePh,
107  const std::vector<double> &ptZeroNe,
108  const std::vector<double> &ptZeroPh,
109  const std::vector<double> &alphaSlope,
110  const std::vector<double> &alphaZero,
111  const std::vector<double> &alphaCrop,
112  const std::vector<double> &priorNe,
113  const std::vector<double> &priorPh,
114  const std::vector<pt_t> &ptCut,
115  unsigned int nFinalSort,
117  : nTrack_(nTrack),
118  nIn_(nIn),
119  nOut_(nOut),
120  nVtx_(nVtx),
121  dR2Min_(dR2Min),
122  dR2Max_(dR2Max),
123  iptMax_(iptMax),
124  dzCut_(dzCut),
125  absEtaBins_(absEtaBins),
126  ptSlopeNe_(ptSlopeNe),
127  ptSlopePh_(ptSlopePh),
128  ptZeroNe_(ptZeroNe),
129  ptZeroPh_(ptZeroPh),
130  alphaSlope_(alphaSlope),
131  alphaZero_(alphaZero),
133  priorNe_(priorNe),
134  priorPh_(priorPh),
135  ptCut_(ptCut),
138  debug_(false),
139  fakePuppi_(false) {}
140 
141  LinPuppiEmulator(const edm::ParameterSet &iConfig);
142 
144 
145  // charged
146  void linpuppi_chs_ref(const PFRegionEmu &region,
147  const PVObjEmu &pv,
148  const std::vector<PFChargedObjEmu> &pfch /*[nTrack]*/,
149  std::vector<PuppiObjEmu> &outallch /*[nTrack]*/) const;
150  //vtx vetor
151  void linpuppi_chs_ref(const PFRegionEmu &region,
152  const std::vector<PVObjEmu> &pv /*[nVtx]*/,
153  const std::vector<PFChargedObjEmu> &pfch /*[nTrack]*/,
154  std::vector<PuppiObjEmu> &outallch /*[nTrack]*/) const;
155 
156  // neutrals, in the tracker
157  void linpuppi_flt(const PFRegionEmu &region,
158  const std::vector<TkObjEmu> &track /*[nTrack]*/,
159  const std::vector<PVObjEmu> &pv /*[nVtx]*/,
160  const std::vector<PFNeutralObjEmu> &pfallne /*[nIn]*/,
161  std::vector<PuppiObjEmu> &outallne_nocut /*[nIn]*/,
162  std::vector<PuppiObjEmu> &outallne /*[nIn]*/,
163  std::vector<PuppiObjEmu> &outselne /*[nOut]*/) const;
164  void linpuppi_ref(const PFRegionEmu &region,
165  const std::vector<TkObjEmu> &track /*[nTrack]*/,
166  const std::vector<PVObjEmu> &pv /*[nVtx]*/,
167  const std::vector<PFNeutralObjEmu> &pfallne /*[nIn]*/,
168  std::vector<PuppiObjEmu> &outallne_nocut /*[nIn]*/,
169  std::vector<PuppiObjEmu> &outallne /*[nIn]*/,
170  std::vector<PuppiObjEmu> &outselne /*[nOut]*/) const;
172  const std::vector<TkObjEmu> &track /*[nTrack]*/,
173  const std::vector<PVObjEmu> &pv /*[nVtx]*/,
174  const std::vector<PFNeutralObjEmu> &pfallne /*[nIn]*/,
175  std::vector<PuppiObjEmu> &outselne /*[nOut]*/) const {
176  std::vector<PuppiObjEmu> outallne_nocut, outallne;
177  linpuppi_ref(region, track, pv, pfallne, outallne_nocut, outallne, outselne);
178  }
179 
180  // neutrals, forward
181  void fwdlinpuppi_ref(const PFRegionEmu &region,
182  const std::vector<HadCaloObjEmu> &caloin /*[nIn]*/,
183  std::vector<PuppiObjEmu> &outallne_nocut /*[nIn]*/,
184  std::vector<PuppiObjEmu> &outallne /*[nIn]*/,
185  std::vector<PuppiObjEmu> &outselne /*[nOut]*/) const;
186  void fwdlinpuppi_flt(const PFRegionEmu &region,
187  const std::vector<HadCaloObjEmu> &caloin /*[nIn]*/,
188  std::vector<PuppiObjEmu> &outallne_nocut /*[nIn]*/,
189  std::vector<PuppiObjEmu> &outallne /*[nIn]*/,
190  std::vector<PuppiObjEmu> &outselne /*[nOut]*/) const;
191 
192  static void puppisort_and_crop_ref(unsigned int nOutMax,
193  const std::vector<PuppiObjEmu> &in,
194  std::vector<PuppiObjEmu> &out,
196 
197  // for CMSSW
198  void run(const PFInputRegion &in, const std::vector<l1ct::PVObjEmu> &pvs, OutputRegion &out) const;
199 
200  void setDebug(bool debug = true) { debug_ = debug; }
201 
202  // instead of running Puppi, write Puppi debug information into the output Puppi candidates
203  void setFakePuppi(bool fakePuppi = true) { fakePuppi_ = fakePuppi; }
204 
205  protected:
206  unsigned int nTrack_, nIn_, nOut_,
207  nVtx_; // nIn_, nOut refer to the calorimeter clusters or neutral PF candidates as input and as output (after sorting)
208  unsigned int dR2Min_, dR2Max_, iptMax_, dzCut_;
209  std::vector<glbeta_t> absEtaBins_;
210  std::vector<double> ptSlopeNe_, ptSlopePh_, ptZeroNe_, ptZeroPh_;
211  std::vector<double> alphaSlope_, alphaZero_, alphaCrop_;
212  std::vector<double> priorNe_, priorPh_;
213  std::vector<pt_t> ptCut_;
214  unsigned int nFinalSort_; // output after a full sort of charged + neutral
216 
217  bool debug_;
219  // utility
220  unsigned int find_ieta(const PFRegionEmu &region, eta_t eta) const;
221  std::pair<pt_t, puppiWgt_t> sum2puppiPt_ref(
222  linpuppi::sumTerm_t sum, pt_t pt, unsigned int ieta, bool isEM, int icand) const;
223  std::pair<float, float> sum2puppiPt_flt(float sum, float pt, unsigned int ieta, bool isEM, int icand) const;
224  };
225 
226 } // namespace l1ct
227 
228 #endif
std::vector< pt_t > ptCut_
Definition: linpuppi_ref.h:213
void run(const PFInputRegion &in, const std::vector< l1ct::PVObjEmu > &pvs, OutputRegion &out) const
const double dR2Max
void linpuppi_chs_ref(const PFRegionEmu &region, const PVObjEmu &pv, const std::vector< PFChargedObjEmu > &pfch, std::vector< PuppiObjEmu > &outallch) const
void linpuppi_flt(const PFRegionEmu &region, const std::vector< TkObjEmu > &track, const std::vector< PVObjEmu > &pv, const std::vector< PFNeutralObjEmu > &pfallne, std::vector< PuppiObjEmu > &outallne_nocut, std::vector< PuppiObjEmu > &outallne, std::vector< PuppiObjEmu > &outselne) const
std::vector< glbeta_t > absEtaBins_
Definition: linpuppi_ref.h:209
std::vector< double > ptZeroNe_
Definition: linpuppi_ref.h:210
unsigned int nFinalSort_
Definition: linpuppi_ref.h:214
std::vector< double > priorNe_
Definition: linpuppi_ref.h:212
LinPuppiEmulator(unsigned int nTrack, unsigned int nIn, unsigned int nOut, unsigned int nVtx, unsigned int dR2Min, unsigned int dR2Max, unsigned int iptMax, unsigned int dzCut, const std::vector< glbeta_t > &absEtaBins, const std::vector< double > &ptSlopeNe, const std::vector< double > &ptSlopePh, const std::vector< double > &ptZeroNe, const std::vector< double > &ptZeroPh, const std::vector< double > &alphaSlope, const std::vector< double > &alphaZero, const std::vector< double > &alphaCrop, const std::vector< double > &priorNe, const std::vector< double > &priorPh, const std::vector< pt_t > &ptCut, unsigned int nFinalSort, SortAlgo finalSortAlgo)
Definition: linpuppi_ref.h:96
std::vector< double > priorPh_
Definition: linpuppi_ref.h:212
std::vector< double > ptZeroPh_
Definition: linpuppi_ref.h:210
void linpuppi_ref(const PFRegionEmu &region, const std::vector< TkObjEmu > &track, const std::vector< PVObjEmu > &pv, const std::vector< PFNeutralObjEmu > &pfallne, std::vector< PuppiObjEmu > &outselne) const
Definition: linpuppi_ref.h:171
std::vector< double > alphaZero_
Definition: linpuppi_ref.h:211
static void puppisort_and_crop_ref(unsigned int nOutMax, const std::vector< PuppiObjEmu > &in, std::vector< PuppiObjEmu > &out, SortAlgo algo=SortAlgo::Insertion)
std::pair< pt_t, puppiWgt_t > sum2puppiPt_ref(linpuppi::sumTerm_t sum, pt_t pt, unsigned int ieta, bool isEM, int icand) const
ap_int< 10 > eta_t
Definition: datatypes.h:14
unsigned int find_ieta(const PFRegionEmu &region, eta_t eta) const
std::vector< double > ptSlopePh_
Definition: linpuppi_ref.h:210
std::vector< double > ptSlopeNe_
Definition: linpuppi_ref.h:210
void setDebug(bool debug=true)
Definition: linpuppi_ref.h:200
static edm::ParameterSetDescription getParameterSetDescription()
void linpuppi_ref(const PFRegionEmu &region, const std::vector< TkObjEmu > &track, const std::vector< PVObjEmu > &pv, const std::vector< PFNeutralObjEmu > &pfallne, std::vector< PuppiObjEmu > &outallne_nocut, std::vector< PuppiObjEmu > &outallne, std::vector< PuppiObjEmu > &outselne) const
void setFakePuppi(bool fakePuppi=true)
Definition: linpuppi_ref.h:203
ap_ufixed< 12, 6, AP_TRN, AP_SAT > sumTerm_t
Definition: linpuppi_bits.h:7
void fwdlinpuppi_ref(const PFRegionEmu &region, const std::vector< HadCaloObjEmu > &caloin, std::vector< PuppiObjEmu > &outallne_nocut, std::vector< PuppiObjEmu > &outallne, std::vector< PuppiObjEmu > &outselne) const
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
Definition: datatypes.h:10
#define debug
Definition: HDRShower.cc:19
std::vector< double > alphaSlope_
Definition: linpuppi_ref.h:211
std::pair< float, float > sum2puppiPt_flt(float sum, float pt, unsigned int ieta, bool isEM, int icand) const
const double dR2Min
HLT enums.
LinPuppiEmulator(unsigned int nTrack, unsigned int nIn, unsigned int nOut, unsigned int nVtx, unsigned int dR2Min, unsigned int dR2Max, unsigned int iptMax, unsigned int dzCut, double ptSlopeNe, double ptSlopePh, double ptZeroNe, double ptZeroPh, double alphaSlope, double alphaZero, double alphaCrop, double priorNe, double priorPh, pt_t ptCut, unsigned int nFinalSort=0, SortAlgo finalSortAlgo=SortAlgo::Insertion)
Definition: linpuppi_ref.h:20
std::vector< double > alphaCrop_
Definition: linpuppi_ref.h:211
ap_int< 12 > glbeta_t
Definition: datatypes.h:18
void fwdlinpuppi_flt(const PFRegionEmu &region, const std::vector< HadCaloObjEmu > &caloin, std::vector< PuppiObjEmu > &outallne_nocut, std::vector< PuppiObjEmu > &outallne, std::vector< PuppiObjEmu > &outselne) const
Definition: datatypes.h:8