CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiStripHitEfficiencyHarvester Class Reference
Inheritance diagram for SiStripHitEfficiencyHarvester:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
 SiStripHitEfficiencyHarvester (const edm::ParameterSet &)
 
 ~SiStripHitEfficiencyHarvester () override=default
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 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
 
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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool checkMapsValidity (const std::vector< MonitorElement *> &maps, const std::string &type) const
 
unsigned int countTotalHits (const std::vector< MonitorElement *> &maps)
 
void makeSummary (DQMStore::IGetter &getter, DQMStore::IBooker &booker, bool doProfiles=false) const
 
void makeSummaryVsVariable (DQMStore::IGetter &getter, DQMStore::IBooker &booker, ::projections theProj, bool doProfiles=true) const
 
void printAndWriteBadModules (const SiStripQuality &quality, const SiStripDetInfo &detInfo) const
 
void printTotalStatistics (const std::array< long, bounds::k_END_OF_LAYERS > &layerFound, const std::array< long, bounds::k_END_OF_LAYERS > &layerTotal) const
 
template<typename T >
void setEffBinLabels (const T gr, const T gr2, const unsigned int nLayers) const
 
void writeBadStripPayload (const SiStripQuality &quality) const
 

Private Attributes

int alllayerfound [bounds::k_END_OF_LAYS_AND_RINGS]
 
int alllayertotal [bounds::k_END_OF_LAYS_AND_RINGS]
 
const bool autoIneffModTagging_
 
SiStripHitEffData calibData_
 
const bool doStoreOnDB_
 
const bool doStoreOnTree_
 
const float effPlotMin_
 
int goodlayerfound [bounds::k_END_OF_LAYS_AND_RINGS]
 
int goodlayertotal [bounds::k_END_OF_LAYS_AND_RINGS]
 
const std::string inputFolder_
 
const bool isAtPCL_
 
const int nModsMin_
 
const unsigned int nTEClayers_
 
const std::string record_
 
const bool showEndcapSides_
 
const bool showOnlyGoodModules_
 
const bool showRings_
 
const bool showTOB6TEC9_
 
std::vector< DetIdstripDetIds_
 
std::unique_ptr< SiStripQualitystripQuality_
 
const edm::ESGetToken< SiStripQuality, SiStripQualityRcdstripQualityToken_
 
unsigned int t_DetId
 
unsigned int t_found
 
bool t_isTaggedIneff
 
unsigned char t_layer
 
float t_threshold
 
unsigned int t_total
 
const double threshold_
 
const std::string title_
 
std::unique_ptr< TkDetMaptkDetMap_
 
const edm::ESGetToken< TkDetMap, TrackerTopologyRcdtkDetMapToken_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtkGeomToken_
 
const double tkMapMin_
 
TTree * tree
 
std::unique_ptr< TrackerTopologytTopo_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::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
 
- 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 DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 42 of file SiStripHitEfficiencyHarvester.cc.

Constructor & Destructor Documentation

◆ SiStripHitEfficiencyHarvester()

SiStripHitEfficiencyHarvester::SiStripHitEfficiencyHarvester ( const edm::ParameterSet conf)
explicit

Definition at line 102 of file SiStripHitEfficiencyHarvester.cc.

References alllayerfound, alllayertotal, goodlayerfound, goodlayertotal, and MainPageGenerator::l.

