59 void endJob()
override;
74 m_record(iConfig.getParameter<
std::
string>(
"record")),
75 m_minNrecords(iConfig.getParameter<unsigned
int>(
"minNRecords")),
102 std::array<std::string,6> mandatories = {{
"X",
"Y",
"Z",
"thetaX",
"thetaY",
"thetaZ"}};
103 std::vector<std::string> alignables;
109 if(
std::find(alignables.begin(), alignables.end(), alignableId) == alignables.end()) {
110 alignables.push_back(alignableId);
114 for (
auto& alignable : alignables){
123 std::vector<std::string> presentDOF;
126 std::vector< AlignPCLThreshold::coordThresholds > extraDOFs = std::vector< AlignPCLThreshold::coordThresholds >();
128 for(
auto& thePSet : m_parameters){
133 const double cutoff(thePSet.getParameter<
double>(
"cut"));
134 const double sigCut(thePSet.getParameter<
double>(
"sigCut"));
135 const double maxMoveCut(thePSet.getParameter<
double>(
"maxMoveCut"));
136 const double maxErrorCut(thePSet.getParameter<
double>(
"maxErrorCut"));
138 if (alignableId == alignable){
139 presentDOF.push_back(DOF);
145 my_X.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
148 my_Y.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
151 my_Z.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
154 my_tX.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
157 my_tY.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
160 my_tZ.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
163 edm::LogInfo(
"AlignPCLThresholdsWriter")<<
"Appending Extra degree of freeedom: "<< DOF <<
" " <<
mapOntoEnum(DOF) << std::endl;
165 ExtraDOF.
setThresholds(cutoff,sigCut,maxErrorCut,maxMoveCut,DOF);
166 extraDOFs.push_back(ExtraDOF);
177 for(
auto& mandatory : mandatories){
178 if(
std::find(presentDOF.begin(), presentDOF.end(), mandatory) == presentDOF.end()) {
179 edm::LogWarning(
"AlignPCLThresholdsWriter")<<
"Configuration for DOF: "<<mandatory<<
" for alignable "<< alignable <<
"is not present \n" 180 <<
"Will build object with defaults!" <<std::endl;
188 edm::LogInfo(
"AlignPCLThresholdsWriter")<<
"Content of AlignPCLThresholds "<<std::endl;
218 else if ( coord==
"Y" ){
221 else if ( coord==
"Z" ){
224 else if ( coord==
"thetaX" ){
227 else if ( coord==
"thetaY" ){
230 else if ( coord==
"thetaZ" ){
void setAlignPCLThreshold(const std::string &AlignableId, const AlignPCLThreshold &Threshold)
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
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
~AlignPCLThresholdsWriter() override
unsigned long long Time_t
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void setNRecords(const int &Nrecords)
const std::string m_record
cond::Time_t currentTime() const
AlignPCLThresholds * myThresholds
void setThresholds(float theCut, float theSigCut, float theErrorCut, float theMaxMoveCut, const std::string &theLabel)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)