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