Skip to content
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

CondFormat storing configuration parameters for the new DYT #6755

Merged
merged 5 commits into from Dec 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CondFormats/DataRecord/interface/DYTParamsObjectRcd.h
@@ -0,0 +1,8 @@
#ifndef CondFormats_DYTParamsObjectRcd_h
#define CondFormats_DYTParamsObjectRcd_h

#include "FWCore/Framework/interface/EventSetupRecordImplementation.h"

class DYTParamsObjectRcd : public edm::eventsetup::EventSetupRecordImplementation<DYTParamsObjectRcd> {};

#endif
7 changes: 7 additions & 0 deletions CondFormats/DataRecord/src/DYTParamsObjectRcd.cc
@@ -0,0 +1,7 @@
// Package: CondFormats
// Class : DYTParamsObjectRcd

#include "CondFormats/DataRecord/interface/DYTParamsObjectRcd.h"
#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h"

EVENTSETUP_RECORD_REG(DYTParamsObjectRcd);
34 changes: 34 additions & 0 deletions CondFormats/RecoMuonObjects/interface/DYTParamObject.h
@@ -0,0 +1,34 @@
#ifndef DytParamObject_h
#define DytParamObject_h

#include<vector>
#include "DataFormats/DetId/interface/DetId.h"
#include "CondFormats/Serialization/interface/Serializable.h"

class DYTParamObject {
public:

DYTParamObject() { };
DYTParamObject(uint32_t id, std::vector<double> & params)
: m_id(id) , m_params(params) { };
~DYTParamObject() { m_params.clear(); };

// Return raw id
uint32_t id() const {return m_id;};

// Return param i (i from 0 to size-1)
double parameter(unsigned int iParam) const;

// Return param vector size (i from 0 to size-1)
unsigned int paramSize() const { return m_params.size(); };

private:

uint32_t m_id;
std::vector<double> m_params;

COND_SERIALIZABLE;

};

#endif
35 changes: 35 additions & 0 deletions CondFormats/RecoMuonObjects/interface/DYTParamsObject.h
@@ -0,0 +1,35 @@
#ifndef DytParamsObject_h
#define DytParamsObject_h

#include <vector>
#include "CondFormats/RecoMuonObjects/interface/DYTParamObject.h"
#include "CondFormats/Serialization/interface/Serializable.h"

class DYTParamsObject {
public:

DYTParamsObject() {};
~DYTParamsObject() { m_paramObjs.clear(); };

// Add a parameter to the vector of parameters
void addParamObject(const DYTParamObject & obj) { m_paramObjs.push_back(obj); };

// Set the parametrized formula
void setFormula(std::string formula) { m_formula = formula; };

// Get the list of parameters
const std::vector<DYTParamObject> & getParamObjs() const { return m_paramObjs; };

// Get the functional parametrization
const std::string & formula() const { return m_formula; };

private:

std::vector<DYTParamObject> m_paramObjs;

std::string m_formula;

COND_SERIALIZABLE;
};

#endif
17 changes: 17 additions & 0 deletions CondFormats/RecoMuonObjects/src/DYTParamObject.cc
@@ -0,0 +1,17 @@
#include "CondFormats/RecoMuonObjects/interface/DYTParamObject.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

double DYTParamObject::parameter(unsigned int iParam) const
{

if (iParam >= paramSize())
{
edm::LogWarning("DYTParamObject")
<< "The requested parameter (" << (iParam + 1)
<< ") is outside size range (" << paramSize() << ").";
return 0.;
}

return m_params.at(iParam);

}
@@ -0,0 +1,5 @@
#include "CondFormats/RecoMuonObjects/interface/DYTParamsObject.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(DYTParamsObject);

2 changes: 1 addition & 1 deletion CondFormats/RecoMuonObjects/src/classes.h
@@ -1,9 +1,9 @@
#include "CondFormats/RecoMuonObjects/src/headers.h"


namespace CondFormats_RecoMuonObjects {
struct dictionary {
// std::vector<PhysicsTools::Calibration::HistogramD2D> a;
MuScleFitDBobject e;
DYTParamsObject g;
};
}
3 changes: 3 additions & 0 deletions CondFormats/RecoMuonObjects/src/classes_def.xml
Expand Up @@ -3,4 +3,7 @@
<class name="DYTThrObject" class_version="0"/>
<class name="DYTThrObject::DytThrStruct"/>
<class name="std::vector<DYTThrObject::DytThrStruct>"/>
<class name="DYTParamsObject" class_version="2"/>
<class name="DYTParamObject"/>
<class name="std::vector<DYTParamObject>"/>
</lcgdict>
1 change: 1 addition & 0 deletions CondFormats/RecoMuonObjects/src/headers.h
@@ -1,5 +1,6 @@
#include "CondFormats/RecoMuonObjects/interface/MuScleFitDBobject.h"
#include "CondFormats/RecoMuonObjects/interface/DYTThrObject.h"
#include "CondFormats/RecoMuonObjects/interface/DYTParamsObject.h"

#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#include "CondFormats/External/interface/DetID.h"
Expand Down
Expand Up @@ -5,6 +5,7 @@
int main()
{
testSerialization<MuScleFitDBobject>();
testSerialization<DYTParamsObject>();
testSerialization<DYTThrObject>();
return 0;
}