ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SCT_CalibBsErrorTool Class Reference

#include <SCT_CalibBsErrorTool.h>

Inheritance diagram for SCT_CalibBsErrorTool:
Collaboration diagram for SCT_CalibBsErrorTool:

Public Member Functions

 SCT_CalibBsErrorTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~SCT_CalibBsErrorTool ()=default
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual bool book ()
 
virtual bool read (const std::string &fileName)
 
virtual bool fill (const bool fromData=false)
 
virtual bool fillFromData ()
 

Private Types

typedef std::vector< int > VecInt
 

Private Member Functions

void fillBsErrorsForWafer (const Identifier &waferId, const int type)
 

Private Attributes

ToolHandle< ISCT_ByteStreamErrorsToolm_bytestreamErrorsTool {this, "SCT_ByteStreamErrorsTool", "SCT_ByteStreamErrorsTool", "Tool to retrieve SCT ByteStream Errors"}
 
const SCT_IDm_pSCTHelper {nullptr}
 
SCT_ID::const_id_iterator m_waferItrBegin
 
SCT_ID::const_id_iterator m_waferItrEnd
 
VecIntm_scterr_bec {nullptr}
 
VecIntm_scterr_layer {nullptr}
 
VecIntm_scterr_eta {nullptr}
 
VecIntm_scterr_phi {nullptr}
 
VecIntm_scterr_side {nullptr}
 
VecIntm_scterr_type {nullptr}
 
int m_maxHash {0}
 

Detailed Description

Definition at line 31 of file SCT_CalibBsErrorTool.h.

Member Typedef Documentation

◆ VecInt

typedef std::vector<int> SCT_CalibBsErrorTool::VecInt
private

Definition at line 57 of file SCT_CalibBsErrorTool.h.

Constructor & Destructor Documentation

◆ SCT_CalibBsErrorTool()

SCT_CalibBsErrorTool::SCT_CalibBsErrorTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 38 of file SCT_CalibBsErrorTool.cxx.

38  :
39  base_class(type, name, parent)
40 {
41 }

◆ ~SCT_CalibBsErrorTool()

virtual SCT_CalibBsErrorTool::~SCT_CalibBsErrorTool ( )
virtualdefault

Member Function Documentation

◆ book()

bool SCT_CalibBsErrorTool::book ( )
virtual

Definition at line 64 of file SCT_CalibBsErrorTool.cxx.

64  {
65  bool result{true};
66  m_phistoVector.clear();
67  std::string histoName{pathRoot+"GENERAL/"};
68  //histogram for numbers of events
69  m_numberOfEventsHisto = new TH1I{"events", "Events", 1, 0.5, 1.5};
70  if (m_thistSvc->regHist(histoName.c_str(), m_numberOfEventsHisto ).isFailure()) {
71  ATH_MSG_ERROR("Error in booking BSErrors histogram");
72  }
73  //--- BSErrors for each wafer
76  for (; waferItr not_eq waferItrE; ++waferItr) {
77  Identifier waferId{*waferItr};
78  const int bec{m_pSCTHelper->barrel_ec(waferId)};
79  const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)};
80  std::string histotitle{std::string{"SCT "} + detectorNames[bec2Index(bec)] + std::string{" BSErrors : plane "} + formattedPosition};
81  const std::string name{pathRoot+detectorPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition};
82  TH1F* hitmapHisto_tmp{new TH1F{TString{formattedPosition}, TString{histotitle}, n_BSErrorType, firstBSErrorType-0.5, lastBSErrorType+0.5}};
83  if (m_thistSvc->regHist(name.c_str(), hitmapHisto_tmp).isFailure()) {
84  ATH_MSG_ERROR("Error in booking BSErrors histogram");
85  }
86  m_phistoVector.push_back(hitmapHisto_tmp);
87  }
88  return result;
89 }

◆ fill()

bool SCT_CalibBsErrorTool::fill ( const bool  fromData = false)
virtual

Definition at line 133 of file SCT_CalibBsErrorTool.cxx.

133  {
134  if (fromData) {
135  return fillFromData();
136  }
137  bool result{true};
138  //--- Number of event
139  m_numberOfEventsHisto->Fill( 1 );
140  //--- Fill BSErrors
141  const int maxEntry{static_cast<int>(m_scterr_type->size())};
142  for (int i{0}; i != maxEntry; ++i ) {
143  int bec{(*m_scterr_bec)[i]};
144  int layer{(*m_scterr_layer)[i]};
145  int phi{(*m_scterr_phi)[i]};
146  int eta{(*m_scterr_eta)[i]};
147  int side{(*m_scterr_side)[i]};
148  int type{(*m_scterr_type)[i]};
149  Identifier waferId{m_pSCTHelper->wafer_id( bec, layer, phi, eta, side )};
150  fillBsErrorsForWafer(waferId, type);
151  }
152  return result;
153 }

