76 m_record(iConfig.getParameter<std::
string>(
"record")),
77 printdebug_(iConfig.getUntrackedParameter<bool>(
"printDebug",
false)),
78 isMC_(iConfig.getUntrackedParameter<bool>(
"isMC",
true)),
79 removeEmptyPayloads_(iConfig.getUntrackedParameter<bool>(
"removeEmptyPayloads",
false)) {
81 myQualities = std::make_unique<SiPixelFEDChannelContainer>();
106 edm::LogInfo(
"SiPixelFEDChannelContainerFromQualityConverter")
107 <<
"Found IOV:" << RunNumber_ <<
"(" << LuminosityBlockNumber_ <<
")" << std::endl;
109 auto theSiPixelFEDChannelCollection =
115 myQualities->setScenario(scenario, theSiPixelFEDChannelCollection);
130 for (
const auto&
mod : theDisabledModules) {
133 int coded_badRocs =
mod.BadRocs;
134 std::vector<PixelFEDChannel> disabledChannelsDetSet;
135 std::vector<sipixelobjects::CablingPathToDetUnit>
path = theFedCabling.
pathToDetUnit(
mod.DetID);
137 unsigned int nrocs_inLink(0);
143 throw cms::Exception(
"Inconsistent data") <<
"could not find CablingPathToDetUnit for detId:" <<
mod.DetID;
146 std::bitset<16> bad_rocs(coded_badRocs);
147 unsigned int n_ch = bad_rocs.size() / nrocs_inLink;
149 for (
unsigned int i_roc = 0; i_roc < n_ch; ++i_roc) {
150 unsigned int first_idx = nrocs_inLink * i_roc;
151 unsigned int sec_idx = nrocs_inLink * (i_roc + 1) - 1;
152 unsigned int mask =
pow(2, nrocs_inLink) - 1;
153 unsigned int n_setbits = (coded_badRocs >> (i_roc * nrocs_inLink)) & mask;
155 if (n_setbits == 0) {
159 if (n_setbits != mask) {
161 <<
"Mismatch! DetId: " <<
mod.DetID <<
" " << n_setbits <<
" " << mask << std::endl;
166 edm::LogVerbatim(
"SiPixelFEDChannelContainerFromQualityConverter") <<
"passed" << std::endl;
169 unsigned int link_id = 99999;
170 unsigned int fed_id = 99999;
172 for (
auto const&
p : path) {
178 if (first_roc == first_idx) {
187 <<
" " << fed_id <<
" " << link_id <<
" " << first_idx <<
" " << sec_idx << std::endl;
191 disabledChannelsDetSet.push_back(ch);
195 << i_roc <<
" " << coded_badRocs <<
" " << first_idx <<
" " << sec_idx << std::endl;
197 <<
"=======================================" << std::endl;
201 if (!disabledChannelsDetSet.empty()) {
202 theBadChannelCollection[
mod.DetID] = disabledChannelsDetSet;
205 return theBadChannelCollection;
212 edm::LogInfo(
"SiPixelFEDChannelContainerFromQualityConverter") <<
"Analyzed " <<
IOVcount_ <<
" IOVs" << std::endl;
213 edm::LogInfo(
"SiPixelFEDChannelContainerFromQualityConverter")
214 <<
"Size of SiPixelFEDChannelContainer object " <<
myQualities->size() << std::endl
218 edm::LogInfo(
"SiPixelFEDChannelContainerFromQualityConverter")
219 <<
"Content of SiPixelFEDChannelContainer " << std::endl;
242 desc.
setComment(
"Writes payloads of type SiPixelFEDChannelContainer");
246 descriptions.
add(
"SiPixelFEDChannelContainerFromQualityConverter", desc);
Log< level::Info, true > LogVerbatim
const PixelROC * roc(unsigned int id) const
return ROC identified by id. ROC ids are ranged [1,numberOfROCs]
~SiPixelFEDChannelContainerFromQualityConverter() override
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
SiPixelFEDChannelContainerFromQualityConverter(const edm::ParameterSet &)
const bool removeEmptyPayloads_
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string to_string(const V &value)
edm::ESWatcher< SiPixelQualityFromDbRcd > SiPixelQualityWatcher_
std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const final
EventAuxiliary const & eventAuxiliary() const override
unsigned int numberOfROCs() const
number of ROCs in fed
LuminosityBlockNumber_t luminosityBlock() const
void setComment(std::string const &value)
unsigned long long Time_t
const std::string m_record
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::vector< disabledModuleType > getBadComponentList() const
void analyze(const edm::Event &, const edm::EventSetup &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
Log< level::Info, false > LogInfo
std::unique_ptr< SiPixelFedCablingTree > cablingTree() const
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< SiPixelFEDChannelContainer > myQualities
bool check(const edm::EventSetup &iSetup)
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelCablingToken_
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id's are ranged [1, numberOfLinks]
SiPixelFEDChannelContainer::SiPixelFEDChannelCollection createFromSiPixelQuality(const SiPixelQuality &theQuality, const SiPixelFedCablingMap &theFedCabling)
cond::Time_t currentTime() const
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Warning, false > LogWarning
T mod(const T &a, const T &b)
Power< A, B >::type pow(const A &a, const B &b)
std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection