CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiPixelStatusHarvester Class Reference

#include <SiPixelStatusHarvester.h>

Inheritance diagram for SiPixelStatusHarvester:
DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks > HistogramManagerHolder edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &) final
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &, const edm::EventSetup &) final
 
void dqmEndRun (const edm::Run &, const edm::EventSetup &) final
 
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
 SiPixelStatusHarvester (const edm::ParameterSet &)
 
 ~SiPixelStatusHarvester () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=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::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 Types

enum  {
  BADROC, PERMANENTBADROC, FEDERRORROC, STUCKTBMROC,
  OTHERBADROC, PROMPTBADROC
}
 

Private Member Functions

void constructTag (std::map< int, SiPixelQuality > siPixelQualityTag, edm::Service< cond::service::PoolDBOutputService > &poolDbService, std::string tagName, edm::Run const &iRun)
 
bool equal (SiPixelQuality a, SiPixelQuality b)
 
double perLayerRingAverage (int detid, SiPixelDetectorStatus tmpSiPixelStatus)
 
edm::LuminosityBlockNumber_t stepIOV (edm::LuminosityBlockNumber_t pin, std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t > IOV)
 
std::string substructure (int detid)
 
- Private Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, edm::Transition transition=edm::Transition::BeginRun)
 

Private Attributes

int aveDigiOcc_
 
const SiPixelQualitybadPixelInfo_
 
const SiPixelFedCablingcablingMap_ = nullptr
 
SiPixelCoordinates coord_
 
int countLumi_ = 0
 
bool debug_
 
edm::LuminosityBlockNumber_t endLumiBlock_
 
std::string label_
 
std::string moduleName_
 
int nLumi_
 
std::string outputBase_
 
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
 
std::string recordName_
 
std::map< int, unsigned int > sensorSize_
 
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdsiPixelFedCablingMapToken_
 
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcdsiPixelQualityToken_
 
SiPixelStatusManager siPixelStatusManager_
 
std::vector< std::string > substructures
 
double thresholdL1_
 
double thresholdL2_
 
double thresholdL3_
 
double thresholdL4_
 
double thresholdRNG1_
 
double thresholdRNG2_
 
const TrackerGeometrytrackerGeometry_ = nullptr
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeometryToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopologyToken_
 
- Private Attributes inherited from HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

harvest per-lumi prduced SiPixelDetector status and make the payload for SiPixelQualityFromDB

Definition at line 33 of file SiPixelStatusHarvester.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ SiPixelStatusHarvester()

SiPixelStatusHarvester::SiPixelStatusHarvester ( const edm::ParameterSet iConfig)

Definition at line 50 of file SiPixelStatusHarvester.cc.

References edm::EDConsumerBase::consumesCollector(), countLumi_, debug_, endLumiBlock_, edm::EndRun, edm::ParameterSet::getUntrackedParameter(), pixelO2O_, recordName_, SiPixelStatusManager::reset(), sensorSize_, siPixelStatusManager_, and AlCaHLTBitMon_QueryRunRegistry::string.

52  thresholdL1_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
53  .getUntrackedParameter<double>("thresholdL1")),
54  thresholdL2_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
55  .getUntrackedParameter<double>("thresholdL2")),
56  thresholdL3_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
57  .getUntrackedParameter<double>("thresholdL3")),
58  thresholdL4_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
59  .getUntrackedParameter<double>("thresholdL4")),
60  thresholdRNG1_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
61  .getUntrackedParameter<double>("thresholdRNG1")),
62  thresholdRNG2_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
63  .getUntrackedParameter<double>("thresholdRNG2")),
64  outputBase_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
65  .getUntrackedParameter<std::string>("outputBase")),
67  iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<int>("aveDigiOcc")),
68  nLumi_(iConfig.getParameter<edm::ParameterSet>("SiPixelStatusManagerParameters")
69  .getUntrackedParameter<int>("resetEveryNLumi")),
70  moduleName_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
71  .getUntrackedParameter<std::string>("moduleName")),
72  label_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
74  trackerGeometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::EndRun>()),
75  trackerTopologyToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::EndRun>()),
76  siPixelFedCablingMapToken_(esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd, edm::Transition::EndRun>()),
77  siPixelQualityToken_(esConsumes<SiPixelQuality, SiPixelQualityFromDbRcd, edm::Transition::EndRun>()) {
78  SiPixelStatusManager* siPixelStatusManager = new SiPixelStatusManager(iConfig, consumesCollector());
79  siPixelStatusManager_ = *siPixelStatusManager;
80  debug_ = iConfig.getUntrackedParameter<bool>("debug");
81  recordName_ = iConfig.getUntrackedParameter<std::string>("recordName", "SiPixelQualityFromDbRcd");
82 
83  sensorSize_.clear();
84  pixelO2O_.clear();
85 
87  endLumiBlock_ = 0;
88  countLumi_ = 0;
89 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< int, unsigned int > sensorSize_
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
HistogramManagerHolder(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, edm::Transition transition=edm::Transition::BeginRun)
edm::LuminosityBlockNumber_t endLumiBlock_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
SiPixelStatusManager siPixelStatusManager_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelFedCablingMapToken_
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_

◆ ~SiPixelStatusHarvester()

SiPixelStatusHarvester::~SiPixelStatusHarvester ( )
override

Definition at line 92 of file SiPixelStatusHarvester.cc.

92 {}

Member Function Documentation

◆ analyze()

void SiPixelStatusHarvester::analyze ( const edm::Event iEvent,
const edm::EventSetup  
)
finalvirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 107 of file SiPixelStatusHarvester.cc.

107 {}

◆ beginJob()

void SiPixelStatusHarvester::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 95 of file SiPixelStatusHarvester.cc.

95 {}

◆ beginLuminosityBlock()

void SiPixelStatusHarvester::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup  
)
final