◆ fillBsErrorsForWafer()

void SCT_CalibBsErrorTool::fillBsErrorsForWafer ( const Identifier waferId,
const int  type 
)
private

Definition at line 173 of file SCT_CalibBsErrorTool.cxx.

173  {
174  int iWaferHash{static_cast<int>(m_pSCTHelper->wafer_hash(waferId))};
175  const std::string osWafer{formatPosition(waferId, m_pSCTHelper,".")};
176  //--- Protection for wrong waferID
177  if ( iWaferHash < 0 || iWaferHash >= m_maxHash ) {
178  ATH_MSG_WARNING("WaferHash " << iWaferHash << " is out of range : [ bec.layer.eta.phi.side, BSErrorType ] = [ " << osWafer << ", " << type << " ]");
179  } else {
180  ATH_MSG_DEBUG("BSError : [ bec.layer.eta.phi.side, Type ] = [ " << osWafer<< ", " << type << " ]");
181  m_phistoVector[ iWaferHash ]->Fill( type );
182  }
183 }

◆ fillFromData()

bool SCT_CalibBsErrorTool::fillFromData ( )
virtual

Definition at line 156 of file SCT_CalibBsErrorTool.cxx.

156  {
157  bool result{true};
158  //--- Number of event
159  m_numberOfEventsHisto->Fill( 1 );
160  //--- Loop over BSErrors
161  const EventContext& ctx{Gaudi::Hive::currentContext()};
163  const std::set<IdentifierHash> errorSet{m_bytestreamErrorsTool->getErrorSet(type, ctx)};
164  for(const auto& idHash : errorSet) {
165  Identifier waferId{m_pSCTHelper->wafer_id(idHash)};
166  fillBsErrorsForWafer(waferId, type);
167  }
168  }
169  return result;
170 }

◆ finalize()

StatusCode SCT_CalibBsErrorTool::finalize ( )
virtual

Definition at line 57 of file SCT_CalibBsErrorTool.cxx.

57  {
58  ATH_MSG_INFO("Finalize of SCT_CalibBsErrorTool");
59 
60  return StatusCode::SUCCESS;
61 }

◆ initialize()

StatusCode SCT_CalibBsErrorTool::initialize ( )
virtual

Definition at line 44 of file SCT_CalibBsErrorTool.cxx.

44  {
45  ATH_CHECK(service("THistSvc", m_thistSvc));
46  ATH_CHECK(detStore()->retrieve(m_pSCTHelper, "SCT_ID"));
48 
52 
53  return StatusCode::SUCCESS;
54 }

◆ read()

bool SCT_CalibBsErrorTool::read ( const std::string &  fileName)
virtual

Definition at line 92 of file SCT_CalibBsErrorTool.cxx.

92  {
93  bool result{true};
94  //pointers to the histos are deleted by m_thistSvc methods
95  m_phistoVector.clear();
96  TFile* fileHitmap{TFile::Open(fileName.c_str())};
97  ATH_MSG_INFO("opening Hitmap file : " << fileName.c_str());
98 
99  if (fileHitmap==nullptr) {
100  ATH_MSG_ERROR("can not open Hitmap file : " << fileName.c_str());
101  return result;
102  }
103  //histogram for numbers of events
104  m_numberOfEventsHisto = static_cast<TH1I*>(fileHitmap->Get("GENERAL/events"));
105  if (m_numberOfEventsHisto==nullptr) {
106  ATH_MSG_ERROR("Error in reading EventNumber histogram");
107  }
108  //histograms for each wafer
110  for (; waferItr not_eq m_waferItrEnd; ++waferItr) {
111  const Identifier& waferId{*waferItr};
112  const std::string formattedPosition{formatPosition(waferId, m_pSCTHelper)};
113  std::string name{detectorPaths[bec2Index(m_pSCTHelper->barrel_ec(waferId))] + formattedPosition};
114  TH1F* hitmapHisto_tmp{static_cast<TH1F*>(fileHitmap->Get(name.c_str()))};
115  if (hitmapHisto_tmp==nullptr) {
116  ATH_MSG_ERROR("Error in reading BSErrors histogram");
117  } else {
118  m_phistoVector.push_back(hitmapHisto_tmp);
119  }
120  }
121  return result;
122 }

Member Data Documentation

