ATLAS Offline Software
Loading...
Searching...
No Matches
LArAutoCorrDecoderTool Class Reference

#include <LArAutoCorrDecoderTool.h>

Inheritance diagram for LArAutoCorrDecoderTool:
Collaboration diagram for LArAutoCorrDecoderTool:

Public Member Functions

virtual ~LArAutoCorrDecoderTool ()
const Eigen::MatrixXd AutoCorr (const HWIdentifier &CellID, int gain, unsigned nSamples) const
virtual StatusCode initialize ()
virtual StatusCode finalize ()

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Member Functions

const Eigen::MatrixXd ACDiagonal (const HWIdentifier &CellID, int gain, unsigned nSamples) const
const Eigen::MatrixXd ACPhysics (const HWIdentifier &CellID, int gain, unsigned nSamples) const

Private Attributes

Gaudi::Property< unsigned > m_decodemode {this,"DecodeMode",0}
Gaudi::Property< bool > m_alwaysHighGain {this,"UseAlwaysHighGain",false}
Gaudi::Property< bool > m_isSC {this,"isSC",false}
Gaudi::Property< std::string > m_keyAutoCorr {this,"KeyAutoCorr","LArAutoCorr"}
const LArOnlineID_Basem_onlineID =nullptr

Detailed Description

Definition at line 21 of file LArAutoCorrDecoderTool.h.

Constructor & Destructor Documentation

◆ ~LArAutoCorrDecoderTool()

LArAutoCorrDecoderTool::~LArAutoCorrDecoderTool ( )
virtualdefault

Member Function Documentation

◆ ACDiagonal()

const Eigen::MatrixXd LArAutoCorrDecoderTool::ACDiagonal ( const HWIdentifier & CellID,
int gain,
unsigned nSamples = 5 ) const
private

Definition at line 45 of file LArAutoCorrDecoderTool.cxx.

45 {
46
47 if (!m_isSC && m_alwaysHighGain) {
48 if (m_onlineID->isFCALchannel(CellID) ||m_onlineID->isHECchannel(CellID))
49 gain=1;
50 else
51 gain=0;
52 }
53
54 Eigen::MatrixXd AutoCorrMatrix=Eigen::MatrixXd::Zero(nSamples,nSamples);
55
56 const ILArAutoCorr* autoCorr=nullptr;
57 detStore()->retrieve(autoCorr,m_keyAutoCorr).ignore();
58
59
60 if ( autoCorr ) { // LArAutoCorrComplete is loaded in DetStore
61
62 ILArAutoCorr::AutoCorrRef_t dbcorr = autoCorr->autoCorr(CellID,gain);
63
64 if ( dbcorr.size()== 0 ) { // empty AutoCorr for given channel
65 ATH_MSG_WARNING( "Empty AutoCorr vector for channel " << m_onlineID->channel_name(CellID) << " in Gain = " << gain);
66 nSamples=0;
67 }
68 else if (dbcorr.size() < nSamples-1 ) {
69 ATH_MSG_WARNING( "Not enough samples in AutoCorr vector for channel " << m_onlineID->channel_name(CellID) << " in Gain = " << gain);
70 nSamples=1+dbcorr.size(); //The remaining values of the eigen matrix are left to 0.0
71 }
72
73 // fill diagonal matrix with vector
74 for (unsigned i=0;i<nSamples;i++) {
75 AutoCorrMatrix(i,i)= 1 ;
76 for (unsigned j=i+1;j<nSamples;j++) {
77 AutoCorrMatrix(i,j) = AutoCorrMatrix(j,i) = dbcorr[j-i-1];
78 }
79 }
80 }//else if m_autoCorr
81 else { // no LArAutoCorrComplete loaded in DetStore (e.g. DB problem) :-(
82 ATH_MSG_WARNING( "No valid AutoCorr object loaded from DetStore" );
83 }
84
85 ATH_MSG_DEBUG("AutoCorr Diagonal matrix for channel " << m_onlineID->channel_name(CellID)
86 << " in Gain = " << gain
87 << ":\n" << AutoCorrMatrix);
88
89 return AutoCorrMatrix;
90
91}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
LArVectorProxy AutoCorrRef_t
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const =0
const LArOnlineID_Base * m_onlineID
Gaudi::Property< std::string > m_keyAutoCorr
Gaudi::Property< bool > m_alwaysHighGain
Gaudi::Property< bool > m_isSC

◆ ACPhysics()

const Eigen::MatrixXd LArAutoCorrDecoderTool::ACPhysics ( const HWIdentifier & CellID,
int gain,
unsigned nSamples = 5 ) const
private

Definition at line 93 of file LArAutoCorrDecoderTool.cxx.

