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

ECAL SC parameters to EventSetup #32066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8a66684
Move the mustache SC parameters and the dynamic dPhi SC parameters to…
thomreis Oct 29, 2020
060bfc6
Code checks.
thomreis Oct 29, 2020
d9e0ecd
Code format.
thomreis Oct 29, 2020
8dd8c2d
Sort parameters in energy and eta bins.
thomreis Nov 2, 2020
11acf05
Add energy and eta bin optimised parameters.
thomreis Nov 2, 2020
17e9152
Put the ESSources and ESProducers for the mustache parameters in the …
thomreis Nov 5, 2020
36ca168
Add customisation function for HLT to load the ESSource and ESProduce…
thomreis Nov 5, 2020
20e0239
Add DB data makers.
thomreis Nov 9, 2020
68ed17b
Use the same weighted average parameters as in the current master.
thomreis Nov 9, 2020
6452460
Code format.
thomreis Nov 9, 2020
54b96f6
Correct PR number for HLT customisation function.
thomreis Nov 9, 2020
131efb7
Fix Clang warnings by adding override to analyze functions.
thomreis Nov 9, 2020
f1d9aed
Use floating point numbers in formula.
thomreis Nov 12, 2020
5bf2c37
Remove now unneeded struct for dictionary creation.
thomreis Nov 12, 2020
29e7e35
Drop the shared pointers to avoid making copies of the objects.
thomreis Nov 12, 2020
a66b752
Move getters from helper to CondFormat to allow using them without ma…
thomreis Nov 16, 2020
66fcfef
Return const pointer with parameter set to avoid copying.
thomreis Nov 16, 2020
cdb877d
Code format.
thomreis Nov 16, 2020
a7a195d
Use binary searches to find the matching parameters.
thomreis Nov 17, 2020
f21b8bb
Simplify getting of ES data and moving this step from beginRun to pro…
thomreis Nov 18, 2020
f663eab
Simplify getting of ES data and moving this step from beginRun to pro…
thomreis Nov 18, 2020
da2cf58
Merge branch 'moustache-sc-params-to-db-112x202011082300' of https://…
thomreis Nov 18, 2020
8457450
Add fillDescriptions functions.
thomreis Nov 18, 2020
17f8a6d
Move cfg files to test directory.
thomreis Nov 19, 2020
f2e7f57
Remove commented out code.
thomreis Nov 19, 2020
d802957
Change helper classes to set parameters to be friends of, instead of …
thomreis Nov 20, 2020
7e756ca
Move the mustache SC parameters and the dynamic dPhi SC parameters to…
thomreis Oct 29, 2020
105d1f3
Code checks.
thomreis Oct 29, 2020
c539190
Code format.
thomreis Oct 29, 2020
090b570
Sort parameters in energy and eta bins.
thomreis Nov 2, 2020
a0c695d
Add energy and eta bin optimised parameters.
thomreis Nov 2, 2020
fb0bb4d
Put the ESSources and ESProducers for the mustache parameters in the …
thomreis Nov 5, 2020
6243b34
Add customisation function for HLT to load the ESSource and ESProduce…
thomreis Nov 5, 2020
d11e7e1
Add DB data makers.
thomreis Nov 9, 2020
6c7ea52
Use the same weighted average parameters as in the current master.
thomreis Nov 9, 2020
2c62015
Code format.
thomreis Nov 9, 2020
02a8167
Correct PR number for HLT customisation function.
thomreis Nov 9, 2020
230ee03
Fix Clang warnings by adding override to analyze functions.
thomreis Nov 9, 2020
05887fd
Use floating point numbers in formula.
thomreis Nov 12, 2020
7ad20f6
Remove now unneeded struct for dictionary creation.
thomreis Nov 12, 2020
bdc8940
Drop the shared pointers to avoid making copies of the objects.
thomreis Nov 12, 2020
61264e9
Move getters from helper to CondFormat to allow using them without ma…
thomreis Nov 16, 2020
eb0a16d
Return const pointer with parameter set to avoid copying.
thomreis Nov 16, 2020
34fd69f
Code format.
thomreis Nov 16, 2020
d6df399
Use binary searches to find the matching parameters.
thomreis Nov 17, 2020
e93b7dc
Simplify getting of ES data and moving this step from beginRun to pro…
thomreis Nov 18, 2020
955649f
Add fillDescriptions functions.
thomreis Nov 18, 2020
6c6314e
Move cfg files to test directory.
thomreis Nov 19, 2020
b184066
Remove commented out code.
thomreis Nov 19, 2020
bcfcd4b
Change helper classes to set parameters to be friends of, instead of …
thomreis Nov 20, 2020
32a0511
Merge branch 'moustache-sc-params-to-db-112x202011082300' of https://…
thomreis Nov 23, 2020
7a28ce7
Clear vector before adding new elements. Code Cleanup.
thomreis Nov 23, 2020
4d107dd
Merge branch 'master' into moustache-sc-params-to-db-112x202011082300
thomreis Nov 24, 2020
029b8e9
Merge branch 'master' into moustache-sc-params-to-db-112x202011082300
thomreis Nov 25, 2020
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 CondCore/EcalPlugins/src/plugin.cc
Expand Up @@ -161,6 +161,11 @@
#include "CondFormats/EcalObjects/interface/EcalSimPulseShape.h"
#include "CondFormats/DataRecord/interface/EcalSimPulseShapeRcd.h"

