CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
SiPixelFakeTemplateDBObjectESSource Class Reference

#include <SiPixelFakeTemplateDBObjectESSource.h>

Inheritance diagram for SiPixelFakeTemplateDBObjectESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::vector< std::string > vstring
 

Public Member Functions

virtual std::unique_ptr< SiPixelTemplateDBObjectproduce (const SiPixelTemplateDBObjectRcd &)
 
 SiPixelFakeTemplateDBObjectESSource (const edm::ParameterSet &)
 
 ~SiPixelFakeTemplateDBObjectESSource () 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)
 

Protected Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *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 >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&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 &)
 

Private Attributes

vstring templateCalibrations_
 
float version_
 

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 > >>
 

Detailed Description

Definition at line 12 of file SiPixelFakeTemplateDBObjectESSource.h.

Member Typedef Documentation

◆ vstring

typedef std::vector<std::string> SiPixelFakeTemplateDBObjectESSource::vstring

Definition at line 17 of file SiPixelFakeTemplateDBObjectESSource.h.

Constructor & Destructor Documentation

◆ SiPixelFakeTemplateDBObjectESSource()

SiPixelFakeTemplateDBObjectESSource::SiPixelFakeTemplateDBObjectESSource ( const edm::ParameterSet conf_)

Definition at line 5 of file SiPixelFakeTemplateDBObjectESSource.cc.

References edm::ESProducer::setWhatProduced().

6  : templateCalibrations_(conf_.getParameter<vstring>("siPixelTemplateCalibrations")),
7  version_(conf_.getParameter<double>("Version")) {
8  edm::LogInfo("SiPixelFakeTemplateDBObjectESSource::SiPixelFakeTemplateDBObjectESSource");
9  //the following line is needed to tell the framework what
10  // data is being produced
11  setWhatProduced(this);
12  findingRecord<SiPixelTemplateDBObjectRcd>();
13 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
vector< string > vstring
Definition: ExoticaDQM.cc:8
Log< level::Info, false > LogInfo

◆ ~SiPixelFakeTemplateDBObjectESSource()

SiPixelFakeTemplateDBObjectESSource::~SiPixelFakeTemplateDBObjectESSource ( )
override

Definition at line 15 of file SiPixelFakeTemplateDBObjectESSource.cc.

15 {}

Member Function Documentation

◆ produce()

std::unique_ptr< SiPixelTemplateDBObject > SiPixelFakeTemplateDBObjectESSource::produce ( const SiPixelTemplateDBObjectRcd )
virtual

Definition at line 17 of file SiPixelFakeTemplateDBObjectESSource.cc.

References c, geometryDiff::file, recoMuon::in, runGCPTkAlMap::in_file, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, getGTfromDQMFile::obj, groupFilesInBlocks::temp, templateCalibrations_, and version_.

18  {
19  using namespace edm::es;
20 
21  //Mostly copied from CondTools/SiPixel/test/SiPixelTemplateDBObjectUploader.cc
22  //--- Make the POOL-ORA object to store the database object
24 
25  // Local variables
26  const char* tempfile;
27  int m;
28 
29  // Set the number of templates to be passed to the dbobject
30  obj->setNumOfTempl(templateCalibrations_.size());
31 
32  // Set the version of the template dbobject - this is an external parameter
33  obj->setVersion(version_);
34 
35  // open the template file(s)
36  for (m = 0; m < obj->numOfTempl(); ++m) {
38  tempfile = (file.fullPath()).c_str();
39 
40  std::ifstream in_file(tempfile, std::ios::in);
41 
42  if (in_file.is_open()) {
43  edm::LogInfo("SiPixelFakeTemplateDBObjectESSource")
44  << "Opened Template File: " << file.fullPath().c_str() << std::endl;
45 
46  // Local variables
47  char title_char[80], c;
49  float tempstore;
50  unsigned int iter;
51 
52  // Templates contain a header char - we must be clever about storing this
53  for (iter = 0; (c = in_file.get()) != '\n' && iter < 79; ++iter) {
54  title_char[iter] = c;
55  }
56  if (iter == 79) {
57  title_char[iter] = '\n';
58  } else {
59  unsigned int ilast = 3 - (iter % 4);
60  for (unsigned int it = 0; it != ilast; it++) {
61  title_char[iter] = ' ';
62  iter++;
63  }
64  title_char[iter] = '\n';
65  }
66 
67  for (unsigned int j = 0; j <= iter; j += 4) {
68  temp.c[0] = title_char[j];
69  temp.c[1] = title_char[j + 1];
70  temp.c[2] = title_char[j + 2];
71  temp.c[3] = title_char[j + 3];
72  obj->push_back(temp.f);
73  obj->setMaxIndex(obj->maxIndex() + 1);
74  }
75 
76  // Fill the dbobject
77  in_file >> tempstore;
78  while (!in_file.eof()) {
79  obj->setMaxIndex(obj->maxIndex() + 1);
80  obj->push_back(tempstore);
81  in_file >> tempstore;
82  }
83 
84  in_file.close();
85  } else {
86  // If file didn't open, report this
87  edm::LogError("SiPixeFakelTemplateDBObjectESSource") << "Error opening File" << tempfile << std::endl;
88  }
89  }
90 
91  //std::cout << *obj << std::endl;
92  return std::unique_ptr<SiPixelTemplateDBObject>(obj);
93 }
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo

◆ setIntervalFor()

void SiPixelFakeTemplateDBObjectESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprotectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 95 of file SiPixelFakeTemplateDBObjectESSource.cc.

References edm::IOVSyncValue::beginOfTime(), edm::IOVSyncValue::endOfTime(), and infinity.

97  {
99  oValidity = infinity;
100 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity

Member Data Documentation

◆ templateCalibrations_

vstring SiPixelFakeTemplateDBObjectESSource::templateCalibrations_
private

Definition at line 27 of file SiPixelFakeTemplateDBObjectESSource.h.

Referenced by produce().

◆ version_

float SiPixelFakeTemplateDBObjectESSource::version_
private

Definition at line 28 of file SiPixelFakeTemplateDBObjectESSource.h.

Referenced by produce().