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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~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
 
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)
 

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 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)
 
- 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 53 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.

55  thresholdL1_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
56  .getUntrackedParameter<double>("thresholdL1")),
57  thresholdL2_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
58  .getUntrackedParameter<double>("thresholdL2")),
59  thresholdL3_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
60  .getUntrackedParameter<double>("thresholdL3")),
61  thresholdL4_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
62  .getUntrackedParameter<double>("thresholdL4")),
63  thresholdRNG1_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
64  .getUntrackedParameter<double>("thresholdRNG1")),
65  thresholdRNG2_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
66  .getUntrackedParameter<double>("thresholdRNG2")),
67  outputBase_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
68  .getUntrackedParameter<std::string>("outputBase")),
70  iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<int>("aveDigiOcc")),
71  nLumi_(iConfig.getParameter<edm::ParameterSet>("SiPixelStatusManagerParameters")
72  .getUntrackedParameter<int>("resetEveryNLumi")),
73  moduleName_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
74  .getUntrackedParameter<std::string>("moduleName")),
75  label_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters")
77  trackerGeometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::EndRun>()),
78  trackerTopologyToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::EndRun>()),
79  siPixelFedCablingMapToken_(esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd, edm::Transition::EndRun>()),
80  siPixelQualityToken_(esConsumes<SiPixelQuality, SiPixelQualityFromDbRcd, edm::Transition::EndRun>()) {
81  SiPixelStatusManager* siPixelStatusManager = new SiPixelStatusManager(iConfig, consumesCollector());
82  siPixelStatusManager_ = *siPixelStatusManager;
83  debug_ = iConfig.getUntrackedParameter<bool>("debug");
84  recordName_ = iConfig.getUntrackedParameter<std::string>("recordName", "SiPixelQualityFromDbRcd");
85 
86  sensorSize_.clear();
87  pixelO2O_.clear();
88 
90  endLumiBlock_ = 0;
91  countLumi_ = 0;
92 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 95 of file SiPixelStatusHarvester.cc.

95 {}

Member Function Documentation

◆ analyze()

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

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

Definition at line 110 of file SiPixelStatusHarvester.cc.

110 {}

◆ beginJob()

void SiPixelStatusHarvester::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 98 of file SiPixelStatusHarvester.cc.

98 {}

◆ beginLuminosityBlock()

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

Definition at line 568 of file SiPixelStatusHarvester.cc.

References countLumi_.

568  {
569  countLumi_++;
570 }

◆ bookHistograms()

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

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

Definition at line 101 of file SiPixelStatusHarvester.cc.

References HistogramManagerHolder::histo.

103  {
104  for (auto& histoman : histo) {
105  histoman.book(iBooker, iSetup);
106  }
107 }
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 642 of file SiPixelStatusHarvester.cc.

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

Referenced by dqmEndRun().

645  {
646  for (std::map<int, SiPixelQuality>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) {
647  edm::LuminosityBlockID lu(iRun.id().run(), qIt->first);
648  cond::Time_t thisIOV = (cond::Time_t)(lu.value());
649 
650  SiPixelQuality thisPayload = qIt->second;
651  if (qIt == siPixelQualityTag.begin())
652  poolDbService->writeOneIOV<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
653  else {
654  SiPixelQuality prevPayload = (std::prev(qIt))->second;
655  if (!SiPixelStatusHarvester::equal(thisPayload,
656  prevPayload)) // only append newIOV if this payload differs wrt last
657  poolDbService->writeOneIOV<SiPixelQuality>(thisPayload, thisIOV, recordName_ + "_" + tagName);
658  }
659  }
660 }
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 113 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(), 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(), if(), SiPixelCoordinates::init(), createfilelist::int, writeEcalDQMStatus::interval, edm::Service< T >::isAvailable(), SiPixelQuality::IsRocBad(), SiPixelCoordinates::layer(), phase1PixelTopology::layer, DTRecHitClients_cfi::local, genParticles_cff::map, PixelTopology::ncolumns(), GetRecoTauVFromDQM_MC_cff::next, SiPixelModuleStatus::nrocs(), DeadROCCounter::nrocs, PixelTopology::nrows(), OTHERBADROC, outputBase_, castor_dqm_sourceclient_file_cfg::path, perLayerRingAverage(), PERMANENTBADROC, SiPixelDetectorStatus::perRocDigiOcc(), pixelO2O_, PROMPTBADROC, DetId::rawId(), 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.

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

References endLumiBlock_, edm::LuminosityBlockBase::luminosityBlock(), SiPixelStatusManager::readLumi(), and siPixelStatusManager_.

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

◆ equal()

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

Definition at line 605 of file SiPixelStatusHarvester.cc.

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

Referenced by constructTag(), and dqmEndRun().

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

◆ perLayerRingAverage()

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

Definition at line 663 of file SiPixelStatusHarvester.cc.

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

Referenced by dqmEndRun().

663  {
664  unsigned long int ave(0);
665  int nrocs(0);
666 
667  int layer = coord_.layer(DetId(detid));
668  int ring = coord_.ring(DetId(detid));
669 
670  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
671  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
672  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
673  if (layer != coord_.layer(DetId(itMod->first)))
674  continue;
675  if (ring != coord_.ring(DetId(itMod->first)))
676  continue;
677  unsigned long int inc = itMod->second.digiOccMOD();
678  ave += inc;
679  nrocs += itMod->second.nrocs();
680  }
681 
682  if (nrocs > 0)
683  return ave * 1.0 / nrocs;
684  else
685  return 0.0;
686 }
int ring(const DetId &)
constexpr std::array< uint8_t, layerIndexSize > layer
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 581 of file SiPixelStatusHarvester.cc.

References first.

Referenced by dqmEndRun().

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

◆ substructure()

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

Definition at line 688 of file SiPixelStatusHarvester.cc.

References coord_, dttmaxenums::L, SiPixelCoordinates::layer(), phase1PixelTopology::layer, dttmaxenums::R, SiPixelCoordinates::ring(), relativeConstraints::ring, AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

688  {
690  int layer = coord_.layer(DetId(detid));
691 
692  if (layer > 0) {
694  substructure = "BpixLYR";
695  substructure += L;
696  } else {
697  substructure = "FpixRNG";
698  int ring = coord_.ring(DetId(detid));
700  substructure += R;
701  }
702 
703  return substructure;
704 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
int ring(const DetId &)
constexpr std::array< uint8_t, layerIndexSize > layer
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().