Skip to content

Commit

Permalink
Merge pull request #25012 from bundocka/caloL2O2OHIFixes_mastCP
Browse files Browse the repository at this point in the history
L1T CaloL2 O2O Fixes for HI
  • Loading branch information
cmsbuild committed Oct 30, 2018
2 parents 19d38f7 + a269440 commit 5e3587e
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 19 deletions.
8 changes: 6 additions & 2 deletions L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h
Expand Up @@ -56,7 +56,7 @@ namespace l1t {
egBypassHoEFlag=44,
etSumCentralityLower=45,
etSumCentralityUpper=46,
jetPUSUsePhiRingFlag=47,
jetPUSUsePhiRingFlag=47,
metPhiCalibration=48,
metHFPhiCalibration=49,
NUM_CALOPARAMNODES=50
Expand Down Expand Up @@ -338,7 +338,11 @@ namespace l1t {
}

unsigned jetBypassPUS() const { return pnode_[jetBypassPUSFlag].uparams_[0]; }
unsigned jetPUSUsePhiRing() const { return pnode_[jetPUSUsePhiRingFlag].uparams_[0]; }
unsigned jetPUSUsePhiRing() const {
if(pnode_[jetPUSUsePhiRingFlag].uparams_.empty()) return 0;
else return pnode_[jetPUSUsePhiRingFlag].uparams_[0];
}


std::string jetPUSType() const { return pnode_[jetPUS].type_; }
std::vector<double> const& jetPUSParams() const { return pnode_[jetPUS].dparams_; }
Expand Down
12 changes: 6 additions & 6 deletions L1Trigger/L1TCalorimeter/python/caloParams_2018_v1_4_cfi.py
Expand Up @@ -110,12 +110,12 @@
caloStage2Params.etSumMetPUSLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_towEtThresh_2017v7.txt")
caloStage2Params.etSumEttPUSLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_towEtThresh_dummy.txt")
caloStage2Params.etSumEcalSumPUSLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_towEtThresh_dummy.txt")
caloStage2Params.metCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.metHFCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.etSumEttCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.etSumEcalSumCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.metPhiCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.metHFPhiCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumPUS_dummy.txt")
caloStage2Params.metCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")
caloStage2Params.metHFCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")
caloStage2Params.etSumEttCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")
caloStage2Params.etSumEcalSumCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")
caloStage2Params.metPhiCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")
caloStage2Params.metHFPhiCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_etSumCalib_dummy.txt")


# Layer 1 SF
Expand Down
1 change: 1 addition & 0 deletions L1Trigger/L1TCalorimeter/python/caloParams_cfi.py
Expand Up @@ -107,6 +107,7 @@
jetCompressEtaLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_eta_compress.txt"),
jetCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/lut_add_mult.txt"),
jetBypassPUS = cms.uint32(0),
jetPUSUsePhiRing = cms.uint32(False),

# sums
etSumLsb = cms.double(0.5),
Expand Down
Expand Up @@ -165,6 +165,13 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca

if(!params_->jetBypassPUS()
&& !satSeed){

// comment out for emulator studies
if(params_->jetPUSUsePhiRing())
PUSubMethod = "PhiRing1";
else
PUSubMethod = "ChunkyDonut";

if (PUSubMethod == "Donut") {
puEt = donutPUEstimate(ieta, iphi, 5, towers);
iEt -= puEt;
Expand Down
5 changes: 4 additions & 1 deletion L1TriggerConfig/L1TConfigProducers/src/CaloParamsHelperO2O.h
Expand Up @@ -318,7 +318,10 @@ namespace l1t {
}

unsigned jetBypassPUS() const { return pnode_[jetBypassPUSFlag].uparams_[0]; }
unsigned jetPUSUsePhiRing() const { return pnode_[jetPUSUsePhiRingFlag].uparams_[0]; }
unsigned jetPUSUsePhiRing() const {
if(pnode_[jetPUSUsePhiRingFlag].uparams_.empty()) return 0;
else return pnode_[jetPUSUsePhiRingFlag].uparams_[0];
}

std::string jetPUSType() const { return pnode_[jetPUS].type_; }
std::vector<double> jetPUSParams() { return pnode_[jetPUS].dparams_; }
Expand Down
17 changes: 15 additions & 2 deletions L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc
Expand Up @@ -86,7 +86,7 @@ std::map<std::string, l1t::Mask>& ) {
"egammaMaxEta",
"egammaBypassCuts",
"egammaBypassShape",
"egammaBypassEcalFG'",
"egammaBypassEcalFG",
"egammaBypassExtendedHOverE",
"egammaHOverECut_iEtaLT15",
"egammaHOverECut_iEtaGTEq15",
Expand Down Expand Up @@ -137,7 +137,7 @@ std::map<std::string, l1t::Mask>& ) {
paramsHelper.setEgEtaCut((conf["egammaMaxEta"].getValue<int>()));
paramsHelper.setEgBypassEGVetos(conf["egammaBypassCuts"].getValue<bool>());
paramsHelper.setEgBypassShape( conf["egammaBypassShape"].getValue<bool>() );
paramsHelper.setEgBypassECALFG( conf["egammaBypassECALFG"].getValue<bool>() );
paramsHelper.setEgBypassECALFG( conf["egammaBypassEcalFG"].getValue<bool>() );
paramsHelper.setEgBypassExtHOverE( conf["egammaBypassExtendedHOverE"].getValue<bool>() );
paramsHelper.setEgHOverEcutBarrel(conf["egammaHOverECut_iEtaLT15"].getValue<int>());
paramsHelper.setEgHOverEcutEndcap(conf["egammaHOverECut_iEtaGTEq15"].getValue<int>());
Expand Down Expand Up @@ -180,6 +180,17 @@ std::map<std::string, l1t::Mask>& ) {
paramsHelper.setEtSumEttPUSLUT ( l1t::convertToLUT( conf["ET_towerThresholdLUT"].getVector<int>() ) );
paramsHelper.setEtSumEcalSumPUSLUT( l1t::convertToLUT( conf["ecalET_towerThresholdLUT"].getVector<int>() ) );

std::vector<double> etSumCentLowerValues;
std::vector<double> etSumCentUpperValues;

etSumCentLowerValues = conf["ET_centralityLowerThresholds"].getVector<double>();
etSumCentUpperValues = conf["ET_centralityUpperThresholds"].getVector<double>();

for(uint i=0; i<8; ++i){
paramsHelper.setEtSumCentLower(i, etSumCentLowerValues[i]/2);
paramsHelper.setEtSumCentUpper(i, etSumCentUpperValues[i]/2);
}

// demux tower sum calib LUTs
paramsHelper.setEtSumEttCalibrationLUT ( l1t::convertToLUT( conf["ET_energyCalibLUT"].getVector<int>() ) );
paramsHelper.setEtSumEcalSumCalibrationLUT( l1t::convertToLUT( conf["ecalET_energyCalibLUT"].getVector<int>() ) );
Expand Down Expand Up @@ -363,6 +374,8 @@ std::shared_ptr<l1t::CaloParams> L1TCaloParamsOnlineProd::newObject(const std::s
calol2.setConfigured();

std::map<std::string, l1t::Parameter> calol2_conf = calol2.getParameters("MP1");
std::map<std::string, l1t::Parameter> calol2_conf_demux = calol2.getParameters("DEMUX");
calol2_conf.insert( calol2_conf_demux.begin(), calol2_conf_demux.end() ) ;
std::map<std::string, l1t::Mask> calol2_rs ;//= calol2.getMasks ("processors");

if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) )
Expand Down
58 changes: 50 additions & 8 deletions L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc
Expand Up @@ -32,6 +32,8 @@ class L1TCaloParamsViewer: public edm::EDAnalyzer {
bool printEtSumEcalSumPUSLUT;
bool printMetCalibrationLUT;
bool printMetHFCalibrationLUT;
bool printMetPhiCalibrationLUT;
bool printMetHFPhiCalibrationLUT;
bool printEtSumEttCalibrationLUT;
bool printEtSumEcalSumCalibrationLUT;

Expand Down Expand Up @@ -202,6 +204,9 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu
}

cout<<" egBypassEGVetos= "<<ptr1->egBypassEGVetos()<<endl;
cout<<" egBypassShape= "<<ptr1->egBypassShape()<<endl;
cout<<" egBypassExtHoverE= "<<ptr1->egBypassExtHOverE()<<endl;
cout<<" egBypassECALFG= "<<ptr1->egBypassECALFG()<<endl;
cout<<" egHOverEcutBarrel= "<<ptr1->egHOverEcutBarrel()<<endl;
cout<<" egHOverEcutEndcap= "<<ptr1->egHOverEcutEndcap()<<endl;

Expand Down Expand Up @@ -267,8 +272,8 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu

cout<<endl<<" Tau: "<<endl;
cout<<" tauLsb= "<<ptr1->tauLsb()<<endl;
cout<<" tauSeedThreshold= "<<ptr1->tauSeedThreshold()<<endl;
cout<<" tauNeighbourThreshold= "<<ptr1->tauNeighbourThreshold()<<endl;
//cout<<" tauSeedThreshold= "<<ptr1->tauSeedThreshold()<<endl;
//cout<<" tauNeighbourThreshold= "<<ptr1->tauNeighbourThreshold()<<endl;
cout<<" tauMaxPtTauVeto= "<<ptr1->tauMaxPtTauVeto()<<endl;
cout<<" tauMinPtJetIsolationB= "<<ptr1->tauMinPtJetIsolationB()<<endl;
cout<<" tauPUSType= "<<ptr1->tauPUSType()<<endl;
Expand Down Expand Up @@ -371,13 +376,14 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu
cout<<" jetNeighbourThreshold= "<<ptr1->jetNeighbourThreshold()<<endl;
cout<<" jetRegionMask= "<<ptr1->jetRegionMask()<<endl;
cout<<" jetBypassPUS= "<<ptr1->jetBypassPUS()<<endl;
cout<<" jetPUSType= "<<ptr1->jetPUSType()<<endl;
//cout<<" jetPUSType= "<<ptr1->jetPUSType()<<endl;
cout<<" jetPUSUsePhiRing= "<<ptr1->jetPUSUsePhiRing()<<endl;
cout<<" jetCalibrationType= "<<ptr1->jetCalibrationType()<<endl;
cout<<" jetCalibrationParams= ["<<ptr1->jetCalibrationParams().size()<<"] "<<flush;
float jetCalibrationParams[ptr1->jetCalibrationParams().size()]; // deliberately drop double precision
for(unsigned int i=0; i<ptr1->jetCalibrationParams().size(); i++) jetCalibrationParams[i] = ptr1->jetCalibrationParams()[i];
//cout<<" jetCalibrationParams= ["<<ptr1->jetCalibrationParams().size()<<"] "<<flush;
//float jetCalibrationParams[ptr1->jetCalibrationParams().size()]; // deliberately drop double precision
//for(unsigned int i=0; i<ptr1->jetCalibrationParams().size(); i++) jetCalibrationParams[i] = ptr1->jetCalibrationParams()[i];

if( !ptr1->jetCalibrationParams().empty() ){
/*if( !ptr1->jetCalibrationParams().empty() ){
cout << hash( jetCalibrationParams, sizeof(float)*ptr1->jetCalibrationParams().size() ) << endl;
if( printJetCalibPar )
for(unsigned int i=0; i<ptr1->jetCalibrationParams().size(); i++)
Expand All @@ -395,7 +401,7 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu
cout<<i<<" " << std::setprecision(14) << jetPUSParams[i]<<endl;
} else cout<<endl;

*/

if( !ptr1->jetCalibrationLUT()->empty() ){
cout<<" jetCalibrationLUT= ["<<ptr1->jetCalibrationLUT()->maxSize()<<"] "<<flush;
Expand Down Expand Up @@ -460,6 +466,10 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu
cout<<" etSumMetPUSType= " << ptr1->etSumMetPUSType() << endl;
cout<<" etSumEttPUSType= " << ptr1->etSumEttPUSType() << endl;
cout<<" etSumEcalSumPUSType= " << ptr1->etSumEcalSumPUSType() << endl;

cout<<" etSumCentralityUpper= ["; for(unsigned int i=0; ptr1->etSumCentUpper(i)>0.001; i++) cout<<(i==0?"":",")<<ptr1->etSumCentUpper(i); cout<<"]"<<endl;
cout<<" etSumCentralityLower= ["; for(unsigned int i=0; ptr1->etSumCentLower(i)>0.001; i++) cout<<(i==0?"":",")<<ptr1->etSumCentLower(i); cout<<"]"<<endl;

cout<<" metCalibrationType= " << ptr1->metCalibrationType() << endl;
cout<<" metHFCalibrationType= " << ptr1->metHFCalibrationType() << endl;
cout<<" etSumEttCalibrationType=" << ptr1->etSumEttCalibrationType() << endl;
Expand Down Expand Up @@ -545,6 +555,38 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu
cout<<" metHFCalibrationLUT= [0]"<<endl;
}

if( !ptr1->metPhiCalibrationLUT()->empty() ){
cout<<" metPhiCalibrationLUT= ["<<ptr1->metPhiCalibrationLUT()->maxSize()<<"] "<<flush;
int metPhiCalibrationLUT[ptr1->metPhiCalibrationLUT()->maxSize()];
for(unsigned int i=0; i<ptr1->metPhiCalibrationLUT()->maxSize(); i++)
metPhiCalibrationLUT[i] = ptr1->metPhiCalibrationLUT()->data(i);

cout << hash( metPhiCalibrationLUT, sizeof(int)*ptr1->metPhiCalibrationLUT()->maxSize() ) << endl;

if( printMetPhiCalibrationLUT )
for(unsigned int i=0; i<ptr1->metPhiCalibrationLUT()->maxSize(); i++)
cout<<i<<" "<<metPhiCalibrationLUT[i]<<endl;

} else {
cout<<" metPhiCalibrationLUT= [0]"<<endl;
}

if( !ptr1->metHFPhiCalibrationLUT()->empty() ){
cout<<" metHFPhiCalibrationLUT= ["<<ptr1->metHFPhiCalibrationLUT()->maxSize()<<"] "<<flush;
int metHFPhiCalibrationLUT[ptr1->metHFPhiCalibrationLUT()->maxSize()];
for(unsigned int i=0; i<ptr1->metHFPhiCalibrationLUT()->maxSize(); i++)
metHFPhiCalibrationLUT[i] = ptr1->metHFPhiCalibrationLUT()->data(i);

cout << hash( metHFPhiCalibrationLUT, sizeof(int)*ptr1->metHFPhiCalibrationLUT()->maxSize() ) << endl;

if( printMetHFCalibrationLUT )
for(unsigned int i=0; i<ptr1->metHFPhiCalibrationLUT()->maxSize(); i++)
cout<<i<<" "<<metHFPhiCalibrationLUT[i]<<endl;

} else {
cout<<" metHFPhiCalibrationLUT= [0]"<<endl;
}

if( !ptr1->etSumEttCalibrationLUT()->empty() ){
cout<<" etSumEttCalibrationLUT= ["<<ptr1->etSumEttCalibrationLUT()->maxSize()<<"] "<<flush;
int etSumEttCalibrationLUT[ptr1->etSumEttCalibrationLUT()->maxSize()];
Expand Down

0 comments on commit 5e3587e

Please sign in to comment.