Definition at line 565 of file SiPixelStatusHarvester.cc.

References countLumi_.

565  {
566  countLumi_++;
567 }

◆ bookHistograms()

void SiPixelStatusHarvester::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  ,
const edm::EventSetup iSetup 
)
finalvirtual

Implements DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 98 of file SiPixelStatusHarvester.cc.

References HistogramManagerHolder::histo.

100  {
101  for (auto& histoman : histo) {
102  histoman.book(iBooker, iSetup);
103  }
104 }
std::vector< HistogramManager > histo

◆ constructTag()

void SiPixelStatusHarvester::constructTag ( std::map< int, SiPixelQuality siPixelQualityTag,
edm::Service< cond::service::PoolDBOutputService > &  poolDbService,
std::string  tagName,
edm::Run const &  iRun 
)
private

Definition at line 639 of file SiPixelStatusHarvester.cc.

References equal(), edm::RunBase::id(), recordName_, edm::RunID::run(), edm::second(), dcs_print_summary_cfg::tagName, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by dqmEndRun().

642  {
643  for (std::map<int, SiPixelQuality>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) {
644  edm::LuminosityBlockID lu(iRun.id().run(), qIt->first);
645  cond::Time_t thisIOV = (cond::Time_t)(lu.value());
646 
647  SiPixelQuality thisPayload = qIt->second;
648  if (qIt == siPixelQualityTag.begin())
649  poolDbService->writeOneIOV<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
650  else {
651  SiPixelQuality prevPayload = (std::prev(qIt))->second;
652  if (!SiPixelStatusHarvester::equal(thisPayload,
653  prevPayload)) // only append newIOV if this payload differs wrt last
654  poolDbService->writeOneIOV<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
655  }
656  }
657 }
U second(std::pair< T, U > const &p)
unsigned long long Time_t
Definition: Time.h:14
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
bool equal(SiPixelQuality a, SiPixelQuality b)

◆ dqmEndRun()

void SiPixelStatusHarvester::dqmEndRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
finalvirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 110 of file SiPixelStatusHarvester.cc.