103  : inputFolder_(conf.getParameter<std::string>("inputFolder")),
104  isAtPCL_(conf.getParameter<bool>("isAtPCL")),
105  autoIneffModTagging_(conf.getUntrackedParameter<bool>("AutoIneffModTagging", false)),
106  doStoreOnDB_(conf.getParameter<bool>("doStoreOnDB")),
107  doStoreOnTree_(conf.getUntrackedParameter<bool>("doStoreOnTree")),
108  showRings_(conf.getUntrackedParameter<bool>("ShowRings", false)),
109  showEndcapSides_(conf.getUntrackedParameter<bool>("ShowEndcapSides", true)),
110  showTOB6TEC9_(conf.getUntrackedParameter<bool>("ShowTOB6TEC9", false)),
111  showOnlyGoodModules_(conf.getUntrackedParameter<bool>("ShowOnlyGoodModules", false)),
112  nTEClayers_(showRings_ ? 7 : 9), // number of rings or wheels
113  threshold_(conf.getParameter<double>("Threshold")),
114  nModsMin_(conf.getParameter<int>("nModsMin")),
115  effPlotMin_(conf.getUntrackedParameter<double>("EffPlotMin", 0.9)),
116  tkMapMin_(conf.getUntrackedParameter<double>("TkMapMin", 0.9)),
117  title_(conf.getParameter<std::string>("Title")),
118  record_(conf.getParameter<std::string>("Record")),
119  tTopoToken_(esConsumes<edm::Transition::EndRun>()),
120  tkDetMapToken_(esConsumes<edm::Transition::EndRun>()),
121  stripQualityToken_(esConsumes<edm::Transition::EndRun>()),
122  tkGeomToken_(esConsumes<edm::Transition::EndRun>()) {
123  // zero in all counts
124  for (int l = 0; l < bounds::k_END_OF_LAYS_AND_RINGS; l++) {
125  goodlayertotal[l] = 0;
126  goodlayerfound[l] = 0;
127  alllayertotal[l] = 0;
128  alllayerfound[l] = 0;
129  }
130 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
int goodlayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
int goodlayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
int alllayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
int alllayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_

◆ ~SiStripHitEfficiencyHarvester()

SiStripHitEfficiencyHarvester::~SiStripHitEfficiencyHarvester ( )
overridedefault

Member Function Documentation

◆ checkMapsValidity()

bool SiStripHitEfficiencyHarvester::checkMapsValidity ( const std::vector< MonitorElement *> &  maps,
const std::string &  type 
) const
private

Definition at line 152 of file SiStripHitEfficiencyHarvester.cc.

References submitPVResolutionJobs::count, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LogDebug, HcalDetIdTransform::transform(), and x.

Referenced by dqmEndJob().

153  {
154  std::vector<bool> isThere;
155  isThere.reserve(maps.size());
156  std::transform(maps.begin() + 1, maps.end(), std::back_inserter(isThere), [](auto& x) { return !(x == nullptr); });
157 
158  int count{0};
159  for (const auto& it : isThere) {
160  count++;
161  LogDebug("SiStripHitEfficiencyHarvester") << " layer: " << count << " " << it << std::endl;
162  if (it)
163  LogDebug("SiStripHitEfficiencyHarvester") << "resolving to " << maps[count]->getName() << std::endl;
164  }
165 
166  // check on the input TkHistoMap
167  bool areMapsAvailable{true};
168  int layerCount{0};
169  for (const auto& it : isThere) {
170  layerCount++;
171  if (!it) {
172  edm::LogError("SiStripHitEfficiencyHarvester")
173  << type << " TkHistoMap for layer " << layerCount << " was not found.\n -> Aborting!";
174  areMapsAvailable = false;
175  break;
176  }
177  }
178  return areMapsAvailable;
179 }
Log< level::Error, false > LogError
#define LogDebug(id)
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ countTotalHits()

unsigned int SiStripHitEfficiencyHarvester::countTotalHits ( const std::vector< MonitorElement *> &  maps)
private

Definition at line 181 of file SiStripHitEfficiencyHarvester.cc.

References B2GTnPMonitor_cfi::item, and dqmMemoryStats::total.

Referenced by dqmEndJob().

181  {
182  return std::accumulate(maps.begin() + 1, maps.end(), 0, [](unsigned int total, MonitorElement* item) {
183  return total + item->getEntries();
184  });
185 }

◆ dqmEndJob()

void SiStripHitEfficiencyHarvester::dqmEndJob ( DQMStore::IBooker booker,
DQMStore::IGetter getter 
)
overridevirtual

Implements DQMEDHarvester.

Definition at line 187 of file SiStripHitEfficiencyHarvester.cc.

References alllayerfound, alllayertotal, cms::cuda::assert(), autoIneffModTagging_, dqm::implementation::IBooker::book1D(), calibData_, SiStripHitEffData::checkFedError(), checkMapsValidity(), countTotalHits(), makePileupJSON::denom, doStoreOnDB_, doStoreOnTree_, Exception, SiStripHitEffData::fedErrorCounts, SiStripHitEffData::FEDErrorOccupancy, SiStripHitEffData::fillMapFromTkMap(), dqm-mbProfile::format, HLT_2024v14_cff::fraction, compareTotals::fs, dqm::implementation::IGetter::get(), dqm::impl::MonitorElement::getBinContent(), goodlayerfound, goodlayertotal, mps_fire::i, inputFolder_, isAtPCL_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SiStripDetInfoFileReader::kDefaultFile, nano_mu_digi_cff::layer, LogDebug, LOGPRINT, makeSummary(), makeSummaryVsVariable(), SiStripPI::max, nModsMin_, me0TriggerPseudoDigis_cff::nStrips, nTEClayers_, EgammaValidation_cff::num, or, printAndWriteBadModules(), printTotalStatistics(), SiStripDetInfoFileReader::read(), dqm::implementation::NavigatorBase::setCurrentFolder(), showRings_, AlCaHLTBitMon_QueryRunRegistry::string, stripDetIds_, stripQuality_, sistrip::STRIPS_PER_APV, t_DetId, t_found, t_isTaggedIneff, t_layer, t_threshold, t_total, threshold_, title_, tkDetMap_, tkMapMin_, tTopo_, and writeBadStripPayload().

187  {
188  if (!isAtPCL_) {
190  if (!fs.isAvailable()) {
191  throw cms::Exception("BadConfig") << "TFileService unavailable: "
192  << "please add it to config file";
193  }
194 
195  if (doStoreOnTree_) {
196  // store information per DetId in the output tree
197  tree = fs->make<TTree>("ModEff", "ModEff");
198  tree->Branch("DetId", &t_DetId, "DetId/i");
199  tree->Branch("Layer", &t_layer, "Layer/b");
200  tree->Branch("FoundHits", &t_found, "FoundHits/i");
201  tree->Branch("AllHits", &t_total, "AllHits/i");
202  tree->Branch("IsTaggedIneff", &t_isTaggedIneff, "IsTaggedIneff/O");
203  tree->Branch("TagThreshold", &t_threshold, "TagThreshold/F");
204  }
205  }
206 
208  LOGPRINT << "A module is bad if efficiency < " << threshold_ << " and has at least " << nModsMin_ << " nModsMin.";
209  else
210  LOGPRINT << "A module is bad if the upper limit on the efficiency is < to the avg in the layer - " << threshold_
211  << " and has at least " << nModsMin_ << " nModsMin.";
212 
213  auto h_module_total = std::make_unique<TkHistoMap>(tkDetMap_.get());
214  h_module_total->loadTkHistoMap(fmt::format("{}/TkDetMaps", inputFolder_), "perModule_total");
215  auto h_module_found = std::make_unique<TkHistoMap>(tkDetMap_.get());
216  h_module_found->loadTkHistoMap(fmt::format("{}/TkDetMaps", inputFolder_), "perModule_found");
217 
218  // collect how many layers are missing
219  const auto& totalMaps = h_module_total->getAllMaps();
220  const auto& foundMaps = h_module_found->getAllMaps();
221 
222  LogDebug("SiStripHitEfficiencyHarvester")
223  << "totalMaps.size(): " << totalMaps.size() << " foundMaps.size() " << foundMaps.size() << std::endl;
224 
225  // check on the input TkHistoMaps
226  bool isTotalMapAvailable = this->checkMapsValidity(totalMaps, std::string("Total"));
227  bool isFoundMapAvailable = this->checkMapsValidity(foundMaps, std::string("Found"));
228 
229  LogDebug("SiStripHitEfficiencyHarvester")
230  << "isTotalMapAvailable: " << isTotalMapAvailable << " isFoundMapAvailable " << isFoundMapAvailable << std::endl;
231 
232  // no input TkHistoMaps -> early return
233  if (!isTotalMapAvailable or !isFoundMapAvailable)
234  return;
235 
236  LogDebug("SiStripHitEfficiencyHarvester")
237  << "Entries in total TkHistoMap for layer 3: " << h_module_total->getMap(3)->getEntries() << ", found "
238  << h_module_found->getMap(3)->getEntries();
239 
240  // count how many hits in the denominator we have
241  const unsigned int totalHits = this->countTotalHits(totalMaps);
242 
243  // set colz
244  for (size_t i = 1; i < totalMaps.size(); i++) {
245  h_module_total->getMap(i)->setOption("colz");
246  h_module_found->getMap(i)->setOption("colz");
247  }
248 
249  // come back to the main folder
251 
252  std::vector<MonitorElement*> hEffInLayer(std::size_t(1), nullptr);
253  hEffInLayer.reserve(bounds::k_END_OF_LAYERS);
254  for (std::size_t i = 1; i != bounds::k_END_OF_LAYERS; ++i) {
255  const auto lyrName = ::layerName(i, showRings_, nTEClayers_);
256  hEffInLayer.push_back(booker.book1D(
257  Form("eff_layer%i", int(i)), Form("Module efficiency in layer %s", lyrName.c_str()), 201, 0, 1.005));
258  }
259  std::array<long, bounds::k_END_OF_LAYERS> layerTotal{};
260  std::array<long, bounds::k_END_OF_LAYERS> layerFound{};
261  layerTotal.fill(0);
262  layerFound.fill(0);
263 
265  // Effiency calculation, bad module tagging, and tracker maps //
267 
268  TrackerMap tkMap{" Detector Inefficiency "};
269  TrackerMap tkMapBad{" Inefficient Modules "};
270  TrackerMap tkMapEff{title_};
271  TrackerMap tkMapNum{" Detector numerator "};
272  TrackerMap tkMapDen{" Detector denominator "};
273  std::map<unsigned int, double> badModules;
274 
275  // load the FEDError map
276  const auto& EventStats = getter.get(fmt::format("{}/EventInfo/EventStats", inputFolder_));
277  const int totalEvents = EventStats->getBinContent(1., 1.); // first bin contains info on number of events run
278  calibData_.FEDErrorOccupancy = std::make_unique<TkHistoMap>(tkDetMap_.get());
279  calibData_.FEDErrorOccupancy->loadTkHistoMap(fmt::format("{}/FEDErrorTkDetMaps", inputFolder_),
280  "perModule_FEDErrors");
281 
282  // tag as bad from FEDErrors the modules that have an error on 75% of the events
283  calibData_.fillMapFromTkMap(totalEvents, 0.75, stripDetIds_);
284 
285  for (const auto& [badId, fraction] : calibData_.fedErrorCounts) {
286  LogDebug("SiStripHitEfficiencyHarvester")
287  << __PRETTY_FUNCTION__ << " bad module from FEDError " << badId << "," << fraction << std::endl;
288  }
289 
290  for (auto det : stripDetIds_) {
291  auto layer = ::checkLayer(det, tTopo_.get());
292  const auto num = h_module_found->getValue(det);
293  const auto denom = h_module_total->getValue(det);
294  if (denom) {
295  // use only the "good" modules
296  if (stripQuality_->getBadApvs(det) == 0 && calibData_.checkFedError(det)) {
297  const auto eff = num / denom;
298  hEffInLayer[layer]->Fill(eff);
299  if (!autoIneffModTagging_) {
300  if ((denom >= nModsMin_) && (eff < threshold_)) {
301  // We have a bad module, put it in the list!
302  badModules[det] = eff;
303  tkMapBad.fillc(det, 255, 0, 0);
304  LOGPRINT << "Layer " << layer << " (" << ::layerName(layer, showRings_, nTEClayers_) << ") module "
305  << det.rawId() << " efficiency: " << eff << " , " << num << "/" << denom;
306  } else {
307  //Fill the bad list with empty results for every module
308  tkMapBad.fillc(det, 255, 255, 255);
309  }
310  if (eff < threshold_)
311  LOGPRINT << "Layer " << layer << " (" << ::layerName(layer, showRings_, nTEClayers_) << ") module "
312  << det.rawId() << " efficiency: " << eff << " , " << num << "/" << denom;
313 
314  if (denom < nModsMin_) {
315  LOGPRINT << "Layer " << layer << " (" << ::layerName(layer, showRings_, nTEClayers_) << ") module "
316  << det.rawId() << " is under occupancy at " << denom;
317  }
318 
319  if (doStoreOnTree_ && !isAtPCL_) {
320  t_DetId = det.rawId();
321  t_layer = layer;
322  t_found = num;
323  t_total = denom;
324  t_isTaggedIneff = false;
325  t_threshold = 0;
326  tree->Fill();
327  } // if storing tree
328  } // if not autoInefModTagging
329  } // if there are no bad APVs
330  } // if denom
331  } // loop on DetIds
332 
333  if (autoIneffModTagging_) {
334  for (unsigned int i = 1; i <= k_LayersAtTECEnd; i++) {
335  //Compute threshold to use for each layer
336  hEffInLayer[i]->getTH1()->GetXaxis()->SetRange(
337  3, hEffInLayer[i]->getNbinsX() + 1); // Remove from the avg modules below 1%
338  const double layer_min_eff = hEffInLayer[i]->getMean() - std::max(2.5 * hEffInLayer[i]->getRMS(), threshold_);
339  LOGPRINT << "Layer " << i << " threshold for bad modules: <" << layer_min_eff
340  << " (layer mean: " << hEffInLayer[i]->getMean() << " rms: " << hEffInLayer[i]->getRMS() << ")";
341 
342  hEffInLayer[i]->getTH1()->GetXaxis()->SetRange(1, hEffInLayer[i]->getNbinsX() + 1);
343 
344  for (auto det : stripDetIds_) {
345  const auto layer = ::checkLayer(det, tTopo_.get());
346  if (layer == i) {
347  const auto num = h_module_found->getValue(det);
348  const auto denom = h_module_total->getValue(det);
349  if (denom) {
350  assert(num <= denom); // can't have this happen
351  // use only the "good" modules
352  if (stripQuality_->getBadApvs(det) == 0 && calibData_.checkFedError(det)) {
353  const auto eff = num / denom;
354  const auto eff_up = TEfficiency::Bayesian(denom, num, .99, 1, 1, true);
355 
356  if ((denom >= nModsMin_) && (eff_up < layer_min_eff)) {
357  //We have a bad module, put it in the list!
358  badModules[det] = eff;
359  tkMapBad.fillc(det, 255, 0, 0);
360  if (!isAtPCL_ && doStoreOnTree_) {
361  t_isTaggedIneff = true;
362  }
363  } else {
364  //Fill the bad list with empty results for every module
365  tkMapBad.fillc(det, 255, 255, 255);
366  if (!isAtPCL_ && doStoreOnTree_) {
367  t_isTaggedIneff = false;
368  }
369  }
370  if (eff_up < layer_min_eff + 0.08) {
371  // printing message also for modules sligthly above (8%) the limit
372  LOGPRINT << "Layer " << layer << " (" << ::layerName(layer, showRings_, nTEClayers_) << ") module "
373  << det.rawId() << " efficiency: " << eff << " , " << num << "/" << denom
374  << " , upper limit: " << eff_up;
375  }
376  if (denom < nModsMin_) {
377  LOGPRINT << "Layer " << layer << " (" << ::layerName(layer, showRings_, nTEClayers_) << ") module "
378  << det.rawId() << " layer " << layer << " is under occupancy at " << denom;
379  }
380 
381  if (!isAtPCL_ && doStoreOnTree_) {
382  t_DetId = det.rawId();
383  t_layer = layer;
384  t_found = num;
385  t_total = denom;
386  t_threshold = layer_min_eff;
387  tree->Fill();
388  } // if storing tree
389 
390  //Put modules into the TKMap
391  tkMap.fill(det, 1. - eff);
392  tkMapEff.fill(det, eff);
393  tkMapNum.fill(det, num);
394  tkMapDen.fill(det, denom);
395 
396  layerTotal[layer] += denom;
397  layerFound[layer] += num;
398 
399  // for the summary
400  // Have to do the decoding for which side to go on (ugh)
401  if (layer <= bounds::k_LayersAtTOBEnd) {
404  } else if (layer <= bounds::k_LayersAtTIDEnd) {
405  if (tTopo_->tidSide(det) == 1) {
408  } else if (tTopo_->tidSide(det) == 2) {
409  goodlayerfound[layer + 3] += num;
410  goodlayertotal[layer + 3] += denom;
411  }
412  } else if (layer <= bounds::k_LayersAtTECEnd) {
413  if (tTopo_->tecSide(det) == 1) {
414  goodlayerfound[layer + 3] += num;
415  goodlayertotal[layer + 3] += denom;
416  } else if (tTopo_->tecSide(det) == 2) {
419  }
420  }
421  } // if the module is good!
422 
423  //Do the one where we don't exclude bad modules!
424  if (layer <= bounds::k_LayersAtTOBEnd) {
425  alllayerfound[layer] += num;
427  } else if (layer <= bounds::k_LayersAtTIDEnd) {
428  if (tTopo_->tidSide(det) == 1) {
429  alllayerfound[layer] += num;
431  } else if (tTopo_->tidSide(det) == 2) {
432  alllayerfound[layer + 3] += num;
433  alllayertotal[layer + 3] += denom;
434  }
435  } else if (layer <= bounds::k_LayersAtTECEnd) {
436  if (tTopo_->tecSide(det) == 1) {
437  alllayerfound[layer + 3] += num;
438  alllayertotal[layer + 3] += denom;
439  } else if (tTopo_->tecSide(det) == 2) {
442  }
443  }
444  } // if denom
445  } // layer = i
446  } // loop on detids
447  } // loop on layers
448  } // if auto tagging
449 
450  tkMap.save(true, 0, 0, "SiStripHitEffTKMap_NEW.png");
451  tkMapBad.save(true, 0, 0, "SiStripHitEffTKMapBad_NEW.png");
452  tkMapEff.save(true, tkMapMin_, 1., "SiStripHitEffTKMapEff_NEW.png");
453  tkMapNum.save(true, 0, 0, "SiStripHitEffTKMapNum_NEW.png");
454  tkMapDen.save(true, 0, 0, "SiStripHitEffTKMapDen_NEW.png");
455 
456  const auto detInfo =
458  SiStripQuality pQuality{detInfo};
459  //This is the list of the bad strips, use to mask out entire APVs
460  //Now simply go through the bad hit list and mask out things that
461  //are bad!
462  for (const auto it : badModules) {
463  const auto det = it.first;
464  std::vector<unsigned int> badStripList;
465  //We need to figure out how many strips are in this particular module
466  //To Mask correctly!
467  const auto nStrips = detInfo.getNumberOfApvsAndStripLength(det).first * sistrip::STRIPS_PER_APV;
468  LOGPRINT << "Number of strips module " << det << " is " << nStrips;
469  badStripList.push_back(pQuality.encode(0, nStrips, 0));
470  //Now compact into a single bad module
471  LOGPRINT << "ID1 should match list of modules above " << det;
472  pQuality.compact(det, badStripList);
473  pQuality.put(det, SiStripQuality::Range(badStripList.begin(), badStripList.end()));
474  }
475  pQuality.fillBadComponents();
476  if (doStoreOnDB_) {
477  if (totalHits > 0u) {
478  writeBadStripPayload(pQuality);
479  } else {
480  edm::LogPrint("SiStripHitEfficiencyHarvester")
481  << __PRETTY_FUNCTION__ << " There are no SiStrip hits for a valid measurement, skipping!";
482  }
483  } else {
484  edm::LogInfo("SiStripHitEfficiencyHarvester") << "Will not produce payload!";
485  }
486 
487  printTotalStatistics(layerFound, layerTotal); // statistics by layer and subdetector
488  //LOGPRINT << "\n-----------------\nNew IOV starting from run " << e.id().run() << " event " << e.id().event()
489  // << " lumiBlock " << e.luminosityBlock() << " time " << e.time().value() << "\n-----------------\n";
490  printAndWriteBadModules(pQuality, detInfo); // TODO
491 
492  // make summary plots
493  makeSummary(getter, booker);
494  makeSummaryVsVariable(getter, booker, projections::k_vs_LUMI);
495  makeSummaryVsVariable(getter, booker, projections::k_vs_PU);
496  makeSummaryVsVariable(getter, booker, projections::k_vs_BX);
497 }
void makeSummary(DQMStore::IGetter &getter, DQMStore::IBooker &booker, bool doProfiles=false) const
int goodlayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
int goodlayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::unique_ptr< TrackerTopology > tTopo_
int alllayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
void printAndWriteBadModules(const SiStripQuality &quality, const SiStripDetInfo &detInfo) const
std::unordered_map< uint32_t, int > fedErrorCounts
assert(be >=bs)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
std::unique_ptr< TkHistoMap > FEDErrorOccupancy
const bool checkFedError(const DetId det)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void printTotalStatistics(const std::array< long, bounds::k_END_OF_LAYERS > &layerFound, const std::array< long, bounds::k_END_OF_LAYERS > &layerTotal) const
unsigned int countTotalHits(const std::vector< MonitorElement *> &maps)
void writeBadStripPayload(const SiStripQuality &quality) const
SiStripDetInfo read(std::string filePath)
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
void fillMapFromTkMap(const int nevents, const float threshold, const std::vector< DetId > &stripDetIds)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
static const uint16_t STRIPS_PER_APV
std::pair< ContainerIterator, ContainerIterator > Range
std::unique_ptr< SiStripQuality > stripQuality_
int alllayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
static constexpr char const *const kDefaultFile
Definition: tree.py:1
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
bool checkMapsValidity(const std::vector< MonitorElement *> &maps, const std::string &type) const
void makeSummaryVsVariable(DQMStore::IGetter &getter, DQMStore::IBooker &booker, ::projections theProj, bool doProfiles=true) const
#define LogDebug(id)
virtual double getBinContent(int binx) const
get content of bin (1-D)

◆ endRun()

void SiStripHitEfficiencyHarvester::endRun ( edm::Run const &  ,
edm::EventSetup const &  iSetup 
)
override

Definition at line 132 of file SiStripHitEfficiencyHarvester.cc.

References edm::EventSetup::getData(), stripDetIds_, stripQuality_, stripQualityToken_, tkDetMap_, tkDetMapToken_, tkGeomToken_, tTopo_, and tTopoToken_.

132  {
133  if (!tTopo_) {
134  tTopo_ = std::make_unique<TrackerTopology>(iSetup.getData(tTopoToken_));
135  }
136  if (!tkDetMap_) {
137  tkDetMap_ = std::make_unique<TkDetMap>(iSetup.getData(tkDetMapToken_));
138  }
139  if (!stripQuality_) {
140  stripQuality_ = std::make_unique<SiStripQuality>(iSetup.getData(stripQualityToken_));
141  }
142  if (stripDetIds_.empty()) {
143  const auto& tkGeom = iSetup.getData(tkGeomToken_);
144  for (const auto& det : tkGeom.detUnits()) {
145  if (dynamic_cast<const StripGeomDetUnit*>(det)) {
146  stripDetIds_.push_back(det->geographicalId());
147  }
148  }
149  }
150 }
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::unique_ptr< TrackerTopology > tTopo_
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
std::unique_ptr< SiStripQuality > stripQuality_
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_

◆ fillDescriptions()

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

Definition at line 1162 of file SiStripHitEfficiencyHarvester.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

1162  {
1164  desc.add<std::string>("inputFolder", "AlCaReco/SiStripHitEfficiency");
1165  desc.add<bool>("isAtPCL", false);
1166  desc.add<bool>("doStoreOnDB", false);
1167  desc.add<std::string>("Record", "SiStripBadStrip");
1168  desc.add<double>("Threshold", 0.1);
1169  desc.add<std::string>("Title", "Hit Efficiency");
1170  desc.add<int>("nModsMin", 5);
1171  desc.addUntracked<bool>("doStoreOnTree", false);
1172  desc.addUntracked<bool>("AutoIneffModTagging", false);
1173  desc.addUntracked<double>("TkMapMin", 0.9);
1174  desc.addUntracked<double>("EffPlotMin", 0.9);
1175  desc.addUntracked<bool>("ShowRings", false);
1176  desc.addUntracked<bool>("ShowEndcapSides", true);
1177  desc.addUntracked<bool>("ShowTOB6TEC9", false);
1178  desc.addUntracked<bool>("ShowOnlyGoodModules", false);
1179  descriptions.addWithDefaultLabel(desc);
1180 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ makeSummary()

void SiStripHitEfficiencyHarvester::makeSummary ( DQMStore::IGetter getter,
DQMStore::IBooker booker,
bool  doProfiles = false 
) const
private

Definition at line 560 of file SiStripHitEfficiencyHarvester.cc.

References alllayerfound, alllayertotal, dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::bookProfile(), MillePedeFileConverter_cfg::e, effPlotMin_, Exception, dqm-mbProfile::format, compareTotals::fs, dqm::impl::MonitorElement::getBinContent(), dqm::impl::MonitorElement::getNbinsX(), dqm::legacy::MonitorElement::getTH1F(), goodlayerfound, goodlayertotal, mps_fire::i, inputFolder_, isAtPCL_, dqmiolumiharvest::j, LOGPRINT, MuonTCMETValueMapProducer_cff::nLayers, nTEClayers_, compare::overlay(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), dqm::implementation::NavigatorBase::setCurrentFolder(), setEffBinLabels(), showEndcapSides_, showOnlyGoodModules_, showRings_, and tkMapMin_.

Referenced by dqmEndJob().

562  {
563  // use goodlayer_total/found and alllayer_total/found, collapse side and/or ring if needed
564  unsigned int nLayers{34}; // default
565  if (showRings_)
566  nLayers = 30;
567  if (!showEndcapSides_) {
568  if (!showRings_)
569  nLayers = 22;
570  else
571  nLayers = 20;
572  }
573 
574  // come back to the main folder and create a final efficiency folder
575  booker.setCurrentFolder(fmt::format("{}/EfficiencySummary", inputFolder_));
576  MonitorElement* found_good =
577  booker.book1D("found_good", "found hits per layer (good modules only)", nLayers + 1, 0, nLayers + 1);
578  MonitorElement* all_good =
579  booker.book1D("all_good", "all hits per layer (good modules only)", nLayers + 1, 0, nLayers + 1);
580  MonitorElement* found_all =
581  booker.book1D("found_all", "found hit per layer (all modules)", nLayers + 1, 0, nLayers + 1);
582  MonitorElement* all_all = booker.book1D("all_all", "all hits per layer (all modules)", nLayers + 1, 0, nLayers + 1);
583 
584  // first bin only to keep real data off the y axis so set to -1
585  found_good->setBinContent(0, -1);
586  all_good->setBinContent(0, 1);
587 
588  // new ROOT version: TGraph::Divide don't handle null or negative values
589  for (unsigned int i = 1; i < nLayers + 2; ++i) {
590  found_good->setBinContent(i, 1e-6);
591  all_good->setBinContent(i, 1);
592  found_all->setBinContent(i, 1e-6);
593  all_all->setBinContent(i, 1);
594  }
595 
596  TCanvas* c7 = new TCanvas("c7", " test ", 10, 10, 800, 600);
597  c7->SetFillColor(0);
598  c7->SetGrid();
599 
600  unsigned int nLayers_max = nLayers + 1; // barrel+endcap
601  if (!showEndcapSides_)
602  nLayers_max = 11; // barrel
603  for (unsigned int i = 1; i < nLayers_max; ++i) {
604  LOGPRINT << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i]
605  << " B = " << goodlayertotal[i];
606  if (goodlayertotal[i] > 5) {
607  found_good->setBinContent(i, goodlayerfound[i]);
608  all_good->setBinContent(i, goodlayertotal[i]);
609  }
610 
611  LOGPRINT << "Filling all modules layer " << i << ": S = " << alllayerfound[i] << " B = " << alllayertotal[i];
612  if (alllayertotal[i] > 5) {
613  found_all->setBinContent(i, alllayerfound[i]);
614  all_all->setBinContent(i, alllayertotal[i]);
615  }
616  }
617 
618  // endcap - merging sides
619  if (!showEndcapSides_) {
620  for (unsigned int i = 11; i < 14; ++i) { // TID disks
621  LOGPRINT << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i] + goodlayerfound[i + 3]
622  << " B = " << goodlayertotal[i] + goodlayertotal[i + 3];
623  if (goodlayertotal[i] + goodlayertotal[i + 3] > 5) {
624  found_good->setBinContent(i, goodlayerfound[i] + goodlayerfound[i + 3]);
625  all_good->setBinContent(i, goodlayertotal[i] + goodlayertotal[i + 3]);
626  }
627  LOGPRINT << "Filling all modules layer " << i << ": S = " << alllayerfound[i] + alllayerfound[i + 3]
628  << " B = " << alllayertotal[i] + alllayertotal[i + 3];
629  if (alllayertotal[i] + alllayertotal[i + 3] > 5) {
630  found_all->setBinContent(i, alllayerfound[i] + alllayerfound[i + 3]);
631  all_all->setBinContent(i, alllayertotal[i] + alllayertotal[i + 3]);
632  }
633  }
634  for (unsigned int i = 17; i < 17 + nTEClayers_; ++i) { // TEC disks
635  LOGPRINT << "Fill only good modules layer " << i - 3
636  << ": S = " << goodlayerfound[i] + goodlayerfound[i + nTEClayers_]
637  << " B = " << goodlayertotal[i] + goodlayertotal[i + nTEClayers_];
638  if (goodlayertotal[i] + goodlayertotal[i + nTEClayers_] > 5) {
639  found_good->setBinContent(i - 3, goodlayerfound[i] + goodlayerfound[i + nTEClayers_]);
641  }
642  LOGPRINT << "Filling all modules layer " << i - 3
643  << ": S = " << alllayerfound[i] + alllayerfound[i + nTEClayers_]
644  << " B = " << alllayertotal[i] + alllayertotal[i + nTEClayers_];
645  if (alllayertotal[i] + alllayertotal[i + nTEClayers_] > 5) {
646  found_all->setBinContent(i - 3, alllayerfound[i] + alllayerfound[i + nTEClayers_]);
648  }
649  }
650  }
651 
652  found_good->getTH1F()->Sumw2();
653  all_good->getTH1F()->Sumw2();
654 
655  found_all->getTH1F()->Sumw2();
656  all_all->getTH1F()->Sumw2();
657 
658  MonitorElement* h_eff_all =
659  booker.book1D("eff_all", "Strip hit efficiency for all modules", nLayers + 1, 0, nLayers + 1);
660  MonitorElement* h_eff_good =
661  booker.book1D("eff_good", "Strip hit efficiency for good modules", nLayers + 1, 0, nLayers + 1);
662 
663  if (doProfiles) {
664  // now do the profile
665  TProfile* profile_all = ::computeEff(found_all->getTH1F(), all_all->getTH1F(), "all");
666  profile_all->SetMinimum(tkMapMin_);
667  profile_all->SetTitle("Strip hit efficiency for all modules");
668  booker.bookProfile(profile_all->GetName(), profile_all);
669 
670  TProfile* profile_good = ::computeEff(found_good->getTH1F(), all_good->getTH1F(), "good");
671  profile_good->SetMinimum(tkMapMin_);
672  profile_good->SetTitle("Strip hit efficiency for good modules");
673  booker.bookProfile(profile_good->GetName(), profile_good);
674 
675  // clean the house
676  delete profile_all;
677  delete profile_good;
678  }
679 
680  for (int i = 1; i < found_good->getNbinsX(); i++) {
681  const auto& den_all = all_all->getBinContent(i);
682  const auto& num_all = found_all->getBinContent(i);
683  const auto& den_good = all_good->getBinContent(i);
684  const auto& num_good = found_good->getBinContent(i);
685 
686  // fill all modules efficiency
687  if (den_all > 0.) {
688  // naive binomial errors
689  //float eff_all = num_all / den_all;
690  //float err_eff_all = (eff_all * (1 - eff_all)) / den_all;
691 
692  // use Clopper-Pearson errors
693  const auto& effPair_all = ::computeCPEfficiency(num_all, den_all);
694  h_eff_all->setBinContent(i, effPair_all.value());
695  h_eff_all->setBinError(i, effPair_all.error());
696  }
697 
698  // fill good modules efficiency
699  if (den_good > 0.) {
700  // naive binomial errors
701  //float eff_good = num_good / den_good;
702  //float err_eff_good = (eff_good * (1 - eff_good)) / den_good;
703 
704  // use Clopper-Pearson errors
705  const auto& effPair_good = ::computeCPEfficiency(num_good, den_good);
706  h_eff_good->setBinContent(i, effPair_good.value());
707  h_eff_good->setBinError(i, effPair_good.error());
708  }
709  }
710 
711  h_eff_all->getTH1F()->SetMinimum(effPlotMin_);
712  h_eff_good->getTH1F()->SetMinimum(effPlotMin_);
713 
714  // set the histogram bin labels
715  this->setEffBinLabels(h_eff_all->getTH1F(), h_eff_good->getTH1F(), nLayers);
716 
717  if (!isAtPCL_) {
718  // if TFileService is not avaible, just go on
720  if (!fs.isAvailable()) {
721  throw cms::Exception("BadConfig") << "TFileService unavailable: "
722  << "please add it to config file";
723  }
724 
725  TGraphAsymmErrors* gr = (*fs).make<TGraphAsymmErrors>(nLayers + 1);
726  gr->SetName("eff_good");
727  gr->BayesDivide(found_good->getTH1F(), all_good->getTH1F());
728 
729  TGraphAsymmErrors* gr2 = (*fs).make<TGraphAsymmErrors>(nLayers + 1);
730  gr2->SetName("eff_all");
731  gr2->BayesDivide(found_all->getTH1F(), all_all->getTH1F());
732 
733  for (unsigned int j = 0; j < nLayers + 1; j++) {
734  gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j), gr->GetErrorYhigh(j));
735  gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j), gr2->GetErrorYhigh(j));
736  }
737 
738  this->setEffBinLabels(gr, gr2, nLayers);
739 
740  gr->GetXaxis()->SetLimits(0, nLayers);
741  gr->SetMarkerColor(2);
742  gr->SetMarkerSize(1.2);
743  gr->SetLineColor(2);
744  gr->SetLineWidth(4);
745  gr->SetMarkerStyle(20);
746  gr->SetMinimum(effPlotMin_);
747  gr->SetMaximum(1.001);
748  gr->GetYaxis()->SetTitle("Efficiency");
749  gStyle->SetTitleFillColor(0);
750  gStyle->SetTitleBorderSize(0);
751  gr->SetTitle("SiStripHitEfficiency by Layer");
752 
753  gr2->GetXaxis()->SetLimits(0, nLayers);
754  gr2->SetMarkerColor(1);
755  gr2->SetMarkerSize(1.2);
756  gr2->SetLineColor(1);
757  gr2->SetLineWidth(4);
758  gr2->SetMarkerStyle(21);
759  gr2->SetMinimum(effPlotMin_);
760  gr2->SetMaximum(1.001);
761  gr2->GetYaxis()->SetTitle("Efficiency");
762  gr2->SetTitle("SiStripHitEfficiency by Layer");
763 
764  gr->Draw("AP");
765  gr->GetXaxis()->SetNdivisions(36);
766 
767  c7->cd();
768  TPad* overlay = new TPad("overlay", "", 0, 0, 1, 1);
769  overlay->SetFillStyle(4000);
770  overlay->SetFillColor(0);
771  overlay->SetFrameFillStyle(4000);
772  overlay->Draw("same");
773  overlay->cd();
775  gr2->Draw("AP");
776 
777  TLegend* leg = new TLegend(0.70, 0.27, 0.88, 0.40);
778  leg->AddEntry(gr, "Good Modules", "p");
780  leg->AddEntry(gr2, "All Modules", "p");
781  leg->SetTextSize(0.020);
782  leg->SetFillColor(0);
783  leg->Draw("same");
784 
785  c7->SaveAs("Summary.png");
786  c7->SaveAs("Summary.root");
787  } // if it's not run at PCL
788 }
void setEffBinLabels(const T gr, const T gr2, const unsigned int nLayers) const
int goodlayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
int goodlayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
int alllayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
def overlay(hists, ytitle, header, addon)
Definition: compare.py:122
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual TH1F * getTH1F() const
int alllayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
virtual int getNbinsX() const
get # of bins in X-axis
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual double getBinContent(int binx) const
get content of bin (1-D)

