CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiStripNoisesGetAllChecker (const edm::ParameterSet &)
 
 ~SiStripNoisesGetAllChecker () override=default
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 Member Functions

void checkModuleNoise (const SiStripNoises &, const uint32_t detID, uint16_t maxNStrips)
 

Private Attributes

const edm::ESGetToken< SiStripNoises, SiStripNoisesRcdnoisesToken_
 
const 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 20 of file SiStripNoisesGetAllChecker.cc.

Constructor & Destructor Documentation

◆ SiStripNoisesGetAllChecker()

SiStripNoisesGetAllChecker::SiStripNoisesGetAllChecker ( const edm::ParameterSet )
explicit

Definition at line 33 of file SiStripNoisesGetAllChecker.cc.

const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noisesToken_

◆ ~SiStripNoisesGetAllChecker()

SiStripNoisesGetAllChecker::~SiStripNoisesGetAllChecker ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 36 of file SiStripNoisesGetAllChecker.cc.

References checkModuleNoise(), SiStripSpyDisplay_cfi::detIDs, MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, edm::EventSetup::getData(), noisesToken_, AlCaHLTBitMon_ParallelJobs::p, StripGeomDetUnit::specificTopology(), AlCaHLTBitMon_QueryRunRegistry::string, tkGeomToken_, and to_string().

36  {
37  const auto& siStripNoises = iSetup.getData(noisesToken_);
38 
39  const auto& tkGeom = &iSetup.getData(tkGeomToken_);
40  const auto& tkDets = tkGeom->dets();
41 
42  edm::LogInfo("SiStripNoisesGetAllChecker") << "Starting to loop over all SiStrip modules...";
43 
44  // Get all DetIDs associated with SiStripNoises
45  std::vector<uint32_t> detIDs;
46  siStripNoises.getDetIds(detIDs);
47 
48  size_t exceptionCounts{0};
49  for (const auto& detID : detIDs) {
50  uint16_t maxNStrips{0};
51  auto det = std::find_if(tkDets.begin(), tkDets.end(), [detID](auto& elem) -> bool {
52  return (elem->geographicalId().rawId() == detID);
53  });
54  const StripTopology& p = dynamic_cast<const StripGeomDetUnit*>(*det)->specificTopology();
55  maxNStrips = p.nstrips();
56 
57  try {
58  checkModuleNoise(siStripNoises, detID, maxNStrips);
59  } catch (const std::exception& e) {
60  // Increment the exception counter if checkModuleNoise itself throws an exception
61  edm::LogError("SiStripNoisesGetAllChecker")
62  << "Exception in checkModuleNoise for detID " << detID << ": " << e.what();
63  ++exceptionCounts;
64  } catch (...) {
65  edm::LogError("SiStripNoisesGetAllChecker") << "Unknown exception in checkModuleNoise for detID " << detID;
66  ++exceptionCounts;
67  }
68  }
69 
70  std::ostringstream message;
71 
72  // Define the box width
73  const int boxWidth = 50;
74 
75  message << "\n"
76  << std::string(boxWidth, '*') << "\n"
77  << "* " << std::setw(boxWidth - 4) << std::left << "SiStripNoisesGetAllChecker Summary"
78  << " *\n"
79  << std::string(boxWidth, '*') << "\n"
80  << "* " << std::setw(boxWidth - 4) << std::left
81  << ("Completed loop over " + std::to_string(detIDs.size()) + " SiStrip modules.") << " *\n"
82  << "* " << std::setw(boxWidth - 4) << std::left
83  << ("Encountered " + std::to_string(exceptionCounts) + " exceptions.") << " *\n"
84  << std::string(boxWidth, '*');
85 
86  edm::LogSystem("SiStripNoisesGetAllChecker") << message.str();
87 }
Log< level::System, false > LogSystem
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Log< level::Info, false > LogInfo
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noisesToken_
void checkModuleNoise(const SiStripNoises &, const uint32_t detID, uint16_t maxNStrips)

◆ checkModuleNoise()

void SiStripNoisesGetAllChecker::checkModuleNoise ( const SiStripNoises siStripNoises,
const uint32_t  detID,
uint16_t  maxNStrips 
)
private

Definition at line 89 of file SiStripNoisesGetAllChecker.cc.

References SiStripNoises::allNoises(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, SiStripNoises::getRange(), and hltHgcalLayerClustersEE_cfi::noises.

Referenced by analyze().

91  {
92  try {
93  SiStripNoises::Range detNoiseRange = siStripNoises.getRange(detID);
94  std::vector<float> noises;
95  noises.resize(maxNStrips);
96  siStripNoises.allNoises(noises, detNoiseRange);
97  edm::LogInfo("SiStripNoisesGetAllChecker") << "Successfully processed detID: " << detID;
98  } catch (const std::exception& e) {
99  edm::LogError("SiStripNoisesGetAllChecker") << "Exception caught for detID " << detID << ": " << e.what();
100  throw; // Re-throw the exception to allow the outer loop to handle it
101  } catch (...) {
102  edm::LogError("SiStripNoisesGetAllChecker") << "Unknown exception caught for detID " << detID;
103  throw; // Re-throw the unknown exception
104  }
105 }
void allNoises(std::vector< float > &noises, const Range &range) const
Log< level::Error, false > LogError
Log< level::Info, false > LogInfo
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47

Member Data Documentation

◆ noisesToken_

const edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> SiStripNoisesGetAllChecker::noisesToken_
private

Definition at line 28 of file SiStripNoisesGetAllChecker.cc.

Referenced by analyze().

◆ tkGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripNoisesGetAllChecker::tkGeomToken_
private

Definition at line 29 of file SiStripNoisesGetAllChecker.cc.

Referenced by analyze().