ATLAS Offline Software
Functions
SCTCalib.cxx File Reference
#include "SCT_CalibAlgs/SCTCalib.h"
#include "SCT_CalibAlgs/SCT_LorentzAngleFunc.h"
#include "SCT_CalibUtilities.h"
#include "XmlHeader.h"
#include "XmlStreamer.h"
#include "InDetReadoutGeometry/SiDetectorElement.h"
#include "GaudiKernel/IEventProcessor.h"
#include "TFile.h"
#include "TH1I.h"
#include "TH2D.h"
#include "TF1.h"
#include "TProfile.h"
#include "TProfile2D.h"
#include "Math/ProbFuncMathCore.h"
#include <array>
#include <cmath>

Go to the source code of this file.

Functions

StatusCode SCTCalib::stop ATLAS_NOT_THREAD_SAFE ()
 stop - process results accumulated in execute() More...
 
StatusCode SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE (const std::map< Identifier, std::set< Identifier >> &moduleListAll, const std::map< Identifier, std::set< Identifier >> &moduleListNew, const std::map< Identifier, std::set< Identifier >> &moduleListRef)
 

Detailed Description

Find noisy strips, HV trips and dead strips/chips Upload NoiseOccupancy and BSErrors from monitoring histograms

Author
Jose E. Garcia, jose..nosp@m.enri.nosp@m.que.g.nosp@m.arci.nosp@m.a@cer.nosp@m.n.ch
Peter Vankov, peter.nosp@m..van.nosp@m.kov@c.nosp@m.ern..nosp@m.ch
Kazu Hanagaki, kazun.nosp@m.ori..nosp@m.hanag.nosp@m.aki@.nosp@m.cern..nosp@m.ch
Minoru Hirose, minor.nosp@m.u.hi.nosp@m.rose@.nosp@m.cern.nosp@m..ch
Tim Andeen, timot.nosp@m.hy.r.nosp@m.obert.nosp@m..and.nosp@m.een@c.nosp@m.ern..nosp@m.ch
Junji Tojo, junji.nosp@m..toj.nosp@m.o@cer.nosp@m.n.ch
Peter Rosendahl, peter.nosp@m..lun.nosp@m.dgaar.nosp@m.d.ro.nosp@m.senda.nosp@m.hl@c.nosp@m.ern.c.nosp@m.h
Christian Sander, chris.nosp@m.tian.nosp@m..sand.nosp@m.er@c.nosp@m.ern.c.nosp@m.h
Mateusz Dyndal, mateu.nosp@m.sz.d.nosp@m.yndal.nosp@m.@cer.nosp@m.n.ch
Timothee Theveneaux-Pelzer, tpelz.nosp@m.er@c.nosp@m.ern.c.nosp@m.h

Definition in file SCTCalib.cxx.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

StatusCode SCTCalib::stop ATLAS_NOT_THREAD_SAFE ( )
inline

stop - process results accumulated in execute()

Install fatal handler with default options.

getLorentzAngle() Read LorentzAngle from HIST and write out into local DB

getBSErrors() Read BSErrors from Monitoring HIST and write out into local DB

getEfficiency() Read Efficiency from Monitoring HIST and write out into local DB

getRawOccupancy() Read RawOccupancy from Monitoring HIST and write out into local DB

getNoiseOccupancy() Read NoiseOccupancy from HIST and write out into local DB

getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats

Definition at line 342 of file SCTCalib.cxx.

