CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FastSiPixelFEDChannelContainerFromQuality Class Reference

#include <CondFormats/SiPixelObjects/plugins/FastSiPixelFEDChannelContainerFromQuality.cc>

Inheritance diagram for FastSiPixelFEDChannelContainerFromQuality:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
SiPixelFEDChannelContainer::SiPixelFEDChannelCollection createFromSiPixelQuality (const SiPixelQuality &theQuality, const SiPixelFedCablingMap &theFedCabling, const SiPixelFedCablingTree &theCablingTree)
 
void endJob () override
 
 FastSiPixelFEDChannelContainerFromQuality (const edm::ParameterSet &iConfig)
 
 ~FastSiPixelFEDChannelContainerFromQuality () 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

unsigned int closest_from_above (std::vector< unsigned int > const &vec, unsigned int value)
 
unsigned int closest_from_below (std::vector< unsigned int > const &vec, unsigned int value)
 

Private Attributes

const bool isMC_
 
const std::string m_CablingTagName
 
const std::string m_condDbCabling
 
const std::string m_condDbQuality
 
cond::persistency::ConnectionPool m_connectionPool
 
unsigned long long m_endTime
 
const std::string m_output
 
const std::string m_QualityTagName
 
const std::string m_record
 
unsigned long long m_startTime
 
std::unique_ptr< SiPixelFEDChannelContainermyQualities
 
const bool printdebug_
 
const bool removeEmptyPayloads_
 

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

Description: class to build the SiPixelFEDChannelContainer payloads

Definition at line 57 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Constructor & Destructor Documentation

◆ FastSiPixelFEDChannelContainerFromQuality()

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

Definition at line 101 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References cond::persistency::ConnectionPool::configure(), edm::ParameterSet::getParameter(), m_connectionPool, myQualities, and cond::persistency::ConnectionPool::setParameters().

