CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloParamsHelper.h
Go to the documentation of this file.
1 // CaloParamsHelper.h
2 // Author: R. Alex Barbieri
3 //
4 // Wrapper class for CaloParams and Et scales
5 
6 #include <iostream>
7 
9 
15 
16 #ifndef CaloParamsHelper_h
17 #define CaloParamsHelper_h
18 
19 namespace l1t {
20 
21  class CaloParamsHelper : public CaloParams {
22 
23  public:
24  // DO NOT ADD ENTRIES ANYWHERE BUT DIRECTLY BEFORE "NUM_CALOPARAMNODES"
25  // DO NOT CHANGE NUMERICAL VALUES OF ANY ALREADY EXISTING FIELDS, YOU CAN ONLY EXTEND, AT THE END.
26  enum { regionPUS=0,
34  };
35 
39 
40 
41 
42  bool isValidForStage1() {return 1; }
43  bool isValidForStage2() {return (version_ >= 2); }
44 
53 
54  // towers
55  double towerLsbH() const { return towerp_.lsbH_; }
56  double towerLsbE() const { return towerp_.lsbE_; }
57  double towerLsbSum() const { return towerp_.lsbSum_; }
58  int towerNBitsH() const { return towerp_.nBitsH_; }
59  int towerNBitsE() const { return towerp_.nBitsE_; }
60  int towerNBitsSum() const { return towerp_.nBitsSum_; }
61  int towerNBitsRatio() const { return towerp_.nBitsRatio_; }
62  int towerMaskE() const { return towerp_.maskE_; }
63  int towerMaskH() const { return towerp_.maskH_; }
64  int towerMaskSum() const { return towerp_.maskSum_; }
65  int towerMaskRatio() const { return towerp_.maskRatio_; }
66  bool doTowerEncoding() const { return towerp_.doEncoding_; }
67 
68  void setTowerLsbH(double lsb) { towerp_.lsbH_ = lsb; }
69  void setTowerLsbE(double lsb) { towerp_.lsbE_ = lsb; }
70  void setTowerLsbSum(double lsb) { towerp_.lsbSum_ = lsb; }
71  void setTowerNBitsH(int n) { towerp_.nBitsH_ = n; towerp_.maskH_ = std::pow(2,n)-1; }
72  void setTowerNBitsE(int n) { towerp_.nBitsE_ = n; towerp_.maskE_ = std::pow(2,n)-1; }
75  void setTowerEncoding(bool doit) { towerp_.doEncoding_ = doit; }
76 
77 
78  // regions
79  double regionLsb() const { return regionLsb_; }
80  std::string regionPUSType() const { return pnode_[regionPUS].type_; }
81  std::vector<double> regionPUSParams() { return pnode_[regionPUS].dparams_; }
82  l1t::LUT* regionPUSLUT() {return &pnode_[regionPUS].LUT_; }
83 
84  int regionPUSValue(int PUM0, int eta)
85  {
86  int puSub = ceil(regionPUSParams()[18*eta+PUM0]*2);
87  return puSub;
88  }
89 
90  void setRegionLsb(double lsb) { regionLsb_ = lsb; }
92  void setRegionPUSParams(const std::vector<double> & params) { pnode_[regionPUS].dparams_ = params; }
93  void setRegionPUSLUT(const l1t::LUT & lut) { pnode_[regionPUS].LUT_ = lut; }
94 
95  // EG
96  int egEtaCut() const {
97  if (pnode_[egPUS].version_ ==1)
98  return pnode_[egPUS].iparams_[0];
99  else
100  return 0;
101  }
102  double egLsb() const { return egp_.lsb_; }
103  double egSeedThreshold() const { return egp_.seedThreshold_; }
104  double egNeighbourThreshold() const { return egp_.neighbourThreshold_; }
105  double egHcalThreshold() const { return egp_.hcalThreshold_; }
106  l1t::LUT* egTrimmingLUT() { return &pnode_[egTrimming].LUT_; }
107  double egMaxHcalEt() const { return egp_.maxHcalEt_; }
108  double egMaxPtHOverE() const {return egp_.maxPtHOverE_;}
111  l1t::LUT* egShapeIdLUT() { return &pnode_[egShapeId].LUT_; }
116 
120  const std::string & egPUSType() const { return pnode_[egPUS].type_; }
121  const std::vector<double> & egPUSParams() const { return pnode_[egPUS].dparams_; }
122  double egPUSParam(int ipar) const { return pnode_[egPUS].dparams_.at(ipar); }
123 
124  std::string egIsolationType() const { return pnode_[egIsolation].type_; }
127  std::vector<double> egCalibrationParams() { return pnode_[egCalibration].dparams_; }
129 
130  void setEgEtaCut(int mask) {
131  pnode_[egPUS].iparams_.resize(1);
132  pnode_[egPUS].iparams_[0] = mask;
133  }
134  void setEgLsb(double lsb) { egp_.lsb_ = lsb; }
138  void setEgTrimmingLUT(const l1t::LUT & lut) { pnode_[egTrimming].LUT_ = lut; }
139  void setEgMaxHcalEt(double cut) { egp_.maxHcalEt_ = cut; }
141  void setEgMaxHOverELUT(const l1t::LUT & lut) { pnode_[egMaxHOverE].LUT_ = lut; }
143  void setEgShapeIdLUT(const l1t::LUT & lut) { pnode_[egShapeId].LUT_ = lut; }
144  void setEgMinPtJetIsolation(int cutValue) { egp_.minPtJetIsolation_ = cutValue; }
145  void setEgMaxPtJetIsolation(int cutValue) { egp_.maxPtJetIsolation_ = cutValue; }
146  void setEgMinPtHOverEIsolation(int cutValue) { egp_.minPtHOverEIsolation_ = cutValue; }
147  void setEgMaxPtHOverEIsolation(int cutValue) { egp_.maxPtHOverEIsolation_ = cutValue; }
148 
149  void setEgIsoAreaNrTowersEta(unsigned iEgIsoAreaNrTowersEta){egp_.isoAreaNrTowersEta_=iEgIsoAreaNrTowersEta;}
150  void setEgIsoAreaNrTowersPhi(unsigned iEgIsoAreaNrTowersPhi){egp_.isoAreaNrTowersPhi_=iEgIsoAreaNrTowersPhi;}
151  void setEgIsoVetoNrTowersPhi(unsigned iEgIsoVetoNrTowersPhi){egp_.isoVetoNrTowersPhi_=iEgIsoVetoNrTowersPhi;}
153  void setEgPUSParams(const std::vector<double> & params) { pnode_[egPUS].dparams_ = params; }
155  void setEgIsolationLUT(const l1t::LUT & lut) { pnode_[egIsolation].LUT_ = lut; }
157  void setEgCalibrationParams(std::vector<double> params) { pnode_[egCalibration].dparams_ = params; }
159 
160  // - recently imported:
161  std::string egShapeIdType() const { return pnode_[egShapeId].type_; }
163  unsigned egShapeIdVersion() const { return pnode_[egShapeId].version_; }
164  void setEgShapeIdVersion(unsigned version) { pnode_[egShapeId].version_ = version; }
165  unsigned egCalibrationVersion() const { return pnode_[egCalibration].version_; }
167 
168  // tau
169  int tauRegionMask() const {
170  if (pnode_[tauPUS].version_ ==1)
171  return pnode_[tauPUS].iparams_[0];
172  else
173  return 0;
174  }
175  double tauLsb() const { return taup_.lsb_; }
176  double tauSeedThreshold() const { return taup_.seedThreshold_; }
178  double tauMaxPtTauVeto() const { return taup_.maxPtTauVeto_;}
180  double tauMaxJetIsolationB() const { return taup_.maxJetIsolationB_; }
181  double tauMaxJetIsolationA() const { return taup_.maxJetIsolationA_; }
182  int isoTauEtaMin() const { return taup_.isoEtaMin_; }
183  int isoTauEtaMax() const { return taup_.isoEtaMax_; }
184  std::string tauPUSType() const { return pnode_[tauPUS].type_; }
185  const std::vector<double> & tauPUSParams() const { return pnode_[tauPUS].dparams_; }
186  double tauPUSParam(int ipar) const { return pnode_[tauPUS].dparams_.at(ipar); }
187 
189 
191  std::vector<double> tauCalibrationParams() { return pnode_[tauCalibration].dparams_; }
194 
196 
200 
201  void setTauRegionMask(int mask) {
202  pnode_[tauPUS].iparams_.resize(1);
203  pnode_[tauPUS].iparams_[0] = mask;
204  }
205  void setTauLsb(double lsb) { taup_.lsb_ = lsb; }
211  void setTauMaxJetIsolationA(double cutValue) { taup_.maxJetIsolationA_ = cutValue; }
216 
218  void setTauIsoAreaNrTowersEta(unsigned iTauIsoAreaNrTowersEta){taup_.isoAreaNrTowersEta_=iTauIsoAreaNrTowersEta;}
219  void setTauIsoAreaNrTowersPhi(unsigned iTauIsoAreaNrTowersPhi){taup_.isoAreaNrTowersPhi_=iTauIsoAreaNrTowersPhi;}
220  void setTauIsoVetoNrTowersPhi(unsigned iTauIsoVetoNrTowersPhi){taup_.isoVetoNrTowersPhi_=iTauIsoVetoNrTowersPhi;}
221 
222  void setTauCalibrationParams(std::vector<double> params) { pnode_[tauCalibration].dparams_ = params; }
224  void setTauCompressLUT(const l1t::LUT & lut) { pnode_[tauCompress].LUT_ = lut; }
225  void setTauPUSParams(const std::vector<double> & params) { pnode_[tauPUS].dparams_ = params; }
226 
228 
229  // jets
230  double jetLsb() const { return jetp_.lsb_; }
231  double jetSeedThreshold() const { return jetp_.seedThreshold_; }
233  int jetRegionMask() const {
234  if (pnode_[jetPUS].version_ ==1)
235  return pnode_[jetPUS].iparams_[0];
236  else
237  return 0;
238  }
239  std::string jetPUSType() const { return pnode_[jetPUS].type_; }
240  std::vector<double> jetPUSParams() { return pnode_[jetPUS].dparams_; }
242  std::vector<double> jetCalibrationParams() { return pnode_[jetCalibration].dparams_; }
244 
245  void setJetLsb(double lsb) { jetp_.lsb_ = lsb; }
248  void setJetRegionMask(int mask) {
249  pnode_[jetPUS].iparams_.resize(1);
250  pnode_[jetPUS].iparams_[0] = mask;
251  }
253  void setJetPUSParams(std::vector<double> params) { pnode_[jetPUS].dparams_ = params; }
255  void setJetCalibrationParams(std::vector<double> params) { pnode_[jetCalibration].dparams_ = params; }
257 
258  // sums
259  double etSumLsb() const { return etSumLsb_; }
260  int etSumEtaMin(unsigned isum) const;
261  int etSumEtaMax(unsigned isum) const;
262  double etSumEtThreshold(unsigned isum) const;
263 
264  void setEtSumLsb(double lsb) { etSumLsb_ = lsb; }
265  void setEtSumEtaMin(unsigned isum, int eta);
266  void setEtSumEtaMax(unsigned isum, int eta);
267  void setEtSumEtThreshold(unsigned isum, double thresh);
268 
269  // HI centrality
270  int centralityRegionMask() const {
271  if(pnode_[hiCentrality].version_ == 1)
272  return pnode_[hiCentrality].iparams_[0] ;
273  else
274  return 0;
275  }
276  std::vector<int> minimumBiasThresholds() const {
277  if(pnode_[hiCentrality].version_ == 1 && pnode_[hiCentrality].iparams_.size()==5) {
278  std::vector<int> newVec;
279  for(int i = 0; i<4; i++) {
280  newVec.push_back(pnode_[hiCentrality].iparams_.at(i+1));
281  }
282  return newVec;
283  } else {
284  std::vector<int> newVec;
285  return newVec;
286  }
287  }
288  l1t::LUT * centralityLUT() { return &pnode_[hiCentrality].LUT_; }
289  void setCentralityRegionMask(int mask) {
290  pnode_[hiCentrality].iparams_.resize(5);
291  pnode_[hiCentrality].iparams_[0] = mask;
292  }
293  void setMinimumBiasThresholds(std::vector<int> thresholds) {
294  pnode_[hiCentrality].iparams_.resize(5);
295  for(int i = 0; i<4; i++) {
296  pnode_[hiCentrality].iparams_[i+1] = thresholds.at(i);
297  }
298  }
299  void setCentralityLUT(const l1t::LUT & lut) { pnode_[hiCentrality].LUT_ = lut; }
300 
301  // HI Q2
302  l1t::LUT * q2LUT() { return &pnode_[hiQ2].LUT_; }
303  void setQ2LUT(const l1t::LUT & lut) { pnode_[hiQ2].LUT_ = lut; }
304 
305  // HI parameters
306 
307 
308 
309  private:
314  friend std::ostream & operator<<(std::ostream &os, const CaloParamsHelper& h);
315  };
316 
317  std::ostream & operator<<(std::ostream &os, const l1t::CaloParamsHelper& p);
318 
319 }
320 
321 
322 
323 #endif
void setEtSumEtaMax(unsigned isum, int eta)
friend std::ostream & operator<<(std::ostream &os, const CaloParamsHelper &h)
const std::string & egPUSType() const
L1CaloEtScale jetScale()
int egMinPtHOverEIsolation() const
type
Definition: HCALResponse.h:21
std::vector< double > jetCalibrationParams()
bool doTowerEncoding() const
const std::vector< double > & tauPUSParams() const
int i
Definition: DBlmapReader.cc:9
void setTauMaxJetIsolationA(double cutValue)
int centralityRegionMask() const
void setEgCalibrationVersion(unsigned version)
std::string tauCalibrationType() const
void setCentralityLUT(const l1t::LUT &lut)
double tauMaxJetIsolationB() const
void setIsoTauEtaMax(int value)
void setTauMinPtJetIsolationB(double limit)
l1t::LUT * jetCalibrationLUT()
void setRegionPUSType(std::string type)
void setEgNeighbourThreshold(double thresh)
void setEgMinPtHOverEIsolation(int cutValue)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
EgParams egp_
Definition: CaloParams.h:214
void setEgLsb(double lsb)
void setJetCalibrationParams(std::vector< double > params)
void setTauEtToHFRingEtLUT(const l1t::LUT &lut)
void setTauCalibrationLUT(const l1t::LUT &lut)
double tauMaxPtTauVeto() const
void setTauLsb(double lsb)
std::string jetPUSType() const
double tauMinPtJetIsolationB() const
void setTauIsolationLUT(const l1t::LUT &lut)
void setJetCalibrationLUT(const l1t::LUT &lut)
void setTauNeighbourThreshold(double thresh)
void setEgMaxPtJetIsolation(int cutValue)
double tauNeighbourThreshold() const
double etSumLsb() const
double etSumEtThreshold(unsigned isum) const
void setEgHcalThreshold(double thresh)
void setTauIsoAreaNrTowersPhi(unsigned iTauIsoAreaNrTowersPhi)
int egMinPtJetIsolation() const
double egMaxHcalEt() const
std::vector< Node > pnode_
Definition: CaloParams.h:207
void setJetScale(L1CaloEtScale jetScale)
unsigned egIsoAreaNrTowersPhi() const
unsigned tauIsoAreaNrTowersPhi() const
void setCentralityRegionMask(int mask)
TowerParams towerp_
Definition: CaloParams.h:209
double isum
unsigned tauIsoAreaNrTowersEta() const
int etSumEtaMax(unsigned isum) const
int towerNBitsSum() const
void setHfRingScale(L1CaloEtScale HfRingScale)
void setTauIsoAreaNrTowersEta(unsigned iTauIsoAreaNrTowersEta)
void setEgCalibrationLUT(const l1t::LUT &lut)
int egMaxPtHOverEIsolation() const
void setRegionPUSLUT(const l1t::LUT &lut)
unsigned egCalibrationVersion() const
void setEgShapeIdLUT(const l1t::LUT &lut)
L1CaloEtScale HtMissScale_
double regionLsb_
Definition: CaloParams.h:212
void setHtMissScale(L1CaloEtScale HtMissScale)
l1t::LUT * egCompressShapesLUT()
double egSeedThreshold() const
void setEtSumEtaMin(unsigned isum, int eta)
void setTauMaxPtTauVeto(double limit)
void setRegionLsb(double lsb)
std::string jetCalibrationType() const
void setJetCalibrationType(std::string type)
std::string egCalibrationType() const
unsigned egIsoVetoNrTowersPhi() const
JetParams jetp_
Definition: CaloParams.h:216
void setTowerLsbH(double lsb)
unsigned egShapeIdVersion() const
std::vector< int > minimumBiasThresholds() const
void setEgMinPtJetIsolation(int cutValue)
int etSumEtaMin(unsigned isum) const
double jetLsb() const
void setTauCompressLUT(const l1t::LUT &lut)
std::vector< double > tauCalibrationParams()
l1t::LUT * tauEtToHFRingEtLUT()
double tauLsb() const
void setEtSumEtThreshold(unsigned isum, double thresh)
int egMaxPtJetIsolation() const
void setTauPUSType(std::string type)
std::string tauPUSType() const
void setEgPUSType(std::string type)
tuple lut
Definition: lumiPlot.py:244
double regionLsb() const
std::vector< double > egCalibrationParams()
void setTauSeedThreshold(double thresh)
void setTowerEncoding(bool doit)
void setTauMaxJetIsolationB(double limit)
void setTauCalibrationType(std::string type)
double egHcalThreshold() const
void setEgIsoAreaNrTowersPhi(unsigned iEgIsoAreaNrTowersPhi)
std::string egIsolationType() const
std::string egShapeIdType() const
double egNeighbourThreshold() const
void setTowerNBitsSum(int n)
void setJetNeighbourThreshold(double thresh)
double egPUSParam(int ipar) const
void setEgShapeIdVersion(unsigned version)
void setTauRegionMask(int mask)
void setJetRegionMask(int mask)
void setEgEtaCut(int mask)
void setJetPUSParams(std::vector< double > params)
void setEgMaxHcalEt(double cut)
unsigned version_
Definition: CaloParams.h:205
std::ostream & operator<<(std::ostream &os, const l1t::CaloParamsHelper &p)
std::string regionPUSType() const
Definition: LUT.h:29
TauParams taup_
Definition: CaloParams.h:215
double jetNeighbourThreshold() const
void setJetLsb(double lsb)
double egMaxPtHOverE() const
L1CaloEtScale HfRingScale_
void setTauPUSParams(const std::vector< double > &params)
void setQ2LUT(const l1t::LUT &lut)
double tauPUSParam(int ipar) const
double etSumLsb_
Definition: CaloParams.h:221
void setEgMaxHOverELUT(const l1t::LUT &lut)
int towerNBitsRatio() const
void setEgCalibrationParams(std::vector< double > params)
void setTauCalibrationParams(std::vector< double > params)
l1t::LUT * egCalibrationLUT()
void setMinimumBiasThresholds(std::vector< int > thresholds)
void setJetSeedThreshold(double thresh)
double tauSeedThreshold() const
void setEgMaxPtHOverE(double thresh)
void setEgTrimmingLUT(const l1t::LUT &lut)
void setEmScale(L1CaloEtScale emScale)
double towerLsbSum() const
void setRegionPUSParams(const std::vector< double > &params)
int towerMaskRatio() const
unsigned tauIsoVetoNrTowersPhi() const
l1t::LUT * tauCalibrationLUT()
void setEgIsolationLUT(const l1t::LUT &lut)
void setEgMaxPtHOverEIsolation(int cutValue)
double towerLsbE() const
void setEgSeedThreshold(double thresh)
void setTauIsoVetoNrTowersPhi(unsigned iTauIsoVetoNrTowersPhi)
void setJetPUSType(std::string type)
void setEgIsoVetoNrTowersPhi(unsigned iEgIsoVetoNrTowersPhi)
void setEtSumLsb(double lsb)
L1CaloEtScale HfRingScale()
double jetSeedThreshold() const
L1CaloEtScale HtMissScale()
void setEgIsoAreaNrTowersEta(unsigned iEgIsoAreaNrTowersEta)
l1t::LUT * tauIsolationLUT()
void setEgShapeIdType(std::string type)
L1CaloEtScale emScale()
void setIsoTauEtaMin(int value)
void setTowerLsbSum(double lsb)
void setEgPUSParams(const std::vector< double > &params)
std::vector< double > regionPUSParams()
std::vector< double > jetPUSParams()
void setTowerLsbE(double lsb)
int regionPUSValue(int PUM0, int eta)
unsigned egIsoAreaNrTowersEta() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setEgCalibrationType(std::string type)
const std::vector< double > & egPUSParams() const
void setEgCompressShapesLUT(const l1t::LUT &lut)
double tauMaxJetIsolationA() const
void setTowerNBitsRatio(int n)
void setEgIsolationType(std::string type)
double towerLsbH() const