-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34494 from panoskatsoulis/kalmanParamsDev_onlyObjs
Introduce L1TMuonBarrelKalmanParams and Record
- Loading branch information
Showing
16 changed files
with
355 additions
and
5 deletions.
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.