Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:16

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