CMS 3D CMS Logo

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
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
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
 
void beginJob () override
 
void endJob () override
 
DOFs::dof mapOntoEnum (std::string coord)
 

Private Attributes

const unsigned int m_minNrecords
 
const std::vector< edm::ParameterSetm_parameters
 
const std::string m_record
 
AlignPCLThresholdsmyThresholds
 

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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: class to build the SiPixelAli PCL thresholds

Definition at line 40 of file AlignPCLThresholdsWriter.cc.

Constructor & Destructor Documentation

◆ AlignPCLThresholdsWriter()

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

Definition at line 63 of file AlignPCLThresholdsWriter.cc.

64  : m_record(iConfig.getParameter<std::string>("record")),
65  m_minNrecords(iConfig.getParameter<unsigned int>("minNRecords")),
66  m_parameters(iConfig.getParameter<std::vector<edm::ParameterSet> >("thresholds")) {
67  //now do what ever initialization is needed
69 }

References myThresholds.

◆ ~AlignPCLThresholdsWriter()

AlignPCLThresholdsWriter::~AlignPCLThresholdsWriter ( )
override

Definition at line 71 of file AlignPCLThresholdsWriter.cc.

71 { delete myThresholds; }

References myThresholds.

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 78 of file AlignPCLThresholdsWriter.cc.

78  {
79  using namespace edm;
80 
81  edm::LogInfo("AlignPCLThresholdsWriter") << "Size of AlignPCLThresholds object " << myThresholds->size() << std::endl
82  << std::endl;
83 
84  // loop on the PSet and insert the conditions
85 
86  std::array<std::string, 6> mandatories = {{"X", "Y", "Z", "thetaX", "thetaY", "thetaZ"}};
87  std::vector<std::string> alignables;
88 
89  // fill the list of alignables
90  for (auto& thePSet : m_parameters) {
91  const std::string alignableId(thePSet.getParameter<std::string>("alignableId"));
92  // only if it is not yet in the list
93  if (std::find(alignables.begin(), alignables.end(), alignableId) == alignables.end()) {
94  alignables.push_back(alignableId);
95  }
96  }
97 
98  for (auto& alignable : alignables) {
105 
106  std::vector<std::string> presentDOF;
107 
108  // extra degrees of freedom
109  std::vector<AlignPCLThreshold::coordThresholds> extraDOFs = std::vector<AlignPCLThreshold::coordThresholds>();
110 
111  for (auto& thePSet : m_parameters) {
112  const std::string alignableId(thePSet.getParameter<std::string>("alignableId"));
113  const std::string DOF(thePSet.getParameter<std::string>("DOF"));
114 
115  const double cutoff(thePSet.getParameter<double>("cut"));
116  const double sigCut(thePSet.getParameter<double>("sigCut"));
117  const double maxMoveCut(thePSet.getParameter<double>("maxMoveCut"));
118  const double maxErrorCut(thePSet.getParameter<double>("maxErrorCut"));
119 
120  if (alignableId == alignable) {
121  presentDOF.push_back(DOF);
122  // create the objects
123 
124  switch (mapOntoEnum(DOF)) {
125  case DOFs::X:
126  my_X.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
127  break;
128  case DOFs::Y:
129  my_Y.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
130  break;
131  case DOFs::Z:
132  my_Z.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
133  break;
134  case DOFs::thetaX:
135  my_tX.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
136  break;
137  case DOFs::thetaY:
138  my_tY.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
139  break;
140  case DOFs::thetaZ:
141  my_tZ.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
142  break;
143  default:
144  edm::LogInfo("AlignPCLThresholdsWriter")
145  << "Appending Extra degree of freeedom: " << DOF << " " << mapOntoEnum(DOF) << std::endl;
147  ExtraDOF.setThresholds(cutoff, sigCut, maxErrorCut, maxMoveCut, DOF);
148  extraDOFs.push_back(ExtraDOF);
149  }
150 
151  AlignPCLThreshold a(my_X, my_tX, my_Y, my_tY, my_Z, my_tZ, extraDOFs);
152  myThresholds->setAlignPCLThreshold(alignableId, a);
153 
154  } // if alignable is found in the PSet
155  } // loop on the PSets
156 
157  // checks if all mandatories are present
158  edm::LogInfo("AlignPCLThresholdsWriter")
159  << "Size of AlignPCLThresholds object " << myThresholds->size() << std::endl;
160  for (auto& mandatory : mandatories) {
161  if (std::find(presentDOF.begin(), presentDOF.end(), mandatory) == presentDOF.end()) {
162  edm::LogWarning("AlignPCLThresholdsWriter")
163  << "Configuration for DOF: " << mandatory << " for alignable " << alignable << "is not present \n"
164  << "Will build object with defaults!" << std::endl;
165  }
166  }
167 
168  } // ends loop on the alignable units
169 
170  // set the minimum number of records to be used in pede
172  edm::LogInfo("AlignPCLThresholdsWriter") << "Content of AlignPCLThresholds " << std::endl;
173 
174  // use buil-in method in the CondFormat
176 
177  // Form the data here
179  if (poolDbService.isAvailable()) {
180  cond::Time_t valid_time = poolDbService->currentTime();
181  // this writes the payload to begin in current run defined in cfg
182  poolDbService->writeOne(myThresholds, valid_time, m_record);
183  }
184 }

