CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripApvSimulationParametersESSource Class Reference
Inheritance diagram for SiStripApvSimulationParametersESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

std::unique_ptr< SiStripApvSimulationParametersproduce (const SiStripApvSimulationParametersRcd &record)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
 
 SiStripApvSimulationParametersESSource (const edm::ParameterSet &conf)
 
 ~SiStripApvSimulationParametersESSource () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Member Functions

SiStripApvSimulationParameters::LayerParameters makeLayerParameters (const std::string &apvBaselinesFileName, const std::vector< float > &rzBinEdges) const
 

Private Attributes

float baseline_max_
 
float baseline_min_
 
unsigned int baseline_nBins_
 
std::vector< edm::FileInPathbaselineFiles_TEC_
 
std::vector< edm::FileInPathbaselineFiles_TIB_
 
std::vector< edm::FileInPathbaselineFiles_TID_
 
std::vector< edm::FileInPathbaselineFiles_TOB_
 
std::vector< float > puBinEdges_
 
std::vector< float > rBinEdgesTEC_
 
std::vector< float > rBinEdgesTID_
 
std::vector< float > zBinEdges_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Definition at line 10 of file SiStripApvSimulationParametersESProducer.cc.

Constructor & Destructor Documentation

◆ SiStripApvSimulationParametersESSource()

SiStripApvSimulationParametersESSource::SiStripApvSimulationParametersESSource ( const edm::ParameterSet conf)
explicit

Definition at line 38 of file SiStripApvSimulationParametersESProducer.cc.

