Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-11 04:40:25

0001 // CaloParamsHelper.h
0002 // Author: R. Alex Barbieri
0003 //
0004 // Wrapper class for CaloParams and Et scales
0005 
0006 #include <iostream>
0007 
0008 #include "CondFormats/L1TObjects/interface/CaloParams.h"
0009 
0010 #include "CondFormats/L1TObjects/interface/L1CaloEtScale.h"
0011 #include "CondFormats/DataRecord/interface/L1EmEtScaleRcd.h"
0012 #include "CondFormats/DataRecord/interface/L1JetEtScaleRcd.h"
0013 #include "CondFormats/DataRecord/interface/L1HtMissScaleRcd.h"
0014 #include "CondFormats/DataRecord/interface/L1HfRingEtScaleRcd.h"
0015 
0016 #ifndef CaloParamsHelper_h
0017 #define CaloParamsHelper_h
0018 
0019 namespace l1t {
0020 
0021   class CaloParamsHelper : public CaloParams {
0022   public:
0023     // DO NOT ADD ENTRIES ANYWHERE BUT DIRECTLY BEFORE "NUM_CALOPARAMNODES"
0024     // DO NOT CHANGE NUMERICAL VALUES OF ANY ALREADY EXISTING FIELDS, YOU CAN ONLY EXTEND, AT THE END.
0025     enum {
0026       regionPUS = 0,
0027       egTrimming = 1,
0028       egMaxHOverE = 2,
0029       egCompressShapes = 3,
0030       egShapeId = 4,
0031       egCalibration = 5,
0032       egPUS = 6,
0033       egIsolation = 7,
0034       tauCalibration = 8,
0035       tauPUS = 9,
0036       tauIsolation = 10,
0037       jetPUS = 11,
0038       jetCalibration = 12,
0039       hiCentrality = 13,
0040       hiQ2 = 14,
0041       tauEtToHFRingEt = 15,
0042       tauCompress = 16,
0043       layer1ECal = 17,
0044       layer1HCal = 18,
0045       layer1HF = 19,
0046       jetCompressEta = 20,
0047       jetCompressPt = 21,
0048       metCalibration = 22,
0049       metHFCalibration = 23,
0050       etSumEttCalibration = 24,
0051       etSumEcalSumCalibration = 25,
0052       tauIsolation2 = 26,
0053       egBypassEGVetosFlag = 27,
0054       jetBypassPUSFlag = 28,
0055       egHOverEBarrel = 29,
0056       egHOverEEndcap = 30,
0057       etSumMetPUS = 31,
0058       etSumBypassMetPUSFlag = 32,
0059       egBypassExtHoE = 33,
0060       egIsolation2 = 34,
0061       etSumEttPUS = 35,
0062       etSumBypassEttPUSFlag = 36,
0063       etSumEcalSumPUS = 37,
0064       etSumBypassEcalSumPUSFlag = 38,
0065       layer1HOverE = 39,
0066       PUTowerThreshold = 40,
0067       tauTrimmingShapeVeto = 41,
0068       egBypassShapeFlag = 42,
0069       egBypassECALFGFlag = 43,
0070       egBypassHoEFlag = 44,
0071       etSumCentralityLower = 45,
0072       etSumCentralityUpper = 46,
0073       jetPUSUsePhiRingFlag = 47,
0074       metPhiCalibration = 48,
0075       metHFPhiCalibration = 49,
0076       NUM_CALOPARAMNODES = 50
0077     };
0078 
0079     CaloParamsHelper() { pnode_.resize(NUM_CALOPARAMNODES); }
0080     CaloParamsHelper(const CaloParams);
0081     ~CaloParamsHelper() {}
0082 
0083     bool isValidForStage1() const { return true; }
0084     bool isValidForStage2() const { return (version_ >= 2); }
0085 
0086     L1CaloEtScale emScale() const { return emScale_; }
0087     void setEmScale(L1CaloEtScale emScale) { emScale_ = emScale; }
0088     L1CaloEtScale jetScale() const { return jetScale_; }
0089     void setJetScale(L1CaloEtScale jetScale) { jetScale_ = jetScale; }
0090     L1CaloEtScale HtMissScale() const { return HtMissScale_; }
0091     L1CaloEtScale HfRingScale() const { return HfRingScale_; }
0092     void setHtMissScale(L1CaloEtScale HtMissScale) { HtMissScale_ = HtMissScale; }
0093     void setHfRingScale(L1CaloEtScale HfRingScale) { HfRingScale_ = HfRingScale; }
0094 
0095     // towers
0096     double towerLsbH() const { return towerp_.lsbH_; }
0097     double towerLsbE() const { return towerp_.lsbE_; }
0098     double towerLsbSum() const { return towerp_.lsbSum_; }
0099     int towerNBitsH() const { return towerp_.nBitsH_; }
0100     int towerNBitsE() const { return towerp_.nBitsE_; }
0101     int towerNBitsSum() const { return towerp_.nBitsSum_; }
0102     int towerNBitsRatio() const { return towerp_.nBitsRatio_; }
0103     int towerMaskE() const { return towerp_.maskE_; }
0104     int towerMaskH() const { return towerp_.maskH_; }
0105     int towerMaskSum() const { return towerp_.maskSum_; }
0106     int towerMaskRatio() const { return towerp_.maskRatio_; }
0107     bool doTowerEncoding() const { return towerp_.doEncoding_; }
0108 
0109     void setTowerLsbH(double lsb) { towerp_.lsbH_ = lsb; }
0110     void setTowerLsbE(double lsb) { towerp_.lsbE_ = lsb; }
0111     void setTowerLsbSum(double lsb) { towerp_.lsbSum_ = lsb; }
0112     void setTowerNBitsH(int n) {
0113       towerp_.nBitsH_ = n;
0114       towerp_.maskH_ = std::pow(2, n) - 1;
0115     }
0116     void setTowerNBitsE(int n) {
0117       towerp_.nBitsE_ = n;
0118       towerp_.maskE_ = std::pow(2, n) - 1;
0119     }
0120     void setTowerNBitsSum(int n) {
0121       towerp_.nBitsSum_ = n;
0122       towerp_.maskSum_ = std::pow(2, n) - 1;
0123     }
0124     void setTowerNBitsRatio(int n) {
0125       towerp_.nBitsRatio_ = n;
0126       towerp_.maskRatio_ = std::pow(2, n) - 1;
0127     }
0128     void setTowerEncoding(bool doit) { towerp_.doEncoding_ = doit; }
0129 
0130     // regions
0131     double regionLsb() const { return regionLsb_; }
0132     std::string const& regionPUSType() const { return pnode_[regionPUS].type_; }
0133     std::vector<double> const& regionPUSParams() const { return pnode_[regionPUS].dparams_; }
0134     l1t::LUT* regionPUSLUT() { return &pnode_[regionPUS].LUT_; }
0135     l1t::LUT const* regionPUSLUT() const { return &pnode_[regionPUS].LUT_; }
0136 
0137     int regionPUSValue(int PUM0, int eta) const {
0138       int puSub = ceil(regionPUSParams()[18 * eta + PUM0] * 2);
0139       return puSub;
0140     }
0141 
0142     void setRegionLsb(double lsb) { regionLsb_ = lsb; }
0143     void setRegionPUSType(std::string type) { pnode_[regionPUS].type_ = type; }
0144     void setRegionPUSParams(const std::vector<double>& params) { pnode_[regionPUS].dparams_ = params; }
0145     void setRegionPUSLUT(const l1t::LUT& lut) { pnode_[regionPUS].LUT_ = lut; }
0146 
0147     int pileUpTowerThreshold() const { return pnode_[PUTowerThreshold].iparams_[0]; }
0148     void setPileUpTowerThreshold(int thresh) {
0149       pnode_[PUTowerThreshold].iparams_.resize(1);
0150       pnode_[PUTowerThreshold].iparams_[0] = thresh;
0151     }
0152 
0153     // EG
0154     int egEtaCut() const {
0155       if (pnode_[egPUS].version_ == 1)
0156         return pnode_[egPUS].iparams_[0];
0157       else
0158         return 0;
0159     }
0160     double egLsb() const { return egp_.lsb_; }
0161     double egSeedThreshold() const { return egp_.seedThreshold_; }
0162     double egNeighbourThreshold() const { return egp_.neighbourThreshold_; }
0163     double egHcalThreshold() const { return egp_.hcalThreshold_; }
0164     l1t::LUT* egTrimmingLUT() { return &pnode_[egTrimming].LUT_; }
0165     l1t::LUT const* egTrimmingLUT() const { return &pnode_[egTrimming].LUT_; }
0166     double egMaxHcalEt() const { return egp_.maxHcalEt_; }
0167     double egMaxPtHOverE() const { return egp_.maxPtHOverE_; }
0168     l1t::LUT* egMaxHOverELUT() { return &pnode_[egMaxHOverE].LUT_; }
0169     l1t::LUT const* egMaxHOverELUT() const { return &pnode_[egMaxHOverE].LUT_; }
0170     l1t::LUT* egCompressShapesLUT() { return &pnode_[egCompressShapes].LUT_; }
0171     l1t::LUT const* egCompressShapesLUT() const { return &pnode_[egCompressShapes].LUT_; }
0172     l1t::LUT* egShapeIdLUT() { return &pnode_[egShapeId].LUT_; }
0173     l1t::LUT const* egShapeIdLUT() const { return &pnode_[egShapeId].LUT_; }
0174     int egMinPtJetIsolation() const { return egp_.minPtJetIsolation_; }
0175     int egMaxPtJetIsolation() const { return egp_.maxPtJetIsolation_; }
0176     int egMinPtHOverEIsolation() const { return egp_.minPtHOverEIsolation_; }
0177     int egMaxPtHOverEIsolation() const { return egp_.maxPtHOverEIsolation_; }
0178     unsigned egBypassEGVetos() const { return pnode_[egBypassEGVetosFlag].uparams_[0]; }
0179     unsigned egBypassExtHOverE() const { return pnode_[egBypassExtHoE].uparams_[0]; }
0180     unsigned egBypassShape() const {
0181       if (pnode_[egBypassShapeFlag].uparams_.empty())
0182         return 0;
0183       else
0184         return pnode_[egBypassShapeFlag].uparams_[0];
0185     }
0186     unsigned egBypassECALFG() const {
0187       if (pnode_[egBypassECALFGFlag].uparams_.empty())
0188         return 0;
0189       else
0190         return pnode_[egBypassECALFGFlag].uparams_[0];
0191     }
0192     unsigned egBypassHoE() const {
0193       if (pnode_[egBypassHoEFlag].uparams_.empty())
0194         return 0;
0195       else
0196         return pnode_[egBypassHoEFlag].uparams_[0];
0197     }
0198 
0199     int egHOverEcutBarrel() const { return pnode_[egHOverEBarrel].iparams_[0]; }
0200     int egHOverEcutEndcap() const { return pnode_[egHOverEEndcap].iparams_[0]; }
0201 
0202     unsigned egIsoAreaNrTowersEta() const { return egp_.isoAreaNrTowersEta_; }
0203     unsigned egIsoAreaNrTowersPhi() const { return egp_.isoAreaNrTowersPhi_; }
0204     unsigned egIsoVetoNrTowersPhi() const { return egp_.isoVetoNrTowersPhi_; }
0205     const std::string& egPUSType() const { return pnode_[egPUS].type_; }
0206     const std::vector<double>& egPUSParams() const { return pnode_[egPUS].dparams_; }
0207     double egPUSParam(int ipar) const { return pnode_[egPUS].dparams_.at(ipar); }
0208 
0209     std::string const& egIsolationType() const { return pnode_[egIsolation].type_; }
0210     l1t::LUT const* egIsolationLUT() const { return &pnode_[egIsolation].LUT_; }
0211     l1t::LUT* egIsolationLUT() { return &pnode_[egIsolation].LUT_; }
0212     l1t::LUT const* egIsolationLUT2() const { return &pnode_[egIsolation2].LUT_; }
0213     l1t::LUT* egIsolationLUT2() { return &pnode_[egIsolation2].LUT_; }
0214     std::string const& egCalibrationType() const { return pnode_[egCalibration].type_; }
0215     std::vector<double> const& egCalibrationParams() const { return pnode_[egCalibration].dparams_; }
0216     l1t::LUT const* egCalibrationLUT() const { return &pnode_[egCalibration].LUT_; }
0217     l1t::LUT* egCalibrationLUT() { return &pnode_[egCalibration].LUT_; }
0218 
0219     void setEgEtaCut(int mask) {
0220       pnode_[egPUS].iparams_.resize(1);
0221       pnode_[egPUS].iparams_[0] = mask;
0222     }
0223     void setEgLsb(double lsb) { egp_.lsb_ = lsb; }
0224     void setEgSeedThreshold(double thresh) { egp_.seedThreshold_ = thresh; }
0225     void setEgNeighbourThreshold(double thresh) { egp_.neighbourThreshold_ = thresh; }
0226     void setEgHcalThreshold(double thresh) { egp_.hcalThreshold_ = thresh; }
0227     void setEgTrimmingLUT(const l1t::LUT& lut) { pnode_[egTrimming].LUT_ = lut; }
0228     void setEgMaxHcalEt(double cut) { egp_.maxHcalEt_ = cut; }
0229     void setEgMaxPtHOverE(double thresh) { egp_.maxPtHOverE_ = thresh; }
0230     void setEgMaxHOverELUT(const l1t::LUT& lut) { pnode_[egMaxHOverE].LUT_ = lut; }
0231     void setEgCompressShapesLUT(const l1t::LUT& lut) { pnode_[egCompressShapes].LUT_ = lut; }
0232     void setEgShapeIdLUT(const l1t::LUT& lut) { pnode_[egShapeId].LUT_ = lut; }
0233     void setEgMinPtJetIsolation(int cutValue) { egp_.minPtJetIsolation_ = cutValue; }
0234     void setEgMaxPtJetIsolation(int cutValue) { egp_.maxPtJetIsolation_ = cutValue; }
0235     void setEgMinPtHOverEIsolation(int cutValue) { egp_.minPtHOverEIsolation_ = cutValue; }
0236     void setEgMaxPtHOverEIsolation(int cutValue) { egp_.maxPtHOverEIsolation_ = cutValue; }
0237     void setEgBypassEGVetos(unsigned flag) {
0238       pnode_[egBypassEGVetosFlag].uparams_.resize(1);
0239       pnode_[egBypassEGVetosFlag].uparams_[0] = flag;
0240     }
0241     void setEgBypassExtHOverE(unsigned flag) {
0242       pnode_[egBypassExtHoE].uparams_.resize(1);
0243       pnode_[egBypassExtHoE].uparams_[0] = flag;
0244     }
0245     void setEgBypassShape(unsigned flag) {
0246       pnode_[egBypassShapeFlag].uparams_.resize(1);
0247       pnode_[egBypassShapeFlag].uparams_[0] = flag;
0248     }
0249     void setEgBypassECALFG(unsigned flag) {
0250       pnode_[egBypassECALFGFlag].uparams_.resize(1);
0251       pnode_[egBypassECALFGFlag].uparams_[0] = flag;
0252     }
0253     void setEgBypassHoE(unsigned flag) {
0254       pnode_[egBypassHoEFlag].uparams_.resize(1);
0255       pnode_[egBypassHoEFlag].uparams_[0] = flag;
0256     }
0257     void setEgHOverEcutBarrel(int cut) {
0258       pnode_[egHOverEBarrel].iparams_.resize(1);
0259       pnode_[egHOverEBarrel].iparams_[0] = cut;
0260     }
0261     void setEgHOverEcutEndcap(int cut) {
0262       pnode_[egHOverEEndcap].iparams_.resize(1);
0263       pnode_[egHOverEEndcap].iparams_[0] = cut;
0264     }
0265 
0266     void setEgIsoAreaNrTowersEta(unsigned iEgIsoAreaNrTowersEta) { egp_.isoAreaNrTowersEta_ = iEgIsoAreaNrTowersEta; }
0267     void setEgIsoAreaNrTowersPhi(unsigned iEgIsoAreaNrTowersPhi) { egp_.isoAreaNrTowersPhi_ = iEgIsoAreaNrTowersPhi; }
0268     void setEgIsoVetoNrTowersPhi(unsigned iEgIsoVetoNrTowersPhi) { egp_.isoVetoNrTowersPhi_ = iEgIsoVetoNrTowersPhi; }
0269     void setEgPUSType(std::string type) { pnode_[egPUS].type_ = type; }
0270     void setEgPUSParams(const std::vector<double>& params) { pnode_[egPUS].dparams_ = params; }
0271     void setEgIsolationType(std::string type) { pnode_[egIsolation].type_ = type; }
0272     void setEgIsolationLUT(const l1t::LUT& lut) { pnode_[egIsolation].LUT_ = lut; }
0273     void setEgIsolationLUT2(const l1t::LUT& lut) { pnode_[egIsolation2].LUT_ = lut; }
0274     void setEgCalibrationType(std::string type) { pnode_[egCalibration].type_ = type; }
0275     void setEgCalibrationParams(std::vector<double> params) { pnode_[egCalibration].dparams_ = params; }
0276     void setEgCalibrationLUT(const l1t::LUT& lut) { pnode_[egCalibration].LUT_ = lut; }
0277 
0278     // - recently imported:
0279     std::string const& egShapeIdType() const { return pnode_[egShapeId].type_; }
0280     void setEgShapeIdType(std::string type) { pnode_[egShapeId].type_ = type; }
0281     unsigned egShapeIdVersion() const { return pnode_[egShapeId].version_; }
0282     void setEgShapeIdVersion(unsigned version) { pnode_[egShapeId].version_ = version; }
0283     unsigned egCalibrationVersion() const { return pnode_[egCalibration].version_; }
0284     void setEgCalibrationVersion(unsigned version) { pnode_[egCalibration].version_ = version; }
0285 
0286     // tau
0287     int tauRegionMask() const {
0288       if (pnode_[tauPUS].version_ == 1)
0289         return pnode_[tauPUS].iparams_[0];
0290       else
0291         return 0;
0292     }
0293     double tauLsb() const { return taup_.lsb_; }
0294     double tauSeedThreshold() const { return taup_.seedThreshold_; }
0295     double tauNeighbourThreshold() const { return taup_.neighbourThreshold_; }
0296     double tauMaxPtTauVeto() const { return taup_.maxPtTauVeto_; }
0297     double tauMinPtJetIsolationB() const { return taup_.minPtJetIsolationB_; }
0298     double tauMaxJetIsolationB() const { return taup_.maxJetIsolationB_; }
0299     double tauMaxJetIsolationA() const { return taup_.maxJetIsolationA_; }
0300     int isoTauEtaMin() const { return taup_.isoEtaMin_; }
0301     int isoTauEtaMax() const { return taup_.isoEtaMax_; }
0302     std::string tauPUSType() const { return pnode_[tauPUS].type_; }
0303     const std::vector<double>& tauPUSParams() const { return pnode_[tauPUS].dparams_; }
0304     double tauPUSParam(int ipar) const { return pnode_[tauPUS].dparams_.at(ipar); }
0305 
0306     l1t::LUT* tauIsolationLUT() { return &pnode_[tauIsolation].LUT_; }
0307     l1t::LUT const* tauIsolationLUT() const { return &pnode_[tauIsolation].LUT_; }
0308     l1t::LUT* tauIsolationLUT2() { return &pnode_[tauIsolation2].LUT_; }
0309     l1t::LUT const* tauIsolationLUT2() const { return &pnode_[tauIsolation2].LUT_; }
0310     l1t::LUT* tauTrimmingShapeVetoLUT() { return &pnode_[tauTrimmingShapeVeto].LUT_; }
0311     l1t::LUT const* tauTrimmingShapeVetoLUT() const { return &pnode_[tauTrimmingShapeVeto].LUT_; }
0312 
0313     std::string const& tauCalibrationType() const { return pnode_[tauCalibration].type_; }
0314     std::vector<double> const& tauCalibrationParams() const { return pnode_[tauCalibration].dparams_; }
0315     l1t::LUT* tauCalibrationLUT() { return &pnode_[tauCalibration].LUT_; }
0316     l1t::LUT const* tauCalibrationLUT() const { return &pnode_[tauCalibration].LUT_; }
0317     l1t::LUT* tauCompressLUT() { return &pnode_[tauCompress].LUT_; }
0318     l1t::LUT const* tauCompressLUT() const { return &pnode_[tauCompress].LUT_; }
0319 
0320     l1t::LUT const* tauEtToHFRingEtLUT() const { return &pnode_[tauEtToHFRingEt].LUT_; }
0321     l1t::LUT* tauEtToHFRingEtLUT() { return &pnode_[tauEtToHFRingEt].LUT_; }
0322 
0323     unsigned tauIsoAreaNrTowersEta() const { return taup_.isoAreaNrTowersEta_; }
0324     unsigned tauIsoAreaNrTowersPhi() const { return taup_.isoAreaNrTowersPhi_; }
0325     unsigned tauIsoVetoNrTowersPhi() const { return taup_.isoVetoNrTowersPhi_; }
0326 
0327     void setTauRegionMask(int mask) {
0328       pnode_[tauPUS].iparams_.resize(1);
0329       pnode_[tauPUS].iparams_[0] = mask;
0330     }
0331     void setTauLsb(double lsb) { taup_.lsb_ = lsb; }
0332     void setTauSeedThreshold(double thresh) { taup_.seedThreshold_ = thresh; }
0333     void setTauNeighbourThreshold(double thresh) { taup_.neighbourThreshold_ = thresh; }
0334     void setTauMaxPtTauVeto(double limit) { taup_.maxPtTauVeto_ = limit; }
0335     void setTauMinPtJetIsolationB(double limit) { taup_.minPtJetIsolationB_ = limit; }
0336     void setTauMaxJetIsolationB(double limit) { taup_.maxJetIsolationB_ = limit; }
0337     void setTauMaxJetIsolationA(double cutValue) { taup_.maxJetIsolationA_ = cutValue; }
0338     void setIsoTauEtaMin(int value) { taup_.isoEtaMin_ = value; }
0339     void setIsoTauEtaMax(int value) { taup_.isoEtaMax_ = value; }
0340     void setTauPUSType(std::string type) { pnode_[tauPUS].type_ = type; }
0341     void setTauIsolationLUT(const l1t::LUT& lut) { pnode_[tauIsolation].LUT_ = lut; }
0342     void setTauIsolationLUT2(const l1t::LUT& lut) { pnode_[tauIsolation2].LUT_ = lut; }
0343     void setTauTrimmingShapeVetoLUT(const l1t::LUT& lut) { pnode_[tauTrimmingShapeVeto].LUT_ = lut; }
0344 
0345     void setTauCalibrationType(std::string type) { pnode_[tauCalibration].type_ = type; }
0346     void setTauIsoAreaNrTowersEta(unsigned iTauIsoAreaNrTowersEta) {
0347       taup_.isoAreaNrTowersEta_ = iTauIsoAreaNrTowersEta;
0348     }
0349     void setTauIsoAreaNrTowersPhi(unsigned iTauIsoAreaNrTowersPhi) {
0350       taup_.isoAreaNrTowersPhi_ = iTauIsoAreaNrTowersPhi;
0351     }
0352     void setTauIsoVetoNrTowersPhi(unsigned iTauIsoVetoNrTowersPhi) {
0353       taup_.isoVetoNrTowersPhi_ = iTauIsoVetoNrTowersPhi;
0354     }
0355 
0356     void setTauCalibrationParams(std::vector<double> params) { pnode_[tauCalibration].dparams_ = params; }
0357     void setTauCalibrationLUT(const l1t::LUT& lut) { pnode_[tauCalibration].LUT_ = lut; }
0358     void setTauCompressLUT(const l1t::LUT& lut) { pnode_[tauCompress].LUT_ = lut; }
0359     void setTauPUSParams(const std::vector<double>& params) { pnode_[tauPUS].dparams_ = params; }
0360 
0361     void setTauEtToHFRingEtLUT(const l1t::LUT& lut) { pnode_[tauEtToHFRingEt].LUT_ = lut; }
0362 
0363     // jets
0364     double jetLsb() const { return jetp_.lsb_; }
0365     double jetSeedThreshold() const { return jetp_.seedThreshold_; }
0366     double jetNeighbourThreshold() const { return jetp_.neighbourThreshold_; }
0367     int jetRegionMask() const {
0368       if (pnode_[jetPUS].version_ == 1)
0369         return pnode_[jetPUS].iparams_[0];
0370       else
0371         return 0;
0372     }
0373 
0374     unsigned jetBypassPUS() const { return pnode_[jetBypassPUSFlag].uparams_[0]; }
0375     unsigned jetPUSUsePhiRing() const {
0376       if (pnode_[jetPUSUsePhiRingFlag].uparams_.empty())
0377         return 0;
0378       else
0379         return pnode_[jetPUSUsePhiRingFlag].uparams_[0];
0380     }
0381 
0382     std::string jetPUSType() const { return pnode_[jetPUS].type_; }
0383     std::vector<double> const& jetPUSParams() const { return pnode_[jetPUS].dparams_; }
0384     std::string const& jetCalibrationType() const { return pnode_[jetCalibration].type_; }
0385     std::vector<double> const& jetCalibrationParams() const { return pnode_[jetCalibration].dparams_; }
0386 
0387     l1t::LUT* jetCalibrationLUT() { return &pnode_[jetCalibration].LUT_; }
0388     l1t::LUT const* jetCalibrationLUT() const { return &pnode_[jetCalibration].LUT_; }
0389     l1t::LUT* jetCompressPtLUT() { return &pnode_[jetCompressPt].LUT_; }
0390     l1t::LUT const* jetCompressPtLUT() const { return &pnode_[jetCompressPt].LUT_; }
0391     l1t::LUT* jetCompressEtaLUT() { return &pnode_[jetCompressEta].LUT_; }
0392     l1t::LUT const* jetCompressEtaLUT() const { return &pnode_[jetCompressEta].LUT_; }
0393 
0394     void setJetLsb(double lsb) { jetp_.lsb_ = lsb; }
0395     void setJetSeedThreshold(double thresh) { jetp_.seedThreshold_ = thresh; }
0396     void setJetNeighbourThreshold(double thresh) { jetp_.neighbourThreshold_ = thresh; }
0397     void setJetRegionMask(int mask) {
0398       pnode_[jetPUS].iparams_.resize(1);
0399       pnode_[jetPUS].iparams_[0] = mask;
0400     }
0401     void setJetPUSType(std::string type) { pnode_[jetPUS].type_ = type; }
0402     void setJetPUSParams(std::vector<double> params) { pnode_[jetPUS].dparams_ = params; }
0403     void setJetCalibrationType(std::string type) { pnode_[jetCalibration].type_ = type; }
0404     void setJetCalibrationParams(std::vector<double> params) { pnode_[jetCalibration].dparams_ = params; }
0405     void setJetCalibrationLUT(const l1t::LUT& lut) { pnode_[jetCalibration].LUT_ = lut; }
0406     void setJetCompressEtaLUT(const l1t::LUT& lut) { pnode_[jetCompressEta].LUT_ = lut; }
0407     void setJetCompressPtLUT(const l1t::LUT& lut) { pnode_[jetCompressPt].LUT_ = lut; }
0408     void setJetBypassPUS(unsigned flag) {
0409       pnode_[jetBypassPUSFlag].uparams_.resize(1);
0410       pnode_[jetBypassPUSFlag].uparams_[0] = flag;
0411     }
0412     void setJetPUSUsePhiRing(unsigned flag) {
0413       pnode_[jetPUSUsePhiRingFlag].uparams_.resize(1);
0414       pnode_[jetPUSUsePhiRingFlag].uparams_[0] = flag;
0415     }
0416 
0417     // sums
0418 
0419     double etSumLsb() const { return etSumLsb_; }
0420     int etSumEtaMin(unsigned isum) const;
0421     int etSumEtaMax(unsigned isum) const;
0422     double etSumEtThreshold(unsigned isum) const;
0423     unsigned etSumBypassMetPUS() const { return pnode_[etSumBypassMetPUSFlag].uparams_[0]; }
0424     unsigned etSumBypassEttPUS() const { return pnode_[etSumBypassEttPUSFlag].uparams_[0]; }
0425     unsigned etSumBypassEcalSumPUS() const { return pnode_[etSumBypassEcalSumPUSFlag].uparams_[0]; }
0426     std::string const& etSumMetPUSType() const { return pnode_[etSumMetPUS].type_; }
0427     std::string const& etSumEttPUSType() const { return pnode_[etSumEttPUS].type_; }
0428     std::string const& etSumEcalSumPUSType() const { return pnode_[etSumEcalSumPUS].type_; }
0429     std::string const& metCalibrationType() const { return pnode_[metCalibration].type_; }
0430     std::string const& metHFCalibrationType() const { return pnode_[metHFCalibration].type_; }
0431     std::string const& etSumEttCalibrationType() const { return pnode_[etSumEttCalibration].type_; }
0432     std::string const& etSumEcalSumCalibrationType() const { return pnode_[etSumEcalSumCalibration].type_; }
0433 
0434     l1t::LUT* etSumMetPUSLUT() { return &pnode_[etSumMetPUS].LUT_; }
0435     l1t::LUT const* etSumMetPUSLUT() const { return &pnode_[etSumMetPUS].LUT_; }
0436     l1t::LUT* etSumEttPUSLUT() { return &pnode_[etSumEttPUS].LUT_; }
0437     l1t::LUT const* etSumEttPUSLUT() const { return &pnode_[etSumEttPUS].LUT_; }
0438     l1t::LUT* etSumEcalSumPUSLUT() { return &pnode_[etSumEcalSumPUS].LUT_; }
0439     l1t::LUT const* etSumEcalSumPUSLUT() const { return &pnode_[etSumEcalSumPUS].LUT_; }
0440     l1t::LUT* metCalibrationLUT() { return &pnode_[metCalibration].LUT_; }
0441     l1t::LUT const* metCalibrationLUT() const { return &pnode_[metCalibration].LUT_; }
0442     l1t::LUT* metHFCalibrationLUT() { return &pnode_[metHFCalibration].LUT_; }
0443     l1t::LUT const* metHFCalibrationLUT() const { return &pnode_[metHFCalibration].LUT_; }
0444     l1t::LUT* etSumEttCalibrationLUT() { return &pnode_[etSumEttCalibration].LUT_; }
0445     l1t::LUT const* etSumEttCalibrationLUT() const { return &pnode_[etSumEttCalibration].LUT_; }
0446     l1t::LUT* etSumEcalSumCalibrationLUT() { return &pnode_[etSumEcalSumCalibration].LUT_; }
0447     l1t::LUT const* etSumEcalSumCalibrationLUT() const { return &pnode_[etSumEcalSumCalibration].LUT_; }
0448     l1t::LUT* metPhiCalibrationLUT() { return &pnode_[metPhiCalibration].LUT_; }
0449     l1t::LUT const* metPhiCalibrationLUT() const { return &pnode_[metPhiCalibration].LUT_; }
0450     l1t::LUT* metHFPhiCalibrationLUT() { return &pnode_[metHFPhiCalibration].LUT_; }
0451     l1t::LUT const* metHFPhiCalibrationLUT() const { return &pnode_[metHFPhiCalibration].LUT_; }
0452 
0453     void setEtSumLsb(double lsb) { etSumLsb_ = lsb; }
0454     void setEtSumEtaMin(unsigned isum, int eta);
0455     void setEtSumEtaMax(unsigned isum, int eta);
0456     void setEtSumEtThreshold(unsigned isum, double thresh);
0457     void setEtSumMetPUSType(std::string type) { pnode_[etSumMetPUS].type_ = type; }
0458     void setEtSumEttPUSType(std::string type) { pnode_[etSumEttPUS].type_ = type; }
0459     void setEtSumEcalSumPUSType(std::string type) { pnode_[etSumEcalSumPUS].type_ = type; }
0460     void setMetCalibrationType(std::string type) { pnode_[metCalibration].type_ = type; }
0461     void setMetHFCalibrationType(std::string type) { pnode_[metHFCalibration].type_ = type; }
0462     void setEtSumEttCalibrationType(std::string type) { pnode_[etSumEttCalibration].type_ = type; }
0463     void setEtSumEcalSumCalibrationType(std::string type) { pnode_[etSumEcalSumCalibration].type_ = type; }
0464     void setEtSumBypassMetPUS(unsigned flag) {
0465       pnode_[etSumBypassMetPUSFlag].uparams_.resize(1);
0466       pnode_[etSumBypassMetPUSFlag].uparams_[0] = flag;
0467     }
0468     void setEtSumBypassEttPUS(unsigned flag) {
0469       pnode_[etSumBypassEttPUSFlag].uparams_.resize(1);
0470       pnode_[etSumBypassEttPUSFlag].uparams_[0] = flag;
0471     }
0472     void setEtSumBypassEcalSumPUS(unsigned flag) {
0473       pnode_[etSumBypassEcalSumPUSFlag].uparams_.resize(1);
0474       pnode_[etSumBypassEcalSumPUSFlag].uparams_[0] = flag;
0475     }
0476 
0477     void setEtSumMetPUSLUT(const l1t::LUT& lut) { pnode_[etSumMetPUS].LUT_ = lut; }
0478     void setEtSumEttPUSLUT(const l1t::LUT& lut) { pnode_[etSumEttPUS].LUT_ = lut; }
0479     void setEtSumEcalSumPUSLUT(const l1t::LUT& lut) { pnode_[etSumEcalSumPUS].LUT_ = lut; }
0480     void setMetCalibrationLUT(const l1t::LUT& lut) { pnode_[metCalibration].LUT_ = lut; }
0481     void setMetHFCalibrationLUT(const l1t::LUT& lut) { pnode_[metHFCalibration].LUT_ = lut; }
0482     void setEtSumEttCalibrationLUT(const l1t::LUT& lut) { pnode_[etSumEttCalibration].LUT_ = lut; }
0483     void setEtSumEcalSumCalibrationLUT(const l1t::LUT& lut) { pnode_[etSumEcalSumCalibration].LUT_ = lut; }
0484     void setMetPhiCalibrationLUT(const l1t::LUT& lut) { pnode_[metPhiCalibration].LUT_ = lut; }
0485     void setMetHFPhiCalibrationLUT(const l1t::LUT& lut) { pnode_[metHFPhiCalibration].LUT_ = lut; }
0486 
0487     // HI centrality
0488     int centralityRegionMask() const {
0489       if (pnode_[hiCentrality].version_ == 1)
0490         return pnode_[hiCentrality].iparams_[0];
0491       else
0492         return 0;
0493     }
0494     std::vector<int> minimumBiasThresholds() const {
0495       if (pnode_[hiCentrality].version_ == 1 && pnode_[hiCentrality].iparams_.size() == 5) {
0496         std::vector<int> newVec;
0497         newVec.reserve(4);
0498         for (int i = 0; i < 4; i++) {
0499           newVec.push_back(pnode_[hiCentrality].iparams_.at(i + 1));
0500         }
0501         return newVec;
0502       } else {
0503         std::vector<int> newVec;
0504         return newVec;
0505       }
0506     }
0507     l1t::LUT* centralityLUT() { return &pnode_[hiCentrality].LUT_; }
0508     l1t::LUT const* centralityLUT() const { return &pnode_[hiCentrality].LUT_; }
0509     void setCentralityRegionMask(int mask) {
0510       pnode_[hiCentrality].iparams_.resize(5);
0511       pnode_[hiCentrality].iparams_[0] = mask;
0512     }
0513     void setMinimumBiasThresholds(std::vector<int> thresholds) {
0514       pnode_[hiCentrality].iparams_.resize(5);
0515       for (int i = 0; i < 4; i++) {
0516         pnode_[hiCentrality].iparams_[i + 1] = thresholds.at(i);
0517       }
0518     }
0519     void setCentralityLUT(const l1t::LUT& lut) { pnode_[hiCentrality].LUT_ = lut; }
0520 
0521     // HI Q2
0522     l1t::LUT* q2LUT() { return &pnode_[hiQ2].LUT_; }
0523     l1t::LUT const* q2LUT() const { return &pnode_[hiQ2].LUT_; }
0524     void setQ2LUT(const l1t::LUT& lut) { pnode_[hiQ2].LUT_ = lut; }
0525 
0526     // HI parameters
0527     double etSumCentLower(unsigned centClass) const {
0528       if (pnode_[etSumCentralityLower].dparams_.size() > centClass)
0529         return pnode_[etSumCentralityLower].dparams_.at(centClass);
0530       else
0531         return 0.;
0532     }
0533     double etSumCentUpper(unsigned centClass) const {
0534       if (pnode_[etSumCentralityUpper].dparams_.size() > centClass)
0535         return pnode_[etSumCentralityUpper].dparams_.at(centClass);
0536       else
0537         return 0.;
0538     }
0539     void setEtSumCentLower(unsigned centClass, double loBound) {
0540       if (pnode_[etSumCentralityLower].dparams_.size() <= centClass)
0541         pnode_[etSumCentralityLower].dparams_.resize(centClass + 1);
0542       pnode_[etSumCentralityLower].dparams_.at(centClass) = loBound;
0543     }
0544     void setEtSumCentUpper(unsigned centClass, double upBound) {
0545       if (pnode_[etSumCentralityUpper].dparams_.size() <= centClass)
0546         pnode_[etSumCentralityUpper].dparams_.resize(centClass + 1);
0547       pnode_[etSumCentralityUpper].dparams_.at(centClass) = upBound;
0548     }
0549 
0550     // Layer 1 LUT specification
0551     std::vector<double> const& layer1ECalScaleFactors() const { return pnode_[layer1ECal].dparams_; }
0552     std::vector<double> const& layer1HCalScaleFactors() const { return pnode_[layer1HCal].dparams_; }
0553     std::vector<double> const& layer1HFScaleFactors() const { return pnode_[layer1HF].dparams_; }
0554     std::vector<int> const& layer1ECalScaleETBins() const { return pnode_[layer1ECal].iparams_; }
0555     std::vector<int> const& layer1HCalScaleETBins() const { return pnode_[layer1HCal].iparams_; }
0556     std::vector<int> const& layer1HFScaleETBins() const { return pnode_[layer1HF].iparams_; }
0557     std::vector<unsigned> const& layer1ECalScalePhiBins() const { return pnode_[layer1ECal].uparams_; }
0558     std::vector<unsigned> const& layer1HCalScalePhiBins() const { return pnode_[layer1HCal].uparams_; }
0559     std::vector<unsigned> const& layer1HFScalePhiBins() const { return pnode_[layer1HF].uparams_; }
0560     void setLayer1ECalScaleFactors(std::vector<double> params) { pnode_[layer1ECal].dparams_ = std::move(params); }
0561     void setLayer1HCalScaleFactors(std::vector<double> params) { pnode_[layer1HCal].dparams_ = std::move(params); }
0562     void setLayer1HFScaleFactors(std::vector<double> params) { pnode_[layer1HF].dparams_ = std::move(params); }
0563     void setLayer1ECalScaleETBins(std::vector<int> params) { pnode_[layer1ECal].iparams_ = std::move(params); }
0564     void setLayer1HCalScaleETBins(std::vector<int> params) { pnode_[layer1HCal].iparams_ = std::move(params); }
0565     void setLayer1HFScaleETBins(std::vector<int> params) { pnode_[layer1HF].iparams_ = std::move(params); }
0566     void setLayer1ECalScalePhiBins(std::vector<unsigned> params) { pnode_[layer1ECal].uparams_ = std::move(params); }
0567     void setLayer1HCalScalePhiBins(std::vector<unsigned> params) { pnode_[layer1HCal].uparams_ = std::move(params); }
0568     void setLayer1HFScalePhiBins(std::vector<unsigned> params) { pnode_[layer1HF].uparams_ = std::move(params); }
0569 
0570     std::vector<unsigned> const& layer1SecondStageLUT() const { return pnode_[layer1HOverE].uparams_; }
0571     void setLayer1SecondStageLUT(const std::vector<unsigned>& lut) { pnode_[layer1HOverE].uparams_ = lut; }
0572 
0573     void setNode(int pos, const Node& n) { pnode_[pos] = n; }
0574     const std::vector<Node>& getNodes(void) const { return pnode_; }
0575 
0576   private:
0577     L1CaloEtScale emScale_;
0578     L1CaloEtScale jetScale_;
0579     L1CaloEtScale HtMissScale_;
0580     L1CaloEtScale HfRingScale_;
0581     friend std::ostream& operator<<(std::ostream& os, const CaloParamsHelper& h);
0582   };
0583 
0584   std::ostream& operator<<(std::ostream& os, const l1t::CaloParamsHelper& p);
0585 
0586 }  // namespace l1t
0587 
0588 #endif