CMS 3D CMS Logo

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

Public Member Functions

 SiPixelBadFEDChannelSimulationSanityChecker (edm::ParameterSet const &p)
 
 ~SiPixelBadFEDChannelSimulationSanityChecker () 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 &e, const edm::EventSetup &c) override
 

Private Attributes

const bool printdebug_
 
const edm::ESGetToken< SiPixelFEDChannelContainer, SiPixelStatusScenariosRcdsiPixelBadFEDChToken_
 
const edm::ESGetToken< SiPixelQualityProbabilities, SiPixelStatusScenarioProbabilityRcdsiPixelQPToken_
 

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 18 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

Constructor & Destructor Documentation

◆ SiPixelBadFEDChannelSimulationSanityChecker()

SiPixelBadFEDChannelSimulationSanityChecker::SiPixelBadFEDChannelSimulationSanityChecker ( edm::ParameterSet const &  p)
explicit

Definition at line 34 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

37  printdebug_(p.getUntrackedParameter<bool>("printDebug", true)) {
38  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker")
39  << "SiPixelBadFEDChannelSimulationSanityChecker" << std::endl;
40 }
const edm::ESGetToken< SiPixelFEDChannelContainer, SiPixelStatusScenariosRcd > siPixelBadFEDChToken_
const edm::ESGetToken< SiPixelQualityProbabilities, SiPixelStatusScenarioProbabilityRcd > siPixelQPToken_
Log< level::Info, false > LogInfo

◆ ~SiPixelBadFEDChannelSimulationSanityChecker()

SiPixelBadFEDChannelSimulationSanityChecker::~SiPixelBadFEDChannelSimulationSanityChecker ( )
override

Definition at line 42 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

42  {
43  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker")
44  << "~SiPixelBadFEDChannelSimulationSanityChecker " << std::endl;
45 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

void SiPixelBadFEDChannelSimulationSanityChecker::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 47 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

References visDQMUpload::context, MillePedeFileConverter_cfg::e, mps_splice::entry, spr::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), SiPixelQualityProbabilities::getProbability_Map(), SiPixelFEDChannelContainer::getScenarioList(), SiPixelFEDChannelContainer::getScenarioMap(), notFound, printdebug_, siPixelBadFEDChToken_, siPixelQPToken_, AlCaHLTBitMon_QueryRunRegistry::string, and edm::eventsetup::EventSetupRecordKey::type().

