ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 }

◆ 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 }

◆ 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 ) {
16  ATH_CHECK( detStore()->retrieve(ll, "LArOnline_SuperCellID") );
17  m_onlineID = (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 = (const LArOnlineID_Base*)ll;
24  ATH_MSG_DEBUG(" Found the LArOnlineID helper. ");
25  }
26 
27 
28  if (!m_isSC && m_alwaysHighGain)
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 }

◆ interfaceID()

static const InterfaceID& LArAutoCorrDecoderTool::interfaceID ( )
inlinestatic

Definition at line 40 of file LArAutoCorrDecoderTool.h.

40  {
42  }

Member Data Documentation

◆ m_alwaysHighGain

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

Definition at line 48 of file LArAutoCorrDecoderTool.h.

◆ m_decodemode

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

Definition at line 47 of file LArAutoCorrDecoderTool.h.

◆ m_isSC

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

Definition at line 49 of file LArAutoCorrDecoderTool.h.

◆ m_keyAutoCorr

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

Definition at line 50 of file LArAutoCorrDecoderTool.h.

◆ 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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArAutoCorrDecoderTool::m_decodemode
Gaudi::Property< unsigned > m_decodemode
Definition: LArAutoCorrDecoderTool.h:47
LArAutoCorrDecoderTool::m_onlineID
const LArOnlineID_Base * m_onlineID
Definition: LArAutoCorrDecoderTool.h:55
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
LArAutoCorrDecoderTool::m_alwaysHighGain
Gaudi::Property< bool > m_alwaysHighGain
Definition: LArAutoCorrDecoderTool.h:48
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
LArAutoCorrDecoderTool::ACDiagonal
const Eigen::MatrixXd ACDiagonal(const HWIdentifier &CellID, int gain, unsigned nSamples) const
Definition: LArAutoCorrDecoderTool.cxx:45
ILArAutoCorr::autoCorr
virtual AutoCorrRef_t autoCorr(const HWIdentifier &CellID, int gain) const =0
ILArAutoCorr
This class defines the interface for accessing AutoCorrelation parameters for each channel @stereotyp...
Definition: ILArAutoCorr.h:29
LArAutoCorrDecoderTool::m_keyAutoCorr
Gaudi::Property< std::string > m_keyAutoCorr
Definition: LArAutoCorrDecoderTool.h:50
LArAutoCorrDecoderTool::ACPhysics
const Eigen::MatrixXd ACPhysics(const HWIdentifier &CellID, int gain, unsigned nSamples) const
Definition: LArAutoCorrDecoderTool.cxx:93
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1657
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArOnlineID_Base::isHECchannel
virtual bool isHECchannel(const HWIdentifier id) const =0
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ILArAutoCorrDecoderTool::interfaceID
static const InterfaceID & interfaceID()
Definition: ILArAutoCorrDecoderTool.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArAutoCorrDecoderTool::m_isSC
Gaudi::Property< bool > m_isSC
Definition: LArAutoCorrDecoderTool.h:49
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition: LArOnlineID_Base.h:105
LArOnlineID
Definition: LArOnlineID.h:20
LArOnline_SuperCellID
Definition: LArOnline_SuperCellID.h:20
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArDigits2NtupleDumper.nSamples
nSamples
Definition: LArDigits2NtupleDumper.py:70
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:218
fitman.k
k
Definition: fitman.py:528
LArVectorProxy
Proxy for accessing a range of float values like a vector.
Definition: LArVectorProxy.h:38
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
DiTauMassTools::TauTypes::ll
@ ll
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49