References a, cond::service::PoolDBOutputService::currentTime(), qjetsadder_cfi::cutoff, spr::find(), edm::Service< T >::isAvailable(), m_minNrecords, m_parameters, m_record, mapOntoEnum(), myThresholds, AlignPCLThresholds::printAll(), AlignPCLThresholds::setAlignPCLThreshold(), AlignPCLThresholds::setNRecords(), AlignPCLThreshold::coordThresholds::setThresholds(), HLT_2018_cff::sigCut, AlignPCLThresholds::size(), AlCaHLTBitMon_QueryRunRegistry::string, DOFs::thetaX, DOFs::thetaY, DOFs::thetaZ, cond::service::PoolDBOutputService::writeOne(), DOFs::X, DOFs::Y, and DOFs::Z.

◆ beginJob()

void AlignPCLThresholdsWriter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 187 of file AlignPCLThresholdsWriter.cc.

187 {}

◆ endJob()

void AlignPCLThresholdsWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 190 of file AlignPCLThresholdsWriter.cc.

190 {}

◆ fillDescriptions()

void AlignPCLThresholdsWriter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 211 of file AlignPCLThresholdsWriter.cc.

211  {
213  desc.setUnknown();
214  descriptions.addDefault(desc);
215 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ mapOntoEnum()

DOFs::dof AlignPCLThresholdsWriter::mapOntoEnum ( std::string  coord)
private

Definition at line 192 of file AlignPCLThresholdsWriter.cc.

192  {
193  if (coord == "X") {
194  return DOFs::X;
195  } else if (coord == "Y") {
196  return DOFs::Y;
197  } else if (coord == "Z") {
198  return DOFs::Z;
199  } else if (coord == "thetaX") {
200  return DOFs::thetaX;
201  } else if (coord == "thetaY") {
202  return DOFs::thetaY;
203  } else if (coord == "thetaZ") {
204  return DOFs::thetaZ;
205  } else {
206  return DOFs::extraDOF;
207  }
208 }

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

Referenced by analyze().

Member Data Documentation

◆ m_minNrecords

const unsigned int AlignPCLThresholdsWriter::m_minNrecords
private

Definition at line 55 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().

◆ m_parameters

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

Definition at line 56 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().

◆ m_record

const std::string AlignPCLThresholdsWriter::m_record
private

Definition at line 54 of file AlignPCLThresholdsWriter.cc.

Referenced by analyze().

◆ myThresholds

AlignPCLThresholds* AlignPCLThresholdsWriter::myThresholds
private
AlignPCLThresholdsWriter::m_minNrecords
const unsigned int m_minNrecords
Definition: AlignPCLThresholdsWriter.cc:55
AlignPCLThresholds::printAll
void printAll() const
Definition: AlignPCLThresholds.cc:182
qjetsadder_cfi.cutoff
cutoff
Definition: qjetsadder_cfi.py:11
edm
HLT enums.
Definition: AlignableModifier.h:19
AlignPCLThreshold
Definition: AlignPCLThreshold.h:6
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
AlignPCLThresholds::setNRecords
void setNRecords(const int &Nrecords)
Definition: AlignPCLThresholds.cc:20
AlignPCLThresholds
Definition: AlignPCLThresholds.h:11
AlignPCLThresholdsWriter::myThresholds
AlignPCLThresholds * myThresholds
Definition: AlignPCLThresholdsWriter.cc:57
AlignPCLThresholdsWriter::m_record
const std::string m_record
Definition: AlignPCLThresholdsWriter.cc:54
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
AlignPCLThresholdsWriter::mapOntoEnum
DOFs::dof mapOntoEnum(std::string coord)
Definition: AlignPCLThresholdsWriter.cc:192
DOFs::extraDOF
Definition: AlignPCLThresholdsWriter.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
AlignPCLThresholds::setAlignPCLThreshold
void setAlignPCLThreshold(const std::string &AlignableId, const AlignPCLThreshold &Threshold)
Definition: AlignPCLThresholds.cc:9
a
double a
Definition: hdecay.h:119
DOFs::X
Definition: AlignPCLThresholdsWriter.cc:37
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
DOFs::Z
Definition: AlignPCLThresholdsWriter.cc:37
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
DOFs::thetaY
Definition: AlignPCLThresholdsWriter.cc:37
AlignPCLThresholds::size
double size() const
Definition: AlignPCLThresholds.h:43
AlignPCLThresholdsWriter::m_parameters
const std::vector< edm::ParameterSet > m_parameters
Definition: AlignPCLThresholdsWriter.cc:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DOFs::thetaX
Definition: AlignPCLThresholdsWriter.cc:37
AlignPCLThreshold::coordThresholds
Definition: AlignPCLThreshold.h:8
DOFs::Y
Definition: AlignPCLThresholdsWriter.cc:37
DOFs::thetaZ
Definition: AlignPCLThresholdsWriter.cc:37
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:57
HLT_2018_cff.sigCut
sigCut
Definition: HLT_2018_cff.py:50439
AlignPCLThreshold::coordThresholds::setThresholds
void setThresholds(float theCut, float theSigCut, float theErrorCut, float theMaxMoveCut, const std::string &theLabel)
Definition: AlignPCLThreshold.h:17
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189