342  { // Thread unsafe getNoisyStrip, getDeadStrip, getNoiseOccupancy, getRawOccupancy, getEfficiency, getBSErrors, getLorentzAngle methods are used.
343  ATH_MSG_INFO("----- in stop() ----- ");
344  //--- Number of events processed
345  m_numberOfEvents = (m_readHIST or (!m_doHitMaps and m_readHitMaps)) ? m_numberOfEventsHist : m_calibEvtInfoTool->counter();
346  m_calibEvtInfoTool->getTimeStamps(m_utcBegin, m_utcEnd);
347 
348  //--- IOV range defined by RunNumber and LB
349  unsigned int beginRun{static_cast<unsigned int>(m_runNumber.value())};
350  unsigned int endRun{static_cast<unsigned int>(m_runNumber.value())};
351  unsigned int beginLB{IOVTime::MINEVENT};
352  unsigned int endLB{IOVTime::MAXEVENT};
353  m_iovStart.setRunEvent(static_cast<unsigned long>(beginRun), static_cast<unsigned long>(beginLB));
354  m_iovStop.setRunEvent(static_cast<unsigned long>(endRun), static_cast<unsigned long>(endLB));
355 
356  //--- Find noisy strips from hitmaps
357  const bool doNoisyStripAnalysis{((!m_doHitMaps and m_readHitMaps) or !m_readHitMaps) and m_doNoisyStrip};
358  if (doNoisyStripAnalysis) {
359  if (getNoisyStrip().isFailure()) {
360  ATH_MSG_ERROR("Failed to run getNoisyStrip()");
361  return StatusCode::FAILURE;
362  }
363  }
364 
365  //--- Upload hv
366  if (m_doHV) {
367  m_gofile.open(m_badModulesFile.value().c_str(), std::ios::out);
368  if (not m_gofile) ATH_MSG_ERROR("Problem opening " << m_badModulesFile);
369  //
370  XmlHeader myXml{m_gofile};
371  XmlStreamer root{"modules", m_gofile};
372  SCT_ID::const_id_iterator waferItr{m_pSCTHelper->wafer_begin()};
373  SCT_ID::const_id_iterator waferItrE{m_pSCTHelper->wafer_end()};
374  const unsigned int onlyDummy{1};
375  std::pair<int, int> timeInterval{0, 0};
376  std::pair<int, int> lbRange{0, 0};
377  const int withinLimits{m_maxtbins};
378  //
379  for (; waferItr not_eq waferItrE; ++waferItr) {
380  const Identifier waferId{*waferItr};
381  IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)};
382  const std::vector<std::pair<int, int>>& tvec{m_summarytrips.at(waferHash.value())};
383  const std::vector<std::pair<int, int>>& tlbn{m_summarytripslb.at(waferHash.value())};
384  //tvec is a pair of times in general, although the very first one is a dummy
385  const unsigned int numberOfElements{static_cast<unsigned int>(tvec.size())};
386  if (numberOfElements > onlyDummy) {
387  //only care if something happened in this module
388  timeInterval=tvec.at(1);
389  lbRange=tlbn.at(1);
390  for (unsigned int itrip{2}; itrip != numberOfElements; ++itrip) { //skip 0 since that is just the dummy pair.
391  if (areConsecutiveIntervals(tvec[itrip], timeInterval, withinLimits)) {
392  timeInterval.second = tvec.at(itrip).second;
393  lbRange.second = tlbn.at(itrip).second;
394  } else {
395  //not consecutive, so first print out the old one
396  doHVPrintXML(timeInterval, lbRange, waferId);
397  timeInterval = tvec.at(itrip);
398  lbRange = tlbn.at(itrip);
399  }
400  } // end loop over times
401  doHVPrintXML(timeInterval, lbRange, waferId);
402  }
403  } // end loop over wafers
404  }
405 
406  //--- Find dead strips/chips from hitmaps
407  if ((m_doDeadStrip or m_doDeadChip) and getDeadStrip().isFailure()) {
408  ATH_MSG_ERROR("Failed to run getDeadStrip()");
409  return StatusCode::FAILURE;
410  }
411 
412  //--- Upload noise occupancy
413  if (m_doNoiseOccupancy and getNoiseOccupancy().isFailure()) {
414  ATH_MSG_ERROR("Failed to run getNoiseOccupancy()");
415  return StatusCode::FAILURE;
416  }
417 
418  //--- Upload raw occupancy
419  if (m_doRawOccupancy and getRawOccupancy().isFailure()) {
420  ATH_MSG_ERROR("Failed to run getRawOccupancy()");
421  return StatusCode::FAILURE;
422  }
423 
424  //--- Upload efficiency
425  if (m_doEfficiency and getEfficiency().isFailure()) {
426  ATH_MSG_ERROR("Failed to run getEfficiency()");
427  return StatusCode::FAILURE;
428  }
429 
430  //--- Upload ByteStream Errors
431  if (m_doBSErrorDB and getBSErrors().isFailure()) {
432  ATH_MSG_ERROR("Failed to run getBSErrors()");
433  return StatusCode::FAILURE;
434  }
435 
436  //--- Upload Lorentz Angle
437  if (m_doLorentzAngle and getLorentzAngle().isFailure()) {
438  ATH_MSG_ERROR("Failed to run getLorentzAngle()");
439  return StatusCode::FAILURE;
440  }
441 
442  //--- Close HIST
443  if (m_readHIST) m_inputHist->Close();
444 
445  return StatusCode::SUCCESS;
446 }

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