◆ makeSummaryVsVariable()

void SiStripHitEfficiencyHarvester::makeSummaryVsVariable ( DQMStore::IGetter getter,
DQMStore::IBooker booker,
::projections  theProj,
bool  doProfiles = true 
) const
private

Definition at line 840 of file SiStripHitEfficiencyHarvester.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::bookProfile(), MillePedeFileConverter_cfg::e, dqm-mbProfile::format, dqm::implementation::IGetter::get(), mps_fire::i, inputFolder_, LogDebug, nTEClayers_, EgammaValidation_cff::num, or, PostProcessor_cff::profile, dqm::implementation::NavigatorBase::setCurrentFolder(), dqm::impl::MonitorElement::setOption(), showRings_, runGCPTkAlMap::title, and tkMapMin_.

Referenced by dqmEndJob().

843  {
844  std::vector<MonitorElement*> effVsVariable;
845  effVsVariable.reserve(showRings_ ? 20 : 22);
846 
847  const auto& folderString = ::projFolder[theProj];
848  const auto& foundHistoString = ::projFoundHisto[theProj];
849  const auto& totalHistoString = ::projTotalHisto[theProj];
850  const auto& titleString = ::projTitle[theProj];
851  const auto& titleXString = ::projXtitle[theProj];
852 
853  LogDebug("SiStripHitEfficiencyHarvester")
854  << " inside" << __PRETTY_FUNCTION__ << " from " << ::projFolder[theProj] << " " << __LINE__ << std::endl;
855 
856  for (unsigned int iLayer = 1; iLayer != (showRings_ ? 20 : 22); ++iLayer) {
857  LogDebug("SiStripHitEfficiencyHarvester")
858  << "iLayer " << iLayer << " " << fmt::format("{}/{}/{}{}", inputFolder_, folderString, foundHistoString, iLayer)
859  << std::endl;
860 
861  const auto lyrName = ::layerName(iLayer, showRings_, nTEClayers_);
862  auto hfound = getter.get(fmt::format("{}/{}/{}{}", inputFolder_, folderString, foundHistoString, iLayer));
863  auto htotal = getter.get(fmt::format("{}/{}/{}{}", inputFolder_, folderString, totalHistoString, iLayer));
864 
865  if (hfound == nullptr or htotal == nullptr) {
866  if (hfound == nullptr)
867  edm::LogError("SiStripHitEfficiencyHarvester")
868  << fmt::format("{}/{}/{}{}", inputFolder_, folderString, foundHistoString, iLayer) << " was not found!";
869  if (htotal == nullptr)
870  edm::LogError("SiStripHitEfficiencyHarvester")
871  << fmt::format("{}/{}/{}{}", inputFolder_, folderString, totalHistoString, iLayer) << " was not found!";
872  // no input histograms -> continue in the loop
873  continue;
874  }
875 
876  // in order to display correct errors when taking the ratio
877  if (!hfound->getTH1F()->GetSumw2())
878  hfound->getTH1F()->Sumw2();
879  if (!htotal->getTH1F()->GetSumw2())
880  htotal->getTH1F()->Sumw2();
881 
882  // prevent dividing by 0
883  for (int i = 0; i != hfound->getNbinsX() + 1; ++i) {
884  if (hfound->getBinContent(i) == 0)
885  hfound->setBinContent(i, 1e-6);
886  if (htotal->getBinContent(i) == 0)
887  htotal->setBinContent(i, 1);
888  }
889  LogDebug("SiStripHitEfficiencyHarvester") << "Total hits for layer " << iLayer << " (" << folderString
890  << "): " << htotal->getEntries() << ", found " << hfound->getEntries();
891 
892  booker.setCurrentFolder(fmt::format("{}/EfficiencySummary{}", inputFolder_, folderString));
893  effVsVariable[iLayer] = booker.book1D(
894  fmt::sprintf("eff%sLayer%s", folderString, lyrName),
895  fmt::sprintf("Efficiency vs %s for layer %s;%s;SiStrip Hit efficiency", titleString, lyrName, titleXString),
896  hfound->getNbinsX(),
897  hfound->getAxisMin(),
898  hfound->getAxisMax());
899 
900  effVsVariable[iLayer]->setOption("e");
901 
902  LogDebug("SiStripHitEfficiencyHarvester")
903  << " bin 0 " << hfound->getAxisMin() << " bin last: " << hfound->getAxisMax() << std::endl;
904 
905  for (int i = 0; i != hfound->getNbinsX() + 1; ++i) {
906  const auto& den = htotal->getBinContent(i);
907  const auto& num = hfound->getBinContent(i);
908 
909  // fill all modules efficiency
910  if (den > 0.) {
911  const auto& effPair = ::computeCPEfficiency(num, den);
912  effVsVariable[iLayer]->setBinContent(i, effPair.value());
913  effVsVariable[iLayer]->setBinError(i, effPair.error());
914 
915  LogDebug("SiStripHitEfficiencyHarvester")
916  << __PRETTY_FUNCTION__ << " " << lyrName << " bin:" << i << " err:" << effPair.error() << std::endl;
917  }
918  }
919 
920  // graphics adjustment
921  effVsVariable[iLayer]->getTH1F()->SetMinimum(tkMapMin_);
922 
923  if (doProfiles) {
924  // now do the profile
925  TProfile* profile = ::computeEff(hfound->getTH1F(), htotal->getTH1F(), lyrName);
926  profile->SetOption("s");
927  TString title =
928  fmt::sprintf("Efficiency vs %s for layer %s;%s;SiStrip Hit efficiency", titleString, lyrName, titleXString);
929  profile->SetMinimum(tkMapMin_);
930 
931  profile->SetTitle(title.Data());
932  booker.bookProfile(profile->GetName(), profile);
933 
934  delete profile;
935  }
936  } // loop on layers
937 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
virtual void setOption(const char *option)
Log< level::Error, false > LogError
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
#define LogDebug(id)

◆ printAndWriteBadModules()

void SiStripHitEfficiencyHarvester::printAndWriteBadModules ( const SiStripQuality quality,
const SiStripDetInfo detInfo 
) const
private

Definition at line 976 of file SiStripHitEfficiencyHarvester.cc.

References SiStripDetInfo::getNumberOfApvsAndStripLength(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, dqmdumpme::k, LOGPRINT, quality, FastTimerService_cff::range, SiStripPI::setBadComponents(), contentValuesCheck::ss, str, sistrip::STRIPS_PER_APV, DetId::subdetId(), SiStripSubdetector::TEC, SiStripSubdetector::TIB, SiStripSubdetector::TID, SiStripSubdetector::TOB, tTopo_, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by dqmEndJob().

977  {
979  //try to write out what's in the quality record
981  int nTkBadComp[4]; //k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
982  int nBadComp[4][19][4];
983  //legend: nBadComp[i][j][k]= SubSystem i, layer/disk/wheel j, BadModule/Fiber/Apv k
984  // i: 0=TIB, 1=TID, 2=TOB, 3=TEC
985  // k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
986  std::stringstream ssV[4][19];
987 
988  for (int i = 0; i < 4; ++i) {
989  nTkBadComp[i] = 0;
990  for (int j = 0; j < 19; ++j) {
991  ssV[i][j].str("");
992  for (int k = 0; k < 4; ++k)
993  nBadComp[i][j][k] = 0;
994  }
995  }
996 
997  for (const auto& bc : quality.getBadComponentList()) {
998  // Full Tk
999  if (bc.BadModule)
1000  nTkBadComp[0]++;
1001  if (bc.BadFibers)
1002  nTkBadComp[1] += ((bc.BadFibers >> 2) & 0x1) + ((bc.BadFibers >> 1) & 0x1) + ((bc.BadFibers) & 0x1);
1003  if (bc.BadApvs)
1004  nTkBadComp[2] += ((bc.BadApvs >> 5) & 0x1) + ((bc.BadApvs >> 4) & 0x1) + ((bc.BadApvs >> 3) & 0x1) +
1005  ((bc.BadApvs >> 2) & 0x1) + ((bc.BadApvs >> 1) & 0x1) + ((bc.BadApvs) & 0x1);
1006  // single subsystem
1007  DetId det(bc.detid);
1008  if ((det.subdetId() >= SiStripSubdetector::TIB) && (det.subdetId() <= SiStripSubdetector::TEC)) {
1009  const auto nAPV = detInfo.getNumberOfApvsAndStripLength(det).first;
1010  switch (det.subdetId()) {
1012  setBadComponents(0, tTopo_->tibLayer(det), bc, ssV, nBadComp, nAPV);
1013  break;
1015  setBadComponents(1,
1016  (tTopo_->tidSide(det) == 2 ? tTopo_->tidWheel(det) : tTopo_->tidWheel(det) + 3),
1017  bc,
1018  ssV,
1019  nBadComp,
1020  nAPV);
1021  break;
1023  setBadComponents(2, tTopo_->tobLayer(det), bc, ssV, nBadComp, nAPV);
1024  break;
1026  setBadComponents(3,
1027  (tTopo_->tecSide(det) == 2 ? tTopo_->tecWheel(det) : tTopo_->tecWheel(det) + 9),
1028  bc,
1029  ssV,
1030  nBadComp,
1031  nAPV);
1032  break;
1033  default:
1034  break;
1035  }
1036  }
1037  }
1038  // single strip info
1039  for (auto rp = quality.getRegistryVectorBegin(); rp != quality.getRegistryVectorEnd(); ++rp) {
1040  DetId det{rp->detid};
1041  int subdet = -999;
1042  int component = -999;
1043  switch (det.subdetId()) {
1045  subdet = 0;
1046  component = tTopo_->tibLayer(det);
1047  break;
1049  subdet = 1;
1050  component = tTopo_->tidSide(det) == 2 ? tTopo_->tidWheel(det) : tTopo_->tidWheel(det) + 3;
1051  break;
1053  subdet = 2;
1054  component = tTopo_->tobLayer(det);
1055  break;
1057  subdet = 3;
1058  component = tTopo_->tecSide(det) == 2 ? tTopo_->tecWheel(det) : tTopo_->tecWheel(det) + 9;
1059  break;
1060  default:
1061  break;
1062  }
1063 
1064  const auto pQdvBegin = quality.getDataVectorBegin();
1065  const auto sqrange = SiStripQuality::Range(pQdvBegin + rp->ibegin, pQdvBegin + rp->iend);
1066  float percentage = 0;
1067  for (int it = 0; it < sqrange.second - sqrange.first; it++) {
1068  unsigned int range = quality.decode(*(sqrange.first + it)).range;
1069  nTkBadComp[3] += range;
1070  nBadComp[subdet][0][3] += range;
1071  nBadComp[subdet][component][3] += range;
1072  percentage += range;
1073  }
1074  if (percentage != 0)
1075  percentage /= (sistrip::STRIPS_PER_APV * detInfo.getNumberOfApvsAndStripLength(det).first);
1076  if (percentage > 1)
1077  edm::LogError("SiStripHitEfficiencyHarvester") << "PROBLEM detid " << det.rawId() << " value " << percentage;
1078  }
1079 
1080  // printout
1081  std::ostringstream ss;
1082  ss << "\n-----------------\nGlobal Info\n-----------------";
1083  ss << "\nBadComp \t Modules \tFibers "
1084  "\tApvs\tStrips\n----------------------------------------------------------------";
1085  ss << "\nTracker:\t\t" << nTkBadComp[0] << "\t" << nTkBadComp[1] << "\t" << nTkBadComp[2] << "\t" << nTkBadComp[3];
1086  ss << "\nTIB:\t\t\t" << nBadComp[0][0][0] << "\t" << nBadComp[0][0][1] << "\t" << nBadComp[0][0][2] << "\t"
1087  << nBadComp[0][0][3];
1088  ss << "\nTID:\t\t\t" << nBadComp[1][0][0] << "\t" << nBadComp[1][0][1] << "\t" << nBadComp[1][0][2] << "\t"
1089  << nBadComp[1][0][3];
1090  ss << "\nTOB:\t\t\t" << nBadComp[2][0][0] << "\t" << nBadComp[2][0][1] << "\t" << nBadComp[2][0][2] << "\t"
1091  << nBadComp[2][0][3];
1092  ss << "\nTEC:\t\t\t" << nBadComp[3][0][0] << "\t" << nBadComp[3][0][1] << "\t" << nBadComp[3][0][2] << "\t"
1093  << nBadComp[3][0][3];
1094  ss << "\n";
1095 
1096  for (int i = 1; i < 5; ++i)
1097  ss << "\nTIB Layer " << i << " :\t\t" << nBadComp[0][i][0] << "\t" << nBadComp[0][i][1] << "\t" << nBadComp[0][i][2]
1098  << "\t" << nBadComp[0][i][3];
1099  ss << "\n";
1100  for (int i = 1; i < 4; ++i)
1101  ss << "\nTID+ Disk " << i << " :\t\t" << nBadComp[1][i][0] << "\t" << nBadComp[1][i][1] << "\t" << nBadComp[1][i][2]
1102  << "\t" << nBadComp[1][i][3];
1103  for (int i = 4; i < 7; ++i)
1104  ss << "\nTID- Disk " << i - 3 << " :\t\t" << nBadComp[1][i][0] << "\t" << nBadComp[1][i][1] << "\t"
1105  << nBadComp[1][i][2] << "\t" << nBadComp[1][i][3];
1106  ss << "\n";
1107  for (int i = 1; i < 7; ++i)
1108  ss << "\nTOB Layer " << i << " :\t\t" << nBadComp[2][i][0] << "\t" << nBadComp[2][i][1] << "\t" << nBadComp[2][i][2]
1109  << "\t" << nBadComp[2][i][3];
1110  ss << "\n";
1111  for (int i = 1; i < 10; ++i)
1112  ss << "\nTEC+ Disk " << i << " :\t\t" << nBadComp[3][i][0] << "\t" << nBadComp[3][i][1] << "\t" << nBadComp[3][i][2]
1113  << "\t" << nBadComp[3][i][3];
1114  for (int i = 10; i < 19; ++i)
1115  ss << "\nTEC- Disk " << i - 9 << " :\t\t" << nBadComp[3][i][0] << "\t" << nBadComp[3][i][1] << "\t"
1116  << nBadComp[3][i][2] << "\t" << nBadComp[3][i][3];
1117  ss << "\n";
1118 
1119  ss << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers "
1120  "Apvs\n----------------------------------------------------------------";
1121  for (int i = 1; i < 5; ++i)
1122  ss << "\nTIB Layer " << i << " :" << ssV[0][i].str();
1123  ss << "\n";
1124  for (int i = 1; i < 4; ++i)
1125  ss << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
1126  for (int i = 4; i < 7; ++i)
1127  ss << "\nTID- Disk " << i - 3 << " :" << ssV[1][i].str();
1128  ss << "\n";
1129  for (int i = 1; i < 7; ++i)
1130  ss << "\nTOB Layer " << i << " :" << ssV[2][i].str();
1131  ss << "\n";
1132  for (int i = 1; i < 10; ++i)
1133  ss << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
1134  for (int i = 10; i < 19; ++i)
1135  ss << "\nTEC- Disk " << i - 9 << " :" << ssV[3][i].str();
1136 
1137  LOGPRINT << ss.str();
1138 
1139  // store also bad modules in log file
1140  std::ofstream badModules;
1141  badModules.open("BadModules_NEW.log");
1142  badModules << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers "
1143  "Apvs\n----------------------------------------------------------------";
1144  for (int i = 1; i < 5; ++i)
1145  badModules << "\nTIB Layer " << i << " :" << ssV[0][i].str();
1146  badModules << "\n";
1147  for (int i = 1; i < 4; ++i)
1148  badModules << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
1149  for (int i = 4; i < 7; ++i)
1150  badModules << "\nTID- Disk " << i - 3 << " :" << ssV[1][i].str();
1151  badModules << "\n";
1152  for (int i = 1; i < 7; ++i)
1153  badModules << "\nTOB Layer " << i << " :" << ssV[2][i].str();
1154  badModules << "\n";
1155  for (int i = 1; i < 10; ++i)
1156  badModules << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
1157  for (int i = 10; i < 19; ++i)
1158  badModules << "\nTEC- Disk " << i - 9 << " :" << ssV[3][i].str();
1159  badModules.close();
1160 }
std::unique_ptr< TrackerTopology > tTopo_
Log< level::Error, false > LogError
string quality
Definition: DetId.h:17
void setBadComponents(int i, int component, const SiStripQuality::BadComponent &BC, int NBadComponent[4][19][4])
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
static const uint16_t STRIPS_PER_APV
std::pair< ContainerIterator, ContainerIterator > Range
#define str(s)

◆ printTotalStatistics()

void SiStripHitEfficiencyHarvester::printTotalStatistics ( const std::array< long, bounds::k_END_OF_LAYERS > &  layerFound,
const std::array< long, bounds::k_END_OF_LAYERS > &  layerTotal 
) const
private

Definition at line 499 of file SiStripHitEfficiencyHarvester.cc.

References mps_fire::i, LOGPRINT, nTEClayers_, and showRings_.

Referenced by dqmEndJob().

501  {
502  //Calculate the statistics by layer
503  int totalfound = 0;
504  int totaltotal = 0;
505  double layereff;
506  int subdetfound[5] = {0, 0, 0, 0, 0};
507  int subdettotal[5] = {0, 0, 0, 0, 0};
508 
509  for (unsigned int i = 1; i <= bounds::k_LayersAtTECEnd; i++) {
510  layereff = double(layerFound[i]) / double(layerTotal[i]);
511  LOGPRINT << "Layer " << i << " (" << ::layerName(i, showRings_, nTEClayers_) << ") has total efficiency "
512  << layereff << " " << layerFound[i] << "/" << layerTotal[i];
513  totalfound += layerFound[i];
514  totaltotal += layerTotal[i];
515  if (i <= bounds::k_LayersAtTIBEnd) {
516  subdetfound[1] += layerFound[i];
517  subdettotal[1] += layerTotal[i];
518  }
519  if (i > bounds::k_LayersAtTIBEnd && i <= bounds::k_LayersAtTOBEnd) {
520  subdetfound[2] += layerFound[i];
521  subdettotal[2] += layerTotal[i];
522  }
523  if (i > bounds::k_LayersAtTOBEnd && i <= bounds::k_LayersAtTIDEnd) {
524  subdetfound[3] += layerFound[i];
525  subdettotal[3] += layerTotal[i];
526  }
527  if (i > bounds::k_LayersAtTIDEnd) {
528  subdetfound[4] += layerFound[i];
529  subdettotal[4] += layerTotal[i];
530  }
531  }
532 
533  LOGPRINT << "The total efficiency is " << double(totalfound) / double(totaltotal);
534  LOGPRINT << " TIB: " << double(subdetfound[1]) / subdettotal[1] << " " << subdetfound[1] << "/"
535  << subdettotal[1];
536  LOGPRINT << " TOB: " << double(subdetfound[2]) / subdettotal[2] << " " << subdetfound[2] << "/"
537  << subdettotal[2];
538  LOGPRINT << " TID: " << double(subdetfound[3]) / subdettotal[3] << " " << subdetfound[3] << "/"
539  << subdettotal[3];
540  LOGPRINT << " TEC: " << double(subdetfound[4]) / subdettotal[4] << " " << subdetfound[4] << "/"
541  << subdettotal[4];
542 }

◆ setEffBinLabels()

template<typename T >
void SiStripHitEfficiencyHarvester::setEffBinLabels ( const T  gr,
const T  gr2,
const unsigned int  nLayers 
) const
private

Definition at line 791 of file SiStripHitEfficiencyHarvester.cc.

References newFWLiteAna::bin, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), dqmdumpme::k, label, LogDebug, MuonTCMETValueMapProducer_cff::nLayers, nTEClayers_, showEndcapSides_, showRings_, showTOB6TEC9_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeSummary().

791  {
792  LogDebug("SiStripHitEfficiencyHarvester")
793  << "nLayers = " << nLayers << " number of bins, gr1: " << gr->GetXaxis()->GetNbins()
794  << " number of bins, gr2: " << gr2->GetXaxis()->GetNbins() << " showRings: " << showRings_
795  << " showEndcapSides: " << showEndcapSides_ << " type of object is "
796  << boost::typeindex::type_id<T>().pretty_name();
797 
798  for (unsigned int k = 1; k < nLayers + 1; k++) {
799  std::string label{};
800  if (showEndcapSides_)
801  label = ::layerSideName(k, showRings_, nTEClayers_);
802  else
803  label = ::layerName(k, showRings_, nTEClayers_);
804  if (!showTOB6TEC9_) {
805  if (k == 10)
806  label = "";
807  if (!showRings_ && k == nLayers)
808  label = "";
809  if (!showRings_ && showEndcapSides_ && k == 25)
810  label = "";
811  }
812 
813  int bin{-1};
814  if constexpr (std::is_same_v<T, TGraphAsymmErrors*>) {
815  edm::LogInfo("SiStripHitEfficiencyHarvester")
816  << "class name: " << gr->ClassName() << " expected TGraphAsymErrors" << std::endl;
817  if (!showRings_) {
818  if (showEndcapSides_) {
819  bin = (((k + 1) * 100 + 2) / (nLayers)-4);
820  } else {
821  bin = ((k + 1) * 100 / (nLayers)-6);
822  }
823  } else {
824  if (showEndcapSides_) {
825  bin = ((k + 1) * 100 / (nLayers)-4);
826  } else {
827  bin = ((k + 1) * 100 / (nLayers)-7);
828  }
829  }
830  } else {
831  edm::LogInfo("SiStripHitEfficiencyHarvester")
832  << "class name: " << gr->ClassName() << " expected TH1F" << std::endl;
833  bin = k;
834  }
835  gr->GetXaxis()->SetBinLabel(bin, label.data());
836  gr2->GetXaxis()->SetBinLabel(bin, label.data());
837  }
838 }
char const * label
Log< level::Info, false > LogInfo
#define LogDebug(id)

◆ writeBadStripPayload()

void SiStripHitEfficiencyHarvester::writeBadStripPayload ( const SiStripQuality quality) const
private

Definition at line 544 of file SiStripHitEfficiencyHarvester.cc.

References cond::service::PoolDBOutputService::currentTime(), Exception, edm::Service< T >::isAvailable(), quality, FastTimerService_cff::range, record_, and cond::service::PoolDBOutputService::writeOneIOV().

Referenced by dqmEndJob().

544  {
545  SiStripBadStrip pBadStrip{};
546  const auto pQdvBegin = quality.getDataVectorBegin();
547  for (auto rIt = quality.getRegistryVectorBegin(); rIt != quality.getRegistryVectorEnd(); ++rIt) {
548  const auto range = SiStripBadStrip::Range(pQdvBegin + rIt->ibegin, pQdvBegin + rIt->iend);
549  if (!pBadStrip.put(rIt->detid, range))
550  edm::LogError("SiStripHitEfficiencyHarvester") << "detid already exists in SiStripBadStrip";
551  }
553  if (poolDbService.isAvailable()) {
554  poolDbService->writeOneIOV(pBadStrip, poolDbService->currentTime(), record_);
555  } else {
556  throw cms::Exception("PoolDBService required");
557  }
558 }
string quality
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
std::pair< ContainerIterator, ContainerIterator > Range
bool isAvailable() const
Definition: Service.h:40

Member Data Documentation

◆ alllayerfound

int SiStripHitEfficiencyHarvester::alllayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
private

◆ alllayertotal

int SiStripHitEfficiencyHarvester::alllayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
private

◆ autoIneffModTagging_

const bool SiStripHitEfficiencyHarvester::autoIneffModTagging_
private

Definition at line 55 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ calibData_

SiStripHitEffData SiStripHitEfficiencyHarvester::calibData_
private

Definition at line 52 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ doStoreOnDB_

const bool SiStripHitEfficiencyHarvester::doStoreOnDB_
private

Definition at line 55 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ doStoreOnTree_

const bool SiStripHitEfficiencyHarvester::doStoreOnTree_
private

Definition at line 56 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ effPlotMin_

const float SiStripHitEfficiencyHarvester::effPlotMin_
private

Definition at line 61 of file SiStripHitEfficiencyHarvester.cc.

Referenced by makeSummary().

◆ goodlayerfound

int SiStripHitEfficiencyHarvester::goodlayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
private

◆ goodlayertotal

int SiStripHitEfficiencyHarvester::goodlayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
private

◆ inputFolder_

const std::string SiStripHitEfficiencyHarvester::inputFolder_
private

Definition at line 53 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), makeSummary(), and makeSummaryVsVariable().

