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

#include <SCT_CalibHvTool.h>

Inheritance diagram for SCT_CalibHvTool:
Collaboration diagram for SCT_CalibHvTool:

Public Member Functions

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

Private Types

enum  {
  n_chipPerSide = 6, n_chipPerModule = 12, n_stripPerChip = 128, n_etaInBarrel = 12,
  n_phiBinsB0 = 32, n_phiBinsB1 = 40, n_phiBinsB2 = 48, n_phiBinsB3 = 56,
  n_phiBinsECShort = 40, n_phiBinsECMiddle = 40, n_phiBinsECOuter = 52, n_elements =8176,
  n_BSErrorType = 15, firstBSErrorType = 0, lastBSErrorType = 14
}
 
typedef std::vector< int > VecInt
 

Private Member Functions

template<class T >
bool retrievedTool (T &tool, const std::string &toolName) const
 retrieve a tool and report if it failed More...
 

Private Attributes

ToolHandle< ISCT_DCSConditionsToolm_DCSConditionsTool {this, "SCT_DCSConditionsTool", "SCT_DCSConditionsTool", "Tool to retrieve SCT DCS information"}
 
const SCT_IDm_pSCTHelper {nullptr}
 
SCT_ID::const_id_iterator m_waferItrBegin
 
SCT_ID::const_id_iterator m_waferItrEnd
 
VecIntm_sct_waferHash {nullptr}
 
VecIntm_sct_numHitsInWafer {nullptr}
 
int m_maxq {100}
 
std::vector< std::queue< int > > m_phvtripQueue
 
std::queue< int > m_prevLBN
 
VecInt m_phvtripRunningTotalInt
 
VecInt m_phvtripProcessedEventsInt
 
VecInt m_phvtripHasItTripped
 
VecInt m_phvtripHasItTripped_prev
 
int m_phvtripPrevTime {0}
 
int m_phvtripFirstTime {0}
 
double m_absolutetriplimit {0}
 
double m_relativetriplimit {0}
 
int m_tq [100] {0}
 
std::vector< std::vector< std::pair< int, int > > > m_summarytrips
 
std::vector< std::vector< std::pair< int, int > > > m_summarytripslb
 
bool m_outputLowHits {false}
 
int m_lowHitCut {100}
 

Detailed Description

Definition at line 38 of file SCT_CalibHvTool.h.

Member Typedef Documentation

◆ VecInt

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

Definition at line 68 of file SCT_CalibHvTool.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
n_chipPerSide 
n_chipPerModule 
n_stripPerChip 
n_etaInBarrel 
n_phiBinsB0 
n_phiBinsB1 
n_phiBinsB2 
n_phiBinsB3 
n_phiBinsECShort 
n_phiBinsECMiddle 
n_phiBinsECOuter 
n_elements 
n_BSErrorType 
firstBSErrorType 
lastBSErrorType 

Definition at line 57 of file SCT_CalibHvTool.h.

Constructor & Destructor Documentation

◆ SCT_CalibHvTool()

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

Definition at line 24 of file SCT_CalibHvTool.cxx.

24  :
25  base_class(type, name, parent)
26 {
27 }

◆ ~SCT_CalibHvTool()

virtual SCT_CalibHvTool::~SCT_CalibHvTool ( )
virtualdefault

Member Function Documentation

◆ book()

bool SCT_CalibHvTool::book ( )
virtual

Definition at line 41 of file SCT_CalibHvTool.cxx.

41  {
42  bool result{true};
43  ATH_MSG_DEBUG("Book HVTrips");
44  //now initialize the queues (fill 100 spots with 0):
45  std::queue<int> qtemp;
46  initQueue(qtemp, m_maxq,0);
47  // need to keep previous bins lbn 4 deep.
48  initQueue(m_prevLBN, 4, 0);
49  std::vector<std::pair <int,int>> dummy;
50  //first set num events processed to 0
54  m_phvtripQueue.insert(m_phvtripQueue.end(), n_elements, qtemp);
58  return result;
59 }

◆ fill()

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

calculate the limit for an individual module, limit is m_relativetriplimit (default = 4) times the running average in that module. limits are given in hits/second. need to convert numhits in bin to average (within bin) hits/sec.

Definition at line 62 of file SCT_CalibHvTool.cxx.

