Skip to content

Commit

Permalink
Merge pull request #20921 from cms-sw/revert-20871-pr94x-l1-noHackCon…
Browse files Browse the repository at this point in the history
…ditions-fromPR20451-cleaned

Revert "[94X] L1 no hack conditions - cleaned"
  • Loading branch information
davidlange6 authored Oct 15, 2017
2 parents 56511c9 + cddc18f commit 8c0f84b
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
cms.InputTag('unpackHcal'),
cms.InputTag('unpackHcal')
)
# L1TEventSetupForHF1x1TPs
from L1Trigger.L1TCalorimeter.caloStage2Params_HFTP_cfi import *

from L1Trigger.Configuration.SimL1Emulator_cff import *
simDtTriggerPrimitiveDigis.digiTag = 'unpackDT'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,10 @@
)

# To get L1 conditions that are not in GlobalTag / O2O yet
#process.load("L1Trigger.L1TCalorimeter.hackConditions_cff")
#process.load("L1Trigger.L1TMuon.hackConditions_cff")
#process.gmtParams.caloInputsMasked = cms.bool(True) # Disable uGMT calo inputs like in the online configuration
#process.load("L1Trigger.L1TGlobal.hackConditions_cff")
process.load("L1Trigger.L1TGlobal.GlobalParameters_cff")

# 2017 EMTF emulator uses payloads and forests from DB, but not yet in GT
process.load("L1Trigger.L1TMuonEndCap.fakeEmtfParams_2017_MC_cff")
process.load("L1Trigger.L1TCalorimeter.hackConditions_cff")
process.load("L1Trigger.L1TMuon.hackConditions_cff")
process.gmtParams.caloInputsMasked = cms.bool(True) # Disable uGMT calo inputs like in the online configuration
process.load("L1Trigger.L1TGlobal.hackConditions_cff")

# To get CaloTPGTranscoder
process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff')
Expand Down
10 changes: 3 additions & 7 deletions DQMOffline/L1Trigger/python/L1TriggerDqmOffline_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,9 @@
#stage2
from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger

#from L1Trigger.L1TGlobal.hackConditions_cff import *
#from L1Trigger.L1TMuon.hackConditions_cff import *
#from L1Trigger.L1TCalorimeter.hackConditions_cff import *
from L1Trigger.L1TGlobal.GlobalParameters_cff import *

# 2017 EMTF emulator uses payloads and forests from DB, but not yet in GT
from L1Trigger.L1TMuonEndCap.fakeEmtfParams_2017_MC_cff import *
from L1Trigger.L1TGlobal.hackConditions_cff import *
from L1Trigger.L1TMuon.hackConditions_cff import *
from L1Trigger.L1TCalorimeter.hackConditions_cff import *

from DQMOffline.L1Trigger.L1TStage2CaloLayer2Offline_cfi import *
l1tStage2CaloLayer2OfflineDQMEmu.stage2CaloLayer2JetSource=cms.InputTag("valCaloStage2Layer2Digis")
Expand Down
9 changes: 3 additions & 6 deletions L1Trigger/Configuration/python/SimL1Emulator_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@
# Next we load ES producers for any conditions that are not yet in GT,
# using the Era configuration.
#
#from L1Trigger.L1TCalorimeter.hackConditions_cff import *
#from L1Trigger.L1TMuon.hackConditions_cff import *
# from L1Trigger.L1TGlobal.hackConditions_cff import *
from L1Trigger.L1TGlobal.GlobalParameters_cff import *
from L1Trigger.L1TCalorimeter.hackConditions_cff import *
from L1Trigger.L1TMuon.hackConditions_cff import *
from L1Trigger.L1TGlobal.hackConditions_cff import *

# 2017 EMTF emulator uses payloads and forests from DB, but not yet in GT
from L1Trigger.L1TMuonEndCap.fakeEmtfParams_2017_MC_cff import *

# Customisation for the phase2_hgcal era. Includes the HGCAL L1 trigger
#from L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff import *
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/L1TCaloLayer1/src/L1TCaloLayer1FetchLUTs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
#include "CondFormats/L1TObjects/interface/CaloParams.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"

#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h"
#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h"
Expand Down Expand Up @@ -50,7 +50,7 @@ bool L1TCaloLayer1FetchLUTs(const edm::EventSetup& iSetup,

// CaloParams contains all persisted parameters for Layer 1
edm::ESHandle<l1t::CaloParams> paramsHandle;
iSetup.get<L1TCaloParamsRcd>().get(paramsHandle);
iSetup.get<L1TCaloStage2ParamsRcd>().get(paramsHandle);
if ( paramsHandle.product() == nullptr ) {
edm::LogError("L1TCaloLayer1FetchLUTs") << "Missing CaloParams object! Check Global Tag, etc.";
return false;
Expand Down
4 changes: 1 addition & 3 deletions L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace l1t {



bool isValidForStage1() {return true; }
bool isValidForStage1() {return 1; }
bool isValidForStage2() {return (version_ >= 2); }

L1CaloEtScale emScale() { return emScale_; }
Expand Down Expand Up @@ -440,8 +440,6 @@ namespace l1t {
std::vector<unsigned> layer1SecondStageLUT() { return pnode_[layer1HOverE].uparams_; }
void setLayer1SecondStageLUT(const std::vector<unsigned>& lut) { pnode_[layer1HOverE].uparams_ = lut; }

void setNode(int pos, const Node &n){ pnode_[pos] = n; }
const std::vector<Node>& getNodes(void) const { return pnode_; }

private:
L1CaloEtScale emScale_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "CondFormats/L1TObjects/interface/CaloParams.h"
#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"

using namespace std;

Expand All @@ -44,11 +44,11 @@ using namespace l1t;
class L1TCaloStage2ParamsESProducer : public edm::ESProducer {
public:
L1TCaloStage2ParamsESProducer(const edm::ParameterSet&);
~L1TCaloStage2ParamsESProducer() override;
~L1TCaloStage2ParamsESProducer();

typedef std::shared_ptr<CaloParams> ReturnType;

ReturnType produce(const L1TCaloParamsRcd&);
ReturnType produce(const L1TCaloStage2ParamsRcd&);

private:
CaloParams m_params ;
Expand Down Expand Up @@ -366,7 +366,7 @@ L1TCaloStage2ParamsESProducer::~L1TCaloStage2ParamsESProducer()

// ------------ method called to produce the data ------------
L1TCaloStage2ParamsESProducer::ReturnType
L1TCaloStage2ParamsESProducer::produce(const L1TCaloParamsRcd& iRecord)
L1TCaloStage2ParamsESProducer::produce(const L1TCaloStage2ParamsRcd& iRecord)
{
using namespace edm::es;
std::shared_ptr<CaloParams> pCaloParams ;
Expand Down
20 changes: 10 additions & 10 deletions L1Trigger/L1TCalorimeter/plugins/L1TStage2Layer1Producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "L1Trigger/L1TCalorimeter/interface/Stage2PreProcessor.h"

#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"

#include "CondFormats/L1TObjects/interface/L1CaloEcalScale.h"
#include "CondFormats/DataRecord/interface/L1CaloEcalScaleRcd.h"
Expand All @@ -64,18 +64,18 @@ using namespace l1t;
class L1TStage2Layer1Producer : public edm::EDProducer {
public:
explicit L1TStage2Layer1Producer(const edm::ParameterSet& ps);
~L1TStage2Layer1Producer() override;
~L1TStage2Layer1Producer();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions)
;

private:
void beginJob() override;
void produce(edm::Event&, const edm::EventSetup&) override;
void endJob() override;
virtual void beginJob() override;
virtual void produce(edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
//virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
//virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

Expand Down Expand Up @@ -110,7 +110,7 @@ L1TStage2Layer1Producer::L1TStage2Layer1Producer(const edm::ParameterSet& ps) :
ecalToken_(bxLast_+1-bxFirst_),
hcalToken_(bxLast_+1-bxFirst_),
paramsCacheId_(0),
params_(nullptr)
params_(0)
{

// register what you produce
Expand Down Expand Up @@ -348,14 +348,14 @@ L1TStage2Layer1Producer::beginRun(edm::Run const& iRun, edm::EventSetup const& i

// parameters

unsigned long long id = iSetup.get<L1TCaloParamsRcd>().cacheIdentifier();
unsigned long long id = iSetup.get<L1TCaloStage2ParamsRcd>().cacheIdentifier();

if (id != paramsCacheId_) {

paramsCacheId_ = id;

edm::ESHandle<CaloParams> paramsHandle;
iSetup.get<L1TCaloParamsRcd>().get(paramsHandle);
iSetup.get<L1TCaloStage2ParamsRcd>().get(paramsHandle);

// replace our local copy of the parameters with a new one using placement new
params_->~CaloParamsHelper();
Expand Down
43 changes: 12 additions & 31 deletions L1Trigger/L1TCalorimeter/plugins/L1TStage2Layer2Producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h"

#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloParamsO2ORcd.h"
#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h"

#include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
#include "DataFormats/L1Trigger/interface/EGamma.h"
Expand All @@ -56,18 +55,18 @@ using namespace l1t;
class L1TStage2Layer2Producer : public edm::EDProducer {
public:
explicit L1TStage2Layer2Producer(const edm::ParameterSet& ps);
~L1TStage2Layer2Producer() override;
~L1TStage2Layer2Producer();

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions)
;

private:
void beginJob() override;
void produce(edm::Event&, const edm::EventSetup&) override;
void endJob() override;
virtual void beginJob() override;
virtual void produce(edm::Event&, const edm::EventSetup&) override;
virtual void endJob() override;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
//virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
//virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

Expand Down Expand Up @@ -127,7 +126,6 @@ L1TStage2Layer2Producer::~L1TStage2Layer2Producer() {
void
L1TStage2Layer2Producer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
{

using namespace edm;

using namespace l1t;
Expand Down Expand Up @@ -264,35 +262,18 @@ L1TStage2Layer2Producer::beginRun(edm::Run const& iRun, edm::EventSetup const& i

// parameters

unsigned long long id = iSetup.get<L1TCaloParamsRcd>().cacheIdentifier();
unsigned long long id = iSetup.get<L1TCaloStage2ParamsRcd>().cacheIdentifier();

if (id != m_paramsCacheId) {

m_paramsCacheId = id;

// fetch payload corresponding to the current run from the CondDB
edm::ESHandle<CaloParams> candidateHandle;
iSetup.get<L1TCaloParamsRcd>().get(candidateHandle);
std::unique_ptr<l1t::CaloParams> candidate(new l1t::CaloParams( *candidateHandle.product() ));

// fetch the latest greatest prototype (equivalent of static payload)
edm::ESHandle<CaloParams> o2oProtoHandle;
iSetup.get<L1TCaloParamsO2ORcd>().get(o2oProtoHandle);
std::unique_ptr<l1t::CaloParams> prototype(new l1t::CaloParams( *o2oProtoHandle.product() ));
edm::ESHandle<CaloParams> paramsHandle;
iSetup.get<L1TCaloStage2ParamsRcd>().get(paramsHandle);

// prepare to set the emulator's configuration
// and then replace our local copy of the parameters with a new one using placement new
// replace our local copy of the parameters with a new one using placement new
m_params->~CaloParamsHelper();

// compare the candidate payload misses some of the pnodes compared to the prototype,
// if this is the case - the candidate is an old payload that'll crash the Stage2 emulator
// and we better use the prototype for the emulator's configuration
if( ((CaloParamsHelper*)candidate.get())->getNodes().size() < ((CaloParamsHelper*)prototype.get())->getNodes().size() )
m_params = new (m_params) CaloParamsHelper( *o2oProtoHandle.product() );
else
m_params = new (m_params) CaloParamsHelper( *candidateHandle.product() );
// KK: the nifty tricks above (placement new) work as long as current definition of
// CaloParams takes more space than the one obtained from the record
m_params = new (m_params) CaloParamsHelper(*paramsHandle.product());

LogDebug("L1TDebug") << *m_params << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1TCalorimeter/python/caloParams_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

caloParamsSource = cms.ESSource(
"EmptyESSource",
recordName = cms.string('L1TCaloParamsRcd'),
recordName = cms.string('L1TCaloStage2ParamsRcd'),
iovIsRunNotTime = cms.bool(True),
firstValid = cms.vuint32(1)
)
Expand Down
12 changes: 0 additions & 12 deletions L1Trigger/L1TCalorimeter/python/simDigis_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from L1Trigger.L1TCalorimeter.simCaloStage1Digis_cfi import *
from L1Trigger.L1TCalorimeter.simCaloStage1FinalDigis_cfi import *
from L1Trigger.L1TCalorimeter.simCaloStage1LegacyFormatDigis_cfi import *
from L1Trigger.L1TCalorimeter.caloConfigStage1PP_cfi import *
SimL1TCalorimeter = cms.Sequence(simRctDigis + simRctUpgradeFormatDigis + simCaloStage1Digis + simCaloStage1FinalDigis + simCaloStage1LegacyFormatDigis)
#
# Stage-2 Trigger
Expand All @@ -48,17 +47,6 @@
# - layer1 from L1Trigger/L1TCaloLayer1 package
from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Digis_cfi import simCaloStage2Layer1Digis
from L1Trigger.L1TCalorimeter.simCaloStage2Digis_cfi import simCaloStage2Digis
from CondCore.CondDB.CondDB_cfi import CondDB
CondDB.connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
l1conddb = cms.ESSource("PoolDBESSource",
CondDB,
toGet = cms.VPSet(
cms.PSet(
record = cms.string('L1TCaloParamsO2ORcd'),
tag = cms.string("L1TCaloParams_static_CMSSW_9_2_10_2017_v1_8_2_updateHFSF_v6MET")
)
)
)
SimL1TCalorimeter = cms.Sequence( simCaloStage2Layer1Digis + simCaloStage2Digis )


31 changes: 6 additions & 25 deletions L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
// system include files
#include <memory>
#include <fstream>
#include <sstream>

// user include files
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
Expand All @@ -47,27 +46,23 @@

#include "CondFormats/L1TObjects/interface/L1TMuonGlobalParams.h"
#include "CondFormats/DataRecord/interface/L1TMuonGlobalParamsRcd.h"
#include "CondFormats/DataRecord/interface/L1TMuonGlobalParamsO2ORcd.h"
#include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParamsHelper.h"
#include "L1Trigger/L1TMuon/interface/L1TMuonGlobalParams_PUBLIC.h"

#include "TMath.h"
//
// class declaration
//
using namespace l1t;

class L1TMuonProducer : public edm::EDProducer {
class L1TMuonProducer : public edm::stream::EDProducer<> {
public:
explicit L1TMuonProducer(const edm::ParameterSet&);
~L1TMuonProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
void beginJob() override ;
void produce(edm::Event&, const edm::EventSetup&) override;
void endJob() override ;

void beginRun(edm::Run const&, edm::EventSetup const&) override;
void endRun(edm::Run const&, edm::EventSetup const&) override;
Expand Down Expand Up @@ -502,17 +497,6 @@ L1TMuonProducer::convertMuons(const edm::Handle<MicroGMTConfiguration::InputColl
}
}

// ------------ method called once each job just before starting event loop ------------
void
L1TMuonProducer::beginJob()
{
}

// ------------ method called once each job just after ending the event loop ------------
void
L1TMuonProducer::endJob() {
}

// ------------ method called when starting to processes a run ------------
void
L1TMuonProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup)
Expand All @@ -521,13 +505,10 @@ L1TMuonProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetup)
edm::ESHandle<L1TMuonGlobalParams> microGMTParamsHandle;
microGMTParamsRcd.get(microGMTParamsHandle);

std::unique_ptr<L1TMuonGlobalParams_PUBLIC> microGMTParams( new L1TMuonGlobalParams_PUBLIC( cast_to_L1TMuonGlobalParams_PUBLIC(*microGMTParamsHandle.product()) ) );
if( microGMTParams->pnodes_.empty() ){
edm::ESHandle<L1TMuonGlobalParams> o2oProtoHandle;
iSetup.get<L1TMuonGlobalParamsO2ORcd>().get(o2oProtoHandle);
microGMTParamsHelper = std::unique_ptr<L1TMuonGlobalParamsHelper>(new L1TMuonGlobalParamsHelper(*o2oProtoHandle.product()));
} else
microGMTParamsHelper.reset( new L1TMuonGlobalParamsHelper(cast_to_L1TMuonGlobalParams(*microGMTParams.get())) );
microGMTParamsHelper = std::make_unique<L1TMuonGlobalParamsHelper>(*microGMTParamsHandle.product());
if (!microGMTParamsHelper) {
edm::LogError("L1TMuonProducer") << "Could not retrieve parameters from Event Setup" << std::endl;
}

//microGMTParamsHelper->print(std::cout);
m_inputsToDisable = microGMTParamsHelper->inputsToDisable();
Expand Down
Loading

0 comments on commit 8c0f84b

Please sign in to comment.