References SiPixelQuality::addDisabledModule(), aveDigiOcc_, badPixelInfo_, BADROC, SiPixelQuality::disabledModuleType::BadRocs, cablingMap_, sipixelobjects::GlobalPixel::col, PixelTopology::colsperroc(), constructTag(), coord_, SiPixelStatusManager::createPayloads(), debug_, SiPixelFedCabling::det2PathMap(), hcalRecHitTable_cff::detId, ALCARECOPPSCalTrackBasedSel_cff::detid, SiPixelQuality::disabledModuleType::DetID, TrackerGeometry::dets(), SiPixelModuleStatus::digiOccROC(), endLumiBlock_, equal(), SiPixelQuality::disabledModuleType::errorType, FEDERRORROC, spr::find(), SiPixelFedCabling::findItem(), cms::cuda::for(), SiPixelQuality::getBadComponentList(), SiPixelStatusManager::getBadComponents(), edm::EventSetup::getData(), SiPixelDetectorStatus::getDetectorStatus(), SiPixelStatusManager::getFEDerror25Rocs(), HistogramManagerHolder::histo, mps_fire::i, edm::RunBase::id(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), Hcal_Conditions_forGlobalTag_cff::iLumi, SiPixelCoordinates::init(), createfilelist::int, MergeJob_cfg::interval, edm::Service< T >::isAvailable(), SiPixelQuality::IsRocBad(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::layer, SiPixelCoordinates::layer(), DTRecHitClients_cfi::local, genParticles_cff::map, PixelTopology::ncolumns(), GetRecoTauVFromDQM_MC_cff::next, SiPixelModuleStatus::nrocs(), DeadROCCounter::nrocs, PixelTopology::nrows(), OTHERBADROC, outputBase_, EnsembleCalibrationLA_cfg::path, perLayerRingAverage(), PERMANENTBADROC, SiPixelDetectorStatus::perRocDigiOcc(), pixelO2O_, PROMPTBADROC, recordName_, SiPixelCoordinates::ring(), relativeConstraints::ring, PixelMapPlotter::roc, sipixelobjects::GlobalPixel::row, PixelTopology::rowsperroc(), edm::RunID::run(), edm::second(), sensorSize_, siPixelFedCablingMapToken_, AlCaHarvesting_cff::SiPixelQuality, siPixelQualityToken_, siPixelStatusManager_, PixelGeomDetUnit::specificTopology(), stepIOV(), STUCKTBMROC, thresholdL1_, thresholdL2_, thresholdL3_, thresholdL4_, thresholdRNG1_, thresholdRNG2_, trackerGeometry_, trackerGeometryToken_, trackerTopologyToken_, cond::service::PoolDBOutputService::writeOneIOV(), and testProducerWithPsetDescEmpty_cfi::x1.

110  {
111  // tracker geometry and cabling map to convert offline row/column (module) to online row/column
113  const TrackerTopology* trackerTopology = &iSetup.getData(trackerTopologyToken_);
114  const SiPixelFedCablingMap* siPixelFedCablingMap = &iSetup.getData(siPixelFedCablingMapToken_);
115  cablingMap_ = siPixelFedCablingMap;
116 
117  // Pixel Phase-1 helper class
118  coord_.init(trackerTopology, trackerGeometry_, siPixelFedCablingMap);
119 
120  for (TrackerGeometry::DetContainer::const_iterator it = trackerGeometry_->dets().begin();
121  it != trackerGeometry_->dets().end();
122  it++) {
123  const PixelGeomDetUnit* pgdu = dynamic_cast<const PixelGeomDetUnit*>((*it));
124  if (pgdu == nullptr)
125  continue;
126  DetId detId = (*it)->geographicalId();
127  int detid = detId.rawId();
128 
129  const PixelTopology* topo = static_cast<const PixelTopology*>(&pgdu->specificTopology());
130  // number of row/columns for a given module
131  int rowsperroc = topo->rowsperroc();
132  int colsperroc = topo->colsperroc();
133 
134  int nROCrows = pgdu->specificTopology().nrows() / rowsperroc;
135  int nROCcolumns = pgdu->specificTopology().ncolumns() / colsperroc;
136  unsigned int nrocs = nROCrows * nROCcolumns;
138 
139  std::map<int, std::pair<int, int>> rocToOfflinePixel;
140 
141  std::vector<sipixelobjects::CablingPathToDetUnit> path = (cablingMap_->det2PathMap()).find(detId.rawId())->second;
142  typedef std::vector<sipixelobjects::CablingPathToDetUnit>::const_iterator IT;
143  for (IT it = path.begin(); it != path.end(); ++it) {
144  // Pixel ROC building from path in cabling map
146  int idInDetUnit = (int)roc->idInDetUnit();
147 
148  // local to global conversion
149  sipixelobjects::LocalPixel::RocRowCol local = {rowsperroc / 2, colsperroc / 2};
151 
152  rocToOfflinePixel[idInDetUnit] = std::pair<int, int>(global.row, global.col);
153  }
154 
155  pixelO2O_[detid] = rocToOfflinePixel;
156  }
157 
158  // Permananent bad components
160 
161  // read in SiPixel occupancy data in ALCARECO/ALCAPROMPT
163  std::map<edm::LuminosityBlockNumber_t, std::map<int, std::vector<int>>> FEDerror25Map =
165  std::map<edm::LuminosityBlockNumber_t, SiPixelDetectorStatus> siPixelStatusMap =
167 
168  // DB service
170 
171  if (poolDbService.isAvailable()) { // if(poolDbService.isAvailable() )
172 
173  // start producing tag for permanent component removed
174  SiPixelQuality siPixelQualityPermBad;
175  const std::vector<SiPixelQuality::disabledModuleType> badComponentList = badPixelInfo_->getBadComponentList();
176  for (unsigned int i = 0; i < badComponentList.size(); i++) {
177  siPixelQualityPermBad.addDisabledModule(badComponentList[i]);
178 
179  uint32_t detId = badComponentList[i].DetID;
180  int detid = int(detId);
181  unsigned int nroc = sensorSize_[detid];
182 
183  for (int iroc = 0; iroc < int(nroc); iroc++) {
184  if (badPixelInfo_->IsRocBad(detId, short(iroc))) {
185  std::map<int, std::pair<int, int>> rocToOfflinePixel = pixelO2O_[detid];
186  int row = rocToOfflinePixel[iroc].first;
187  int column = rocToOfflinePixel[iroc].second;
188  histo[PERMANENTBADROC].fill(detId, nullptr, column, row);
189  }
190  }
191  }
192  if (debug_ == true) { // only produced for debugging reason
193  cond::Time_t thisIOV = (cond::Time_t)iRun.id().run();
194  poolDbService->writeOneIOV<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_ + "_permanentBad");
195  }
196 
197  // IOV for final payloads. FEDerror25 and pcl
198  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> finalIOV;
199  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> fedError25IOV;
200  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> pclIOV;
201 
202  // container for SiPixelQuality for the whole run
203  std::map<int, SiPixelQuality> siPixelQualityStuckTBM_Tag;
204 
205  // stuckTBM tag from FED error 25 with permanent component removed
206  for (SiPixelStatusManager::FEDerror25Map_iterator it = FEDerror25Map.begin(); it != FEDerror25Map.end(); it++) {
207  cond::Time_t thisIOV = 1;
208  edm::LuminosityBlockID lu(iRun.id().run(), it->first);
209  thisIOV = (cond::Time_t)(lu.value());
210 
211  int interval = 0;
212  // interval is the number of lumi sections in the IOV
214  if (nextIt != FEDerror25Map.end())
215  interval = int(nextIt->first - it->first);
216  else
217  interval = int(endLumiBlock_ - it->first + 1); // +1 because need to include the last lumi section
218 
219  SiPixelQuality siPixelQuality_stuckTBM;
220  SiPixelQuality siPixelQuality_FEDerror25;
221 
222  std::map<int, std::vector<int>> tmpFEDerror25 = it->second;
223  for (std::map<int, std::vector<int>>::iterator ilist = tmpFEDerror25.begin(); ilist != tmpFEDerror25.end();
224  ilist++) {
225  int detid = ilist->first;
226  uint32_t detId = uint32_t(detid);
227 
228  SiPixelQuality::disabledModuleType BadModule_stuckTBM, BadModule_FEDerror25;
229 
230  BadModule_stuckTBM.DetID = uint32_t(detid);
231  BadModule_FEDerror25.DetID = uint32_t(detid);
232  BadModule_stuckTBM.errorType = 3;
233  BadModule_FEDerror25.errorType = 3;
234 
235  BadModule_stuckTBM.BadRocs = 0;
236  BadModule_FEDerror25.BadRocs = 0;
237  std::vector<uint32_t> BadRocList_stuckTBM, BadRocList_FEDerror25;
238  std::vector<int> list = ilist->second;
239 
240  for (unsigned int i = 0; i < list.size(); i++) {
241  int iroc = list[i];
242  std::map<int, std::pair<int, int>> rocToOfflinePixel = pixelO2O_[detid];
243  int row = rocToOfflinePixel[iroc].first;
244  int column = rocToOfflinePixel[iroc].second;
245 
246  BadRocList_FEDerror25.push_back(uint32_t(iroc));
247  for (int iLumi = 0; iLumi < interval; iLumi++) {
248  histo[FEDERRORROC].fill(detId, nullptr, column, row); // 1.0/nLumiBlock_);
249  }
250 
251  // only include rocs that are not permanent known bad
252  if (!badPixelInfo_->IsRocBad(detId, short(iroc))) { // stuckTBM = FEDerror25 - permanent bad
253  BadRocList_stuckTBM.push_back(uint32_t(iroc));
254  for (int iLumi = 0; iLumi < interval; iLumi++) {
255  histo[STUCKTBMROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
256  }
257  }
258  }
259 
260  // change module error type if all ROCs are bad
261  if (BadRocList_stuckTBM.size() == sensorSize_[detid])
262  BadModule_stuckTBM.errorType = 0;
263 
264  short badrocs_stuckTBM = 0;
265  for (std::vector<uint32_t>::iterator iter = BadRocList_stuckTBM.begin(); iter != BadRocList_stuckTBM.end();
266  ++iter) {
267  badrocs_stuckTBM += 1 << *iter; // 1 << *iter = 2^{*iter} using bitwise shift
268  }
269  // fill the badmodule only if there is(are) bad ROC(s) in it
270  if (badrocs_stuckTBM != 0) {
271  BadModule_stuckTBM.BadRocs = badrocs_stuckTBM;
272  siPixelQuality_stuckTBM.addDisabledModule(BadModule_stuckTBM);
273  }
274 
275  // change module error type if all ROCs are bad
276  if (BadRocList_FEDerror25.size() == sensorSize_[detid])
277  BadModule_FEDerror25.errorType = 0;
278 
279  short badrocs_FEDerror25 = 0;
280  for (std::vector<uint32_t>::iterator iter = BadRocList_FEDerror25.begin(); iter != BadRocList_FEDerror25.end();
281  ++iter) {
282  badrocs_FEDerror25 += 1 << *iter; // 1 << *iter = 2^{*iter} using bitwise shift
283  }
284  // fill the badmodule only if there is(are) bad ROC(s) in it
285  if (badrocs_FEDerror25 != 0) {
286  BadModule_FEDerror25.BadRocs = badrocs_FEDerror25;
287  siPixelQuality_FEDerror25.addDisabledModule(BadModule_FEDerror25);
288  }
289 
290  } // loop over modules
291 
292  siPixelQualityStuckTBM_Tag[it->first] = siPixelQuality_stuckTBM;
293 
294  finalIOV[it->first] = it->first;
295  fedError25IOV[it->first] = it->first;
296 
297  if (debug_ == true) // only produced for debugging reason
298  poolDbService->writeOneIOV<SiPixelQuality>(siPixelQuality_FEDerror25, thisIOV, recordName_ + "_FEDerror25");
299  }
300 
301  // IOV for PCL output tags that "combines" permanent bad/stuckTBM/other
302  for (SiPixelStatusManager::siPixelStatusMap_iterator it = siPixelStatusMap.begin(); it != siPixelStatusMap.end();
303  it++) {
304  finalIOV[it->first] = it->first;
305  pclIOV[it->first] = it->first;
306  }
307 
308  // loop over final IOV
309  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
310 
311  // container for SiPixelQuality for the whole run
312  std::map<int, SiPixelQuality> siPixelQualityPCL_Tag;
313  std::map<int, SiPixelQuality> siPixelQualityPrompt_Tag;
314  std::map<int, SiPixelQuality> siPixelQualityOther_Tag;
315 
316  for (itIOV = finalIOV.begin(); itIOV != finalIOV.end(); itIOV++) {
317  int interval = 0;
318  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV = std::next(itIOV);
319  if (nextItIOV != finalIOV.end())
320  interval = int(nextItIOV->first - itIOV->first);
321  else
322  interval = int(endLumiBlock_ - itIOV->first + 1);
323 
324  edm::LuminosityBlockNumber_t lumiFEDerror25 = SiPixelStatusHarvester::stepIOV(itIOV->first, fedError25IOV);
325  edm::LuminosityBlockNumber_t lumiPCL = SiPixelStatusHarvester::stepIOV(itIOV->first, pclIOV);
326 
327  // get badROC list due to FEDerror25 = stuckTBM + permanent bad components
328  std::map<int, std::vector<int>> tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
329  // get SiPixelDetectorStatus
330  SiPixelDetectorStatus tmpSiPixelStatus = siPixelStatusMap[lumiPCL];
331  double DetAverage = tmpSiPixelStatus.perRocDigiOcc();
332 
333  // For the IOV of which the statistics is too low, for e.g., a cosmic run
334  // When using dynamicLumibased harvester or runbased harvester
335  // this only happens when the full run is lack of statistics
336  if (DetAverage < aveDigiOcc_) {
337  edm::LogInfo("SiPixelStatusHarvester")
338  << "Tag requested for prompt in low statistics IOV in the " << outputBase_ << " harvester" << std::endl;
339  siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
340  siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
341 
342  // loop over modules to fill the PROMPT DQM plots with permanent bad components
343  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
344  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
345  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
346  int detid = itMod->first;
347  uint32_t detId = uint32_t(detid);
348  SiPixelModuleStatus modStatus = itMod->second;
349 
350  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
351  if (badPixelInfo_->IsRocBad(detId, short(iroc))) {
352  std::map<int, std::pair<int, int>> rocToOfflinePixel = pixelO2O_[detid];
353  int row = rocToOfflinePixel[iroc].first;
354  int column = rocToOfflinePixel[iroc].second;
355  for (int iLumi = 0; iLumi < interval; iLumi++) {
356  histo[PROMPTBADROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
357  histo[PERMANENTBADROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
358  }
359 
360  } // if permanent BAD
361 
362  } // loop over ROCs
363 
364  } // loop over modules
365 
366  // add empty bad components to "other" tag
367  edm::LogInfo("SiPixelStatusHarvester")
368  << "Tag requested for other in low statistics IOV in the " << outputBase_ << " harvester" << std::endl;
369  siPixelQualityOther_Tag[itIOV->first] = SiPixelQuality();
370 
371  continue;
372  }
373 
374  // create the DB object
375  // payload including all : PCL = permanent bad (low DIGI ROC) + other + stuckTBM
376  SiPixelQuality siPixelQualityPCL;
377  SiPixelQuality siPixelQualityOther;
378  // Prompt = permanent bad(low DIGI + low eff/damaged ROCs + other)
379  SiPixelQuality siPixelQualityPrompt;
380 
381  // loop over modules
382  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
383  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
384  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
385  // create the bad module list for PCL and other
386  SiPixelQuality::disabledModuleType BadModulePCL, BadModuleOther;
387 
388  int detid = itMod->first;
389  uint32_t detId = uint32_t(detid);
390 
391  double DetAverage_local = SiPixelStatusHarvester::perLayerRingAverage(detid, tmpSiPixelStatus);
392  double local_threshold = 0.0;
393 
394  int layer = coord_.layer(DetId(detid));
395  int ring = coord_.ring(DetId(detid));
396 
397  if (layer == 1)
398  local_threshold = thresholdL1_;
399  if (layer == 2)
400  local_threshold = thresholdL2_;
401  if (layer == 3)
402  local_threshold = thresholdL3_;
403  if (layer == 4)
404  local_threshold = thresholdL4_;
405 
406  if (ring == 1)
407  local_threshold = thresholdRNG1_;
408  if (ring == 2)
409  local_threshold = thresholdRNG2_;
410 
411  BadModulePCL.DetID = uint32_t(detid);
412  BadModuleOther.DetID = uint32_t(detid);
413  BadModulePCL.errorType = 3;
414  BadModuleOther.errorType = 3;
415  BadModulePCL.BadRocs = 0;
416  BadModuleOther.BadRocs = 0;
417 
418  std::vector<uint32_t> BadRocListPCL, BadRocListOther;
419 
420  // module status and FEDerror25 status for module with DetId detId
421  SiPixelModuleStatus modStatus = itMod->second;
422  std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
423 
424  std::map<int, std::pair<int, int>> rocToOfflinePixel = pixelO2O_[detid];
425  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
426  unsigned int rocOccupancy = modStatus.digiOccROC(iroc);
427 
428  int row = rocToOfflinePixel[iroc].first;
429  int column = rocToOfflinePixel[iroc].second;
430 
431  // Bad ROC are from low DIGI Occ ROCs
432  if (rocOccupancy < local_threshold * DetAverage_local) { // if BAD
433 
434  //PCL bad roc list
435  BadRocListPCL.push_back(uint32_t(iroc));
436  for (int iLumi = 0; iLumi < interval; iLumi++) {
437  histo[BADROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
438  }
439 
440  //FEDerror25 list
441  std::vector<int>::iterator it = std::find(listFEDerror25.begin(), listFEDerror25.end(), iroc);
442 
443  // other source of bad components = PCL bad - FEDerror25 - permanent bad
444  if (it == listFEDerror25.end() && !(badPixelInfo_->IsRocBad(detId, short(iroc)))) {
445  // if neither permanent nor FEDerror25
446  BadRocListOther.push_back(uint32_t(iroc));
447  for (int iLumi = 0; iLumi < interval; iLumi++) {
448  histo[OTHERBADROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
449  }
450  }
451 
452  } // if BAD
453 
454  } // loop over ROCs
455 
456  // errorType 0 means the full module is bad
457  if (BadRocListPCL.size() == sensorSize_[detid])
458  BadModulePCL.errorType = 0;
459  if (BadRocListOther.size() == sensorSize_[detid])
460  BadModuleOther.errorType = 0;
461 
462  // PCL
463  short badrocsPCL = 0;
464  for (std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end();
465  ++iterPCL) {
466  badrocsPCL += 1 << *iterPCL; // 1 << *iter = 2^{*iter} using bitwise shift
467  }
468  if (badrocsPCL != 0) {
469  BadModulePCL.BadRocs = badrocsPCL;
470  siPixelQualityPCL.addDisabledModule(BadModulePCL);
471  }
472 
473  // Other
474  short badrocsOther = 0;
475  for (std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end();
476  ++iterOther) {
477  badrocsOther += 1 << *iterOther; // 1 << *iter = 2^{*iter} using bitwise shift
478  }
479  if (badrocsOther != 0) {
480  BadModuleOther.BadRocs = badrocsOther;
481  siPixelQualityOther.addDisabledModule(BadModuleOther);
482  }
483 
484  // start constructing bad components for prompt = "other" + permanent
485  SiPixelQuality::disabledModuleType BadModulePrompt;
486  BadModulePrompt.DetID = uint32_t(detid);
487  BadModulePrompt.errorType = 3;
488  BadModulePrompt.BadRocs = 0;
489 
490  std::vector<uint32_t> BadRocListPrompt;
491  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
492  // if in permannet bad tag or is in other tag
493  if (badPixelInfo_->IsRocBad(detId, short(iroc)) || ((badrocsOther >> short(iroc)) & 0x1)) {
494  BadRocListPrompt.push_back(uint32_t(iroc));
495 
496  std::map<int, std::pair<int, int>> rocToOfflinePixel = pixelO2O_[detid];
497  int row = rocToOfflinePixel[iroc].first;
498  int column = rocToOfflinePixel[iroc].second;
499  for (int iLumi = 0; iLumi < interval; iLumi++) {
500  histo[PROMPTBADROC].fill(detId, nullptr, column, row); //, 1.0/nLumiBlock_);
501  }
502  } // if bad
503  } // loop over all ROCs
504 
505  // errorType 0 means the full module is bad
506  if (BadRocListPrompt.size() == sensorSize_[detid])
507  BadModulePrompt.errorType = 0;
508 
509  short badrocsPrompt = 0;
510  for (std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin();
511  iterPrompt != BadRocListPrompt.end();
512  ++iterPrompt) {
513  badrocsPrompt += 1 << *iterPrompt; // 1 << *iter = 2^{*iter} using bitwise shift
514  }
515  if (badrocsPrompt != 0) {
516  BadModulePrompt.BadRocs = badrocsPrompt;
517  siPixelQualityPrompt.addDisabledModule(BadModulePrompt);
518  }
519 
520  } // end module loop
521 
522  // PCL
523  siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
524  // Prompt
525  siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
526  // Other
527  siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
528 
529  } // loop over IOV
530 
531  // Now construct the tags made of payloads
532  // and only append newIOV if this payload differs wrt last
533 
534  //PCL
535  if (debug_ == true) // only produced for debugging reason
536  SiPixelStatusHarvester::constructTag(siPixelQualityPCL_Tag, poolDbService, "PCL", iRun);
537  // other
538  SiPixelStatusHarvester::constructTag(siPixelQualityOther_Tag, poolDbService, "other", iRun);
539  // prompt
540  SiPixelStatusHarvester::constructTag(siPixelQualityPrompt_Tag, poolDbService, "prompt", iRun);
541  // stuckTBM
542  SiPixelStatusHarvester::constructTag(siPixelQualityStuckTBM_Tag, poolDbService, "stuckTBM", iRun);
543 
544  // Add a dummy IOV starting from last lumisection+1 to close the tag for the run
545  if ((outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased") && !finalIOV.empty()) {
546  itIOV = std::prev(finalIOV.end()); // go to last element in the pixel quality tag
547  SiPixelQuality lastPrompt = siPixelQualityPrompt_Tag[itIOV->first];
548  SiPixelQuality lastOther = siPixelQualityOther_Tag[itIOV->first];
549 
550  // add permanent bad components to last lumi+1 IF AND ONLY IF the last payload of prompt is not equal to permanent bad components
551  edm::LuminosityBlockID lu(iRun.id().run(), endLumiBlock_ + 1);
552  cond::Time_t thisIOV = (cond::Time_t)(lu.value());
553  if (!SiPixelStatusHarvester::equal(lastPrompt, siPixelQualityPermBad))
554  poolDbService->writeOneIOV<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_ + "_prompt");
555 
556  // add empty bad components to last lumi+1 IF AND ONLY IF the last payload of other is not equal to empty
557  SiPixelQuality siPixelQualityDummy;
558  if (!SiPixelStatusHarvester::equal(lastOther, siPixelQualityDummy))
559  poolDbService->writeOneIOV<SiPixelQuality>(siPixelQualityDummy, thisIOV, recordName_ + "_other");
560  }
561  } // end of if(poolDbService.isAvailable() )
562 }
void addDisabledModule(disabledModuleType module)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::map< int, unsigned int > sensorSize_
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > siPixelQualityToken_
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
virtual int ncolumns() const =0
void constructTag(std::map< int, SiPixelQuality > siPixelQualityTag, edm::Service< cond::service::PoolDBOutputService > &poolDbService, std::string tagName, edm::Run const &iRun)
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
edm::LuminosityBlockNumber_t endLumiBlock_
virtual int rowsperroc() const =0
virtual int nrows() const =0
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
int ring(const DetId &)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
edm::LuminosityBlockNumber_t stepIOV(edm::LuminosityBlockNumber_t pin, std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t > IOV)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned int LuminosityBlockNumber_t
SiPixelStatusManager siPixelStatusManager_
identify pixel inside single ROC
Definition: LocalPixel.h:7
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > siPixelFedCablingMapToken_
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
int layer(const DetId &)
U second(std::pair< T, U > const &p)
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
virtual std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap() const =0
const std::vector< disabledModuleType > getBadComponentList() const
unsigned long long Time_t
Definition: Time.h:14
const SiPixelQuality * badPixelInfo_
virtual int colsperroc() const =0
const std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus > & getBadComponents()
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > > & getFEDerror25Rocs()
void init(const TrackerTopology *, const TrackerGeometry *, const SiPixelFedCablingMap *)
const SiPixelFedCabling * cablingMap_
std::vector< LinkConnSpec >::const_iterator IT
const TrackerGeometry * trackerGeometry_
bool equal(SiPixelQuality a, SiPixelQuality b)
RunID const & id() const
Definition: RunBase.h:39
Log< level::Info, false > LogInfo
std::map< int, SiPixelModuleStatus > getDetectorStatus()
Definition: DetId.h:17
row and collumn in ROC representation
Definition: LocalPixel.h:13
double perLayerRingAverage(int detid, SiPixelDetectorStatus tmpSiPixelStatus)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
std::vector< HistogramManager > histo
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
bool isAvailable() const
Definition: Service.h:40
unsigned int digiOccROC(int iroc)
return ROC status (= hits on ROC iroc)
std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > >::iterator FEDerror25Map_iterator
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
RunNumber_t run() const
Definition: RunID.h:26
std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus >::iterator siPixelStatusMap_iterator

