Skip to content

Commit

Permalink
Merge pull request #17053 from cms-l1t-offline/pr90x-l1t-integration-…
Browse files Browse the repository at this point in the history
…v89.20

Pr90x l1t integration (v89.20) Mu isolation perf, EG new vars, Gen in L1TNtuple
  • Loading branch information
cmsbuild committed Dec 18, 2016
2 parents 3b29841 + 4521903 commit 7a94b01
Show file tree
Hide file tree
Showing 18 changed files with 188 additions and 83 deletions.
Expand Up @@ -18,6 +18,11 @@
import EventFilter.DTTFRawToDigi.dttfunpacker_cfi
unpackDttf = EventFilter.DTTFRawToDigi.dttfunpacker_cfi.dttfunpacker.clone(
DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))

import EventFilter.L1TRawToDigi.emtfStage2Digis_cfi
unpackEmtf = EventFilter.L1TRawToDigi.emtfStage2Digis_cfi.emtfStage2Digis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))


import EventFilter.CSCTFRawToDigi.csctfunpacker_cfi
unpackCsctf = EventFilter.CSCTFRawToDigi.csctfunpacker_cfi.csctfunpacker.clone(
Expand Down Expand Up @@ -78,9 +83,9 @@
# simOmtfDigis.srcCSC = cms.InputTag("simCscTriggerPrimitiveDigis") # DEFAULT

# EMTF
simEmtfDigis.RPCInput = cms.InputTag('unpackRPC')
simEmtfDigis.CSCInput = cms.InputTag("unpackCsctf")
simEmtfDigis.CSCInput = cms.InputTag("unpackEmtf")
# simEmtfDigis.CSCInput = cms.InputTag("simCscTriggerPrimitiveDigis") # DEFAULT
simEmtfDigis.RPCInput = cms.InputTag('unpackRPC')

# simCaloStage2Layer1Digis.ecalToken = cms.InputTag('simEcalTriggerPrimitiveDigis') # DEFAULT
# simCaloStage2Layer1Digis.hcalToken = cms.InputTag('simHcalTriggerPrimitiveDigis') # DEFAULT
Expand All @@ -105,7 +110,7 @@



SimL1Emulator = cms.Sequence(unpackEcal+unpackHcal+unpackCSC+unpackDT+unpackRPC+unpackCsctf+unpackBmtf
SimL1Emulator = cms.Sequence(unpackEcal+unpackHcal+unpackCSC+unpackDT+unpackRPC+unpackEmtf+unpackCsctf+unpackBmtf
+simEcalTriggerPrimitiveDigis
+simHcalTriggerPrimitiveDigis
+SimL1EmulatorCore+packCaloStage2
Expand Down
Expand Up @@ -17,8 +17,12 @@

import EventFilter.DTTFRawToDigi.dttfunpacker_cfi
unpackDttf = EventFilter.DTTFRawToDigi.dttfunpacker_cfi.dttfunpacker.clone(
DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))

DTTF_FED_Source = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))

import EventFilter.L1TRawToDigi.emtfStage2Digis_cfi
unpackEmtf = EventFilter.L1TRawToDigi.emtfStage2Digis_cfi.emtfStage2Digis.clone(
InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))

import EventFilter.CSCTFRawToDigi.csctfunpacker_cfi
unpackCsctf = EventFilter.CSCTFRawToDigi.csctfunpacker_cfi.csctfunpacker.clone(
producer = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()))
Expand Down Expand Up @@ -78,10 +82,10 @@
simOmtfDigis.srcRPC = cms.InputTag('unpackRPC')
simOmtfDigis.srcDTPh = cms.InputTag("unpackBmtf")
simOmtfDigis.srcDTTh = cms.InputTag("unpackBmtf")
simOmtfDigis.srcCSC = cms.InputTag("unpackCsctf") # replace when emtfDigis availalbe
simOmtfDigis.srcCSC = cms.InputTag("unpackCsctf") ## Replace when emtfStage2Digis give equal data-emulator agreement

