CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
AlignPCLThresholdsWriter Class Reference

#include <CondFormats/PCLConfig/plugins/AlignPCLThresholdsWriter.cc>

Inheritance diagram for AlignPCLThresholdsWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 AlignPCLThresholdsWriter (const edm::ParameterSet &)
 
 ~AlignPCLThresholdsWriter () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
DOFs::dof mapOntoEnum (std::string coord)
 

Private Attributes

const unsigned int m_minNrecords
 
const std::vector
< edm::ParameterSet
m_parameters
 
const std::string m_record
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: class to build the SiPixelAli PCL thresholds

Definition at line 40 of file AlignPCLThresholdsWriter.cc.

Constructor & Destructor Documentation

AlignPCLThresholdsWriter::AlignPCLThresholdsWriter ( const edm::ParameterSet iConfig)
explicit

Definition at line 60 of file AlignPCLThresholdsWriter.cc.

61  : m_record(iConfig.getParameter<std::string>("record")),
62  m_minNrecords(iConfig.getParameter<unsigned int>("minNRecords")),
63  m_parameters(iConfig.getParameter<std::vector<edm::ParameterSet> >("thresholds")) {}
const std::vector< edm::ParameterSet > m_parameters
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignPCLThresholdsWriter::~AlignPCLThresholdsWriter ( )
overridedefault

Member Function Documentation

void AlignPCLThresholdsWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 70 of file AlignPCLThresholdsWriter.cc.

References a, cond::service::PoolDBOutputService::currentTime(), spr::find(), m_minNrecords, m_parameters, m_record, mapOntoEnum(), AlignPCLThreshold::coordThresholds::setThresholds(), HLT_FULL_cff::sigCut, AlCaHLTBitMon_QueryRunRegistry::string, DOFs::thetaX, DOFs::thetaY, DOFs::thetaZ, DOFs::X, DOFs::Y, and DOFs::Z.

70  {
71  using namespace edm;
72 
73  // output object
74  AlignPCLThresholds myThresholds{};
75 
76  edm::LogInfo("AlignPCLThresholdsWriter") << "Size of AlignPCLThresholds object " << myThresholds.size() << std::endl;
77 
78  // loop on the PSet and insert the conditions
79  std::array<std::string, 6> mandatories = {{"X", "Y", "Z", "thetaX", "thetaY", "thetaZ"}};
80  std::vector<std::string> alignables;
81 
82  // fill the list of alignables
83  for (auto& thePSet : m_parameters) {
84  const std::string alignableId(thePSet.getParameter<std::string>("alignableId"));
85  // only if it is not yet in the list
86  if (std::find(alignables.begin(), alignables.end(), alignableId) == alignables.end()) {
87  alignables.push_back(alignableId);
88  }
89  }
90 
91  for (auto& alignable : alignables) {
98 
99  std::vector<std::string> presentDOF;
100 
101  // extra degrees of freedom
102  std::vector<AlignPCLThreshold::coordThresholds> extraDOFs = std::vector<AlignPCLThreshold::coordThresholds>();
103 
104  for (auto& thePSet : m_parameters) {
105  const std::string alignableId(thePSet.getParameter<std::string>("alignableId"));
106  const std::string DOF(thePSet.getParameter<std::string>("DOF"));
107 
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"));
112 
113  if (alignableId == alignable) {
114  presentDOF.push_back(DOF);
115  // create the objects
116 
117  switch (mapOntoEnum(DOF)) {
118  case DOFs::X:
119  my_X.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
120  break;
121  case DOFs::Y:
122  my_Y.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
123  break;
124  case DOFs::Z:
125  my_Z.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
126  break;
127  case DOFs::thetaX:
128  my_tX.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
129  break;
130  case DOFs::thetaY:
131  my_tY.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
132  break;
133  case DOFs::thetaZ:
134  my_tZ.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
135  break;
136  default:
137  edm::LogInfo("AlignPCLThresholdsWriter")
138  << "Appending Extra degree of freeedom: " << DOF << " " << mapOntoEnum(DOF) << std::endl;
140  ExtraDOF.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
141  extraDOFs.push_back(ExtraDOF);
142  }
143 
144  AlignPCLThreshold a(my_X, my_tX, my_Y, my_tY, my_Z, my_tZ, extraDOFs);
145  myThresholds.setAlignPCLThreshold(alignableId, a);
146 
147  } // if alignable is found in the PSet
148  } // loop on the PSets
149 
150  // checks if all mandatories are present
151  edm::LogInfo("AlignPCLThresholdsWriter")
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()) {
155  edm::LogWarning("AlignPCLThresholdsWriter")
156  << "Configuration for DOF: " << mandatory << " for alignable " << alignable << "is not present \n"
157  << "Will build object with defaults!" << std::endl;
158  }
159  }
160 
161  } // ends loop on the alignable units
162 
163  // set the minimum number of records to be used in pede
164  myThresholds.setNRecords(m_minNrecords);
165  edm::LogInfo("AlignPCLThresholdsWriter") << "Content of AlignPCLThresholds " << std::endl;
166 
167  // use buil-in method in the CondFormat
168  myThresholds.printAll();
169 
170  // Form the data here
172  if (poolDbService.isAvailable()) {
173  cond::Time_t valid_time = poolDbService->currentTime();
174  // this writes the payload to begin in current run defined in cfg
175  poolDbService->writeOneIOV(myThresholds, valid_time, m_record);
176  }
177 }
const std::vector< edm::ParameterSet > m_parameters
DOFs::dof mapOntoEnum(std::string coord)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned long long Time_t
Definition: Time.h:14
Log< level::Info, false > LogInfo
double a
Definition: hdecay.h:119
Log< level::Warning, false > LogWarning
void setThresholds(float theCut, float theSigCut, float theErrorCut, float theMaxMoveCut, const std::string &theLabel)
void AlignPCLThresholdsWriter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 198 of file AlignPCLThresholdsWriter.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, edm::ParameterSetDescription::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