◆ endLuminosityBlock()

void SiPixelStatusHarvester::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup  
)
final

Definition at line 570 of file SiPixelStatusHarvester.cc.

References endLumiBlock_, Hcal_Conditions_forGlobalTag_cff::iLumi, SiPixelStatusManager::readLumi(), and siPixelStatusManager_.

570  {
572  // update endLumiBlock_ by current lumi block
573  if (endLumiBlock_ < iLumi.luminosityBlock())
574  endLumiBlock_ = iLumi.luminosityBlock();
575 }
edm::LuminosityBlockNumber_t endLumiBlock_
SiPixelStatusManager siPixelStatusManager_
void readLumi(const edm::LuminosityBlock &)

◆ equal()

bool SiPixelStatusHarvester::equal ( SiPixelQuality  a,
SiPixelQuality  b 
)
private

Definition at line 602 of file SiPixelStatusHarvester.cc.

References a, b, mps_fire::i, cuy::ib, findQualityFiles::size, and jetUpdater_cfi::sort.

Referenced by constructTag(), and dqmEndRun().

602  {
603  std::vector<SiPixelQuality::disabledModuleType> badRocListA;
604  std::vector<SiPixelQuality::disabledModuleType> badRocListB;
605 
606  for (unsigned int ia = 0; ia < (a.getBadComponentList()).size(); ia++) {
607  badRocListA.push_back((a.getBadComponentList())[ia]);
608  }
609  for (unsigned int ib = 0; ib < (b.getBadComponentList()).size(); ib++) {
610  badRocListB.push_back((b.getBadComponentList())[ib]);
611  }
612 
613  if (badRocListA.size() != badRocListB.size())
614  return false;
615 
616  // ordering ROCs by DetId
617  std::sort(badRocListA.begin(), badRocListA.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
618  std::sort(badRocListB.begin(), badRocListB.end(), SiPixelQuality::BadComponentStrictWeakOrdering());
619 
620  for (unsigned int i = 0; i < badRocListA.size(); i++) {
621  uint32_t detIdA = badRocListA[i].DetID;
622  uint32_t detIdB = badRocListB[i].DetID;
623  if (detIdA != detIdB)
624  return false;
625  else {
626  unsigned short BadRocsA = badRocListA[i].BadRocs;
627  unsigned short BadRocsB = badRocListB[i].BadRocs;
628  if (BadRocsA != BadRocsB)
629  return false;
630  }
631  }
632 
633  //if the module list is the same, and for each module, roc list is the same
634  //the two SiPixelQualitys are equal
635  return true;
636 }
size
Write out results.
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
ib
Definition: cuy.py:661

◆ perLayerRingAverage()

double SiPixelStatusHarvester::perLayerRingAverage ( int  detid,
SiPixelDetectorStatus  tmpSiPixelStatus 
)
private

Definition at line 660 of file SiPixelStatusHarvester.cc.

References coord_, ALCARECOPPSCalTrackBasedSel_cff::detid, SiPixelDetectorStatus::getDetectorStatus(), nano_mu_digi_cff::layer, SiPixelCoordinates::layer(), DeadROCCounter::nrocs, SiPixelCoordinates::ring(), and relativeConstraints::ring.

Referenced by dqmEndRun().

660  {
661  unsigned long int ave(0);
662  int nrocs(0);
663 
664  int layer = coord_.layer(DetId(detid));
665  int ring = coord_.ring(DetId(detid));
666 
667  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
668  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
669  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
670  if (layer != coord_.layer(DetId(itMod->first)))
671  continue;
672  if (ring != coord_.ring(DetId(itMod->first)))
673  continue;
674  unsigned long int inc = itMod->second.digiOccMOD();
675  ave += inc;
676  nrocs += itMod->second.nrocs();
677  }
678 
679  if (nrocs > 0)
680  return ave * 1.0 / nrocs;
681  else
682  return 0.0;
683 }
int ring(const DetId &)
int layer(const DetId &)
std::map< int, SiPixelModuleStatus > getDetectorStatus()
Definition: DetId.h:17