◆ isAtPCL_

const bool SiStripHitEfficiencyHarvester::isAtPCL_
private

Definition at line 54 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), and makeSummary().

◆ nModsMin_

const int SiStripHitEfficiencyHarvester::nModsMin_
private

Definition at line 60 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ nTEClayers_

const unsigned int SiStripHitEfficiencyHarvester::nTEClayers_
private

◆ record_

const std::string SiStripHitEfficiencyHarvester::record_
private

Definition at line 63 of file SiStripHitEfficiencyHarvester.cc.

Referenced by writeBadStripPayload().

◆ showEndcapSides_

const bool SiStripHitEfficiencyHarvester::showEndcapSides_
private

Definition at line 57 of file SiStripHitEfficiencyHarvester.cc.

Referenced by makeSummary(), and setEffBinLabels().

◆ showOnlyGoodModules_

const bool SiStripHitEfficiencyHarvester::showOnlyGoodModules_
private

Definition at line 57 of file SiStripHitEfficiencyHarvester.cc.

Referenced by makeSummary().

◆ showRings_

const bool SiStripHitEfficiencyHarvester::showRings_
private

◆ showTOB6TEC9_

const bool SiStripHitEfficiencyHarvester::showTOB6TEC9_
private

Definition at line 57 of file SiStripHitEfficiencyHarvester.cc.