◆ m_bytestreamErrorsTool

ToolHandle<ISCT_ByteStreamErrorsTool> SCT_CalibBsErrorTool::m_bytestreamErrorsTool {this, "SCT_ByteStreamErrorsTool", "SCT_ByteStreamErrorsTool", "Tool to retrieve SCT ByteStream Errors"}
private

Definition at line 51 of file SCT_CalibBsErrorTool.h.

◆ m_maxHash

int SCT_CalibBsErrorTool::m_maxHash {0}
private

Definition at line 64 of file SCT_CalibBsErrorTool.h.

◆ m_pSCTHelper

const SCT_ID* SCT_CalibBsErrorTool::m_pSCTHelper {nullptr}
private

Definition at line 52 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_bec

VecInt* SCT_CalibBsErrorTool::m_scterr_bec {nullptr}
private

Definition at line 58 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_eta

VecInt* SCT_CalibBsErrorTool::m_scterr_eta {nullptr}
private

Definition at line 60 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_layer

VecInt* SCT_CalibBsErrorTool::m_scterr_layer {nullptr}
private

Definition at line 59 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_phi

VecInt* SCT_CalibBsErrorTool::m_scterr_phi {nullptr}
private

Definition at line 61 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_side

VecInt* SCT_CalibBsErrorTool::m_scterr_side {nullptr}
private

Definition at line 62 of file SCT_CalibBsErrorTool.h.

◆ m_scterr_type

VecInt* SCT_CalibBsErrorTool::m_scterr_type {nullptr}
private

Definition at line 63 of file SCT_CalibBsErrorTool.h.

◆ m_waferItrBegin

SCT_ID::const_id_iterator SCT_CalibBsErrorTool::m_waferItrBegin
private

Definition at line 55 of file SCT_CalibBsErrorTool.h.

◆ m_waferItrEnd

SCT_ID::const_id_iterator SCT_CalibBsErrorTool::m_waferItrEnd
private

Definition at line 56 of file SCT_CalibBsErrorTool.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_CalibAlgs::bec2Index
unsigned int bec2Index(const int bec)
Definition: SCT_CalibUtilities.cxx:60
get_generator_info.result
result
Definition: get_generator_info.py:21
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SCT_CalibBsErrorTool::m_waferItrBegin
SCT_ID::const_id_iterator m_waferItrBegin
Definition: SCT_CalibBsErrorTool.h:55
SCT_ID::wafer_begin
const_id_iterator wafer_begin(void) const
Iterators over full set of ids. Wafer iterator is sorted.
Definition: SCT_ID.cxx:648
SCT_ID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: SCT_ID.h:73
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_CalibBsErrorTool::m_waferItrEnd
SCT_ID::const_id_iterator m_waferItrEnd
Definition: SCT_CalibBsErrorTool.h:56
SCT_CalibBsErrorTool::m_bytestreamErrorsTool
ToolHandle< ISCT_ByteStreamErrorsTool > m_bytestreamErrorsTool
Definition: SCT_CalibBsErrorTool.h:51
TRT::Hit::side
@ side
Definition: HitInfo.h:83
SCT_CalibBsErrorTool::m_pSCTHelper
const SCT_ID * m_pSCTHelper
Definition: SCT_CalibBsErrorTool.h:52
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_CalibAlgs::formatPosition
std::string formatPosition(const Identifier &waferId, const SCT_ID *helper, const std::string &delimiter, const bool includeSide)
Definition: SCT_CalibUtilities.cxx:36
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ID::wafer_hash
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
Definition: SCT_ID.h:492
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SCT_ID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: SCT_ID.cxx:639
SCT_CalibBsErrorTool::fillBsErrorsForWafer
void fillBsErrorsForWafer(const Identifier &waferId, const int type)
Definition: SCT_CalibBsErrorTool.cxx:173
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SCT_FlaggedCondEnum::NUM_ERROR_TYPES
@ NUM_ERROR_TYPES
Definition: SCT_FlaggedCondEnum.h:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_CalibBsErrorTool::m_scterr_type
VecInt * m_scterr_type
Definition: SCT_CalibBsErrorTool.h:63
SCT_ID::wafer_end
const_id_iterator wafer_end(void) const
Definition: SCT_ID.cxx:652
SCT_CalibBsErrorTool::m_maxHash
int m_maxHash
Definition: SCT_CalibBsErrorTool.h:64
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
SCT_ID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
Definition: SCT_ID.h:464
SCT_CalibBsErrorTool::fillFromData
virtual bool fillFromData()
Definition: SCT_CalibBsErrorTool.cxx:156