CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelPerformanceSummaryBuilder (const edm::ParameterSet &)
 
 ~SiPixelPerformanceSummaryBuilder () 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)
 

Private Attributes

std::vector< uint32_t > detectorModules_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 26 of file SiPixelPerformanceSummaryBuilder.cc.

Constructor & Destructor Documentation

◆ SiPixelPerformanceSummaryBuilder()

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

Definition at line 40 of file SiPixelPerformanceSummaryBuilder.cc.

41  : tkGeomToken_(esConsumes()) {}
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_

◆ ~SiPixelPerformanceSummaryBuilder()

SiPixelPerformanceSummaryBuilder::~SiPixelPerformanceSummaryBuilder ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelPerformanceSummaryBuilder::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 45 of file SiPixelPerformanceSummaryBuilder.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), detectorModules_, TrackerGeometry::detUnits(), submitPVResolutionJobs::err, cppFunctionSkipper::exception, nano_mu_digi_cff::float, edm::EventSetup::getData(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SiPixelPerformanceSummary::print(), SiPixelPerformanceSummary::setNumberOfDigis(), SiPixelPerformanceSummary::setTimeStamp(), and tkGeomToken_.

45  {
46  const TrackerGeometry* pDD = &iSetup.getData(tkGeomToken_);
47  edm::LogInfo("SiPixelPerformanceSummaryBuilder") << pDD->detUnits().size() << " detectors" << std::endl;
48 
49  for (const auto& it : pDD->detUnits()) {
50  if (dynamic_cast<PixelGeomDetUnit const*>(it) != nullptr) {
51  detectorModules_.push_back(it->geographicalId().rawId());
52  }
53  }
54  edm::LogInfo("Modules") << "detectorModules_.size() = " << detectorModules_.size();
55 
56  SiPixelPerformanceSummary performanceSummary;
57 
58  for (std::vector<uint32_t>::const_iterator iDet = detectorModules_.begin(); // fill object
59  iDet != detectorModules_.end();
60  ++iDet) {
61  float nDigisMean = (float)CLHEP::RandGauss::shoot(50., 20.); // generate random values for each detId
62  float nDigisRMS = (float)CLHEP::RandGauss::shoot(20., 4.);
63  float emptyFraction = (float)CLHEP::RandGauss::shoot(.5, .2);
64 
65  performanceSummary.setNumberOfDigis(*iDet, nDigisMean, nDigisRMS, emptyFraction); // set values
66  }
67  clock_t presentTime = clock();
68  performanceSummary.setTimeStamp((unsigned long long)presentTime);
69  performanceSummary.print();
70 
71  edm::Service<cond::service::PoolDBOutputService> poolDBService; // write to DB
72  if (poolDBService.isAvailable()) {
73  try {
74  if (poolDBService->isNewTagRequest("SiPixelPerformanceSummaryRcd")) {
75  edm::LogInfo("Tag") << " is a new tag request.";
77  performanceSummary, poolDBService->beginOfTime(), "SiPixelPerformanceSummaryRcd");
78  } else {
79  edm::LogInfo("Tag") << " tag exists already";
81  performanceSummary, poolDBService->currentTime(), "SiPixelPerformanceSummaryRcd");
82  }
83  } catch (const cond::Exception& err) {
84  edm::LogError("DBWriting") << err.what() << std::endl;
85  } catch (const std::exception& err) {
86  edm::LogError("DBWriting") << "caught std::exception " << err.what() << std::endl;
87  } catch (...) {
88  edm::LogError("DBWriting") << "unknown error" << std::endl;
89  }
90  } else
91  edm::LogError("PoolDBOutputService") << "service unavailable" << std::endl;
92 }
Base exception class for the object to relational access.
Definition: Exception.h:11
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void setTimeStamp(unsigned long long timeStamp)
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool setNumberOfDigis(uint32_t detId, float mean, float rms, float emPtn)
bool isNewTagRequest(const std::string &recordName)
Log< level::Info, false > LogInfo
bool isAvailable() const
Definition: Service.h:40
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_

Member Data Documentation

◆ detectorModules_

std::vector<uint32_t> cms::SiPixelPerformanceSummaryBuilder::detectorModules_
private

Definition at line 34 of file SiPixelPerformanceSummaryBuilder.cc.

Referenced by analyze().

◆ tkGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> cms::SiPixelPerformanceSummaryBuilder::tkGeomToken_
private

Definition at line 33 of file SiPixelPerformanceSummaryBuilder.cc.

Referenced by analyze().