File indexing completed on 2024-04-06 12:21:26
0001 #ifndef LINPUPPI_REF_H
0002 #define LINPUPPI_REF_H
0003
0004 #include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"
0005 #include "linpuppi_bits.h"
0006
0007 #include <vector>
0008
0009 namespace edm {
0010 class ParameterSet;
0011 class ParameterSetDescription;
0012 }
0013
0014 namespace l1ct {
0015
0016 class LinPuppiEmulator {
0017 public:
0018 enum class SortAlgo { Insertion, BitonicRUFL, BitonicHLS, Hybrid, FoldedHybrid };
0019
0020 LinPuppiEmulator(unsigned int nTrack,
0021 unsigned int nIn,
0022 unsigned int nOut,
0023 unsigned int nVtx,
0024 unsigned int dR2Min,
0025 unsigned int dR2Max,
0026 unsigned int iptMax,
0027 unsigned int dzCut,
0028 double ptSlopeNe,
0029 double ptSlopePh,
0030 double ptZeroNe,
0031 double ptZeroPh,
0032 double alphaSlope,
0033 double alphaZero,
0034 double alphaCrop,
0035 double priorNe,
0036 double priorPh,
0037 pt_t ptCut,
0038 unsigned int nFinalSort = 0,
0039 SortAlgo finalSortAlgo = SortAlgo::Insertion)
0040 : nTrack_(nTrack),
0041 nIn_(nIn),
0042 nOut_(nOut),
0043 nVtx_(nVtx),
0044 dR2Min_(dR2Min),
0045 dR2Max_(dR2Max),
0046 iptMax_(iptMax),
0047 dzCut_(dzCut),
0048 absEtaBins_(),
0049 ptSlopeNe_(1, ptSlopeNe),
0050 ptSlopePh_(1, ptSlopePh),
0051 ptZeroNe_(1, ptZeroNe),
0052 ptZeroPh_(1, ptZeroPh),
0053 alphaSlope_(1, alphaSlope),
0054 alphaZero_(1, alphaZero),
0055 alphaCrop_(1, alphaCrop),
0056 priorNe_(1, priorNe),
0057 priorPh_(1, priorPh),
0058 ptCut_(1, ptCut),
0059 nFinalSort_(nFinalSort ? nFinalSort : nOut),
0060 finalSortAlgo_(finalSortAlgo),
0061 debug_(false),
0062 fakePuppi_(false) {}
0063
0064 LinPuppiEmulator(unsigned int nTrack,
0065 unsigned int nIn,
0066 unsigned int nOut,
0067 unsigned int nVtx,
0068 unsigned int dR2Min,
0069 unsigned int dR2Max,
0070 unsigned int iptMax,
0071 unsigned int dzCut,
0072 glbeta_t etaCut,
0073 double ptSlopeNe_0,
0074 double ptSlopeNe_1,
0075 double ptSlopePh_0,
0076 double ptSlopePh_1,
0077 double ptZeroNe_0,
0078 double ptZeroNe_1,
0079 double ptZeroPh_0,
0080 double ptZeroPh_1,
0081 double alphaSlope_0,
0082 double alphaSlope_1,
0083 double alphaZero_0,
0084 double alphaZero_1,
0085 double alphaCrop_0,
0086 double alphaCrop_1,
0087 double priorNe_0,
0088 double priorNe_1,
0089 double priorPh_0,
0090 double priorPh_1,
0091 pt_t ptCut_0,
0092 pt_t ptCut_1,
0093 unsigned int nFinalSort = 0,
0094 SortAlgo finalSortAlgo = SortAlgo::Insertion);
0095
0096 LinPuppiEmulator(unsigned int nTrack,
0097 unsigned int nIn,
0098 unsigned int nOut,
0099 unsigned int nVtx,
0100 unsigned int dR2Min,
0101 unsigned int dR2Max,
0102 unsigned int iptMax,
0103 unsigned int dzCut,
0104 const std::vector<glbeta_t> &absEtaBins,
0105 const std::vector<double> &ptSlopeNe,
0106 const std::vector<double> &ptSlopePh,
0107 const std::vector<double> &ptZeroNe,
0108 const std::vector<double> &ptZeroPh,
0109 const std::vector<double> &alphaSlope,
0110 const std::vector<double> &alphaZero,
0111 const std::vector<double> &alphaCrop,
0112 const std::vector<double> &priorNe,
0113 const std::vector<double> &priorPh,
0114 const std::vector<pt_t> &ptCut,
0115 unsigned int nFinalSort,
0116 SortAlgo finalSortAlgo)
0117 : nTrack_(nTrack),
0118 nIn_(nIn),
0119 nOut_(nOut),
0120 nVtx_(nVtx),
0121 dR2Min_(dR2Min),
0122 dR2Max_(dR2Max),
0123 iptMax_(iptMax),
0124 dzCut_(dzCut),
0125 absEtaBins_(absEtaBins),
0126 ptSlopeNe_(ptSlopeNe),
0127 ptSlopePh_(ptSlopePh),
0128 ptZeroNe_(ptZeroNe),
0129 ptZeroPh_(ptZeroPh),
0130 alphaSlope_(alphaSlope),
0131 alphaZero_(alphaZero),
0132 alphaCrop_(alphaCrop),
0133 priorNe_(priorNe),
0134 priorPh_(priorPh),
0135 ptCut_(ptCut),
0136 nFinalSort_(nFinalSort),
0137 finalSortAlgo_(finalSortAlgo),
0138 debug_(false),
0139 fakePuppi_(false) {}
0140
0141 LinPuppiEmulator(const edm::ParameterSet &iConfig);
0142
0143 static edm::ParameterSetDescription getParameterSetDescription();
0144
0145
0146 void linpuppi_chs_ref(const PFRegionEmu ®ion,
0147 const PVObjEmu &pv,
0148 const std::vector<PFChargedObjEmu> &pfch ,
0149 std::vector<PuppiObjEmu> &outallch ) const;
0150
0151 void linpuppi_chs_ref(const PFRegionEmu ®ion,
0152 const std::vector<PVObjEmu> &pv ,
0153 const std::vector<PFChargedObjEmu> &pfch ,
0154 std::vector<PuppiObjEmu> &outallch ) const;
0155
0156
0157 void linpuppi_flt(const PFRegionEmu ®ion,
0158 const std::vector<TkObjEmu> &track ,
0159 const std::vector<PVObjEmu> &pv ,
0160 const std::vector<PFNeutralObjEmu> &pfallne ,
0161 std::vector<PuppiObjEmu> &outallne_nocut ,
0162 std::vector<PuppiObjEmu> &outallne ,
0163 std::vector<PuppiObjEmu> &outselne ) const;
0164 void linpuppi_ref(const PFRegionEmu ®ion,
0165 const std::vector<TkObjEmu> &track ,
0166 const std::vector<PVObjEmu> &pv ,
0167 const std::vector<PFNeutralObjEmu> &pfallne ,
0168 std::vector<PuppiObjEmu> &outallne_nocut ,
0169 std::vector<PuppiObjEmu> &outallne ,
0170 std::vector<PuppiObjEmu> &outselne ) const;
0171 void linpuppi_ref(const PFRegionEmu ®ion,
0172 const std::vector<TkObjEmu> &track ,
0173 const std::vector<PVObjEmu> &pv ,
0174 const std::vector<PFNeutralObjEmu> &pfallne ,
0175 std::vector<PuppiObjEmu> &outselne ) const {
0176 std::vector<PuppiObjEmu> outallne_nocut, outallne;
0177 linpuppi_ref(region, track, pv, pfallne, outallne_nocut, outallne, outselne);
0178 }
0179
0180
0181 void fwdlinpuppi_ref(const PFRegionEmu ®ion,
0182 const std::vector<HadCaloObjEmu> &caloin ,
0183 std::vector<PuppiObjEmu> &outallne_nocut ,
0184 std::vector<PuppiObjEmu> &outallne ,
0185 std::vector<PuppiObjEmu> &outselne ) const;
0186 void fwdlinpuppi_flt(const PFRegionEmu ®ion,
0187 const std::vector<HadCaloObjEmu> &caloin ,
0188 std::vector<PuppiObjEmu> &outallne_nocut ,
0189 std::vector<PuppiObjEmu> &outallne ,
0190 std::vector<PuppiObjEmu> &outselne ) const;
0191
0192 static void puppisort_and_crop_ref(unsigned int nOutMax,
0193 const std::vector<PuppiObjEmu> &in,
0194 std::vector<PuppiObjEmu> &out,
0195 SortAlgo algo = SortAlgo::Insertion);
0196
0197
0198 void run(const PFInputRegion &in, const std::vector<l1ct::PVObjEmu> &pvs, OutputRegion &out) const;
0199
0200 void setDebug(bool debug = true) { debug_ = debug; }
0201
0202
0203 void setFakePuppi(bool fakePuppi = true) { fakePuppi_ = fakePuppi; }
0204
0205 protected:
0206 unsigned int nTrack_, nIn_, nOut_,
0207 nVtx_;
0208 unsigned int dR2Min_, dR2Max_, iptMax_, dzCut_;
0209 std::vector<glbeta_t> absEtaBins_;
0210 std::vector<double> ptSlopeNe_, ptSlopePh_, ptZeroNe_, ptZeroPh_;
0211 std::vector<double> alphaSlope_, alphaZero_, alphaCrop_;
0212 std::vector<double> priorNe_, priorPh_;
0213 std::vector<pt_t> ptCut_;
0214 unsigned int nFinalSort_;
0215 SortAlgo finalSortAlgo_;
0216
0217 bool debug_;
0218 bool fakePuppi_;
0219
0220 unsigned int find_ieta(const PFRegionEmu ®ion, eta_t eta) const;
0221 std::pair<pt_t, puppiWgt_t> sum2puppiPt_ref(
0222 linpuppi::sumTerm_t sum, pt_t pt, unsigned int ieta, bool isEM, int icand) const;
0223 std::pair<float, float> sum2puppiPt_flt(float sum, float pt, unsigned int ieta, bool isEM, int icand) const;
0224 };
0225
0226 }
0227
0228 #endif