47  {
48  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker")
49  << "### SiPixelBadFEDChannelSimulationSanityChecker::analyze ###" << std::endl;
50  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker") << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
51  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker") << " ---EVENT NUMBER " << e.id().event() << std::endl;
52 
54  edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiPixelStatusScenariosRcd"));
55  if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
56  //record not found
57  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker") << "Record \"SiPixelStatusScenariosRcd"
58  << "\" does not exist " << std::endl;
59  }
60 
61  //this part gets the handle of the event source and the record (i.e. the Database)
62  const SiPixelFEDChannelContainer* quality_map = &context.getData(siPixelBadFEDChToken_);
63 
65  edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiPixelStatusScenarioProbabilityRcd>"));
66 
67  if (recordKey2.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
68  //record not found
69  edm::LogWarning("SiPixelQualityProbabilitiesTestReader") << "Record \"SiPixelStatusScenarioProbabilityRcd>"
70  << "\" does not exist " << std::endl;
71  }
72 
73  //this part gets the handle of the event source and the record (i.e. the Database)
74  const SiPixelQualityProbabilities* myProbabilities = &context.getData(siPixelQPToken_);
75 
77  SiPixelQualityProbabilities::probabilityMap m_probabilities = myProbabilities->getProbability_Map();
78 
79  std::vector<std::string> allScenarios = quality_map->getScenarioList();
80  std::vector<std::string> allScenariosInProb;
81 
82  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
83  //int PUbin = it->first;
84  for (const auto& entry : it->second) {
85  auto scenario = entry.first;
86  auto probability = entry.second;
87  if (probability != 0) {
88  if (std::find(allScenariosInProb.begin(), allScenariosInProb.end(), scenario) == allScenariosInProb.end()) {
89  allScenariosInProb.push_back(scenario);
90  }
91 
92  // if(m_qualities.find(scenario) == m_qualities.end()){
93  // edm::LogWarning("SiPixelBadFEDChannelSimulationSanityChecker") <<"Pretty worrying! the scenario: " << scenario << " (prob:" << probability << ") is not found in the map!!"<<std::endl;
94  // } else {
95  // edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker") << "scenario: "<< scenario << " is in the map! (all is good)"<< std::endl;
96  // }
97 
98  } // if prob!=0
99  } // loop on the scenarios for that PU bin
100  } // loop on PU bins
101 
102  std::vector<std::string> notFound;
103  std::copy_if(allScenariosInProb.begin(),
104  allScenariosInProb.end(),
105  std::back_inserter(notFound),
106  [&allScenarios](const std::string& arg) {
107  return (std::find(allScenarios.begin(), allScenarios.end(), arg) == allScenarios.end());
108  });
109 
110  if (!notFound.empty()) {
111  for (const auto& entry : notFound) {
112  edm::LogWarning("SiPixelBadFEDChannelSimulationSanityChecker")
113  << "Pretty worrying! the scenario: " << entry << " is not found in the map!!" << std::endl;
114 
115  if (printdebug_) {
116  edm::LogVerbatim("SiPixelBadFEDChannelSimulationSanityChecker") << " This scenario is found in: " << std::endl;
117  for (auto it = m_probabilities.begin(); it != m_probabilities.end(); ++it) {
118  int PUbin = it->first;
119 
120  for (const auto& pair : it->second) {
121  if (pair.first == entry) {
122  edm::LogVerbatim("SiPixelBadFEDChannelSimulationSanityChecker")
123  << " - PU bin " << PUbin << " with probability: " << pair.second << std::endl;
124  } // if the scenario matches
125  } // loop on scenarios
126  } // loop on PU
127  } // if printdebug
128  edm::LogVerbatim("SiPixelBadFEDChannelSimulationSanityChecker")
129  << "==============================================" << std::endl;
130  } // loop on scenarios not found
131 
132  edm::LogWarning("SiPixelBadFEDChannelSimulationSanityChecker")
133  << " ====> A total of " << notFound.size() << " scenarios are not found in the map!" << std::endl;
134 
135  } else {
136  edm::LogVerbatim("SiPixelBadFEDChannelSimulationSanityChecker")
137  << "=================================================================================" << std::endl;
138  edm::LogInfo("SiPixelBadFEDChannelSimulationSanityChecker")
139  << " All scenarios in probability record are found in the scenario map, (all is good)!" << std::endl;
140  edm::LogVerbatim("SiPixelBadFEDChannelSimulationSanityChecker")
141  << "=================================================================================" << std::endl;
142  }
143 }
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< SiPixelFEDChannelContainer, SiPixelStatusScenariosRcd > siPixelBadFEDChToken_
std::map< unsigned int, probabilityVec > probabilityMap
const SiPixelBadFEDChannelsScenarioMap & getScenarioMap() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
A arg
Definition: Factorize.h:31
const edm::ESGetToken< SiPixelQualityProbabilities, SiPixelStatusScenarioProbabilityRcd > siPixelQPToken_
scenario
Definition: constants.h:173
Log< level::Info, false > LogInfo
const probabilityMap & getProbability_Map() const
static const GlobalPoint notFound(0, 0, 0)
std::vector< std::string > getScenarioList() const
heterocontainer::HCTypeTag TypeTag
std::unordered_map< std::string, SiPixelFEDChannelCollection > SiPixelBadFEDChannelsScenarioMap
Log< level::Warning, false > LogWarning
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:121

◆ fillDescriptions()

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

Definition at line 145 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

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

145  {
147  desc.setComment("Tries sanity of Pixel Stuck TBM simulation");
148  desc.addUntracked<bool>("printDebug", true);
149  descriptions.add("SiPixelBadFEDChannelSimulationSanityChecker", desc);
150 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ printdebug_

const bool SiPixelBadFEDChannelSimulationSanityChecker::printdebug_
private

Definition at line 31 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

Referenced by analyze().

◆ siPixelBadFEDChToken_

const edm::ESGetToken<SiPixelFEDChannelContainer, SiPixelStatusScenariosRcd> SiPixelBadFEDChannelSimulationSanityChecker::siPixelBadFEDChToken_
private

Definition at line 29 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

Referenced by analyze().

◆ siPixelQPToken_

const edm::ESGetToken<SiPixelQualityProbabilities, SiPixelStatusScenarioProbabilityRcd> SiPixelBadFEDChannelSimulationSanityChecker::siPixelQPToken_
private

Definition at line 30 of file SiPixelBadFEDChannelSimulationSanityChecker.cc.

Referenced by analyze().