Referenced by setEffBinLabels().

◆ stripDetIds_

std::vector<DetId> SiStripHitEfficiencyHarvester::stripDetIds_
private

Definition at line 73 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), and endRun().

◆ stripQuality_

std::unique_ptr<SiStripQuality> SiStripHitEfficiencyHarvester::stripQuality_
private

Definition at line 72 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), and endRun().

◆ stripQualityToken_

const edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripHitEfficiencyHarvester::stripQualityToken_
private

Definition at line 67 of file SiStripHitEfficiencyHarvester.cc.

Referenced by endRun().

◆ t_DetId

unsigned int SiStripHitEfficiencyHarvester::t_DetId
private

Definition at line 82 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ t_found

unsigned int SiStripHitEfficiencyHarvester::t_found
private

Definition at line 82 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ t_isTaggedIneff

bool SiStripHitEfficiencyHarvester::t_isTaggedIneff
private

Definition at line 84 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ t_layer

unsigned char SiStripHitEfficiencyHarvester::t_layer
private

Definition at line 83 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ t_threshold

float SiStripHitEfficiencyHarvester::t_threshold
private

Definition at line 85 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ t_total

unsigned int SiStripHitEfficiencyHarvester::t_total
private

Definition at line 82 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ threshold_

const double SiStripHitEfficiencyHarvester::threshold_
private