#include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h"
#include "CondFormats/DataRecord/interface/EcalMustacheSCParametersRcd.h"
#include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
#include "CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h"

REGISTER_PLUGIN(EcalPedestalsRcd, EcalCondObjectContainer<EcalPedestal>);
REGISTER_PLUGIN(EcalWeightXtalGroupsRcd, EcalCondObjectContainer<EcalXtalGroupId>);
REGISTER_PLUGIN(EcalTBWeightsRcd, EcalTBWeights);
Expand Down Expand Up @@ -222,3 +227,6 @@ REGISTER_PLUGIN(EcalSamplesCorrelationRcd, EcalSamplesCorrelation);
REGISTER_PLUGIN(EcalPulseShapesRcd, EcalCondObjectContainer<EcalPulseShape>);
REGISTER_PLUGIN(EcalPulseCovariancesRcd, EcalCondObjectContainer<EcalPulseCovariance>);
REGISTER_PLUGIN(EcalPulseSymmCovariancesRcd, EcalCondObjectContainer<EcalPulseSymmCovariance>);

REGISTER_PLUGIN(EcalMustacheSCParametersRcd, EcalMustacheSCParameters);
REGISTER_PLUGIN(EcalSCDynamicDPhiParametersRcd, EcalSCDynamicDPhiParameters);
26 changes: 26 additions & 0 deletions CondFormats/DataRecord/interface/EcalMustacheSCParametersRcd.h
@@ -0,0 +1,26 @@
#ifndef CondFormats_DataRecord_EcalMustacheSCParametersRcd_h
#define CondFormats_DataRecord_EcalMustacheSCParametersRcd_h
// -*- C++ -*-
//
// Package: CondFormats/DataRecord
// Class : EcalMustacheSCParametersRcd
//
/**\class EcalMustacheSCParametersRcd EcalMustacheSCParametersRcd.h CondFormats/DataRecord/interface/EcalMustacheSCParametersRcd.h

Description: [one line class summary]

Usage:
<usage>

*/
//
// Author: Thomas Reis
// Created: Fri, 23 Oct 2020 09:52:36 GMT
//

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

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

#endif
26 changes: 26 additions & 0 deletions CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h
@@ -0,0 +1,26 @@
#ifndef CondFormats_DataRecord_EcalSCDynamicDPhiParametersRcd_h
#define CondFormats_DataRecord_EcalSCDynamicDPhiParametersRcd_h
// -*- C++ -*-
//
// Package: CondFormats/DataRecord
// Class : EcalSCDynamicDPhiParametersRcd
//
/**\class EcalSCDynamicDPhiParametersRcd EcalSCDynamicDPhiParametersRcd.h CondFormats/DataRecord/interface/EcalSCDynamicDPhiParametersRcd.h

Description: [one line class summary]

Usage:
<usage>

*/
//
// Author: Thomas Reis
// Created: Wed, 28 Oct 2020 12:56:00 GMT
//

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

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

#endif
15 changes: 15 additions & 0 deletions CondFormats/DataRecord/src/EcalMustacheSCParametersRcd.cc
@@ -0,0 +1,15 @@
// -*- C++ -*-
//
// Package: CondFormats/DataRecord
// Class : EcalMustacheSCParametersRcd
//
// Implementation:
// [Notes on implementation]
//
// Author: Thomas Reis
// Created: Fri, 23 Oct 2020 09:52:36 GMT

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

EVENTSETUP_RECORD_REG(EcalMustacheSCParametersRcd);
15 changes: 15 additions & 0 deletions CondFormats/DataRecord/src/EcalSCDynamicDPhiParametersRcd.cc
@@ -0,0 +1,15 @@
// -*- C++ -*-
//
// Package: CondFormats/DataRecord
// Class : EcalSCDynamicDPhiParametersRcd
//
// Implementation:
// [Notes on implementation]
//
// Author: Thomas Reis
// Created: Wed, 28 Oct 2020 12:56:00 GMT

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