# EMTF
simEmtfDigis.CSCInput = cms.InputTag("unpackCsctf") # replace when emtfDigis availalbe
simEmtfDigis.CSCInput = cms.InputTag("unpackEmtf")
simEmtfDigis.RPCInput = cms.InputTag('unpackRPC')

simCaloStage2Layer1Digis.ecalToken = cms.InputTag('unpackEcal:EcalTriggerPrimitives')
Expand All @@ -107,6 +111,6 @@



SimL1Emulator = cms.Sequence(unpackEcal+unpackHcal+unpackCSC+unpackDT+unpackRPC+unpackCsctf+unpackBmtf
SimL1Emulator = cms.Sequence(unpackEcal+unpackHcal+unpackCSC+unpackDT+unpackRPC+unpackEmtf+unpackCsctf+unpackBmtf
+SimL1EmulatorCore+packCaloStage2
+packGmtStage2+packGtStage2+rawDataCollector)
3 changes: 3 additions & 0 deletions DataFormats/L1Trigger/interface/EGamma.h
Expand Up @@ -45,6 +45,7 @@ namespace l1t {
void setFootprintEt(short int fp); // raw footprint
void setNTT(short int ntt); // n towers above threshold
void setShape(short int s); // cluster shape variable
void setTowerHoE(short int HoE); // H/E as computed in Layer-1

short int towerIEta() const;
short int towerIPhi() const;
Expand All @@ -53,6 +54,7 @@ namespace l1t {
short int footprintEt() const;
short int nTT() const;
short int shape() const;
short int towerHoE() const;

private:

Expand All @@ -65,6 +67,7 @@ namespace l1t {
short int footprintEt_;
short int nTT_;
short int shape_;
short int towerHoE_;

};

Expand Down
9 changes: 9 additions & 0 deletions DataFormats/L1Trigger/src/EGamma.cc
Expand Up @@ -10,6 +10,7 @@ void EGamma::clear_extended(){
footprintEt_ = 0;
nTT_ = 0;
shape_ = 0;
towerHoE_ = 0;
}

EGamma::EGamma( const LorentzVector& p4,
Expand Down Expand Up @@ -67,6 +68,10 @@ void EGamma::setShape(short int s) {
shape_ = s;
}

void EGamma::setTowerHoE(short int HoE) {
towerHoE_ = HoE;
}

short int EGamma::towerIEta() const {
return towerIEta_;
}
Expand Down Expand Up @@ -94,3 +99,7 @@ short int EGamma::nTT() const {
short int EGamma::shape() const {
return shape_;
}

short int EGamma::towerHoE() const {
return towerHoE_;
}
3 changes: 2 additions & 1 deletion DataFormats/L1Trigger/src/classes_def.xml
Expand Up @@ -31,7 +31,8 @@
<class name="edm::Wrapper<l1t::JetVectorRef>"/>


<class name="l1t::EGamma" ClassVersion="13">
<class name="l1t::EGamma" ClassVersion="14">
<version ClassVersion="14" checksum="1235149790"/>
<version ClassVersion="13" checksum="2044674704"/>
<version ClassVersion="12" checksum="1332125006"/>
<version ClassVersion="11" checksum="2788532966"/>
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/Configuration/python/customiseReEmul.py
Expand Up @@ -139,7 +139,7 @@ def L1TReEmulFromRAW(process):
process.simOmtfDigis.srcDTPh = cms.InputTag('bmtfDigis')
process.simOmtfDigis.srcDTTh = cms.InputTag('bmtfDigis')
# EMTF
process.simEmtfDigis.CSCInput = cms.InputTag('csctfDigis')
process.simEmtfDigis.CSCInput = cms.InputTag('emtfStage2Digis')
process.simEmtfDigis.RPCInput = cms.InputTag('muonRPCDigis')
# Calo Layer1
process.simCaloStage2Layer1Digis.ecalToken = cms.InputTag('ecalDigis:EcalTriggerPrimitives')
Expand Down
Expand Up @@ -33,6 +33,8 @@ namespace l1t
unsigned int trimmingLutIndex(unsigned int shape, int iEta);
// shape
unsigned int returnShape(const l1t::CaloCluster& clus);
// shape
int returnHoE(const l1t::CaloTower& tow);
// identification
bool idShape(const l1t::CaloCluster& clus, int hwPt);
unsigned int idShapeLutIndex(int iEta, int E, int shape);
Expand Down
1 change: 1 addition & 0 deletions L1Trigger/L1TCalorimeter/src/CaloTools.cc
Expand Up @@ -305,6 +305,7 @@ l1t::EGamma l1t::CaloTools::egP4Demux(l1t::EGamma& eg) {
tmpEG.setFootprintEt(eg.footprintEt());
tmpEG.setNTT(eg.nTT());
tmpEG.setShape(eg.shape());
tmpEG.setTowerHoE(eg.towerHoE());

return tmpEG;

Expand Down
Expand Up @@ -147,13 +147,14 @@ void l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(const std::vecto
int hwIsoEnergy = hwEtSum-hwFootPrint;

// development vars
egamma.setTowerIPhi((short int)CaloTools::towerEta(cluster.hwEta()));
egamma.setTowerIEta((short int)CaloTools::towerPhi(cluster.hwEta(), cluster.hwPhi()));
egamma.setTowerIPhi((short int)cluster.hwPhi());
egamma.setTowerIEta((short int)cluster.hwEta());
egamma.setRawEt((short int)egamma.hwPt());
egamma.setIsoEt((short int)hwIsoEnergy);
egamma.setFootprintEt((short int)hwFootPrint);
egamma.setNTT((short int)nrTowers);
egamma.setShape((short int)returnShape(cluster));
egamma.setTowerHoE((short int)returnHoE(seed));

// Energy calibration
// Corrections function of ieta, ET, and cluster shape
Expand Down Expand Up @@ -501,3 +502,27 @@ unsigned int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::returnShape(const l1t
return shape;
}




/*****************************************************************/
int l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::returnHoE(const l1t::CaloTower& tow)
/*****************************************************************/
{

int ratio = tow.hwEtRatio();
int qual = tow.hwQual();
bool denomZeroFlag = ((qual&0x1) > 0);
bool eOverHFlag = ((qual&0x2) > 0);

if (denomZeroFlag && !eOverHFlag) //E=0
ratio = -1;
if (denomZeroFlag && eOverHFlag) //H=0
ratio = 8; // ratio is on 3 bits, so 8 should be ok for overflow
if (!denomZeroFlag && !eOverHFlag) // H > E
ratio = -1;
//else E >= H , so ratio=log(E/H)

return ratio;

}
9 changes: 7 additions & 2 deletions L1Trigger/L1TGlobal/plugins/GenToInputProducer.cc
@@ -1,4 +1,4 @@
///
////
/// \class l1t::GenToInputProducer
///
/// Description: Create Input Collections for the GT from MC gen particles. Allows testing of emulation.
Expand Down Expand Up @@ -450,7 +450,11 @@ GenToInputProducer::produce(Event& iEvent, const EventSetup& iSetup)

// Scale down ETTem as an estimate
pt = convertPtToHW( sumEt*0.6, 2047, PtStep_ );
l1t::EtSum etEmTotal(*p4, l1t::EtSum::EtSumType::kTotalEtEm,pt, 0, 0, 0);
l1t::EtSum etEmTotal(*p4, l1t::EtSum::EtSumType::kTotalEtEm,pt, 0, 0, 0);

//ccla Generate uniform distribution of tower counts
int nTowers=4095*gRandom->Rndm();
l1t::EtSum towerCounts(*p4, l1t::EtSum::EtSumType::kTowerCount,nTowers, 0, 0, 0);

pt = convertPtToHW( sumEt*0.9, 2047, PtStep_ );
l1t::EtSum htTotal(*p4, l1t::EtSum::EtSumType::kTotalHt,pt, 0, 0, 0);
Expand Down Expand Up @@ -513,6 +517,7 @@ GenToInputProducer::produce(Event& iEvent, const EventSetup& iSetup)
etsumVec.push_back(htmiss);
etsumVec.push_back(hfM1);
etsumVec.push_back(etmissHF);
etsumVec.push_back(towerCounts);

// Fill in some external conditions for testing
if((iEvent.id().event())%2 == 0 ) {
Expand Down
31 changes: 28 additions & 3 deletions L1Trigger/L1TGlobal/plugins/GtRecordDump.cc
Expand Up @@ -68,7 +68,7 @@ namespace l1t {
public:
explicit GtRecordDump(const edm::ParameterSet&);
virtual ~GtRecordDump(){};
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void endRun(edm::Run const&, edm::EventSetup const&) override;

InputTag uGtAlgInputTag;
Expand Down Expand Up @@ -97,6 +97,7 @@ namespace l1t {
unsigned int formatJet(std::vector<l1t::Jet>::const_iterator jet);
unsigned int formatMissET(std::vector<l1t::EtSum>::const_iterator etSum);
unsigned int formatTotalET(std::vector<l1t::EtSum>::const_iterator etSum);
unsigned int formatTowerCounts(std::vector<l1t::EtSum>::const_iterator etSum);
unsigned int formatHMB(std::vector<l1t::EtSum>::const_iterator etSum);
std::map<std::string, std::vector<int> > m_algoSummary;

Expand Down Expand Up @@ -450,7 +451,10 @@ namespace l1t {
break;
case l1t::EtSum::EtSumType::kTotalHt:
cout << " HTT: ";
break;
break;
case l1t::EtSum::EtSumType::kTowerCount:
cout << " TowerCounts: ";
break;
case l1t::EtSum::EtSumType::kMinBiasHFP0:
cout << " HFP0: ";
break;
Expand Down Expand Up @@ -650,6 +654,7 @@ void GtRecordDump::dumpTestVectors(int bx, std::ofstream& myOutFile,
unsigned int HFM0packWd = 0;
unsigned int HFP1packWd = 0;
unsigned int HFM1packWd = 0;
unsigned int TowerCountspackWd = 0; // ccla

if(etsums.isValid()){
for(std::vector<l1t::EtSum>::const_iterator etsum = etsums->begin(bx); etsum != etsums->end(bx); ++etsum) {
Expand All @@ -672,7 +677,10 @@ void GtRecordDump::dumpTestVectors(int bx, std::ofstream& myOutFile,
break;
case l1t::EtSum::EtSumType::kTotalHt:
HTTpackWd = formatTotalET(etsum);
break;
break;
case l1t::EtSum::EtSumType::kTowerCount:
TowerCountspackWd = formatTowerCounts(etsum);
break;
case l1t::EtSum::EtSumType::kMinBiasHFP0:
HFP0packWd = formatHMB(etsum);
break;
Expand Down Expand Up @@ -700,6 +708,9 @@ void GtRecordDump::dumpTestVectors(int bx, std::ofstream& myOutFile,
// ETTem goes into ETT word bits 12 - 23
if(m_tvVersion>1) ETTpackWd |= ( ETTempackWd << 12);

// ccla Towercounts go in HTT word, bits 12-24
if(m_tvVersion>1) HTTpackWd |= ( TowerCountspackWd << 12);

// Fill in the words in appropriate order
myOutFile << " " << std::hex << std::setw(8) << std::setfill('0') << ETTpackWd;
myOutFile << " " << std::hex << std::setw(8) << std::setfill('0') << HTTpackWd;
Expand Down Expand Up @@ -838,6 +849,20 @@ unsigned int GtRecordDump::formatTotalET(std::vector<l1t::EtSum>::const_iterator
return packedVal;
}

unsigned int GtRecordDump::formatTowerCounts(std::vector<l1t::EtSum>::const_iterator etSum){

unsigned int packedVal = 0;
//unsigned int shift = 12;

// Pack Bits
//packedVal |= ((etSum->hwPt() & 0xfff) << shift);

//towercount takes 13 bits
packedVal |= ((etSum->hwPt() & 0x1fff) <<0);

return packedVal;
}

unsigned int GtRecordDump::formatHMB(std::vector<l1t::EtSum>::const_iterator etSum){

unsigned int packedVal = 0;
Expand Down

0 comments on commit 7a94b01

Please sign in to comment.