62  {
63  const EventContext& ctx = Gaudi::Hive::currentContext();
64 
65  if (fromData) {
66  return fillFromData();
67  }
68  bool result{true};
69  int lumi_block{0}; //fix me!
70  const int wafersize{static_cast<int>(m_sct_waferHash->size())};
71  int time_stamp{static_cast<int>(ctx.eventID().time_stamp())};
72  int curr_time{time_stamp};
73  int dtime{curr_time - m_phvtripPrevTime};
74  int totalHits{0};
75  if (curr_time<m_phvtripPrevTime) {
76  ATH_MSG_ERROR("Events not sorted properly (time is going backwards!) ");
77  return false;
78  }
79  // for first event
80  if (m_phvtripFirstTime > curr_time) {
81  m_phvtripFirstTime = curr_time;
82  }
83  bool newbin{false};
84  // check if we have a new time bin, if we do pop off the back (oldest) part
85  // of the queue and enqueue 0 for every wafer
86  int maxtbins{5};
87  if (dtime > maxtbins) {
88  newbin = true;
89  ATH_MSG_DEBUG(" new t bin " << dtime <<" since start "<< (curr_time-(m_phvtripFirstTime-1.01)));
91  for (int iwaf{0}; iwaf!=n_elements; ++iwaf) {
92  m_phvtripQueue[iwaf].pop();
93  m_phvtripQueue[iwaf].push(0);
94  m_phvtripHasItTripped[iwaf]=0;
95  }
96  }
97  // Loop over all hits in the event
98  bool isgoodnow;
99  for( int itrk{0}; itrk!=wafersize; ++itrk) {
100  int waferhash{(*m_sct_waferHash)[itrk]};
101  Identifier waferId{m_pSCTHelper->wafer_id(waferhash)};
102  Identifier moduleId{m_pSCTHelper->module_id(waferId)};
103  //step one is to make sure this one isn't already know to be messed up:
104  isgoodnow = m_DCSConditionsTool->isGood(moduleId,InDetConditions::SCT_MODULE);
105  ATH_MSG_DEBUG("checked is good "<< isgoodnow);
106  if (isgoodnow) {
107  int numhits{(*m_sct_numHitsInWafer)[itrk]};
108  totalHits += numhits;
113  double limit{m_relativetriplimit * static_cast<double>(m_phvtripRunningTotalInt[waferhash]) / (static_cast<double>(curr_time)-(static_cast<double>(m_phvtripFirstTime-0.01)))};
114 
115  ATH_MSG_DEBUG("waferhash "<<waferhash<<" itrk "<<itrk <<" run tot "<< m_phvtripRunningTotalInt[waferhash]
116  <<" num hits "<<numhits<<" evnts processed "<< m_phvtripProcessedEventsInt[waferhash] <<" limit "<<limit
117  <<" abs limit, rel limit "<<m_absolutetriplimit<<","<< m_relativetriplimit<<" max bins "<<maxtbins);
118 
119  if ( ((numhits + m_phvtripQueue[waferhash].back() )/ static_cast<double>(maxtbins) ) > m_absolutetriplimit
120  and ((numhits + m_phvtripQueue[waferhash].back() )/ static_cast<double>(maxtbins) ) > limit) {
121  //read back queue and see if the high hit rate is persistant for 3 previous bins (a bin is 5 seconds by default)
122  for (int iq{0}; iq<m_maxq; ++iq) {
123  m_tq[iq]=m_phvtripQueue[waferhash].front();
124  m_phvtripQueue[waferhash].pop();
125  }
126  if (m_tq[m_maxq-2]/static_cast<double>(maxtbins) > limit && m_tq[m_maxq-3]/static_cast<double>(maxtbins) > limit && m_tq[m_maxq-4]/static_cast<double>(maxtbins) > limit) {
127  // found a persistent trip/thing
128  ATH_MSG_DEBUG("Found a potential trip in SCT wafer " << waferhash);
129  ATH_MSG_DEBUG("TRIP more info: limit = " << limit << " abslimit = " << m_absolutetriplimit
130  << " hits/secs now = " << ((numhits + m_tq[m_maxq-1])/ maxtbins )
131  << " running total = " << m_phvtripRunningTotalInt[waferhash]
132  << " running average = " << m_phvtripRunningTotalInt[waferhash] / (curr_time-(m_phvtripFirstTime-1.01)));
133  m_phvtripHasItTripped[waferhash] = (numhits + m_tq[m_maxq-1] );
134  } // end trip found
135 
136  //put queue back the way we found it:
137  for (int iq{0}; iq < m_maxq; ++iq) {
138  m_phvtripQueue[waferhash].push(m_tq[iq]);
139  }
140  } // end potential trip id
141  //incriment event counter
142  m_phvtripProcessedEventsInt[waferhash] += 1;
143  //recalcuate running total:
144  m_phvtripRunningTotalInt[waferhash] += numhits;
145  m_phvtripQueue[waferhash].back() += numhits;
146  } //end is good check
147  else {
148  ATH_MSG_DEBUG("Was a bad module already: " << waferhash);
149  }
150  } //end loop over tracks
151 
152  // text output, summarizing the event
153  //if new bin summarzie the previous event.
154  if (newbin) {
157  for (; waferItr not_eq waferItrE; ++waferItr) {
158  Identifier waferId{*waferItr};
159  IdentifierHash waferHash{m_pSCTHelper->wafer_hash(waferId)};
160  if (m_phvtripHasItTripped_prev[waferHash]>0) {
161  std::pair<int, int> wp;
162  wp.first = (m_phvtripPrevTime - 3*maxtbins);
163  wp.second = (m_phvtripPrevTime + maxtbins);
164  m_summarytrips[waferHash].push_back(wp);
165  std::pair<int,int> lbn;
166  lbn.first = m_prevLBN.front();
167  lbn.second = m_prevLBN.back();
168  m_summarytripslb[waferHash].push_back(lbn);
169  }
170  }
171  m_phvtripPrevTime = curr_time; //reset prev and current time
172  m_prevLBN.pop();
173  m_prevLBN.push(lumi_block);
174  }
175 
176  for (int iwaf{0}; iwaf!=n_elements; ++iwaf) {
177  ATH_MSG_DEBUG("mod "<< iwaf <<" events with that waf " <<m_phvtripProcessedEventsInt[iwaf] << " numhits "<<m_phvtripRunningTotalInt[iwaf]);
178  ATH_MSG_DEBUG("did it trip "<<m_phvtripHasItTripped[iwaf]);
179  if (m_phvtripHasItTripped[iwaf]) {
180  ATH_MSG_DEBUG("TRIP more info: abslimit = "<< m_absolutetriplimit
181  <<" hits/secs now = "<< ( m_phvtripQueue[iwaf].back() / maxtbins )
182  <<" running total = "<< m_phvtripRunningTotalInt[iwaf]
183  <<" running average = "<< m_phvtripRunningTotalInt[iwaf] / (curr_time-(m_phvtripFirstTime-1.01)));
184  }
185  }
186  if (m_outputLowHits && (totalHits < m_lowHitCut) ) {
187  }
188  return result;
189 }