102  : m_connectionPool(),
103  m_condDbQuality(iConfig.getParameter<std::string>("condDBQuality")),
104  m_condDbCabling(iConfig.getParameter<std::string>("condDBCabling")),
105  m_QualityTagName(iConfig.getParameter<std::string>("qualityTagName")),
106  m_CablingTagName(iConfig.getParameter<std::string>("cablingMapTagName")),
107  m_record(iConfig.getParameter<std::string>("record")),
108  m_output(iConfig.getParameter<std::string>("output")),
109  m_startTime(iConfig.getParameter<unsigned long long>("startIOV")),
110  m_endTime(iConfig.getParameter<unsigned long long>("endIOV")),
111  printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", false)),
112  isMC_(iConfig.getUntrackedParameter<bool>("isMC", true)),
113  removeEmptyPayloads_(iConfig.getUntrackedParameter<bool>("removeEmptyPayloads", false)) {
116 
117  //now do what ever initialization is needed
118  myQualities = std::make_unique<SiPixelFEDChannelContainer>();
119 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void setParameters(const edm::ParameterSet &connectionPset)
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< SiPixelFEDChannelContainer > myQualities

◆ ~FastSiPixelFEDChannelContainerFromQuality()

FastSiPixelFEDChannelContainerFromQuality::~FastSiPixelFEDChannelContainerFromQuality ( )
overridedefault

Member Function Documentation

◆ analyze()

void FastSiPixelFEDChannelContainerFromQuality::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 123 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References cond::TimeTypeSpecs::beginValue, closest_from_above(), closest_from_below(), cond::persistency::Transaction::commit(), createFromSiPixelQuality(), cond::persistency::ConnectionPool::createSession(), HLT_2022v12_cff::distance, cond::TimeTypeSpecs::endValue, Exception, cond::persistency::Session::fetchPayload(), spr::find(), groupFilesInBlocks::fout, m_CablingTagName, m_condDbCabling, m_condDbQuality, m_connectionPool, m_endTime, m_output, m_QualityTagName, m_startTime, cond::time::MAX_VAL(), cond::time::MIN_VAL(), myQualities, jetsAK4_Puppi_cff::payload, printdebug_, cond::persistency::Session::readIov(), removeEmptyPayloads_, cond::runnumber, cond::persistency::IOVProxy::selectRange(), contentValuesCheck::ss, cond::persistency::Transaction::start(), mps_setup::stdout, AlCaHLTBitMon_QueryRunRegistry::string, cond::timeTypeSpecs, cond::impl::to_string(), cond::persistency::Session::transaction(), HcalDetIdTransform::transform(), and SiPixelFEDChannelUtils::unpack().

123  {
124  std::stringstream ss;
125 
126  cond::Time_t startIov = m_startTime;
127  cond::Time_t endIov = m_endTime;
128  if (startIov > endIov)
129  throw cms::Exception("endTime must be greater than startTime!");
130  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
131  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
132  << "Set start time " << startIov << "\n ... Set end time " << endIov;
133 
134  // open db session for the quality
135  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
136  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
137  << "Query the condition database " << m_condDbQuality;
138 
140  condDbSession.transaction().start(true);
141 
142  // query the database
143  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
144  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
145  << "Reading IOVs from tag " << m_QualityTagName;
146 
147  // open db session for the cabling map
148  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
149  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
150  << "Query the condition database " << m_condDbCabling;
151 
153  condDbSession2.transaction().start(true);
154 
155  // query the database
156  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
157  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
158  << "Reading IOVs from tag " << m_CablingTagName;
159 
160  // get the list of payloads for the SiPixelQuality tag
161  std::vector<std::tuple<cond::Time_t, cond::Hash> > m_iovs;
162  condDbSession.readIov(m_QualityTagName).selectRange(startIov, endIov, m_iovs);
163 
166 
167  // get the list of payloads for the Cabling Map
168  std::vector<std::tuple<cond::Time_t, cond::Hash> > m_cabling_iovs;
169  condDbSession2.readIov(m_CablingTagName).selectRange(MIN_VAL, MAX_VAL, m_cabling_iovs);
170 
171  // create here the unpacked list of IOVs (run numbers)
172  std::vector<unsigned int> listOfIOVs;
173  std::transform(m_iovs.begin(),
174  m_iovs.end(),
175  std::back_inserter(listOfIOVs),
176  [](std::tuple<cond::Time_t, cond::Hash> myIOV) -> unsigned int {
177  return SiPixelFEDChannelUtils::unpack(std::get<0>(myIOV)).first;
178  });
179 
180  std::vector<unsigned int> listOfCablingIOVs;
181  std::transform(m_cabling_iovs.begin(),
182  m_cabling_iovs.end(),
183  std::back_inserter(listOfCablingIOVs),
184  [](std::tuple<cond::Time_t, cond::Hash> myIOV2) -> unsigned int { return std::get<0>(myIOV2); });
185 
186  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
187  << " Number of SiPixelQuality paloyads to analyze: " << listOfIOVs.size()
188  << " Number of SiPixelFedCablngMap payloads: " << listOfCablingIOVs.size() << std::endl;
189 
190  if (listOfCablingIOVs.size() > 1) {
191  if (closest_from_below(listOfCablingIOVs, listOfIOVs.front()) !=
192  closest_from_above(listOfCablingIOVs, listOfIOVs.back())) {
193  throw cms::Exception("") << " The Pixel FED Cabling map does not cover all the requested SiPixelQuality IOVs in "
194  "the same interval of validity \n";
195  }
196  } else {
197  if (listOfIOVs.front() < listOfCablingIOVs.front()) {
198  throw cms::Exception("") << " The Pixel FED Cabling map does not cover all the requested IOVs \n";
199  }
200  }
201 
202  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
203  << " First run covered by SiPixelQuality tag: " << listOfIOVs.front()
204  << " / last run covered by SiPixelQuality tag: " << listOfIOVs.back() << std::endl;
205 
206  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality") << " SiPixel Cabling Map IOVs in the interval: ";
207  for (const auto& cb : m_cabling_iovs) {
208  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality")
209  << " " << std::setw(6) << std::get<0>(cb) << " : " << std::get<1>(cb);
210  }
211  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality") << std::endl;
212 
213  if (printdebug_) {
214  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
215  << " closest_from_above(listOfCablingIOVs,listOfIOVs.back()): "
216  << closest_from_above(listOfCablingIOVs, listOfIOVs.back()) << std::endl;
217  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
218  << " closest_from_below(listOfCablingIOVs,listOfIOVs.front()): "
219  << closest_from_below(listOfCablingIOVs, listOfIOVs.front()) << std::endl;
220  }
221 
222  auto it = std::find(
223  listOfCablingIOVs.begin(), listOfCablingIOVs.end(), closest_from_below(listOfCablingIOVs, listOfIOVs.front()));
224  int index = std::distance(listOfCablingIOVs.begin(), it);
225 
226  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
227  << " using the SiPixelFedCablingMap with hash: " << std::get<1>(m_cabling_iovs.at(index)) << std::endl;
228 
229  auto theCablingMapPayload = condDbSession2.fetchPayload<SiPixelFedCablingMap>(std::get<1>(m_cabling_iovs.at(index)));
230  auto theCablingTree = (*theCablingMapPayload).cablingTree();
231 
232  printf(
233  "Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
234  printf("Translating into SiPixelFEDChannelCollection :");
235  int step = (m_iovs.size() >= 50) ? m_iovs.size() / 50 : 1;
236  int niov = 0;
237  for (const auto& myIOV : m_iovs) {
238  if (niov % step == 0) {
239  printf(".");
240  fflush(stdout);
241  }
242 
243  auto payload = condDbSession.fetchPayload<SiPixelQuality>(std::get<1>(myIOV));
244  auto runLS = SiPixelFEDChannelUtils::unpack(std::get<0>(myIOV));
245 
246  // print IOVs summary
247  ss << runLS.first << "," << runLS.second << " (" << std::get<0>(myIOV) << ")"
248  << " [hash: " << std::get<1>(myIOV) << "] \n";
249 
250  std::string scenario = std::to_string(runLS.first) + "_" + std::to_string(runLS.second);
251 
252  if (printdebug_) {
253  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
254  << "Found IOV:" << runLS.first << "(" << runLS.second << ")" << std::endl;
255  }
256 
257  auto theSiPixelFEDChannelCollection =
258  this->createFromSiPixelQuality(*payload, *theCablingMapPayload, *theCablingTree);
259 
260  if (removeEmptyPayloads_ && theSiPixelFEDChannelCollection.empty())
261  return;
262 
263  myQualities->setScenario(scenario, theSiPixelFEDChannelCollection);
264 
265  ++niov;
266  }
267  //carriage return for tests
268  printf("\n\n");
269 
270  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
271  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] "
272  << "Read " << niov << " IOVs from tag " << m_QualityTagName
273  << " corresponding to the specified time interval.\n\n"
274  << ss.str();
275 
276  if (printdebug_) {
277  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
278  << "[FastSiPixelFEDChannelContainerFromQuality::" << __func__ << "] " << ss.str();
279  }
280 
281  condDbSession.transaction().commit();
282  condDbSession2.transaction().commit();
283 
284  if (!m_output.empty()) {
285  std::ofstream fout;
286  fout.open(m_output);
287  fout << ss.str();
288  fout.close();
289  }
290 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
Log< level::Info, true > LogVerbatim
Time_t beginValue
Definition: Time.h:41
void start(bool readOnly=true)
Definition: Session.cc:18
const Time_t MIN_VAL(0)
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Transaction & transaction()
Definition: Session.cc:52
scenario
Definition: constants.h:173
unsigned long long Time_t
Definition: Time.h:14
SiPixelFEDChannelContainer::SiPixelFEDChannelCollection createFromSiPixelQuality(const SiPixelQuality &theQuality, const SiPixelFedCablingMap &theFedCabling, const SiPixelFedCablingTree &theCablingTree)
unsigned int closest_from_below(std::vector< unsigned int > const &vec, unsigned int value)
Session createSession(const std::string &connectionString, bool writeCapable=false)
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
Log< level::Info, false > LogInfo
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
IOVArray selectRange(const cond::Time_t &begin, const cond::Time_t &end)
Definition: IOVProxy.cc:197
std::unique_ptr< SiPixelFEDChannelContainer > myQualities
step
Definition: StallMonitor.cc:98
Time_t endValue
Definition: Time.h:42
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
unsigned int closest_from_above(std::vector< unsigned int > const &vec, unsigned int value)
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ closest_from_above()

unsigned int FastSiPixelFEDChannelContainerFromQuality::closest_from_above ( std::vector< unsigned int > const &  vec,
unsigned int  value 
)
inlineprivate

Definition at line 90 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References pfDeepBoostedJetPreprocessParams_cfi::lower_bound, and relativeConstraints::value.

Referenced by analyze().

90  {
91  auto const it = std::lower_bound(vec.begin(), vec.end(), value);
92  return vec.at(it - vec.begin() - 1);
93  }

◆ closest_from_below()

unsigned int FastSiPixelFEDChannelContainerFromQuality::closest_from_below ( std::vector< unsigned int > const &  vec,
unsigned int  value 
)
inlineprivate

Definition at line 95 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and relativeConstraints::value.

Referenced by analyze().

95  {
96  auto const it = std::upper_bound(vec.begin(), vec.end(), value);
97  return vec.at(it - vec.begin() - 1);
98  }

◆ createFromSiPixelQuality()

SiPixelFEDChannelContainer::SiPixelFEDChannelCollection FastSiPixelFEDChannelContainerFromQuality::createFromSiPixelQuality ( const SiPixelQuality theQuality,
const SiPixelFedCablingMap theFedCabling,
const SiPixelFedCablingTree theCablingTree 
)

Definition at line 294 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References SiPixelFedCablingMap::det2fedMap(), Exception, SiPixelFedCablingTree::fed(), SiPixelQuality::getBadComponentList(), sipixelobjects::PixelFEDCabling::link(), MainPageGenerator::link, mod(), AlCaHLTBitMon_ParallelJobs::p, castor_dqm_sourceclient_file_cfg::path, SiPixelFedCablingMap::pathToDetUnit(), funct::pow(), printdebug_, and PixelMapPlotter::roc.

Referenced by analyze().

296  {
297  auto fedid_ = theFedCabling.det2fedMap();
298 
300 
301  auto theDisabledModules = theQuality.getBadComponentList();
302  for (const auto& mod : theDisabledModules) {
303  //mod.DetID, mod.errorType,mod.BadRocs
304 
305  int coded_badRocs = mod.BadRocs;
306  std::vector<PixelFEDChannel> disabledChannelsDetSet;
307  std::vector<sipixelobjects::CablingPathToDetUnit> path = theFedCabling.pathToDetUnit(mod.DetID);
308  unsigned int nrocs_inLink(0);
309  if (!path.empty()) {
310  const sipixelobjects::PixelFEDCabling* aFed = theCablingTree.fed(path.at(0).fed);
311  const sipixelobjects::PixelFEDLink* link = aFed->link(path.at(0).link);
312  nrocs_inLink = link->numberOfROCs();
313  } else {
314  throw cms::Exception("Inconsistent data") << "could not find CablingPathToDetUnit for detId:" << mod.DetID;
315  }
316 
317  std::bitset<16> bad_rocs(coded_badRocs);
318  unsigned int n_ch = bad_rocs.size() / nrocs_inLink;
319 
320  for (unsigned int i_roc = 0; i_roc < n_ch; ++i_roc) {
321  unsigned int first_idx = nrocs_inLink * i_roc;
322  unsigned int sec_idx = nrocs_inLink * (i_roc + 1) - 1;
323  unsigned int mask = pow(2, nrocs_inLink) - 1;
324  unsigned int n_setbits = (coded_badRocs >> (i_roc * nrocs_inLink)) & mask;
325 
326  if (n_setbits == 0) {
327  continue;
328  }
329 
330  if (n_setbits != mask) {
331  if (printdebug_) {
332  edm::LogWarning("FastSiPixelFEDChannelContainerFromQuality")
333  << "Mismatch! DetId: " << mod.DetID << " " << n_setbits << " " << mask << std::endl;
334  }
335  continue;
336  }
337 
338  if (printdebug_) {
339  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality") << "passed" << std::endl;
340  }
341 
342  unsigned int link_id = 99999;
343  unsigned int fed_id = 99999;
344 
345  for (auto const& p : path) {
346  const sipixelobjects::PixelFEDCabling* aFed = theCablingTree.fed(p.fed);
347  const sipixelobjects::PixelFEDLink* link = aFed->link(p.link);
348  const sipixelobjects::PixelROC* roc = link->roc(p.roc);
349  unsigned int first_roc = roc->idInDetUnit();
350 
351  if (first_roc == first_idx) {
352  link_id = p.link;
353  fed_id = p.fed;
354  break;
355  }
356  }
357 
358  if (printdebug_) {
359  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality")
360  << " " << fed_id << " " << link_id << " " << first_idx << " " << sec_idx << std::endl;
361  }
362 
363  PixelFEDChannel ch = {fed_id, link_id, first_idx, sec_idx};
364  disabledChannelsDetSet.push_back(ch);
365 
366  if (printdebug_) {
367  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality")
368  << i_roc << " " << coded_badRocs << " " << first_idx << " " << sec_idx << std::endl;
369  edm::LogVerbatim("FastSiPixelFEDChannelContainerFromQuality")
370  << "=======================================" << std::endl;
371  }
372  }
373 
374  if (!disabledChannelsDetSet.empty()) {
375  theBadChannelCollection[mod.DetID] = disabledChannelsDetSet;
376  }
377  }
378  return theBadChannelCollection;
379 }
Log< level::Info, true > LogVerbatim
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id&#39;s are ranged [1, numberOfLinks]
std::vector< sipixelobjects::CablingPathToDetUnit > pathToDetUnit(uint32_t rawDetId) const final
const std::vector< disabledModuleType > getBadComponentList() const
const PixelFEDCabling * fed(unsigned int idFed) const
get fed identified by its id
std::unordered_map< uint32_t, unsigned int > det2fedMap() const final
Log< level::Warning, false > LogWarning
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection

◆ endJob()

void FastSiPixelFEDChannelContainerFromQuality::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 406 of file FastSiPixelFEDChannelContainerFromQuality.cc.

References cond::service::PoolDBOutputService::currentTime(), edm::Service< T >::isAvailable(), isMC_, m_record, myQualities, printdebug_, and cond::service::PoolDBOutputService::writeOneIOV().

406  {
407  // edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")<<"Analyzed "<<IOVcount_<<" IOVs"<<std::endl;
408  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality")
409  << "Size of SiPixelFEDChannelContainer object " << myQualities->size() << std::endl
410  << std::endl;
411 
412  if (printdebug_) {
413  edm::LogInfo("FastSiPixelFEDChannelContainerFromQuality") << "Content of SiPixelFEDChannelContainer " << std::endl;
414 
415  // use built-in method in the CondFormat
416  myQualities->printAll();
417  }
418 
419  // Form the data here
421  if (poolDbService.isAvailable()) {
422  cond::Time_t valid_time = poolDbService->currentTime();
423  // this writes the payload to begin in current run defined in cfg
424  if (!isMC_) {
425  poolDbService->writeOneIOV(*myQualities, valid_time, m_record);
426  } else {
427  // for MC IOV since=1
428  poolDbService->writeOneIOV(*myQualities, 1, m_record);
429  }
430  }
431 }
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
std::unique_ptr< SiPixelFEDChannelContainer > myQualities
bool isAvailable() const
Definition: Service.h:40

◆ fillDescriptions()

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

Definition at line 381 of file FastSiPixelFEDChannelContainerFromQuality.cc.

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

381  {
383  desc.setComment("Writes payloads of type SiPixelFEDChannelContainer");
384  desc.addUntracked<bool>("printDebug", false);
385  desc.addUntracked<bool>("removeEmptyPayloads", false);
386  desc.add<std::string>("record", "SiPixelStatusScenariosRcd");
387  desc.add<std::string>("condDBQuality", "frontier://FrontierPrep/CMS_CONDITIONS");
388  desc.add<std::string>("qualityTagName", "SiPixelQualityOffline_2017_threshold1percent_stuckTBM");
389  desc.add<std::string>("condDBCabling", "frontier://FrontierProd/CMS_CONDITIONS");
390  desc.add<std::string>("cablingMapTagName", "SiPixelFedCablingMap_v1");
391  desc.add<unsigned long long>("startIOV", 1310841198608821);
392  desc.add<unsigned long long>("endIOV", 1312696624480350);
393  desc.add<std::string>("output", "summary.txt");
394  desc.add<std::string>("connect", "");
395 
396  edm::ParameterSetDescription descDBParameters;
397  descDBParameters.addUntracked<std::string>("authenticationPath", "");
398  descDBParameters.addUntracked<int>("authenticationSystem", 0);
399  descDBParameters.addUntracked<std::string>("security", "");
400  descDBParameters.addUntracked<int>("messageLevel", 0);
401 
402  desc.add<edm::ParameterSetDescription>("DBParameters", descDBParameters);
403  descriptions.add("FastSiPixelFEDChannelContainerFromQuality", desc);
404 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ isMC_

const bool FastSiPixelFEDChannelContainerFromQuality::isMC_
private

Definition at line 85 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by endJob().

◆ m_CablingTagName

const std::string FastSiPixelFEDChannelContainerFromQuality::m_CablingTagName
private

Definition at line 74 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_condDbCabling

const std::string FastSiPixelFEDChannelContainerFromQuality::m_condDbCabling
private

Definition at line 72 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_condDbQuality

const std::string FastSiPixelFEDChannelContainerFromQuality::m_condDbQuality
private

Definition at line 71 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_connectionPool

cond::persistency::ConnectionPool FastSiPixelFEDChannelContainerFromQuality::m_connectionPool
private

◆ m_endTime

unsigned long long FastSiPixelFEDChannelContainerFromQuality::m_endTime
private

Definition at line 82 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_output

const std::string FastSiPixelFEDChannelContainerFromQuality::m_output
private

Definition at line 78 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_QualityTagName

const std::string FastSiPixelFEDChannelContainerFromQuality::m_QualityTagName
private

Definition at line 73 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ m_record

const std::string FastSiPixelFEDChannelContainerFromQuality::m_record
private

Definition at line 75 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by endJob().

◆ m_startTime

unsigned long long FastSiPixelFEDChannelContainerFromQuality::m_startTime
private

Definition at line 81 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().

◆ myQualities

std::unique_ptr<SiPixelFEDChannelContainer> FastSiPixelFEDChannelContainerFromQuality::myQualities
private

◆ printdebug_

const bool FastSiPixelFEDChannelContainerFromQuality::printdebug_
private

◆ removeEmptyPayloads_

const bool FastSiPixelFEDChannelContainerFromQuality::removeEmptyPayloads_
private

Definition at line 86 of file FastSiPixelFEDChannelContainerFromQuality.cc.

Referenced by analyze().