Definition at line 59 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ title_

const std::string SiStripHitEfficiencyHarvester::title_
private

Definition at line 63 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob().

◆ tkDetMap_

std::unique_ptr<TkDetMap> SiStripHitEfficiencyHarvester::tkDetMap_
private

Definition at line 71 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), and endRun().

◆ tkDetMapToken_

const edm::ESGetToken<TkDetMap, TrackerTopologyRcd> SiStripHitEfficiencyHarvester::tkDetMapToken_
private

Definition at line 66 of file SiStripHitEfficiencyHarvester.cc.

Referenced by endRun().

◆ tkGeomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiStripHitEfficiencyHarvester::tkGeomToken_
private

Definition at line 68 of file SiStripHitEfficiencyHarvester.cc.

Referenced by endRun().

◆ tkMapMin_

const double SiStripHitEfficiencyHarvester::tkMapMin_
private

Definition at line 62 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), makeSummary(), and makeSummaryVsVariable().

◆ tree

TTree* SiStripHitEfficiencyHarvester::tree
private

◆ tTopo_

std::unique_ptr<TrackerTopology> SiStripHitEfficiencyHarvester::tTopo_
private

Definition at line 70 of file SiStripHitEfficiencyHarvester.cc.

Referenced by dqmEndJob(), endRun(), and printAndWriteBadModules().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripHitEfficiencyHarvester::tTopoToken_
private

Definition at line 65 of file SiStripHitEfficiencyHarvester.cc.

Referenced by endRun().