◆ fillFromData()

bool SCT_CalibHvTool::fillFromData ( )
virtual

Definition at line 192 of file SCT_CalibHvTool.cxx.

192  {
193  bool result{true};
194  return result;
195 }

◆ finalize()

StatusCode SCT_CalibHvTool::finalize ( )
virtual

Definition at line 36 of file SCT_CalibHvTool.cxx.

36  {
37  return StatusCode::SUCCESS;
38 }

◆ initialize()

StatusCode SCT_CalibHvTool::initialize ( )
virtual

Definition at line 30 of file SCT_CalibHvTool.cxx.

30  {
31  ATH_CHECK(m_DCSConditionsTool.retrieve());
32  return StatusCode::SUCCESS;
33 }

◆ retrievedTool()

template<class T >
bool SCT_CalibHvTool::retrievedTool ( T &  tool,
const std::string &  toolName 
) const
inlineprivate

retrieve a tool and report if it failed

Definition at line 94 of file SCT_CalibHvTool.h.

94  {
95  if (tool.retrieve().isFailure()) {
96  ATH_MSG_ERROR("Unable to retrieve " << toolName);
97  return false;
98  }
99  return true;
100  }

Member Data Documentation

◆ m_absolutetriplimit

double SCT_CalibHvTool::m_absolutetriplimit {0}
private

Definition at line 84 of file SCT_CalibHvTool.h.

◆ m_DCSConditionsTool

ToolHandle<ISCT_DCSConditionsTool> SCT_CalibHvTool::m_DCSConditionsTool {this, "SCT_DCSConditionsTool", "SCT_DCSConditionsTool", "Tool to retrieve SCT DCS information"}
private

Definition at line 63 of file SCT_CalibHvTool.h.

◆ m_lowHitCut

int SCT_CalibHvTool::m_lowHitCut {100}
private

Definition at line 91 of file SCT_CalibHvTool.h.

◆ m_maxq

int SCT_CalibHvTool::m_maxq {100}
private

Definition at line 73 of file SCT_CalibHvTool.h.

◆ m_outputLowHits

bool SCT_CalibHvTool::m_outputLowHits {false}
private

Definition at line 90 of file SCT_CalibHvTool.h.

◆ m_phvtripFirstTime

