CMS 3D CMS Logo

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

Public Member Functions

 SiPixelFEDChannelContainerWriteFromASCII (const edm::ParameterSet &)
 
 ~SiPixelFEDChannelContainerWriteFromASCII () 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
 
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
 
void endJob () override
 

Private Attributes

const bool addDefault_
 
const std::string m_record
 
const std::string m_SnapshotInputs
 
SiPixelFEDChannelContainermyQualities
 
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 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

Definition at line 39 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

Constructor & Destructor Documentation

◆ SiPixelFEDChannelContainerWriteFromASCII()

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

Definition at line 61 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

References myQualities.

◆ ~SiPixelFEDChannelContainerWriteFromASCII()

SiPixelFEDChannelContainerWriteFromASCII::~SiPixelFEDChannelContainerWriteFromASCII ( )
override

Definition at line 70 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

References myQualities.

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 77 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

References mps_splice::line, eostools::ls(), m_SnapshotInputs, myQualities, SiPixelFEDChannelContainer::printAll(), printdebug_, writedatasetfile::run, SiPixelFEDChannelContainer::setScenario(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

77  {
78  using namespace edm;
79 
80  std::ifstream mysnapshots(m_SnapshotInputs);
82 
83  std::string scenario = "";
84  unsigned int thedetid(0);
85 
87 
88  if (mysnapshots.is_open()) {
89  while (getline(mysnapshots, line)) {
90  if (printdebug_) {
91  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII") << line << std::endl;
92  }
93  std::istringstream iss(line);
94  unsigned int run, ls, detid, fed, link, roc_first, roc_last;
95  iss >> run >> ls >> detid >> fed >> link >> roc_first >> roc_last;
96 
97  PixelFEDChannel theBadChannel{fed, link, roc_first, roc_last};
98 
99  auto newscenario = std::to_string(run) + "_" + std::to_string(ls);
100  if (newscenario != scenario) {
101  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII") << "================================" << std::endl;
102  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII")
103  << "found a new scenario: " << newscenario << std::endl;
104  if (!scenario.empty()) {
105  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII")
106  << "size of the fed channel vector: " << theBadFEDChannels.size() << std::endl;
107  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII")
108  << "================================" << std::endl;
109  myQualities->setScenario(scenario, theBadFEDChannels);
110  theBadFEDChannels.clear();
111  }
112  scenario = newscenario;
113  }
114 
115  if (detid != thedetid) {
116  if (printdebug_) {
117  edm::LogVerbatim("SiPixelFEDChannelContainerWriteFromASCII") << "found a new detid!" << detid << std::endl;
118  }
119  thedetid = detid;
120  }
121  theBadFEDChannels[thedetid].push_back(theBadChannel);
122  }
123  }
124 
125  myQualities->setScenario(scenario, theBadFEDChannels);
126 
127  if (printdebug_) {
128  edm::LogInfo("SiPixelFEDChannelContainerWriteFromASCII") << "Content of SiPixelFEDChannelContainer " << std::endl;
129 
130  // use buil-in method in the CondFormat
132  }
133 }
Log< level::Info, true > LogVerbatim
std::string to_string(const V &value)
Definition: OMSAccess.h:77
scenario
Definition: constants.h:173
Log< level::Info, false > LogInfo
def ls(path, rec=False)
Definition: eostools.py:349
void setScenario(const std::string &theScenarioId, const SiPixelFEDChannelCollection &theBadFEDChannels)
HLT enums.
std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection

◆ endJob()

void SiPixelFEDChannelContainerWriteFromASCII::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 136 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

References addDefault_, cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), m_record, myQualities, SiPixelFEDChannelContainer::setScenario(), SiPixelFEDChannelContainer::size(), and cond::service::PoolDBOutputService::writeOneIOV().

136  {
137  // adds an empty payload with name "default" => no channels are masked
138  if (addDefault_) {
140  myQualities->setScenario("default", theBadFEDChannels);
141  }
142 
143  edm::LogInfo("SiPixelFEDChannelContainerWriteFromASCII")
144  << "Size of SiPixelFEDChannelContainer object " << myQualities->size() << std::endl
145  << std::endl;
146 
147  // Form the data here
149  if (poolDbService.isAvailable()) {
150  cond::Time_t valid_time = poolDbService->currentTime();
151  // this writes the payload to begin in current run defined in cfg
152  poolDbService->writeOneIOV(*myQualities, valid_time, m_record);
153  }
154 }
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
void setScenario(const std::string &theScenarioId, const SiPixelFEDChannelCollection &theBadFEDChannels)
bool isAvailable() const
Definition: Service.h:40
std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection

◆ fillDescriptions()

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

Definition at line 157 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

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

157  {
159  desc.setComment("Writes payloads of type SiPixelFEDChannelContainer from input ASCII files");
160  desc.addUntracked<bool>("printDebug", true);
161  desc.addUntracked<bool>("addDefault", true);
162  desc.add<std::string>("snapshots", "");
163  desc.add<std::string>("record", "SiPixelStatusScenariosRcd");
164  descriptions.add("SiPixelFEDChannelContainerWriteFromASCII", desc);
165 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ addDefault_

const bool SiPixelFEDChannelContainerWriteFromASCII::addDefault_
private

Definition at line 54 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

Referenced by endJob().

◆ m_record

const std::string SiPixelFEDChannelContainerWriteFromASCII::m_record
private

Definition at line 51 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

Referenced by endJob().

◆ m_SnapshotInputs

const std::string SiPixelFEDChannelContainerWriteFromASCII::m_SnapshotInputs
private

Definition at line 52 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

Referenced by analyze().

◆ myQualities

SiPixelFEDChannelContainer* SiPixelFEDChannelContainerWriteFromASCII::myQualities
private

◆ printdebug_

const bool SiPixelFEDChannelContainerWriteFromASCII::printdebug_
private

Definition at line 53 of file SiPixelFEDChannelContainerWriteFromASCII.cc.

Referenced by analyze().