◆ stepIOV()

edm::LuminosityBlockNumber_t SiPixelStatusHarvester::stepIOV ( edm::LuminosityBlockNumber_t  pin,
std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t IOV 
)
private

Definition at line 578 of file SiPixelStatusHarvester.cc.

References dqmdumpme::first, and run_AlCaRecoTriggerBitsUpdateWorkflow::IOV.

Referenced by dqmEndRun().

579  {
580  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
581  for (itIOV = IOV.begin(); itIOV != IOV.end(); itIOV++) {
582  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
583  nextItIOV = itIOV;
584  nextItIOV++;
585 
586  if (nextItIOV != IOV.end()) {
587  if (pin >= itIOV->first && pin < nextItIOV->first) {
588  return itIOV->first;
589  }
590  } else {
591  if (pin >= itIOV->first) {
592  return itIOV->first;
593  }
594  }
595  }
596 
597  // return the firstIOV in case all above fail
598  return (IOV.begin())->first;
599 }

◆ substructure()

std::string SiPixelStatusHarvester::substructure ( int  detid)
private

Definition at line 685 of file SiPixelStatusHarvester.cc.

References coord_, ALCARECOPPSCalTrackBasedSel_cff::detid, dttmaxenums::L, nano_mu_digi_cff::layer, SiPixelCoordinates::layer(), dttmaxenums::R, SiPixelCoordinates::ring(), relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