39  : baseline_nBins_(conf.getUntrackedParameter<unsigned int>("apvBaselines_nBinsPerBaseline")),
40  baseline_min_(conf.getUntrackedParameter<double>("apvBaselines_minBaseline")),
41  baseline_max_(conf.getUntrackedParameter<double>("apvBaselines_maxBaseline")) {
42  setWhatProduced(this);
43  findingRecord<SiStripApvSimulationParametersRcd>();
44  for (const auto x : conf.getUntrackedParameter<std::vector<double>>("apvBaselines_puBinEdges")) {
45  puBinEdges_.push_back(x);
46  }
47  for (const auto x : conf.getUntrackedParameter<std::vector<double>>("apvBaselines_zBinEdges")) {
48  zBinEdges_.push_back(x);
49  }
50  for (const auto x : conf.getUntrackedParameter<std::vector<double>>("apvBaselines_rBinEdges_TID")) {
51  rBinEdgesTID_.push_back(x);
52  }
53  for (const auto x : conf.getUntrackedParameter<std::vector<double>>("apvBaselines_rBinEdges_TEC")) {
54  rBinEdgesTEC_.push_back(x);
55  }
56  baselineFiles_TIB_ = {conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tib1"),
57  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tib2"),
58  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tib3"),
59  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tib4")};
60  baselineFiles_TOB_ = {conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob1"),
61  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob2"),
62  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob3"),
63  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob4"),
64  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob5"),
65  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tob6")};
66 
67  if (!rBinEdgesTID_.empty()) {
68  baselineFiles_TID_ = {conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tid1"),
69  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tid2"),
70  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tid3")};
71  }
72 
73  if (!rBinEdgesTEC_.empty()) {
74  baselineFiles_TEC_ = {conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec1"),
75  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec2"),
76  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec3"),
77  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec4"),
78  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec5"),
79  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec6"),
80  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec7"),
81  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec8"),
82  conf.getUntrackedParameter<edm::FileInPath>("apvBaselinesFile_tec9")};
83  }
84 }

References baselineFiles_TEC_, baselineFiles_TIB_, baselineFiles_TID_, baselineFiles_TOB_, edm::ParameterSet::getUntrackedParameter(), puBinEdges_, rBinEdgesTEC_, rBinEdgesTID_, edm::ESProducer::setWhatProduced(), x, and zBinEdges_.

◆ ~SiStripApvSimulationParametersESSource()

SiStripApvSimulationParametersESSource::~SiStripApvSimulationParametersESSource ( )
inlineoverride

Definition at line 13 of file SiStripApvSimulationParametersESProducer.cc.

13 {}

Member Function Documentation

◆ makeLayerParameters()

SiStripApvSimulationParameters::LayerParameters SiStripApvSimulationParametersESSource::makeLayerParameters ( const std::string &  apvBaselinesFileName,
const std::vector< float > &  rzBinEdges 
) const
private

Definition at line 92 of file SiStripApvSimulationParametersESProducer.cc.

93  {
94  // Prepare histograms
95  unsigned int nZBins = rzBinEdges.size();
96  unsigned int nPUBins = puBinEdges_.size();
97 
98  if (nPUBins == 0 || nZBins == 0 || baseline_nBins_ == 0) {
99  throw cms::Exception("MissingInput") << "The parameters for the APV simulation are not correctly configured\n";
100  }
101  std::vector<float> baselineBinEdges{};
102  const auto baseline_binWidth = (baseline_max_ - baseline_min_) / baseline_nBins_;
103  for (unsigned i{0}; i != baseline_nBins_; ++i) {
104  baselineBinEdges.push_back(baseline_min_ + i * baseline_binWidth);
105  }
106  baselineBinEdges.push_back(baseline_max_);
107 
108  SiStripApvSimulationParameters::LayerParameters layerParams{baselineBinEdges, puBinEdges_, rzBinEdges};
109 
110  // Read apv baselines from text files
111  std::vector<double> theAPVBaselines;
112  std::ifstream apvBaselineFile(apvBaselinesFileName.c_str());
113  if (!apvBaselineFile.good()) {
114  throw cms::Exception("FileError") << "Problem opening APV baselines file: " << apvBaselinesFileName;
115  }
117  while (std::getline(apvBaselineFile, line)) {
118  if (!line.empty()) {
119  std::istringstream lStr{line};
120  double value;
121  while (lStr >> value) {
122  theAPVBaselines.push_back(value);
123  }
124  }
125  }
126  if (theAPVBaselines.empty()) {
127  throw cms::Exception("WrongAPVBaselines")
128  << "Problem reading from APV baselines file " << apvBaselinesFileName << ": no values read in";
129  }
130 
131  if (theAPVBaselines.size() != nZBins * nPUBins * baseline_nBins_) {
132  throw cms::Exception("WrongAPVBaselines") << "Problem reading from APV baselines file " << apvBaselinesFileName
133  << ": number of baselines read different to that expected i.e. nZBins * "
134  "nPUBins * apvBaselines_nBinsPerBaseline_";
135  }
136 
137  // Put baselines into histograms
138  for (auto const& apvBaseline : theAPVBaselines | boost::adaptors::indexed(0)) {
139  unsigned int binInCurrentHistogram = apvBaseline.index() % baseline_nBins_ + 1;
140  unsigned int binInZ = int(apvBaseline.index()) / (nPUBins * baseline_nBins_);
141  unsigned int binInPU = int(apvBaseline.index() - binInZ * (nPUBins)*baseline_nBins_) / baseline_nBins_;
142 
143  layerParams.setBinContent(binInCurrentHistogram, binInPU + 1, binInZ + 1, apvBaseline.value());
144  }
145 
146  return layerParams;
147 }

References baseline_max_, baseline_min_, baseline_nBins_, Exception, mps_fire::i, createfilelist::int, mps_splice::line, puBinEdges_, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by produce().

◆ produce()

std::unique_ptr< SiStripApvSimulationParameters > SiStripApvSimulationParametersESSource::produce ( const SiStripApvSimulationParametersRcd record)

Definition at line 149 of file SiStripApvSimulationParametersESProducer.cc.

150  {
151  auto apvSimParams = std::make_unique<SiStripApvSimulationParameters>(
153  for (unsigned int i{0}; i != baselineFiles_TIB_.size(); ++i) {
154  if (!apvSimParams->putTIB(i + 1, makeLayerParameters(baselineFiles_TIB_[i].fullPath(), zBinEdges_))) {
155  throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TIB layer " << (i + 1);
156  } else {
157  LogDebug("SiStripApvSimulationParameters") << "Added parameters for TIB layer " << (i + 1);
158  }
159  }
160  for (unsigned int i{0}; i != baselineFiles_TOB_.size(); ++i) {
161  if (!apvSimParams->putTOB(i + 1, makeLayerParameters(baselineFiles_TOB_[i].fullPath(), zBinEdges_))) {
162  throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TOB layer " << (i + 1);
163  } else {
164  LogDebug("SiStripApvSimulationParameters") << "Added parameters for TOB layer " << (i + 1);
165  }
166  }
167  for (unsigned int i{0}; i != baselineFiles_TID_.size(); ++i) {
168  if (!apvSimParams->putTID(i + 1, makeLayerParameters(baselineFiles_TID_[i].fullPath(), rBinEdgesTID_))) {
169  throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TID wheel " << (i + 1);
170  } else {
171  LogDebug("SiStripApvSimulationParameters") << "Added parameters for TID wheel " << (i + 1);
172  }
173  }
174  for (unsigned int i{0}; i != baselineFiles_TEC_.size(); ++i) {
175  if (!apvSimParams->putTEC(i + 1, makeLayerParameters(baselineFiles_TEC_[i].fullPath(), rBinEdgesTEC_))) {
176  throw cms::Exception("SiStripApvSimulationParameters") << "Could not add parameters for TEC wheel " << (i + 1);
177  } else {
178  LogDebug("SiStripApvSimulationParameters") << "Added parameters for TEC wheel " << (i + 1);
179  }
180  }
181  return apvSimParams;
182 }

References baselineFiles_TEC_, baselineFiles_TIB_, baselineFiles_TID_, baselineFiles_TOB_, Exception, contentValuesFiles::fullPath, mps_fire::i, LogDebug, makeLayerParameters(), rBinEdgesTEC_, rBinEdgesTID_, and zBinEdges_.

◆ setIntervalFor()

void SiStripApvSimulationParametersESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
overridevirtual

Member Data Documentation

◆ baseline_max_

float SiStripApvSimulationParametersESSource::baseline_max_
private

Definition at line 28 of file SiStripApvSimulationParametersESProducer.cc.

Referenced by makeLayerParameters().

◆ baseline_min_

float SiStripApvSimulationParametersESSource::baseline_min_
private

Definition at line 27 of file SiStripApvSimulationParametersESProducer.cc.

Referenced by makeLayerParameters().

◆ baseline_nBins_

unsigned int SiStripApvSimulationParametersESSource::baseline_nBins_
private

Definition at line 26 of file SiStripApvSimulationParametersESProducer.cc.

Referenced by makeLayerParameters().

◆ baselineFiles_TEC_

std::vector<edm::FileInPath> SiStripApvSimulationParametersESSource::baselineFiles_TEC_
private

◆ baselineFiles_TIB_

std::vector<edm::FileInPath> SiStripApvSimulationParametersESSource::baselineFiles_TIB_
private

◆ baselineFiles_TID_

std::vector<edm::FileInPath> SiStripApvSimulationParametersESSource::baselineFiles_TID_
private

◆ baselineFiles_TOB_

std::vector<edm::FileInPath> SiStripApvSimulationParametersESSource::baselineFiles_TOB_
private

◆ puBinEdges_

std::vector<float> SiStripApvSimulationParametersESSource::puBinEdges_
private

◆ rBinEdgesTEC_

std::vector<float> SiStripApvSimulationParametersESSource::rBinEdgesTEC_
private

◆ rBinEdgesTID_

std::vector<float> SiStripApvSimulationParametersESSource::rBinEdgesTID_
private

◆ zBinEdges_

std::vector<float> SiStripApvSimulationParametersESSource::zBinEdges_
private
SiStripApvSimulationParametersESSource::baseline_min_
float baseline_min_
Definition: SiStripApvSimulationParametersESProducer.cc:27
mps_fire.i
i
Definition: mps_fire.py:428
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
SiStripApvSimulationParametersESSource::baselineFiles_TID_
std::vector< edm::FileInPath > baselineFiles_TID_
Definition: SiStripApvSimulationParametersESProducer.cc:24
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
SiStripApvSimulationParametersESSource::rBinEdgesTID_
std::vector< float > rBinEdgesTID_
Definition: SiStripApvSimulationParametersESProducer.cc:31
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
SiStripApvSimulationParametersESSource::baselineFiles_TIB_
std::vector< edm::FileInPath > baselineFiles_TIB_
Definition: SiStripApvSimulationParametersESProducer.cc:23
SiStripApvSimulationParametersESSource::baseline_nBins_
unsigned int baseline_nBins_
Definition: SiStripApvSimulationParametersESProducer.cc:26
edm::FileInPath
Definition: FileInPath.h:61
SiStripApvSimulationParametersESSource::zBinEdges_
std::vector< float > zBinEdges_
Definition: SiStripApvSimulationParametersESProducer.cc:30
SiStripApvSimulationParametersESSource::baselineFiles_TOB_
std::vector< edm::FileInPath > baselineFiles_TOB_
Definition: SiStripApvSimulationParametersESProducer.cc:22
SiStripApvSimulationParametersESSource::baselineFiles_TEC_
std::vector< edm::FileInPath > baselineFiles_TEC_
Definition: SiStripApvSimulationParametersESProducer.cc:25
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripApvSimulationParametersESSource::rBinEdgesTEC_
std::vector< float > rBinEdgesTEC_
Definition: SiStripApvSimulationParametersESProducer.cc:32
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
SiStripApvSimulationParametersESSource::puBinEdges_
std::vector< float > puBinEdges_
Definition: SiStripApvSimulationParametersESProducer.cc:29
SiStripApvSimulationParametersESSource::makeLayerParameters
SiStripApvSimulationParameters::LayerParameters makeLayerParameters(const std::string &apvBaselinesFileName, const std::vector< float > &rzBinEdges) const
Definition: SiStripApvSimulationParametersESProducer.cc:92
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
PhysicsTools::Calibration::Histogram3D
Definition: Histogram3D.h:24
mps_splice.line
line
Definition: mps_splice.py:76
SiStripApvSimulationParametersESSource::baseline_max_
float baseline_max_
Definition: SiStripApvSimulationParametersESProducer.cc:28