Skip to content

Commit

Permalink
Updates to Tau and Jet calibration LUTs, and emulation algorithm fixe…
Browse files Browse the repository at this point in the history
…s, for improved agreement with latest firmware
  • Loading branch information
mulhearn committed Sep 15, 2015
1 parent 439c1ef commit 5b1778d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 18 deletions.
10 changes: 6 additions & 4 deletions L1Trigger/L1TCalorimeter/python/caloStage1Params_cfi.py
Expand Up @@ -13,7 +13,7 @@

# EG
caloStage1Params.egLsb = cms.double(1.)
caloStage1Params.egSeedThreshold = cms.double(1.)
caloStage1Params.egSeedThreshold = cms.double(0.)

caloStage1Params.egMinPtJetIsolation = cms.int32(25)
caloStage1Params.egMaxPtJetIsolation = cms.int32(63)
Expand All @@ -38,17 +38,19 @@
caloStage1Params.tauMaxJetIsolationB = cms.double(100.)
caloStage1Params.tauMaxJetIsolationA = cms.double(0.1)
caloStage1Params.tauIsoLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/tauIsoLUT_stage1_isolA0.10_isolB100.00_ch_switchToIsoBPt192.00_j8t8.txt")
caloStage1Params.tauCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/tauCalibrationLUT_stage1.txt")
## caloStage1Params.tauCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/tauCalibrationLUT_stage1.txt")
caloStage1Params.tauCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/tauL1Calib_LUT.txt")
caloStage1Params.tauEtToHFRingEtLUTFile= cms.FileInPath("L1Trigger/L1TCalorimeter/data/tauHwEtToHFRingScale_LUT.txt")
caloStage1Params.isoTauEtaMin = cms.int32(5)
caloStage1Params.isoTauEtaMax = cms.int32(16)
# jets
caloStage1Params.jetLsb = cms.double(0.5)
caloStage1Params.jetSeedThreshold = cms.double(10.)
caloStage1Params.jetSeedThreshold = cms.double(5.)
caloStage1Params.jetNeighbourThreshold = cms.double(0.)
caloStage1Params.jetCalibrationType = cms.string("Stage1JEC")
caloStage1Params.jetCalibrationParams = jetSF_8TeV_data
caloStage1Params.jetCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/jetCalibrationLUT_stage1_prelim.txt")
## caloStage1Params.jetCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/jetCalibrationLUT_stage1_prelim.txt")
caloStage1Params.jetCalibrationLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/jetCalibrationLUT_symmetric_0is0.txt")