685  {
687  int layer = coord_.layer(DetId(detid));
688 
689  if (layer > 0) {
691  substructure = "BpixLYR";
692  substructure += L;
693  } else {
694  substructure = "FpixRNG";
695  int ring = coord_.ring(DetId(detid));
697  substructure += R;
698  }
699 
700  return substructure;
701 }
int ring(const DetId &)
static std::string to_string(const XMLCh *ch)
int layer(const DetId &)
std::string substructure(int detid)
Definition: DetId.h:17

Member Data Documentation

◆ aveDigiOcc_

int SiPixelStatusHarvester::aveDigiOcc_
private

Definition at line 57 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ badPixelInfo_

const SiPixelQuality* SiPixelStatusHarvester::badPixelInfo_
private

Definition at line 69 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ cablingMap_

const SiPixelFedCabling* SiPixelStatusHarvester::cablingMap_ = nullptr
private

Definition at line 77 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ coord_

SiPixelCoordinates SiPixelStatusHarvester::coord_
private

Definition at line 80 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), perLayerRingAverage(), and substructure().

◆ countLumi_

int SiPixelStatusHarvester::countLumi_ = 0
private

Definition at line 72 of file SiPixelStatusHarvester.h.

Referenced by beginLuminosityBlock(), and SiPixelStatusHarvester().