EVENTSETUP_RECORD_REG(EcalSCDynamicDPhiParametersRcd);
54 changes: 54 additions & 0 deletions CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h
@@ -0,0 +1,54 @@
#ifndef CondFormats_EcalObjects_EcalMustacheSCParameters_h
#define CondFormats_EcalObjects_EcalMustacheSCParameters_h

#include <iostream>
#include <vector>

#include "CondFormats/Serialization/interface/Serializable.h"

namespace reco {
class MustacheSCParametersHelper;
} // namespace reco

class EcalMustacheSCParameters {
public:
EcalMustacheSCParameters(){};
virtual ~EcalMustacheSCParameters() = default;

struct ParabolaParameters {
double log10EMin;
double etaMin;
std::vector<double> pUp;
std::vector<double> pLow;
std::vector<double> w0Up;
std::vector<double> w1Up;
std::vector<double> w0Low;
std::vector<double> w1Low;

COND_SERIALIZABLE;
};

float sqrtLogClustETuning() const;

const ParabolaParameters* parabolaParameters(float log10ClustE, float absSeedEta) const;

// helper class to set parameters
friend class reco::MustacheSCParametersHelper;

// print parameters to stream:
void print(std::ostream&) const;
friend std::ostream& operator<<(std::ostream& out, const EcalMustacheSCParameters& params) {
params.print(out);
return out;
}

protected:
float sqrtLogClustETuning_;

// collection is expected to be sorted in ascending ParabolaParameters.log10EMin and ascending ParabolaParameters.etaMax
std::vector<ParabolaParameters> parabolaParametersCollection_;

COND_SERIALIZABLE;
};

#endif
50 changes: 50 additions & 0 deletions CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h
@@ -0,0 +1,50 @@
#ifndef CondFormats_EcalObjects_EcalSCDynamicDPhiParameters_h
#define CondFormats_EcalObjects_EcalSCDynamicDPhiParameters_h

#include <iostream>
#include <vector>

#include "CondFormats/Serialization/interface/Serializable.h"

namespace reco {
class SCDynamicDPhiParametersHelper;
} // namespace reco

class EcalSCDynamicDPhiParameters {
public:
EcalSCDynamicDPhiParameters(){};
virtual ~EcalSCDynamicDPhiParameters() = default;

struct DynamicDPhiParameters {
double eMin;
double etaMin;
double yoffset;
double scale;
double xoffset;
double width;
double saturation;
double cutoff;

COND_SERIALIZABLE;
};

const DynamicDPhiParameters* dynamicDPhiParameters(double clustE, double absSeedEta) const;

// helper class to set parameters
friend class reco::SCDynamicDPhiParametersHelper;

// print parameters to stream:
void print(std::ostream&) const;
friend std::ostream& operator<<(std::ostream& out, const EcalSCDynamicDPhiParameters& params) {
params.print(out);
return out;
}

protected:
// collection is expected to be sorted in ascending DynamicDPhiParameters.eMin and ascending DynamicDPhiParameters.etaMax
std::vector<DynamicDPhiParameters> dynamicDPhiParametersCollection_;

COND_SERIALIZABLE;
};

#endif
71 changes: 71 additions & 0 deletions CondFormats/EcalObjects/src/EcalMustacheSCParameters.cc
@@ -0,0 +1,71 @@
#include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h"

float EcalMustacheSCParameters::sqrtLogClustETuning() const { return sqrtLogClustETuning_; }

const EcalMustacheSCParameters::ParabolaParameters* EcalMustacheSCParameters::parabolaParameters(
float log10ClustE, float absSeedEta) const {
// assume the collection is lexicographically sorted in ascending ParabolaParameters.log10EMin and ascending ParabolaParameters.etaMin
// find the matching log10EMin value
auto it1 = std::lower_bound(parabolaParametersCollection_.begin(),
parabolaParametersCollection_.end(),
log10ClustE,
[](const EcalMustacheSCParameters::ParabolaParameters& params, const double var) {
return params.log10EMin < var;
});
if (it1 != parabolaParametersCollection_.begin()) {
--it1;
}

// find the matching log10EMin and etaMin entry going only up to the sets matching for log10ClustE
const auto vars = std::make_pair(it1->log10EMin, absSeedEta);
auto it2 = std::lower_bound(
parabolaParametersCollection_.begin(),
it1 + 1,
vars,
[](const EcalMustacheSCParameters::ParabolaParameters& params, const std::pair<double, double> vars) {
return params.log10EMin < vars.first || params.etaMin < vars.second;
});

return (it2 != parabolaParametersCollection_.begin()) ? &*(it2 - 1) : nullptr;
}