# sums
caloStage1Params.etSumLsb = cms.double(0.5)
Expand Down
Expand Up @@ -147,6 +147,8 @@ unsigned l1t::Stage1Layer2EGammaAlgorithmImpHW::isoLutIndex(unsigned int egPt,un
const unsigned int nbitsEG=6; // number of bits used for EG bins in LUT file (needed for left shift operation)
// const unsigned int nbitsJet=9; // not used but here for info number of bits used for Jet bins in LUT file

//jetPt &= 511; // Take only the LSB 9 bits to match firmware.
if(jetPt > 511) jetPt = 511;
unsigned int address= (jetPt << nbitsEG) + egPt;
// std::cout << address << "\t## " << egPt << " " << jetPt << std::endl;
return address;
Expand Down
Expand Up @@ -98,11 +98,6 @@ void l1t::Stage1Layer2EtSumAlgorithmImpHW::processEvent(const std::vector<l1t::C
int sumHT, MHT, iPhiHT;
std::tie(sumHT, MHT, iPhiHT) = doSumAndMET(regionHtVect, ETSumType::kHadronicSum);

//MHT is replaced with MHT/HT
uint16_t MHToHT=MHToverHT(MHT,sumHT);
//iPhiHt is replaced by the dPhi between two most energetic jets
iPhiHT = DiJetPhi(jets);

// Set quality (i.e. overflow) bits appropriately
int METqual = 0;
int MHTqual = 0;
Expand All @@ -117,6 +112,14 @@ void l1t::Stage1Layer2EtSumAlgorithmImpHW::processEvent(const std::vector<l1t::C
if(sumHT >= 0xfff)
HTTqual = 1;

MHT &= 127; // limit MHT to 7 bits as the firmware does, but only after checking for overflow.
//MHT is replaced with MHT/HT
uint16_t MHToHT=MHToverHT(MHT,sumHT);
// std::cout << "MHT HT MHT/HT" << std::endl;
// std::cout << MHT << " " << sumHT << " " << MHToHT << std::endl;
//iPhiHt is replaced by the dPhi between two most energetic jets
iPhiHT = DiJetPhi(jets);


const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > etLorentz(0,0,0,0);
l1t::EtSum etMiss(*&etLorentz,EtSum::EtSumType::kMissingEt,MET&0xfff,0,iPhiET,METqual);
Expand Down
Expand Up @@ -131,12 +131,13 @@ void l1t::Stage1Layer2TauAlgorithmImpHW::processEvent(const std::vector<l1t::Cal
if ((highestNeighborTauVeto == 0 && regionTauVeto == 0) || tauEt > tauMaxPtTauVeto) {
int jetEt=AssociatedJetPt(region->hwEta(), region->hwPhi(),unCorrJets);
if (jetEt>0){
// unsigned int MAX_LUT_ADDRESS = params_->tauIsolationLUT()->maxSize()-1;
unsigned int MAX_LUT_ADDRESS = params_->tauIsolationLUT()->maxSize()-1;
// unsigned int lutAddress = isoLutIndex(tauEt,jetEt);
unsigned lutAddress = isoTauLut->lutAddress(tauEt,jetEt);
if (tauEt >0){
// if (lutAddress > MAX_LUT_ADDRESS) lutAddress = MAX_LUT_ADDRESS;
isoFlag= isoTauLut->lutPayload(lutAddress);
if (lutAddress > MAX_LUT_ADDRESS) lutAddress = MAX_LUT_ADDRESS;
isoFlag = params_->tauIsolationLUT()->data(lutAddress);
// isoFlag= isoTauLut->lutPayload(lutAddress);
// if (isoFlag != params_->tauIsolationLUT()->data(lutAddress)) std::cout << "XXX -- isoFlag: " << isoFlag << "\tisoFlag2: " << params_->tauIsolationLUT()->data(lutAddress) << std::endl;
}

Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/L1TCalorimeter/src/legacyGtHelper.cc
Expand Up @@ -19,6 +19,10 @@ namespace l1t {
if(pt > ((1<<10) -1) )
pt = ((1<<10) -1);
unsigned int eta = itJet->hwEta();
if (eta>10){ // LUT is symmetric in eta. For eta>10 map to corresponding eta<10 bin
int offset=2*(eta-10)-1;
eta=eta-offset;
}
unsigned int lutAddress = (eta<<10)+pt;

unsigned int rank = params->jetCalibrationLUT()->data(lutAddress);
Expand Down
40 changes: 34 additions & 6 deletions L1Trigger/L1TCalorimeter/test/SimL1Emulator_Stage1.py
Expand Up @@ -4,21 +4,22 @@

process.load('Configuration.StandardSequences.Services_cff')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
## process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')
process.load('Configuration.EventContent.EventContent_cff')
process.load('Configuration.Geometry.GeometryIdeal_cff')

# Select the Message Logger output you would like to see:
process.load('FWCore.MessageService.MessageLogger_cfi')

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(100)
input = cms.untracked.int32(-200)
)

# Input source
process.source = cms.Source("PoolSource",
secondaryFileNames = cms.untracked.vstring(),
fileNames = cms.untracked.vstring("root://xrootd.unl.edu//store/mc/Fall13dr/Neutrino_Pt-2to20_gun/GEN-SIM-RAW/tsg_PU40bx25_POSTLS162_V2-v1/00005/02B79593-F47F-E311-8FF6-003048FFD796.root")
fileNames = cms.untracked.vstring("/store/relval/CMSSW_7_5_0_pre4/RelValTTbar_13/GEN-SIM-DIGI-RAW-HLTDEBUG/PU25ns_MCRUN2_75_V1-v1/00000/0CD12657-DAF7-E411-91F2-002618943910.root")
)


Expand All @@ -40,9 +41,10 @@
process.options = cms.untracked.PSet()

# Other statements
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag.connect = cms.string('frontier://FrontierProd/CMS_COND_31X_GLOBALTAG')
process.GlobalTag.globaltag = cms.string('POSTLS162_V2::All')
## from Configuration.AlCa.GlobalTag import GlobalTag
## process.GlobalTag.connect = cms.string('frontier://FrontierProd/CMS_COND_31X_GLOBALTAG')
from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
process.GlobalTag.globaltag = cms.string('MCRUN2_75_V1')

process.load('L1Trigger.L1TCalorimeter.caloConfigStage1PP_cfi')

Expand All @@ -56,6 +58,32 @@
process.simGtDigis.TechnicalTriggersInputTags = cms.VInputTag( )


### Get new RCT calibrations from CondDB until new GlobalTag is ready
### Goes with tauL1Calib_LUT.txt
### Need new GCT jet calibrations to go with it
#from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
#process.rctSFDB = cms.ESSource("PoolDBESSource",
# CondDBSetup,
# connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
# DumpStat=cms.untracked.bool(True),
# toGet = cms.VPSet(
# cms.PSet(
# record = cms.string('L1RCTParametersRcd'),
# tag = cms.string('L1RCTParametersRcd_L1TDevelCollisions_ExtendedScaleFactorsV4')
# )
# )
#)
## process.prefer("caloParmsDB")
#process.es_prefer_rctSFDB = cms.ESPrefer( "PoolDBESSource", "rctSFDB" )

## load the CaloStage1 params
## process.GlobalTag.toGet = cms.VPSet(
## cms.PSet(record = cms.string("L1TCaloParamsRcd"),
## tag = cms.string("L1TCaloParams_CRAFT09_hlt"),
## connect = cms.string("sqlite:l1config.db")
## )
## )

process.p1 = cms.Path(
process.L1TCaloStage1_PPFromRaw
+process.simGtDigis
Expand Down

0 comments on commit 5b1778d

Please sign in to comment.