◆ debug_

bool SiPixelStatusHarvester::debug_
private

Definition at line 64 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), and SiPixelStatusHarvester().

◆ endLumiBlock_

edm::LuminosityBlockNumber_t SiPixelStatusHarvester::endLumiBlock_
private

Definition at line 74 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), endLuminosityBlock(), and SiPixelStatusHarvester().

◆ label_

std::string SiPixelStatusHarvester::label_
private

◆ moduleName_

std::string SiPixelStatusHarvester::moduleName_
private

Definition at line 59 of file SiPixelStatusHarvester.h.

◆ nLumi_

int SiPixelStatusHarvester::nLumi_
private

Definition at line 58 of file SiPixelStatusHarvester.h.

◆ outputBase_

std::string SiPixelStatusHarvester::outputBase_
private

Definition at line 56 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ pixelO2O_

std::map<int, std::map<int, std::pair<int, int> > > SiPixelStatusHarvester::pixelO2O_
private

Definition at line 83 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), and SiPixelStatusHarvester().

◆ recordName_

std::string SiPixelStatusHarvester::recordName_
private

Definition at line 66 of file SiPixelStatusHarvester.h.

Referenced by constructTag(), dqmEndRun(), and SiPixelStatusHarvester().

◆ sensorSize_

std::map<int, unsigned int> SiPixelStatusHarvester::sensorSize_
private

