61 : m_record(iConfig.getParameter<std::
string>(
"record")),
62 m_minNrecords(iConfig.getParameter<unsigned int>(
"minNRecords")),
76 edm::LogInfo(
"AlignPCLThresholdsWriter") <<
"Size of AlignPCLThresholds object " << myThresholds.size() << std::endl;
79 std::array<std::string, 6> mandatories = {{
"X",
"Y",
"Z",
"thetaX",
"thetaY",
"thetaZ"}};
80 std::vector<std::string> alignables;
86 if (
std::find(alignables.begin(), alignables.end(), alignableId) == alignables.end()) {
87 alignables.push_back(alignableId);
91 for (
auto& alignable : alignables) {
99 std::vector<std::string> presentDOF;
102 std::vector<AlignPCLThreshold::coordThresholds> extraDOFs = std::vector<AlignPCLThreshold::coordThresholds>();
104 for (
auto& thePSet : m_parameters) {
108 const double cutoff(thePSet.getParameter<
double>(
"cut"));
109 const double sigCut(thePSet.getParameter<
double>(
"sigCut"));
110 const double maxMoveCut(thePSet.getParameter<
double>(
"maxMoveCut"));
111 const double maxErrorCut(thePSet.getParameter<
double>(
"maxErrorCut"));
113 if (alignableId == alignable) {
114 presentDOF.push_back(DOF);
119 my_X.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
122 my_Y.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
125 my_Z.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
128 my_tX.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
131 my_tY.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
134 my_tZ.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
138 <<
"Appending Extra degree of freeedom: " << DOF <<
" " <<
mapOntoEnum(DOF) << std::endl;
140 ExtraDOF.
setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
141 extraDOFs.push_back(ExtraDOF);
145 myThresholds.setAlignPCLThreshold(alignableId, a);
152 <<
"Size of AlignPCLThresholds object " << myThresholds.size() << std::endl;
153 for (
auto& mandatory : mandatories) {
154 if (
std::find(presentDOF.begin(), presentDOF.end(), mandatory) == presentDOF.end()) {
156 <<
"Configuration for DOF: " << mandatory <<
" for alignable " << alignable <<
"is not present \n"
157 <<
"Will build object with defaults!" << std::endl;
165 edm::LogInfo(
"AlignPCLThresholdsWriter") <<
"Content of AlignPCLThresholds " << std::endl;
168 myThresholds.printAll();
172 if (poolDbService.isAvailable()) {
175 poolDbService->writeOneIOV(myThresholds, valid_time,
m_record);
182 }
else if (coord ==
"Y") {
184 }
else if (coord ==
"Z") {
186 }
else if (coord ==
"thetaX") {
188 }
else if (coord ==
"thetaY") {
190 }
else if (coord ==
"thetaZ") {
200 desc.
setComment(
"Plugin to write payloads of type AlignPCLThresholds");
202 desc.
add<
unsigned int>(
"minNRecords", 25000);
207 desc_thresholds.add<
double>(
"cut");
208 desc_thresholds.add<
double>(
"sigCut");
209 desc_thresholds.add<
double>(
"maxMoveCut");
210 desc_thresholds.add<
double>(
"maxErrorCut");
212 std::vector<edm::ParameterSet> default_thresholds(1);
213 desc.
addVPSet(
"thresholds", desc_thresholds, default_thresholds);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
const std::vector< edm::ParameterSet > m_parameters
DOFs::dof mapOntoEnum(std::string coord)
const unsigned int m_minNrecords
#define DEFINE_FWK_MODULE(type)
AlignPCLThresholdsWriter(const edm::ParameterSet &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void analyze(const edm::Event &, const edm::EventSetup &) override
void setComment(std::string const &value)
unsigned long long Time_t
~AlignPCLThresholdsWriter() override=default
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
const std::string m_record
cond::Time_t currentTime() const
Log< level::Warning, false > LogWarning
void setThresholds(float theCut, float theSigCut, float theErrorCut, float theMaxMoveCut, const std::string &theLabel)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)