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