StatusCode SCTCalib::writeModuleListToCool ATLAS_NOT_THREAD_SAFE ( const std::map< Identifier, std::set< Identifier >> &  moduleListAll,
const std::map< Identifier, std::set< Identifier >> &  moduleListNew,
const std::map< Identifier, std::set< Identifier >> &  moduleListRef 
)

Definition at line 2767 of file SCTCalib.cxx.

2770  {
2771  //--- Write out strips
2772  float noisyStripThr{m_noisyStripThrDef?(m_noisyStripThrOffline):(m_noisyStripThrOnline)};
2773  int nDefects{0};
2774  SCT_ID::const_id_iterator idItr{m_pSCTHelper->wafer_begin()};
2775  SCT_ID::const_id_iterator idItrE{m_pSCTHelper->wafer_end()};
2776  for (; idItr != idItrE; ++idItr) {
2777  if (m_pSCTHelper->side(*idItr) == 0) {
2778  Identifier moduleId{m_pSCTHelper->module_id(*idItr)};
2779  std::map<Identifier, std::set<Identifier>>::const_iterator moduleAllItr{moduleListAll.find(moduleId)};
2780  std::map<Identifier, std::set<Identifier>>::const_iterator moduleNewItr{moduleListNew.find(moduleId)};
2781  std::map<Identifier, std::set<Identifier>>::const_iterator moduleRefItr{moduleListRef.find(moduleId)};
2782  std::string defectStripsAll{moduleAllItr != moduleListAll.end() ? getStripList((*moduleAllItr).second) : ""};
2783  std::string defectStripsNew{moduleNewItr != moduleListNew.end() ? getStripList((*moduleNewItr).second) : ""};
2784  std::string defectStripsRef{moduleRefItr != moduleListRef.end() ? getStripList((*moduleRefItr).second) : ""};
2785  if (m_noisyUpdate) { //--- UPD1/UPD4
2786  if (defectStripsAll != defectStripsRef) {
2787  if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll).isFailure()) {
2788  ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
2789  }
2790  nDefects++;
2791  };
2792  } else {
2793  if (m_noisyStripAll) { //--- ALL noisy strips
2794  if (!defectStripsAll.empty() || m_noisyWriteAllModules) {
2795  if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsAll).isFailure()) {
2796  ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
2797  }
2798  }
2799  } else { //--- Only NEW noisy strips
2800  if (!defectStripsNew.empty()) {
2801  if (m_pCalibWriteTool->createCondObjects(moduleId, m_pSCTHelper, 10000, "NOISY", noisyStripThr, defectStripsNew).isFailure()) {
2802  ATH_MSG_ERROR("Could not create defect strip entry in the CalibWriteTool.");
2803  }
2804  }
2805  }
2806  }
2807  }
2808  }
2809  ATH_MSG_DEBUG("Number of modules for which conditions were created: " << nDefects << " !!!!");
2810  if (moduleListAll.empty() or ( nDefects==0 && m_noisyUpdate )) {
2811  ATH_MSG_INFO("Number of noisy strips was zero or the same list of noisy strips. No local DB was created.");
2812  } else {
2813  ATH_MSG_DEBUG("directly before call of wrapUpNoisyChannel");
2814  if (m_pCalibWriteTool->wrapUpNoisyChannel().isFailure()) {
2815  ATH_MSG_ERROR("Could not get NoisyStrips info");
2816  return StatusCode::FAILURE;
2817  }
2818  }
2819  ATH_MSG_DEBUG("before return");
2820  return StatusCode::SUCCESS;
2821 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_CalibAlgs::XmlHeader
Definition: XmlHeader.h:18
SCT_CalibAlgs::XmlStreamer
Definition: XmlStreamer.h:18
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
SCT_ID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: SCT_ID.h:73
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
DeMoAtlasDataLoss.lbRange
string lbRange
Definition: DeMoAtlasDataLoss.py:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
IOVTime::MAXEVENT
static constexpr uint32_t MAXEVENT
Definition: IOVTime.h:51
IOVTime::MINEVENT
static constexpr uint32_t MINEVENT
Definition: IOVTime.h:50
Identifier
Definition: IdentifierFieldParser.cxx:14