int SCT_CalibHvTool::m_phvtripFirstTime {0}
private

Definition at line 83 of file SCT_CalibHvTool.h.

◆ m_phvtripHasItTripped

VecInt SCT_CalibHvTool::m_phvtripHasItTripped
private

Definition at line 79 of file SCT_CalibHvTool.h.

◆ m_phvtripHasItTripped_prev

VecInt SCT_CalibHvTool::m_phvtripHasItTripped_prev
private

Definition at line 80 of file SCT_CalibHvTool.h.

◆ m_phvtripPrevTime

int SCT_CalibHvTool::m_phvtripPrevTime {0}
private

Definition at line 82 of file SCT_CalibHvTool.h.

◆ m_phvtripProcessedEventsInt

VecInt SCT_CalibHvTool::m_phvtripProcessedEventsInt
private

Definition at line 78 of file SCT_CalibHvTool.h.

◆ m_phvtripQueue

std::vector<std::queue<int> > SCT_CalibHvTool::m_phvtripQueue
private

Definition at line 75 of file SCT_CalibHvTool.h.

◆ m_phvtripRunningTotalInt

VecInt SCT_CalibHvTool::m_phvtripRunningTotalInt
private

Definition at line 77 of file SCT_CalibHvTool.h.

◆ m_prevLBN

std::queue<int> SCT_CalibHvTool::m_prevLBN
private

Definition at line 76 of file SCT_CalibHvTool.h.

◆ m_pSCTHelper

const SCT_ID* SCT_CalibHvTool::m_pSCTHelper {nullptr}
private

Definition at line 65 of file SCT_CalibHvTool.h.

◆ m_relativetriplimit

double SCT_CalibHvTool::m_relativetriplimit {0}
private

Definition at line 85 of file SCT_CalibHvTool.h.

◆ m_sct_numHitsInWafer

VecInt* SCT_CalibHvTool::m_sct_numHitsInWafer {nullptr}
private

Definition at line 70 of file SCT_CalibHvTool.h.

◆ m_sct_waferHash

VecInt* SCT_CalibHvTool::m_sct_waferHash {nullptr}
private

Definition at line 69 of file SCT_CalibHvTool.h.

◆ m_summarytrips

std::vector<std::vector<std::pair<int, int> > > SCT_CalibHvTool::m_summarytrips
private

Definition at line 88 of file SCT_CalibHvTool.h.

◆ m_summarytripslb

std::vector<std::vector<std::pair<int, int> > > SCT_CalibHvTool::m_summarytripslb
private

Definition at line 89 of file SCT_CalibHvTool.h.

◆ m_tq

int SCT_CalibHvTool::m_tq[100] {0}
private

Definition at line 86 of file SCT_CalibHvTool.h.

◆ m_waferItrBegin

SCT_ID::const_id_iterator SCT_CalibHvTool::m_waferItrBegin
private

Definition at line 66 of file SCT_CalibHvTool.h.

◆ m_waferItrEnd

SCT_ID::const_id_iterator SCT_CalibHvTool::m_waferItrEnd
private

Definition at line 67 of file SCT_CalibHvTool.h.


