Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Level-1 Trigger changes for HI Firmware (75X backport of #12176) #12183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
192 changes: 8 additions & 184 deletions CondFormats/L1TObjects/interface/CaloParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace l1t {
std::vector<unsigned> uparams_;
std::vector<int> iparams_;
std::vector<std::string> sparams_;
Node(){ type_="unspecified"; version_=0; }
Node(){ type_="unspecified"; version_=1; }
COND_SERIALIZABLE;
};

Expand Down Expand Up @@ -84,7 +84,7 @@ namespace l1t {

TowerParams() : lsbH_(0), lsbE_(0), lsbSum_(0),
nBitsH_(0), nBitsE_(0), nBitsSum_(0), nBitsRatio_(0),
maskH_(0), maskE_(0), maskSum_(0), maskRatio_(0),
maskH_(0), maskE_(0), maskSum_(0), maskRatio_(0),
doEncoding_(false)
{ /* no-op */}

Expand Down Expand Up @@ -128,8 +128,8 @@ namespace l1t {
// veto region is seed tower +/- <=egIsoVetoNrTowersPhi
unsigned isoVetoNrTowersPhi_;

EgParams() : lsb_(0), seedThreshold_(0), neighbourThreshold_(0), hcalThreshold_(0), maxHcalEt_(0), maxPtHOverE_(0),
minPtJetIsolation_(0), maxPtJetIsolation_(0), minPtHOverEIsolation_(0), maxPtHOverEIsolation_(0),
EgParams() : lsb_(0), seedThreshold_(0), neighbourThreshold_(0), hcalThreshold_(0), maxHcalEt_(0), maxPtHOverE_(0),
minPtJetIsolation_(0), maxPtJetIsolation_(0), minPtHOverEIsolation_(0), maxPtHOverEIsolation_(0),
isoAreaNrTowersEta_(0), isoAreaNrTowersPhi_(0), isoVetoNrTowersPhi_(0)
{ /* no-op */ }

Expand Down Expand Up @@ -173,9 +173,9 @@ namespace l1t {
// veto region is seed tower +/- <=tauIsoVetoNrTowersPhi
unsigned isoVetoNrTowersPhi_;

TauParams() : lsb_(0), seedThreshold_(0), neighbourThreshold_(0), maxPtTauVeto_(0),
TauParams() : lsb_(0), seedThreshold_(0), neighbourThreshold_(0), maxPtTauVeto_(0),
minPtJetIsolationB_(0), maxJetIsolationB_(0), maxJetIsolationA_(0),
isoEtaMin_(0), isoEtaMax_(0),
isoEtaMin_(0), isoEtaMax_(0),
isoAreaNrTowersEta_(0), isoAreaNrTowersPhi_(0), isoVetoNrTowersPhi_(0)
{ /* no-op */ }

Expand Down Expand Up @@ -204,195 +204,19 @@ namespace l1t {
egTrimming=1, egMaxHOverE=2, egCompressShapes=3, egShapeId=4, egCalibration=5, egPUS=6, egIsolation=7,
tauCalibration=8, tauPUS=9, tauIsolation=10,
jetPUS=11, jetCalibration=12,
hiCentrality=13, hiQ2=14,
hiCentrality=13, hiQ2=14,
tauEtToHFRingEt=15,
NUM_CALOPARAMNODES=16
};

CaloParams() { version_=Version; pnode_.resize(NUM_CALOPARAMNODES); }
~CaloParams() {}

// towers
double towerLsbH() const { return towerp_.lsbH_; }
double towerLsbE() const { return towerp_.lsbE_; }
double towerLsbSum() const { return towerp_.lsbSum_; }
int towerNBitsH() const { return towerp_.nBitsH_; }
int towerNBitsE() const { return towerp_.nBitsE_; }
int towerNBitsSum() const { return towerp_.nBitsSum_; }
int towerNBitsRatio() const { return towerp_.nBitsRatio_; }
int towerMaskE() const { return towerp_.maskE_; }
int towerMaskH() const { return towerp_.maskH_; }
int towerMaskSum() const { return towerp_.maskSum_; }
int towerMaskRatio() const { return towerp_.maskRatio_; }
bool doTowerEncoding() const { return towerp_.doEncoding_; }

void setTowerLsbH(double lsb) { towerp_.lsbH_ = lsb; }
void setTowerLsbE(double lsb) { towerp_.lsbE_ = lsb; }
void setTowerLsbSum(double lsb) { towerp_.lsbSum_ = lsb; }
void setTowerNBitsH(int n) { towerp_.nBitsH_ = n; towerp_.maskH_ = std::pow(2,n)-1; }
void setTowerNBitsE(int n) { towerp_.nBitsE_ = n; towerp_.maskE_ = std::pow(2,n)-1; }
void setTowerNBitsSum(int n) { towerp_.nBitsSum_ = n; towerp_.maskSum_ = std::pow(2,n)-1; }
void setTowerNBitsRatio(int n) { towerp_.nBitsRatio_ = n; towerp_.maskRatio_ = std::pow(2,n)-1; }
void setTowerEncoding(bool doit) { towerp_.doEncoding_ = doit; }


// regions
double regionLsb() const { return regionLsb_; }
std::string regionPUSType() const { return pnode_[regionPUS].type_; }
std::vector<double> regionPUSParams() { return pnode_[regionPUS].dparams_; }

void setRegionLsb(double lsb) { regionLsb_ = lsb; }
void setRegionPUSType(std::string type) { pnode_[regionPUS].type_ = type; }
void setRegionPUSParams(const std::vector<double> & params) { pnode_[regionPUS].dparams_ = params; }

// EG
double egLsb() const { return egp_.lsb_; }
double egSeedThreshold() const { return egp_.seedThreshold_; }
double egNeighbourThreshold() const { return egp_.neighbourThreshold_; }
double egHcalThreshold() const { return egp_.hcalThreshold_; }
l1t::LUT* egTrimmingLUT() { return &pnode_[egTrimming].LUT_; }
double egMaxHcalEt() const { return egp_.maxHcalEt_; }
double egMaxPtHOverE() const {return egp_.maxPtHOverE_;}
l1t::LUT* egMaxHOverELUT() { return &pnode_[egMaxHOverE].LUT_; }
l1t::LUT* egCompressShapesLUT() { return &pnode_[egCompressShapes].LUT_; }
l1t::LUT* egShapeIdLUT() { return &pnode_[egShapeId].LUT_; }
int egMinPtJetIsolation() const { return egp_.minPtJetIsolation_; }
int egMaxPtJetIsolation() const { return egp_.maxPtJetIsolation_; }
int egMinPtHOverEIsolation() const { return egp_.minPtHOverEIsolation_; }
int egMaxPtHOverEIsolation() const { return egp_.maxPtHOverEIsolation_; }

unsigned egIsoAreaNrTowersEta()const{return egp_.isoAreaNrTowersEta_;}
unsigned egIsoAreaNrTowersPhi()const{return egp_.isoAreaNrTowersPhi_;}
unsigned egIsoVetoNrTowersPhi()const{return egp_.isoVetoNrTowersPhi_;}
const std::string & egPUSType() const { return pnode_[egPUS].type_; }
const std::vector<double> & egPUSParams() const { return pnode_[egPUS].dparams_; }
double egPUSParam(int ipar) const { return pnode_[egPUS].dparams_.at(ipar); }



l1t::LUT* egIsolationLUT() { return &pnode_[egIsolation].LUT_; }
std::string egCalibrationType() const { return pnode_[egCalibration].type_; }
std::vector<double> egCalibrationParams() { return pnode_[egCalibration].dparams_; }
l1t::LUT* egCalibrationLUT() { return &pnode_[egCalibration].LUT_; }

void setEgLsb(double lsb) { egp_.lsb_ = lsb; }
void setEgSeedThreshold(double thresh) { egp_.seedThreshold_ = thresh; }
void setEgNeighbourThreshold(double thresh) { egp_.neighbourThreshold_ = thresh; }
void setEgHcalThreshold(double thresh) { egp_.hcalThreshold_ = thresh; }
void setEgTrimmingLUT(const l1t::LUT & lut) { pnode_[egTrimming].LUT_ = lut; }
void setEgMaxHcalEt(double cut) { egp_.maxHcalEt_ = cut; }
void setEgMaxPtHOverE(double thresh) { egp_.maxPtHOverE_ = thresh;}
void setEgMaxHOverELUT(const l1t::LUT & lut) { pnode_[egMaxHOverE].LUT_ = lut; }
void setEgCompressShapesLUT(const l1t::LUT & lut) { pnode_[egCompressShapes].LUT_ = lut; }
void setEgShapeIdLUT(const l1t::LUT & lut) { pnode_[egShapeId].LUT_ = lut; }
void setEgMinPtJetIsolation(int cutValue) { egp_.minPtJetIsolation_ = cutValue; }
void setEgMaxPtJetIsolation(int cutValue) { egp_.maxPtJetIsolation_ = cutValue; }
void setEgMinPtHOverEIsolation(int cutValue) { egp_.minPtHOverEIsolation_ = cutValue; }
void setEgMaxPtHOverEIsolation(int cutValue) { egp_.maxPtHOverEIsolation_ = cutValue; }

void setEgIsoAreaNrTowersEta(unsigned iEgIsoAreaNrTowersEta){egp_.isoAreaNrTowersEta_=iEgIsoAreaNrTowersEta;}
void setEgIsoAreaNrTowersPhi(unsigned iEgIsoAreaNrTowersPhi){egp_.isoAreaNrTowersPhi_=iEgIsoAreaNrTowersPhi;}
void setEgIsoVetoNrTowersPhi(unsigned iEgIsoVetoNrTowersPhi){egp_.isoVetoNrTowersPhi_=iEgIsoVetoNrTowersPhi;}
void setEgPUSType(std::string type) { pnode_[egPUS].type_ = type; }
void setEgPUSParams(const std::vector<double> & params) { pnode_[egPUS].dparams_ = params; }
void setEgIsolationLUT(const l1t::LUT & lut) { pnode_[egIsolation].LUT_ = lut; }
void setEgCalibrationType(std::string type) { pnode_[egCalibration].type_ = type; }
void setEgCalibrationParams(std::vector<double> params) { pnode_[egCalibration].dparams_ = params; }
void setEgCalibrationLUT(const l1t::LUT & lut) { pnode_[egCalibration].LUT_ = lut; }

// tau
double tauLsb() const { return taup_.lsb_; }
double tauSeedThreshold() const { return taup_.seedThreshold_; }
double tauNeighbourThreshold() const { return taup_.neighbourThreshold_; }
double tauMaxPtTauVeto() const { return taup_.maxPtTauVeto_;}
double tauMinPtJetIsolationB() const { return taup_.minPtJetIsolationB_;}
double tauMaxJetIsolationB() const { return taup_.maxJetIsolationB_; }
double tauMaxJetIsolationA() const { return taup_.maxJetIsolationA_; }
int isoTauEtaMin() const { return taup_.isoEtaMin_; }
int isoTauEtaMax() const { return taup_.isoEtaMax_; }
std::string tauPUSType() const { return pnode_[tauPUS].type_; }
const std::vector<double> & tauPUSParams() const { return pnode_[tauPUS].dparams_; }
double tauPUSParam(int ipar) const { return pnode_[tauPUS].dparams_.at(ipar); }

l1t::LUT* tauIsolationLUT() { return &pnode_[tauIsolation].LUT_; }

std::string tauCalibrationType() const { return pnode_[tauCalibration].type_; }
std::vector<double> tauCalibrationParams() { return pnode_[tauCalibration].dparams_; }
l1t::LUT* tauCalibrationLUT() { return &pnode_[tauCalibration].LUT_; }

l1t::LUT* tauEtToHFRingEtLUT() { return &pnode_[tauEtToHFRingEt].LUT_; }

unsigned tauIsoAreaNrTowersEta()const{return taup_.isoAreaNrTowersEta_;}
unsigned tauIsoAreaNrTowersPhi()const{return taup_.isoAreaNrTowersPhi_;}
unsigned tauIsoVetoNrTowersPhi()const{return taup_.isoVetoNrTowersPhi_;}


void setTauLsb(double lsb) { taup_.lsb_ = lsb; }
void setTauSeedThreshold(double thresh) { taup_.seedThreshold_ = thresh; }
void setTauNeighbourThreshold(double thresh) { taup_.neighbourThreshold_ = thresh; }
void setTauMaxPtTauVeto(double limit) { taup_.maxPtTauVeto_ = limit; }
void setTauMinPtJetIsolationB(double limit) { taup_.minPtJetIsolationB_ = limit; }
void setTauMaxJetIsolationB(double limit) { taup_.maxJetIsolationB_ = limit; }
void setTauMaxJetIsolationA(double cutValue) { taup_.maxJetIsolationA_ = cutValue; }
void setIsoTauEtaMin(int value) { taup_.isoEtaMin_ = value; }
void setIsoTauEtaMax(int value) { taup_.isoEtaMax_ = value; }
void setTauPUSType(std::string type) { pnode_[tauPUS].type_ = type; }
void setTauIsolationLUT(const l1t::LUT & lut) { pnode_[tauIsolation].LUT_ = lut; }

void setTauCalibrationType(std::string type) { pnode_[tauCalibration].type_ = type; }
void setTauIsoAreaNrTowersEta(unsigned iTauIsoAreaNrTowersEta){taup_.isoAreaNrTowersEta_=iTauIsoAreaNrTowersEta;}
void setTauIsoAreaNrTowersPhi(unsigned iTauIsoAreaNrTowersPhi){taup_.isoAreaNrTowersPhi_=iTauIsoAreaNrTowersPhi;}
void setTauIsoVetoNrTowersPhi(unsigned iTauIsoVetoNrTowersPhi){taup_.isoVetoNrTowersPhi_=iTauIsoVetoNrTowersPhi;}

void setTauCalibrationParams(std::vector<double> params) { pnode_[tauCalibration].dparams_ = params; }
void setTauCalibrationLUT(const l1t::LUT & lut) { pnode_[tauCalibration].LUT_ = lut; }
void setTauPUSParams(const std::vector<double> & params) { pnode_[tauPUS].dparams_ = params; }

void setTauEtToHFRingEtLUT(const l1t::LUT & lut) { pnode_[tauEtToHFRingEt].LUT_ = lut; }

// jets
double jetLsb() const { return jetp_.lsb_; }
double jetSeedThreshold() const { return jetp_.seedThreshold_; }
double jetNeighbourThreshold() const { return jetp_.neighbourThreshold_; }
std::string jetPUSType() const { return pnode_[jetPUS].type_; }
std::vector<double> jetPUSParams() { return pnode_[jetPUS].dparams_; }
std::string jetCalibrationType() const { return pnode_[jetCalibration].type_; }
std::vector<double> jetCalibrationParams() { return pnode_[jetCalibration].dparams_; }
l1t::LUT* jetCalibrationLUT() { return &pnode_[jetCalibration].LUT_; }

void setJetLsb(double lsb) { jetp_.lsb_ = lsb; }
void setJetSeedThreshold(double thresh) { jetp_.seedThreshold_ = thresh; }
void setJetNeighbourThreshold(double thresh) { jetp_.neighbourThreshold_ = thresh; }
void setJetPUSType(std::string type) { pnode_[jetPUS].type_ = type; }
void setJetPUSParams(std::vector<double> params) { pnode_[jetPUS].dparams_ = params; }
void setJetCalibrationType(std::string type) { pnode_[jetCalibration].type_ = type; }
void setJetCalibrationParams(std::vector<double> params) { pnode_[jetCalibration].dparams_ = params; }
void setJetCalibrationLUT(const l1t::LUT & lut) { pnode_[jetCalibration].LUT_ = lut; }

// sums
double etSumLsb() const { return etSumLsb_; }
int etSumEtaMin(unsigned isum) const;
int etSumEtaMax(unsigned isum) const;
double etSumEtThreshold(unsigned isum) const;

void setEtSumLsb(double lsb) { etSumLsb_ = lsb; }
void setEtSumEtaMin(unsigned isum, int eta);
void setEtSumEtaMax(unsigned isum, int eta);
void setEtSumEtThreshold(unsigned isum, double thresh);

// HI centrality
l1t::LUT * centralityLUT() { return &pnode_[hiCentrality].LUT_; }
void setCentralityLUT(const l1t::LUT & lut) { pnode_[hiCentrality].LUT_ = lut; }

// HI Q2
l1t::LUT * q2LUT() { return &pnode_[hiQ2].LUT_; }
void setQ2LUT(const l1t::LUT & lut) { pnode_[hiQ2].LUT_ = lut; }

// print parameters to stream:
void print(std::ostream&) const;
friend std::ostream& operator<<(std::ostream& o, const CaloParams & p) { p.print(o); return o; }

private:
protected:
unsigned version_;

std::vector<Node> pnode_;
Expand Down
80 changes: 0 additions & 80 deletions CondFormats/L1TObjects/src/CaloParams.cc
Original file line number Diff line number Diff line change
@@ -1,83 +1,3 @@
#include "CondFormats/L1TObjects/interface/CaloParams.h"

using namespace l1t;

int CaloParams::etSumEtaMin(unsigned isum) const {
if (etSumEtaMin_.size()>isum) return etSumEtaMin_.at(isum);
else return 0;
}

int CaloParams::etSumEtaMax(unsigned isum) const {
if (etSumEtaMax_.size()>isum) return etSumEtaMax_.at(isum);
else return 0;
}

double CaloParams::etSumEtThreshold(unsigned isum) const {
if (etSumEtThreshold_.size()>isum) return etSumEtThreshold_.at(isum);
else return 0.;
}

void CaloParams::setEtSumEtaMin(unsigned isum, int eta) {
if (etSumEtaMin_.size()<=isum) etSumEtaMin_.resize(isum+1);
etSumEtaMin_.at(isum) = eta;
}

void CaloParams::setEtSumEtaMax(unsigned isum, int eta) {
if (etSumEtaMax_.size()<=isum) etSumEtaMax_.resize(isum+1);
etSumEtaMax_.at(isum) = eta;
}

void CaloParams::setEtSumEtThreshold(unsigned isum, double thresh) {
if (etSumEtThreshold_.size()<=isum) etSumEtThreshold_.resize(isum+1);
etSumEtThreshold_.at(isum) = thresh;
}

void CaloParams::print(std::ostream& out) const {

out << "L1 Calo Parameters" << std::endl;
out << "Towers" << std::endl;
out << " LSB H : " << this->towerLsbH() << std::endl;
out << " LSB E : " << this->towerLsbE() << std::endl;
out << " LSB Sum : " << this->towerLsbSum() << std::endl;
out << " Nbits H : " << this->towerNBitsH() << std::endl;
out << " Nbits E : " << this->towerNBitsE() << std::endl;
out << " Nbits Sum : " << this->towerNBitsSum() << std::endl;
out << " Nbits Ratio : " << this->towerNBitsRatio() << std::endl;
out << " Mask E : " << this->towerMaskE() << std::endl;
out << " Mask H : " << this->towerMaskH() << std::endl;
out << " Mask Sum : " << this->towerMaskSum() << std::endl;
out << " Mask Ratio : " << this->towerMaskRatio() << std::endl;
out << " Encoding : " << this->doTowerEncoding() << std::endl;

out << "Regions" << std::endl;
out << " PUS : " << this->regionPUSType() << std::endl;
out << " LSB : " << this->regionLsb() << std::endl;

out << "EG" << std::endl;
out << " LSB : " << this->egLsb() << std::endl;
out << " Seed thresh : " << this->egSeedThreshold() << std::endl;
out << " Neighbour thresh : " << this->egNeighbourThreshold() << std::endl;
out << " HCAL thresh : " << this->egHcalThreshold() << std::endl;
out << " HCAL max Et : " << this->egMaxHcalEt() << std::endl;
out << " Iso PUS type : " << this->egPUSType() << std::endl;

out << "Tau" << std::endl;
out << " Seed thresh : " << this->tauSeedThreshold() << std::endl;
out << " Neighbour thresh : " << this->tauNeighbourThreshold() << std::endl;
out << " Iso PUS type : " << this->tauPUSType() << std::endl;

out << "Jets" << std::endl;
out << " LSB : " << this->jetLsb() << std::endl;
out << " Seed thresh : " << this->jetSeedThreshold() << std::endl;
out << " Neighbour thresh : " << this->jetNeighbourThreshold() << std::endl;
out << " PUS type : " << this->jetPUSType() << std::endl;
out << " Calibration type : " << this->jetCalibrationType() << std::endl;

out << "Sums" << std::endl;
for (unsigned i=0; i<etSumEtaMin_.size(); ++i) {
out << " EtSum" << i << " eta min : " << this->etSumEtaMin(i) << std::endl;
if (etSumEtaMax_.size()>i) out << " EtSum" << i << " eta max : " << this->etSumEtaMax(i) << std::endl;
if (etSumEtThreshold_.size()>i) out << " EtSum" << i << " Et thresh : " << this->etSumEtThreshold(i) << std::endl;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ namespace l1t {
int overFlow=(int)j->overFlow();
int fineGrain=(int)j->fineGrain();
int mip=(int)j->mip();
bool tauveto=j->tauVeto();
//int quiet=(int)j->quiet();

int rctCrate=(int)j->rctCrate();
int rctCard=(int)j->rctCard();
int rctRegion=(int)j->rctRegionIndex();
Expand All @@ -57,13 +59,14 @@ namespace l1t {
if(!isHf){
converter[rctCrate].SetRCEt(et,rctCard,rctRegion);
converter[rctCrate].SetRCOf(overFlow,rctCard,rctRegion);
converter[rctCrate].SetRCTau(fineGrain,rctCard,rctRegion);
converter[rctCrate].SetRCTau(tauveto,rctCard,rctRegion);
converter[rctCrate].SetRCHad(mip,rctCard,rctRegion);
LogDebug("L1T")<<"CRATE"<<rctCrate<<"region="<<rctRegion<<", card="<<rctCard<<", rgnEt="<<et<<", overflow="<<overFlow<<", tauveto="<<fineGrain<<", hadveto="<<mip<<std::endl;
LogDebug("L1T")<<"CRATE"<<rctCrate<<"region="<<rctRegion<<", card="<<rctCard<<", rgnEt="<<et<<", overflow="<<overFlow<<", tauveto="<<tauveto<<", hadveto="<<mip<<std::endl;

}
else{
converter[rctCrate].SetHFEt(et,rctRegion);
converter[rctCrate].SetHFFg(fineGrain,rctRegion);
LogDebug("L1T")<<"CRATE"<<rctCrate<<"region="<<rctRegion<<", rgnEt="<<et<<std::endl;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ namespace l1t {
for(int j = 0; j < 8; j++) {

unsigned int hfet=(unsigned int)converter.GetHFEt(j);
bool hfgrain=(bool)converter.GetHFFg(j);

LogDebug("L1T")<<"UNPACKER, CRATE"<<crate<<"region="<<j<<", rgnEt="<<hfet<<std::endl;
L1CaloRegion rgn = L1CaloRegion(hfet,0,crate,j);
L1CaloRegion rgn = L1CaloRegion(hfet,hfgrain,crate,j);
rgn.setBx(bx);
resRCTRegions_->push_back(rgn);
}
Expand Down
27 changes: 27 additions & 0 deletions L1Trigger/L1TCalorimeter/data/centrality_extended_LUT_preRun.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# LUT for centrality thresholds in hw scale
# Index is just threshold number (0-7 inclusive)
#anything after # is ignored with the exception of the header
#the header is first valid line starting with #<header> versionStr(unused but may be in future) nrBitsAddress nrBitsData </header>
#<header> V2 5 14 </header>
0 0
1 92
2 591
3 1774
4 4155
5 5091
6 6000
7 7000
8 87
9 97
10 561
11 621
12 1685
13 1863
14 4113
15 4197
16 5040
17 5142
18 5940
19 6060
20 6930
21 7070