198  {
200  desc.setComment("Plugin to write payloads of type AlignPCLThresholds");
201  desc.add<std::string>("record", "AlignPCLThresholdsRcd");
202  desc.add<unsigned int>("minNRecords", 25000);
203  edm::ParameterSetDescription desc_thresholds;
204 
205  desc_thresholds.add<std::string>("alignableId");
206  desc_thresholds.add<std::string>("DOF");
207  desc_thresholds.add<double>("cut");
208  desc_thresholds.add<double>("sigCut");
209  desc_thresholds.add<double>("maxMoveCut");
210  desc_thresholds.add<double>("maxErrorCut");
211 
212  std::vector<edm::ParameterSet> default_thresholds(1);
213  desc.addVPSet("thresholds", desc_thresholds, default_thresholds);
214  descriptions.addWithDefaultLabel(desc);
215 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum ( std::string  coord)
private

Definition at line 179 of file AlignPCLThresholdsWriter.cc.

References DOFs::extraDOF, DOFs::thetaX, DOFs::thetaY, DOFs::thetaZ, DOFs::X, DOFs::Y, and DOFs::Z.

Referenced by analyze().

179  {
180  if (coord == "X") {
181  return DOFs::X;
182  } else if (coord == "Y") {
183  return DOFs::Y;
184  } else if (coord == "Z") {
185  return DOFs::Z;
186  } else if (coord == "thetaX") {
187  return DOFs::thetaX;
188  } else if (coord == "thetaY") {
189  return DOFs::thetaY;
190  } else if (coord == "thetaZ") {
191  return DOFs::thetaZ;
192  } else {
193  return DOFs::extraDOF;
194  }
195 }

Member Data Documentation

const unsigned int AlignPCLThresholdsWriter::m_minNrecords
private

Definition at line 53 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().

const std::vector<edm::ParameterSet> AlignPCLThresholdsWriter::m_parameters
private

Definition at line 54 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().

const std::string AlignPCLThresholdsWriter::m_record
private

Definition at line 52 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().