The documentation for this class was generated from the following files:
SCT_CalibHvTool::m_outputLowHits
bool m_outputLowHits
Definition: SCT_CalibHvTool.h:90
SCT_CalibHvTool::m_phvtripQueue
std::vector< std::queue< int > > m_phvtripQueue
Definition: SCT_CalibHvTool.h:75
SCT_CalibHvTool::n_phiBinsECMiddle
@ n_phiBinsECMiddle
Definition: SCT_CalibHvTool.h:59
SCT_CalibHvTool::n_phiBinsB1
@ n_phiBinsB1
Definition: SCT_CalibHvTool.h:58
SCT_CalibHvTool::n_phiBinsB3
@ n_phiBinsB3
Definition: SCT_CalibHvTool.h:58
get_generator_info.result
result
Definition: get_generator_info.py:21
SCT_CalibHvTool::m_waferItrEnd
SCT_ID::const_id_iterator m_waferItrEnd
Definition: SCT_CalibHvTool.h:67
SCT_CalibHvTool::n_BSErrorType
@ n_BSErrorType
Definition: SCT_CalibHvTool.h:60
SCT_CalibHvTool::m_sct_waferHash
VecInt * m_sct_waferHash
Definition: SCT_CalibHvTool.h:69
SCT_CalibHvTool::fillFromData
virtual bool fillFromData()
Definition: SCT_CalibHvTool.cxx:192
SCT_CalibHvTool::m_relativetriplimit
double m_relativetriplimit
Definition: SCT_CalibHvTool.h:85
SCT_ID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: SCT_ID.h:73
SCT_CalibHvTool::m_phvtripHasItTripped_prev
VecInt m_phvtripHasItTripped_prev
Definition: SCT_CalibHvTool.h:80
SCT_CalibHvTool::m_pSCTHelper
const SCT_ID * m_pSCTHelper
Definition: SCT_CalibHvTool.h:65
SCT_ID::module_id
Identifier module_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: SCT_ID.h:416
SCT_CalibHvTool::n_phiBinsB2
@ n_phiBinsB2
Definition: SCT_CalibHvTool.h:58
SCT_CalibHvTool::n_stripPerChip
@ n_stripPerChip
Definition: SCT_CalibHvTool.h:57
SCT_CalibHvTool::m_absolutetriplimit
double m_absolutetriplimit
Definition: SCT_CalibHvTool.h:84
SCT_CalibHvTool::lastBSErrorType
@ lastBSErrorType
Definition: SCT_CalibHvTool.h:60
SCT_CalibHvTool::n_chipPerModule
@ n_chipPerModule
Definition: SCT_CalibHvTool.h:57
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SCT_CalibHvTool::m_summarytripslb
std::vector< std::vector< std::pair< int, int > > > m_summarytripslb
Definition: SCT_CalibHvTool.h:89
InDetConditions::SCT_MODULE
@ SCT_MODULE
Definition: InDetHierarchy.h:14
SCT_CalibHvTool::m_DCSConditionsTool
ToolHandle< ISCT_DCSConditionsTool > m_DCSConditionsTool
Definition: SCT_CalibHvTool.h:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SCT_CalibHvTool::n_elements
@ n_elements
Definition: SCT_CalibHvTool.h:59
SCT_CalibHvTool::m_phvtripRunningTotalInt
VecInt m_phvtripRunningTotalInt
Definition: SCT_CalibHvTool.h:77
SCT_CalibHvTool::n_phiBinsECShort
@ n_phiBinsECShort
Definition: SCT_CalibHvTool.h:59
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.xAODType.dummy
dummy
Definition: xAODType.py:4
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
PlotSFuncertainty.wp
wp
Definition: PlotSFuncertainty.py:112
SCT_CalibHvTool::firstBSErrorType
@ firstBSErrorType
Definition: SCT_CalibHvTool.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_CalibHvTool::m_phvtripHasItTripped
VecInt m_phvtripHasItTripped
Definition: SCT_CalibHvTool.h:79
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
SCT_CalibHvTool::m_prevLBN
std::queue< int > m_prevLBN
Definition: SCT_CalibHvTool.h:76
SCT_CalibHvTool::n_chipPerSide
@ n_chipPerSide
Definition: SCT_CalibHvTool.h:57
SCT_CalibHvTool::n_etaInBarrel
@ n_etaInBarrel
Definition: SCT_CalibHvTool.h:57
SCT_CalibHvTool::n_phiBinsECOuter
@ n_phiBinsECOuter
Definition: SCT_CalibHvTool.h:59
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_CalibHvTool::m_tq
int m_tq[100]
Definition: SCT_CalibHvTool.h:86
SCT_CalibHvTool::m_phvtripPrevTime
int m_phvtripPrevTime
Definition: SCT_CalibHvTool.h:82
SCT_CalibHvTool::m_maxq
int m_maxq
Definition: SCT_CalibHvTool.h:73
SCT_CalibHvTool::m_phvtripProcessedEventsInt
VecInt m_phvtripProcessedEventsInt
Definition: SCT_CalibHvTool.h:78
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_CalibHvTool::m_waferItrBegin
SCT_ID::const_id_iterator m_waferItrBegin
Definition: SCT_CalibHvTool.h:66
updateCoolNtuple.limit
int limit
Definition: updateCoolNtuple.py:45
SCT_CalibHvTool::m_lowHitCut
int m_lowHitCut
Definition: SCT_CalibHvTool.h:91
SCT_CalibHvTool::m_summarytrips
std::vector< std::vector< std::pair< int, int > > > m_summarytrips
Definition: SCT_CalibHvTool.h:88
SCT_CalibHvTool::n_phiBinsB0
@ n_phiBinsB0
Definition: SCT_CalibHvTool.h:58
LB_AnalMapSplitter.lbn
lbn
Definition: LB_AnalMapSplitter.py:28
SCT_CalibHvTool::m_phvtripFirstTime
int m_phvtripFirstTime
Definition: SCT_CalibHvTool.h:83
Identifier
Definition: IdentifierFieldParser.cxx:14