void EcalMustacheSCParameters::print(std::ostream& out) const {
out << "Mustache SC parameters:" << std::endl;
out << " sqrtLogClustETuning: " << sqrtLogClustETuning_ << std::endl;
out << " Parabola parameters are binned in " << parabolaParametersCollection_.size() << " (log10(E), |eta|) regions."
<< std::endl;
for (const auto& params : parabolaParametersCollection_) {
out << " Parameters for log10(E_min)=" << params.log10EMin << " and |eta_min|=" << params.etaMin << ":"
<< std::endl;

out << " pUp:" << std::endl;
for (size_t i = 0; i < params.pUp.size(); ++i) {
out << " [" << i << "]: " << params.pUp[i] << std::endl;
}

out << " pLow:" << std::endl;
for (size_t i = 0; i < params.pLow.size(); ++i) {
out << " [" << i << "]: " << params.pLow[i] << std::endl;
}

out << " w0Up:" << std::endl;
for (size_t i = 0; i < params.w0Up.size(); ++i) {
out << " [" << i << "]: " << params.w0Up[i] << std::endl;
}

out << " w1Up:" << std::endl;
for (size_t i = 0; i < params.w1Up.size(); ++i) {
out << " [" << i << "]: " << params.w1Up[i] << std::endl;
}

out << " w0Low:" << std::endl;
for (size_t i = 0; i < params.w0Low.size(); ++i) {
out << " [" << i << "]: " << params.w0Low[i] << std::endl;
}

out << " w1Low:" << std::endl;
for (size_t i = 0; i < params.w1Low.size(); ++i) {
out << " [" << i << "]: " << params.w1Low[i] << std::endl;
}
}
}
42 changes: 42 additions & 0 deletions CondFormats/EcalObjects/src/EcalSCDynamicDPhiParameters.cc
@@ -0,0 +1,42 @@
#include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"

const EcalSCDynamicDPhiParameters::DynamicDPhiParameters* EcalSCDynamicDPhiParameters::dynamicDPhiParameters(
double clustE, double absSeedEta) const {
// assume the collection is lexicographically sorted in ascending DynamicDPhiParams.eMin and ascending DynamicDPhiParams.etaMin
// find the matching eMin value
auto it1 = std::lower_bound(dynamicDPhiParametersCollection_.begin(),
dynamicDPhiParametersCollection_.end(),
clustE,
[](const EcalSCDynamicDPhiParameters::DynamicDPhiParameters& params, const double var) {
return params.eMin < var;
});
if (it1 != dynamicDPhiParametersCollection_.begin()) {
--it1;
}

// find the matching eMin and etaMin entry going only up to the sets matching for clustE
const auto vars = std::make_pair(it1->eMin, absSeedEta);
auto it2 = std::lower_bound(
dynamicDPhiParametersCollection_.begin(),
it1 + 1,
vars,
[](const EcalSCDynamicDPhiParameters::DynamicDPhiParameters& params, const std::pair<double, double> vars) {
return params.eMin < vars.first || params.etaMin < vars.second;
});

return (it2 != dynamicDPhiParametersCollection_.begin()) ? &*(it2 - 1) : nullptr;
}

void EcalSCDynamicDPhiParameters::print(std::ostream& out) const {
out << "SC dynamic dPhi parameters:" << std::endl;
out << " Parameters are binned in " << dynamicDPhiParametersCollection_.size() << " (E, |eta|) regions." << std::endl;
for (const auto& params : dynamicDPhiParametersCollection_) {
out << " Parameters for E_min=" << params.eMin << " and |eta_min|=" << params.etaMin << ":" << std::endl;
out << " yoffset: " << params.yoffset << std::endl;
out << " scale: " << params.scale << std::endl;
out << " xoffset: " << params.xoffset << std::endl;
out << " width: " << params.width << std::endl;
out << " saturation: " << params.saturation << std::endl;
out << " cutoff: " << params.cutoff << std::endl;
}
}
@@ -0,0 +1,5 @@
// user include files
#include "CondFormats/EcalObjects/interface/EcalMustacheSCParameters.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(EcalMustacheSCParameters);
@@ -0,0 +1,5 @@
// user include files
#include "CondFormats/EcalObjects/interface/EcalSCDynamicDPhiParameters.h"
#include "FWCore/Utilities/interface/typelookup.h"

TYPELOOKUP_DATA_REG(EcalSCDynamicDPhiParameters);