93 {
94
95
96 if (!m_isSC && m_alwaysHighGain) {
97 if (m_onlineID->isFCALchannel(CellID) ||m_onlineID->isHECchannel(CellID))
98 gain=1;
99 else
100 gain=0;
101 }
102
103 Eigen::MatrixXd AutoCorrMatrix=Eigen::MatrixXd::Identity(nSamples,nSamples);
104
105 const ILArAutoCorr* autoCorr=nullptr;
106 detStore()->retrieve(autoCorr,m_keyAutoCorr).ignore();
107
108 if ( autoCorr ) { // LArAutoCorrComplete is loaded in DetStore
109
110 ILArAutoCorr::AutoCorrRef_t corrdb = autoCorr->autoCorr(CellID,gain);
111
112 if ( corrdb.size()== 0 ) { // empty AutoCorr for given channel
113 ATH_MSG_WARNING( "Empty AutoCorr vector for channel " << m_onlineID->channel_name(CellID) << " in Gain = " << gain);
114 nSamples=0; //return all-zero matrix
115 }
116 else if ( corrdb.size() < nSamples*(nSamples+1)/2 ) {
117 ATH_MSG_WARNING( "Not enough samples in AutoCorr vector for channel " << m_onlineID->channel_name(CellID)
118 << "in Gain = " << gain << " for AC Physics mode");
119 nSamples=0;//return all-zero matrix
120 }
121
122 // Corr size could be bigger, then it's asked now, need remapping:
123 const unsigned int nsamples_AC = (-1+((int)(sqrt(1+8*corrdb.size()))))/2;
124 unsigned int k=0;
125 for (unsigned i=0;i<nSamples;i++) {
126 for (unsigned j=i;j<nSamples;j++,k++) {
127 if (i<=j) {
128 AutoCorrMatrix(i,j) = AutoCorrMatrix(j,i)= corrdb[k];
129 }
130 }
131 k+=nsamples_AC-nSamples;
132 }
133 } //end if m_autoCorr
134 else { // no LArAutoCorrComplete loaded in DetStore (e.g. DB problem) :-(
135 ATH_MSG_WARNING( "No valid AutoCorr object loaded from DetStore" );
136 }
137
138 ATH_MSG_DEBUG("AutoCorr Physics matrix for channel " << m_onlineID->channel_name(CellID)
139 << " in Gain = " << gain
140 << ":\n" << AutoCorrMatrix);
141 return AutoCorrMatrix;
142
143}

◆ AutoCorr()

const Eigen::MatrixXd LArAutoCorrDecoderTool::AutoCorr ( const HWIdentifier & CellID,
int gain,
unsigned nSamples = 5 ) const

Definition at line 36 of file LArAutoCorrDecoderTool.cxx.

37{
38 if (m_decodemode==1u)
39 return ACPhysics(CellID,gain,nSamples);
40 else
41 return ACDiagonal(CellID,gain,nSamples);
42}
const Eigen::MatrixXd ACDiagonal(const HWIdentifier &CellID, int gain, unsigned nSamples) const
Gaudi::Property< unsigned > m_decodemode
const Eigen::MatrixXd ACPhysics(const HWIdentifier &CellID, int gain, unsigned nSamples) const

◆ finalize()

virtual StatusCode LArAutoCorrDecoderTool::finalize ( )
inlinevirtual

Definition at line 38 of file LArAutoCorrDecoderTool.h.

38{return StatusCode::SUCCESS;}

◆ initialize()

StatusCode LArAutoCorrDecoderTool::initialize ( )
virtual

Definition at line 10 of file LArAutoCorrDecoderTool.cxx.

11{
12 ATH_MSG_DEBUG("LArAutoCorrDecoderTool initialize() begin");
13
14 if ( m_isSC ) {
15 const LArOnline_SuperCellID* ll;
16 ATH_CHECK( detStore()->retrieve(ll, "LArOnline_SuperCellID") );
17 m_onlineID = static_cast<const LArOnlineID_Base*>(ll);
18 ATH_MSG_DEBUG("Found the LArOnlineID helper");
19
20 } else { // m_isSC
21 const LArOnlineID* ll;
22 ATH_CHECK( detStore()->retrieve(ll, "LArOnlineID") );
23 m_onlineID = static_cast<const LArOnlineID_Base*>(ll);
24 ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
25 }
26
27
29 ATH_MSG_INFO( "Will always return HIGH gain autocorrelation matrix for EM calo, MEDIUM for HEC and FCAL" );
30
31 ATH_MSG_DEBUG("LArAutoCorrDecoderTool initialize() end");
32 return StatusCode::SUCCESS;
33}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
long long ll
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ interfaceID()

const InterfaceID & LArAutoCorrDecoderTool::interfaceID ( )
inlinestatic

Definition at line 40 of file LArAutoCorrDecoderTool.h.

40 {
42 }
static const InterfaceID & interfaceID()

Member Data Documentation

◆ m_alwaysHighGain

Gaudi::Property<bool> LArAutoCorrDecoderTool::m_alwaysHighGain {this,"UseAlwaysHighGain",false}
private

Definition at line 48 of file LArAutoCorrDecoderTool.h.

48{this,"UseAlwaysHighGain",false};

◆ m_decodemode

Gaudi::Property<unsigned> LArAutoCorrDecoderTool::m_decodemode {this,"DecodeMode",0}
private

Definition at line 47 of file LArAutoCorrDecoderTool.h.

47{this,"DecodeMode",0};

◆ m_isSC

Gaudi::Property<bool> LArAutoCorrDecoderTool::m_isSC {this,"isSC",false}
private

Definition at line 49 of file LArAutoCorrDecoderTool.h.

49{this,"isSC",false};

◆ m_keyAutoCorr

Gaudi::Property<std::string> LArAutoCorrDecoderTool::m_keyAutoCorr {this,"KeyAutoCorr","LArAutoCorr"}
private

Definition at line 50 of file LArAutoCorrDecoderTool.h.

50{this,"KeyAutoCorr","LArAutoCorr"};

◆ m_onlineID

const LArOnlineID_Base* LArAutoCorrDecoderTool::m_onlineID =nullptr
private

Definition at line 55 of file LArAutoCorrDecoderTool.h.


The documentation for this class was generated from the following files: