Skip to content

Commit

Permalink
Add esConsumes to OmtfPacker and OmtfUnpacker
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Jul 26, 2021
1 parent 5b7d4de commit 86b5b65
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions EventFilter/L1TRawToDigi/plugins/OmtfPacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ namespace omtf {
edm::EDGetTokenT<L1MuDTChambThContainer> theDtThToken;
edm::EDGetTokenT<L1MuDTChambPhContainer> theDtPhToken;

edm::ESGetToken<RPCEMap, RPCEMapRcd> theRPCEMapToken;
edm::ESGetToken<RPCAMCLinkMap, RPCOMTFLinkMapRcd> theAmcMappingToken;

CscPacker theCscPacker;
RpcPacker theRpcPacker;
DtPacker theDtPacker;
Expand All @@ -90,6 +93,13 @@ namespace omtf {
theSkipDt = pset.getParameter<bool>("skipDt");
theSkipRpc = pset.getParameter<bool>("skipRpc");
theSkipCsc = pset.getParameter<bool>("skipCsc");

if (!theSkipRpc) {
theRPCEMapToken = esConsumes<edm::Transition::BeginRun>();
if (not theConfig.getParameter<bool>("useRpcConnectionFile")) {
theAmcMappingToken = esConsumes<edm::Transition::BeginRun>();
}
}
}

void OmtfPacker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand All @@ -112,15 +122,13 @@ namespace omtf {
// initialise RPC packer
//
if (!theSkipRpc) {
edm::ESTransientHandle<RPCEMap> readoutMapping;
es.get<RPCEMapRcd>().get(readoutMapping);
edm::ESTransientHandle<RPCEMap> readoutMapping = es.getTransientHandle(theRPCEMapToken);
if (theConfig.getParameter<bool>("useRpcConnectionFile")) {
theRpcPacker.init(*readoutMapping,
edm::FileInPath(theConfig.getParameter<std::string>("rpcConnectionFile")).fullPath());
} else {
edm::ESHandle<RPCAMCLinkMap> amcMapping;
es.get<RPCOMTFLinkMapRcd>().get(amcMapping);
theRpcPacker.init(*readoutMapping, *amcMapping);
auto const& amcMapping = es.getData(theAmcMappingToken);
theRpcPacker.init(*readoutMapping, amcMapping);
}
}

Expand Down
18 changes: 13 additions & 5 deletions EventFilter/L1TRawToDigi/plugins/OmtfUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ namespace omtf {

edm::EDGetTokenT<FEDRawDataCollection> theFedDataToken;

edm::ESGetToken<RPCEMap, RPCEMapRcd> theRPCEMapToken;
edm::ESGetToken<RPCAMCLinkMap, RPCOMTFLinkMapRcd> theAmcMappingToken;

RpcUnpacker theRpcUnpacker;
CscUnpacker theCscUnpacker;
DtUnpacker theDtUnpacker;
Expand All @@ -92,6 +95,13 @@ namespace omtf {
theSkipMuon = pset.getParameter<bool>("skipMuon");

theFedDataToken = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("inputLabel"));

if (!theSkipRpc) {
theRPCEMapToken = esConsumes<edm::Transition::BeginRun>();
if (not theConfig.getParameter<bool>("useRpcConnectionFile")) {
theAmcMappingToken = esConsumes<edm::Transition::BeginRun>();
}
}
}

void OmtfUnpacker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
Expand All @@ -112,15 +122,13 @@ namespace omtf {
// rpc unpacker
//
if (!theSkipRpc) {
edm::ESTransientHandle<RPCEMap> readoutMapping;
es.get<RPCEMapRcd>().get(readoutMapping);
edm::ESTransientHandle<RPCEMap> readoutMapping = es.getTransientHandle(theRPCEMapToken);
if (theConfig.getParameter<bool>("useRpcConnectionFile")) {
theRpcUnpacker.init(*readoutMapping,
edm::FileInPath(theConfig.getParameter<std::string>("rpcConnectionFile")).fullPath());
} else {
edm::ESHandle<RPCAMCLinkMap> amcMapping;
es.get<RPCOMTFLinkMapRcd>().get(amcMapping);
theRpcUnpacker.init(*readoutMapping, *amcMapping);
auto const& amcMapping = es.getData(theAmcMappingToken);
theRpcUnpacker.init(*readoutMapping, amcMapping);
}
}

Expand Down

0 comments on commit 86b5b65

Please sign in to comment.