Definition at line 78 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), and SiPixelStatusHarvester().

◆ siPixelFedCablingMapToken_

edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> SiPixelStatusHarvester::siPixelFedCablingMapToken_
private

Definition at line 87 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ siPixelQualityToken_

edm::ESGetToken<SiPixelQuality, SiPixelQualityFromDbRcd> SiPixelStatusHarvester::siPixelQualityToken_
private

Definition at line 88 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ siPixelStatusManager_

SiPixelStatusManager SiPixelStatusHarvester::siPixelStatusManager_
private

Definition at line 62 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun(), endLuminosityBlock(), and SiPixelStatusHarvester().

◆ substructures

std::vector<std::string> SiPixelStatusHarvester::substructures
private

Definition at line 91 of file SiPixelStatusHarvester.h.

◆ thresholdL1_

double SiPixelStatusHarvester::thresholdL1_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ thresholdL2_

double SiPixelStatusHarvester::thresholdL2_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ thresholdL3_

double SiPixelStatusHarvester::thresholdL3_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ thresholdL4_

double SiPixelStatusHarvester::thresholdL4_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ thresholdRNG1_

double SiPixelStatusHarvester::thresholdRNG1_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ thresholdRNG2_

double SiPixelStatusHarvester::thresholdRNG2_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ trackerGeometry_

const TrackerGeometry* SiPixelStatusHarvester::trackerGeometry_ = nullptr
private

Definition at line 76 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ trackerGeometryToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelStatusHarvester::trackerGeometryToken_
private

Definition at line 85 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().

◆ trackerTopologyToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelStatusHarvester::trackerTopologyToken_
private

Definition at line 86 of file SiPixelStatusHarvester.h.

Referenced by dqmEndRun().