CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiPixelQualityProbabilitiesWriteFromASCII Class Reference
Inheritance diagram for SiPixelQualityProbabilitiesWriteFromASCII:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiPixelQualityProbabilitiesWriteFromASCII (const edm::ParameterSet &)
 
 ~SiPixelQualityProbabilitiesWriteFromASCII () override
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 endJob () override
 

Private Attributes

const std::string m_ProbInputs
 
const std::string m_record
 
std::unique_ptr< SiPixelQualityProbabilitiesmyProbabilities
 
const bool printdebug_
 

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

Definition at line 37 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

Constructor & Destructor Documentation

◆ SiPixelQualityProbabilitiesWriteFromASCII()

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

Definition at line 58 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

References myProbabilities.

59  : m_ProbInputs(iConfig.getParameter<std::string>("probabilities")),
60  m_record(iConfig.getParameter<std::string>("record")),
61  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)) {
62  //now do what ever initialization is needed
63  myProbabilities = std::make_unique<SiPixelQualityProbabilities>();
64 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< SiPixelQualityProbabilities > myProbabilities

◆ ~SiPixelQualityProbabilitiesWriteFromASCII()

SiPixelQualityProbabilitiesWriteFromASCII::~SiPixelQualityProbabilitiesWriteFromASCII ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 73 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

References mps_fire::i, mps_splice::line, m_ProbInputs, myProbabilities, printdebug_, and AlCaHLTBitMon_QueryRunRegistry::string.

73  {
74  using namespace edm;
75  std::ifstream myfile(m_ProbInputs);
77 
79 
80  if (myfile.is_open()) {
81  while (getline(myfile, line)) {
82  if (printdebug_) {
83  edm::LogInfo("SiPixelQualityProbabilitiesWriteFromASCII") << line << std::endl;
84  }
85  std::istringstream iss(line);
86  int pileupBinId, nEntries;
87  iss >> pileupBinId >> nEntries;
88  edm::LogInfo("SiPixelQualityProbabilitiesWriteFromASCII")
89  << "PILEUP BIN/ENTRIES: " << pileupBinId << " " << nEntries << std::endl;
90  std::vector<std::string> ids(nEntries, "");
91  std::vector<float> probs(nEntries, 0.0);
92  for (int i = 0; i < nEntries; ++i) {
93  iss >> ids.at(i) >> probs.at(i);
94  if (printdebug_) {
95  edm::LogInfo("SiPixelQualityProbabilitiesWriteFromASCII") << ids.at(i) << " " << probs.at(i) << std::endl;
96  }
97  auto idAndProb = std::make_pair(ids.at(i), probs.at(i));
98  myProbVector.push_back(idAndProb);
99  }
100  if (nEntries > 0) {
101  myProbabilities->setProbabilities(pileupBinId, myProbVector);
102  }
103  myProbVector.clear();
104  }
105  myfile.close();
106  }
107 
108  if (printdebug_) {
109  edm::LogInfo("SiPixelQualityProbabilitiesWriteFromASCII") << "Content of SiPixelQualityProbabilities " << std::endl;
110  // use buil-in method in the CondFormat
111  myProbabilities->printAll();
112  }
113 }
std::vector< std::pair< std::string, float > > probabilityVec
Log< level::Info, false > LogInfo
HLT enums.
std::unique_ptr< SiPixelQualityProbabilities > myProbabilities

◆ endJob()

void SiPixelQualityProbabilitiesWriteFromASCII::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 116 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

References cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), m_record, myProbabilities, and cond::service::PoolDBOutputService::writeOneIOV().

116  {
117  edm::LogInfo("SiPixelQualityProbabilitiesWriteFromASCII")
118  << "Size of SiPixelQualityProbabilities object " << myProbabilities->size() << std::endl
119  << std::endl;
120 
121  // Form the data here
123  if (poolDbService.isAvailable()) {
124  cond::Time_t valid_time = poolDbService->currentTime();
125  // this writes the payload to begin in current run defined in cfg
126  poolDbService->writeOneIOV(*myProbabilities, valid_time, m_record);
127  }
128 }
unsigned long long Time_t
Definition: Time.h:14
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
Log< level::Info, false > LogInfo
bool isAvailable() const
Definition: Service.h:40
std::unique_ptr< SiPixelQualityProbabilities > myProbabilities

◆ fillDescriptions()

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

Definition at line 131 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

131  {
133  desc.setComment("Writes payloads of type SiPixelQualityProbabilities");
134  desc.addUntracked<bool>("printDebug", true);
135  desc.add<std::string>("record", "SiPixelStatusScenarioProbabilityRcd");
136  desc.add<std::string>("probabilities", "");
137  descriptions.add("SiPixelQualityProbabilitiesWriteFromASCII", desc);
138 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ m_ProbInputs

const std::string SiPixelQualityProbabilitiesWriteFromASCII::m_ProbInputs
private

Definition at line 49 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

Referenced by analyze().

◆ m_record

const std::string SiPixelQualityProbabilitiesWriteFromASCII::m_record
private

Definition at line 50 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

Referenced by endJob().

◆ myProbabilities

std::unique_ptr<SiPixelQualityProbabilities> SiPixelQualityProbabilitiesWriteFromASCII::myProbabilities
private

◆ printdebug_

const bool SiPixelQualityProbabilitiesWriteFromASCII::printdebug_
private

Definition at line 51 of file SiPixelQualityProbabilitiesWriteFromASCII.cc.

Referenced by analyze().