-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce L1TMuonBarrelKalmanParams and Record #34494
Merged
cmsbuild
merged 10 commits into
cms-sw:master
from
panoskatsoulis:kalmanParamsDev_onlyObjs
Jul 28, 2021
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
439cbf2
added new L1TMuonBarrelKalmanParams and record
panoskatsoulis 9bb9e19
new KalmanParams ESProducer and static params config
panoskatsoulis 053a393
changes in the L1Config utilities, adapt Writer and upload config
panoskatsoulis 5362863
added new kBmtf Viewer in the L1Config utils
panoskatsoulis 61a6883
new DataProxy plugin for L1TMuonBarrelKalmanParamsRcd
panoskatsoulis a1e3263
code-checks fix
panoskatsoulis bf9ac0c
cosmetics and comments
panoskatsoulis e98cd9a
build fixed
panoskatsoulis 063e451
added masks and removed commented out code from BarrelKalmanParams
panoskatsoulis 18bc00e
fix code format
panoskatsoulis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
CondFormats/DataRecord/interface/L1TMuonBarrelKalmanParamsRcd.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef L1TBMTFKalmanParamsRcd_L1TBMTFKalmanParamsRcd_h | ||
#define L1TBMTFKalmanParamsRcd_L1TBMTFKalmanParamsRcd_h | ||
// -*- C++ -*- | ||
// | ||
// Class : L1TMuonBarrelKalmanParamsRcd | ||
// | ||
// Author: Panos Katsoulis | ||
// Created: | ||
// | ||
|
||
#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" | ||
|
||
class L1TMuonBarrelKalmanParamsRcd | ||
: public edm::eventsetup::EventSetupRecordImplementation<L1TMuonBarrelKalmanParamsRcd> {}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
CondFormats/DataRecord/src/L1TMuonBarrelKalmanParamsRcd.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: Subsystem/Package | ||
// Class : L1TMuonBarrelKalmanParamsRcd | ||
// | ||
// Author: Panos Katsoulis | ||
// Created: | ||
|
||
#include "CondFormats/DataRecord/interface/L1TMuonBarrelKalmanParamsRcd.h" | ||
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" | ||
|
||
EVENTSETUP_RECORD_REG(L1TMuonBarrelKalmanParamsRcd); |
45 changes: 45 additions & 0 deletions
45
CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/// | ||
/// \class L1TMuonBarrelKalmanParams | ||
/// | ||
/// Description: Placeholder for Kalman BMTF parameters | ||
/// | ||
/// | ||
/// \author: Panos Katsoulis | ||
/// | ||
|
||
#ifndef L1TBMTFKalmanParams_h | ||
#define L1TBMTFKalmanParams_h | ||
|
||
#include <memory> | ||
#include <iostream> | ||
#include <vector> | ||
|
||
#include "CondFormats/Serialization/interface/Serializable.h" | ||
#include "CondFormats/L1TObjects/interface/L1MuDTTFMasks.h" | ||
#include "CondFormats/L1TObjects/interface/LUT.h" | ||
|
||
class L1TMuonBarrelKalmanParams { | ||
public: | ||
L1TMuonBarrelKalmanParams(); | ||
~L1TMuonBarrelKalmanParams() {} | ||
|
||
enum { Version = 1 }; | ||
enum { CONFIG = 0, NUM_BMTF_PARAM_NODES = 2 }; | ||
|
||
class Node { | ||
public: | ||
std::string type_; | ||
std::string kalmanLUTsPath_; | ||
unsigned fwVersion_; | ||
l1t::LUT LUT_; | ||
COND_SERIALIZABLE; | ||
}; | ||
|
||
L1MuDTTFMasks l1mudttfmasks; | ||
unsigned version_; | ||
|
||
std::vector<Node> pnodes_; | ||
std::vector<L1MuDTTFMasks> l1mudttfmasks_; | ||
COND_SERIALIZABLE; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h" | ||
|
||
L1TMuonBarrelKalmanParams::L1TMuonBarrelKalmanParams() : pnodes_(NUM_BMTF_PARAM_NODES), l1mudttfmasks_(1) { | ||
version_ = Version; | ||
pnodes_[CONFIG].type_ = "unspecified"; | ||
pnodes_[CONFIG].fwVersion_ = 0; //default to recognize a RCD that is not filled | ||
} |
2 changes: 2 additions & 0 deletions
2
CondFormats/L1TObjects/src/T_EventSetup_L1TMuonBarrelParams.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" | ||
#include "CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h" | ||
#include "FWCore/Utilities/interface/typelookup.h" | ||
|
||
TYPELOOKUP_DATA_REG(L1TMuonBarrelParams); | ||
TYPELOOKUP_DATA_REG(L1TMuonBarrelKalmanParams); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
L1Trigger/L1TMuonBarrel/plugins/L1TMuonBarrelKalmanParamsESProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// -*- C++ -*- | ||
// | ||
// Class: L1TMuonBarrelKalmanParamsESProducer | ||
// | ||
// Original Author (of the base file): Giannis Flouris | ||
// Kalman Mod & clean up: Panos Katsoulis | ||
// Created: | ||
// | ||
// | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
// user include files | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
#include "FWCore/Framework/interface/ESProducer.h" | ||
|
||
#include "CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h" | ||
#include "CondFormats/DataRecord/interface/L1TMuonBarrelKalmanParamsRcd.h" | ||
|
||
// for future, LUTs implementaion | ||
//#include "L1Trigger/L1TMuon/interface/MicroGMTLUTFactories.h" | ||
// for future, masks | ||
//#include "L1Trigger/L1TCommon/interface/Mask.h" | ||
|
||
// class declaration | ||
// | ||
|
||
class L1TMuonBarrelKalmanParamsESProducer : public edm::ESProducer { | ||
public: | ||
L1TMuonBarrelKalmanParamsESProducer(const edm::ParameterSet&); | ||
~L1TMuonBarrelKalmanParamsESProducer() override; | ||
|
||
using ReturnType = std::unique_ptr<L1TMuonBarrelKalmanParams>; | ||
ReturnType produce(const L1TMuonBarrelKalmanParamsRcd&); | ||
|
||
private: | ||
L1TMuonBarrelKalmanParams kalman_params; | ||
}; | ||
|
||
// | ||
// constants, enums and typedefs | ||
// | ||
|
||
// | ||
// static data member definitions | ||
// | ||
|
||
// | ||
// constructors and destructor | ||
// | ||
L1TMuonBarrelKalmanParamsESProducer::L1TMuonBarrelKalmanParamsESProducer(const edm::ParameterSet& iConfig) { | ||
// the following line is needed to tell the framework what data is being produced | ||
setWhatProduced(this); | ||
|
||
// basic configurables needed (now set static) | ||
kalman_params.pnodes_[kalman_params.CONFIG].fwVersion_ = iConfig.getParameter<unsigned>("fwVersion"); | ||
|
||
// the LUTs | ||
kalman_params.pnodes_[kalman_params.CONFIG].kalmanLUTsPath_ = iConfig.getParameter<std::string>("LUTsPath"); | ||
} | ||
|
||
L1TMuonBarrelKalmanParamsESProducer::~L1TMuonBarrelKalmanParamsESProducer() {} | ||
|
||
// | ||
// member functions | ||
// | ||
|
||
// ------------ method called to produce the data ------------ | ||
L1TMuonBarrelKalmanParamsESProducer::ReturnType L1TMuonBarrelKalmanParamsESProducer::produce( | ||
const L1TMuonBarrelKalmanParamsRcd& iRecord) { | ||
return std::make_unique<L1TMuonBarrelKalmanParams>(kalman_params); | ||
} | ||
|
||
//define this as a plug-in | ||
DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonBarrelKalmanParamsESProducer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
kalmanParamsSource = cms.ESSource( | ||
"EmptyESSource", | ||
recordName = cms.string('L1TMuonBarrelKalmanParamsRcd'), | ||
iovIsRunNotTime = cms.bool(True), | ||
firstValid = cms.vuint32(1) | ||
) | ||
|
||
staticKBmtfParams = cms.ESProducer( | ||
'L1TMuonBarrelKalmanParamsESProducer', | ||
fwVersion = cms.uint32(0x95030160), | ||
LUTsPath = cms.string("L1Trigger/L1TMuon/data/bmtf_luts/kalmanLUTs_v302.root") | ||
) |
77 changes: 77 additions & 0 deletions
77
L1TriggerConfig/Utilities/src/L1TMuonBarrelKalmanParamsViewer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include <iomanip> | ||
#include <iostream> | ||
|
||
#include "FWCore/Framework/interface/EDAnalyzer.h" | ||
|
||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
|
||
#include "CondFormats/DataRecord/interface/L1TMuonBarrelKalmanParamsRcd.h" | ||
#include "CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" | ||
#include "CondCore/CondDB/interface/Session.h" | ||
|
||
#include <iostream> | ||
using namespace std; | ||
|
||
class L1TMuonBarrelKalmanParamsViewer : public edm::EDAnalyzer { | ||
private: | ||
std::string hash(void *buf, size_t len) const; | ||
|
||
public: | ||
void analyze(const edm::Event &, const edm::EventSetup &) override; | ||
|
||
L1TMuonBarrelKalmanParamsViewer(const edm::ParameterSet &){}; | ||
~L1TMuonBarrelKalmanParamsViewer(void) override {} | ||
}; | ||
|
||
#include <openssl/sha.h> | ||
#include <cmath> | ||
#include <iostream> | ||
using namespace std; | ||
|
||
std::string L1TMuonBarrelKalmanParamsViewer::hash(void *buf, size_t len) const { | ||
char tmp[SHA_DIGEST_LENGTH * 2 + 1]; | ||
bzero(tmp, sizeof(tmp)); | ||
SHA_CTX ctx; | ||
if (!SHA1_Init(&ctx)) | ||
throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 initialization error"; | ||
|
||
if (!SHA1_Update(&ctx, buf, len)) | ||
throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 processing error"; | ||
|
||
unsigned char hash[SHA_DIGEST_LENGTH]; | ||
if (!SHA1_Final(hash, &ctx)) | ||
throw cms::Exception("L1TMuonBarrelKalmanParamsViewer::hash") << "SHA1 finalization error"; | ||
|
||
// re-write bytes in hex | ||
for (unsigned int i = 0; i < 20; i++) | ||
::sprintf(&tmp[i * 2], "%02x", hash[i]); | ||
|
||
tmp[20 * 2] = 0; | ||
return std::string(tmp); | ||
} | ||
|
||
void L1TMuonBarrelKalmanParamsViewer::analyze(const edm::Event &iEvent, const edm::EventSetup &evSetup) { | ||
edm::ESHandle<L1TMuonBarrelKalmanParams> handle1; | ||
evSetup.get<L1TMuonBarrelKalmanParamsRcd>().get(handle1); | ||
std::shared_ptr<L1TMuonBarrelKalmanParams> ptr(new L1TMuonBarrelKalmanParams(*(handle1.product()))); | ||
|
||
// Get the nodes and print out | ||
auto pnodes = ptr->pnodes_[ptr->CONFIG]; | ||
cout << "version : " << ptr->version_ << endl; | ||
cout << "fwVersion : " << hex << pnodes.fwVersion_ << dec << endl; | ||
cout << "LUTsPath : " << pnodes.kalmanLUTsPath_ << endl; | ||
|
||
// typedef std::map<short, short, std::less<short> > LUT; | ||
} | ||
|
||
#include "FWCore/PluginManager/interface/ModuleDef.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/ModuleFactory.h" | ||
|
||
DEFINE_FWK_MODULE(L1TMuonBarrelKalmanParamsViewer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::cout is not threadsafe, please use https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideMessageLogger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the notice about this
This module here is an L1T private tester and is not used in any central CMSSW workflow.
The purpose is to read 1 event (only) and print out the info included in the db Rcd
However, if it's required we can update it with MesageLogger in the next iteration of this development, is this fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@panoskatsoulis For the next iteration: if it is a private test, it shoud be better moved into the \test area?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @perrotta, this is a good point
it is the entire pkg
L1TriggerConfig/Utilities
that contains these testing modulesLet me discuss this with the other L1 guys tho, thx