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

This tool correct TileRawChannels amplitudes which came from OF1 DSP if pedestal changed. More...

#include <TileRawChannelOF1Corrector.h>

Inheritance diagram for TileRawChannelOF1Corrector:
Collaboration diagram for TileRawChannelOF1Corrector:

Public Member Functions

 TileRawChannelOF1Corrector (const std::string &type, const std::string &name, const IInterface *parent)
 AlgTool like constructor. More...
 
virtual ~TileRawChannelOF1Corrector ()
 Virtual destructor. More...
 
virtual StatusCode initialize () override
 AlgTool initialize method. More...
 
virtual StatusCode finalize () override
 AlgTool finalize method. More...
 
virtual StatusCode process (TileMutableRawChannelContainer &rchCont, const EventContext &ctx) const override
 Correct TileRawChannel amplitudes if pedestal changed. More...
 

Private Attributes

const TileHWIDm_tileHWID
 Pointer to TileHWID. More...
 
SG::ReadCondHandleKey< TileSampleNoisem_sampleNoiseKey
 Name of TileSampleNoise in condition store. More...
 
SG::ReadCondHandleKey< TileSampleNoisem_onlineSampleNoiseKey
 Name of online TileSampleNoise in condition store. More...
 
ToolHandle< ITileCondToolOfcm_tileCondToolOfc
 
ToolHandle< TileCondToolTimingm_tileToolTiming
 
SG::ReadCondHandleKey< TileEMScalem_emScaleKey
 Name of TileEMScale in condition store. More...
 
ToolHandle< ITileCondToolDspThresholdm_tileDspThreshold
 
SG::ReadHandleKey< TileDigitsContainerm_digitsContainerKey
 
bool m_zeroAmplitudeWithoutDigits
 
bool m_correctPedestalDifference
 

Detailed Description

This tool correct TileRawChannels amplitudes which came from OF1 DSP if pedestal changed.

Definition at line 38 of file TileRawChannelOF1Corrector.h.

Constructor & Destructor Documentation

◆ TileRawChannelOF1Corrector()

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

AlgTool like constructor.

Definition at line 20 of file TileRawChannelOF1Corrector.cxx.

22  : base_class(type, name, parent)
23  , m_tileHWID(0)
24 {
25  declareProperty("ZeroAmplitudeWithoutDigits", m_zeroAmplitudeWithoutDigits = true);
26  declareProperty("CorrectPedestalDifference", m_correctPedestalDifference = true);
27 }

◆ ~TileRawChannelOF1Corrector()

virtual TileRawChannelOF1Corrector::~TileRawChannelOF1Corrector ( )
inlinevirtual

Virtual destructor.

Definition at line 46 of file TileRawChannelOF1Corrector.h.

46 {};

Member Function Documentation

◆ finalize()

StatusCode TileRawChannelOF1Corrector::finalize ( )
overridevirtual

AlgTool finalize method.

Definition at line 199 of file TileRawChannelOF1Corrector.cxx.

199  {
200  return StatusCode::SUCCESS;
201 }

◆ initialize()

StatusCode TileRawChannelOF1Corrector::initialize ( )
overridevirtual

AlgTool initialize method.

Definition at line 31 of file TileRawChannelOF1Corrector.cxx.

31  {
32 
33  ATH_MSG_INFO("Initializing...");
34 
36 
39 
41  //=== get TileCondToolOfc
42  ATH_CHECK( m_tileCondToolOfc.retrieve() );
43 
44  //=== get TileToolTiming
45  ATH_CHECK( m_tileToolTiming.retrieve() );
46  } else {
47  m_tileCondToolOfc.disable();
48  m_tileToolTiming.disable();
49  }
50 
52 
54  //=== get TileToolTiming
55  ATH_CHECK( m_tileDspThreshold.retrieve() );
56  } else {
57  m_tileDspThreshold.disable();
58  }
59 
62  } else {
64  }
65 
66  return StatusCode::SUCCESS;
67 }

◆ process()

StatusCode TileRawChannelOF1Corrector::process ( TileMutableRawChannelContainer rchCont,
const EventContext &  ctx 
) const
overridevirtual

Correct TileRawChannel amplitudes if pedestal changed.

Definition at line 74 of file TileRawChannelOF1Corrector.cxx.

75 {
76  ATH_MSG_DEBUG("in TileRawChannelOF1Corrector::process()");
77 
78  TileFragHash::TYPE rawChannelType = rchCont.get_type();
79  uint32_t bsFlags = rchCont.get_bsflags();
80 
81  if ((rawChannelType == TileFragHash::OptFilterDsp
82  || rawChannelType == TileFragHash::OptFilterDspCompressed) // DSP container
83  && (bsFlags & (1U << 26U)) == 0) { // OF1 method
84 
85  TileRawChannelUnit::UNIT rawChannelUnit = rchCont.get_unit();
86  ATH_MSG_VERBOSE( "Units in container is " << rawChannelUnit );
87 
88  const TileEMScale* emScale{nullptr};
89  const TileDigitsContainer* digitsContainer(nullptr);
90 
93  ATH_CHECK( emScaleHandle.isValid() );
94  emScale = emScaleHandle.cptr();
95 
98  digitsContainer = allDigits.cptr();
99  }
100  }
101 
102  const TileSampleNoise* sampleNoise = nullptr;
103  const TileSampleNoise* onlineSampleNoise = nullptr;
106  ATH_CHECK( sampleNoiseHandle.isValid() );
107  sampleNoise = sampleNoiseHandle.retrieve();
108 
109  SG::ReadCondHandle<TileSampleNoise> onlineSampleNoiseHandle(m_onlineSampleNoiseKey, ctx);
110  ATH_CHECK( onlineSampleNoiseHandle.isValid() );
111  onlineSampleNoise = onlineSampleNoiseHandle.retrieve();
112  }
113 
114 
115  for (IdentifierHash hash : rchCont.GetAllCurrentHashes()) {
116  TileRawChannelCollection* rawChannelCollection = rchCont.indexFindPtr (hash);
117 
118  int fragId = rawChannelCollection->identify();
119  unsigned int drawer = (fragId & 0x3F);
120  unsigned int ros = fragId >> 8;
121  unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
122 
123  bool checkDigits(false);
124  std::vector<bool> noDigits(TileCalibUtils::MAX_CHAN, true);
125  if (digitsContainer) {
126  IdentifierHash fragHash = (digitsContainer->hashFunc())(fragId);
127  const TileDigitsCollection* digitsCollection = digitsContainer->indexFindPtr(fragHash);
128  if (digitsCollection->getFragBCID() != 0xDEAD) {
129  ATH_MSG_VERBOSE(TileCalibUtils::getDrawerString(ros, drawer) << ": digits in bytestream => check digits");
130  checkDigits = true;
131  } else {
132  ATH_MSG_VERBOSE(TileCalibUtils::getDrawerString(ros, drawer) << ": no digits in bytestream => do not check digits");
133  }
134 
135  for (const TileDigits* tile_digits : *digitsCollection) {
136  int channel = m_tileHWID->channel(tile_digits->adc_HWID());
137  noDigits[channel] = false;
138  }
139  }
140 
141  for (TileRawChannel* rawChannel : *rawChannelCollection) {
142  HWIdentifier adcId = rawChannel->adc_HWID();
143  int channel = m_tileHWID->channel(adcId);
144  int gain = m_tileHWID->adc(adcId);
145 
147 
148  float pedestal = sampleNoise->getPed(drawerIdx, channel, gain);
149  float onlinePedestal = onlineSampleNoise->getPed(drawerIdx, channel, gain);
150  float onlinePedestalDifference = emScale->calibrateOnlineChannel(drawerIdx, channel, gain, (onlinePedestal - pedestal), rawChannelUnit);
151  float phase = -m_tileToolTiming->getSignalPhase(drawerIdx, channel, gain);
153  ATH_CHECK( m_tileCondToolOfc->getOfcWeights(drawerIdx, channel, gain, phase, false, weights, ctx) );
154  float weightsSum(0.0);
155  for (int i = 0; i < weights.n_samples; ++i) weightsSum += weights.w_a[i];
156  float energyCorrection = onlinePedestalDifference * weightsSum;
158  << " ch" << channel << (gain ? " HG: " : " LG: ")
159  << "online pedestal difference: " << onlinePedestalDifference
160  << "; OFC weights (a) sum: " << weightsSum
161  << " => energy correction: " << energyCorrection);
162 
163  rawChannel->setAmplitude(rawChannel->amplitude() + energyCorrection);
164 
165  }
166 
167  if (checkDigits && noDigits[channel]) {
168 
169  float amplitude = emScale->undoOnlineChannelCalibration(drawerIdx, channel, gain, rawChannel->amplitude(), rawChannelUnit);
170  float minimuAmplitudeThreshold(-99999.0);
171  float maximumAmplitudeThreshold(99999.0);
172  m_tileDspThreshold->getAmplitudeThresholds(drawerIdx, channel, gain, minimuAmplitudeThreshold, maximumAmplitudeThreshold);
173  if (amplitude < minimuAmplitudeThreshold
174  || amplitude > maximumAmplitudeThreshold)
175  {
176 
178  << " ch" << channel << (gain ? " HG:" : " LG:")
179  << " amplitude: " << amplitude << " [ADC]"
180  << " outside range: " << minimuAmplitudeThreshold << ".." << maximumAmplitudeThreshold
181  << " without digits => set apmlitude/time/quality: 0.0/0.0/15.0");
182 
183  rawChannel->insert(0.0F, 0.0F, 15.0F);
184 
185  }
186 
187  }
188 
189  }
190  }
191 
192  }
193 
194  return StatusCode::SUCCESS;
195 }

Member Data Documentation

◆ m_correctPedestalDifference

bool TileRawChannelOF1Corrector::m_correctPedestalDifference
private

Definition at line 93 of file TileRawChannelOF1Corrector.h.

◆ m_digitsContainerKey

SG::ReadHandleKey<TileDigitsContainer> TileRawChannelOF1Corrector::m_digitsContainerKey
private
Initial value:
{this,
"TileDigitsContainer", "TileDigitsCnt", "Input Tile digits container key"}

Definition at line 88 of file TileRawChannelOF1Corrector.h.

◆ m_emScaleKey

SG::ReadCondHandleKey<TileEMScale> TileRawChannelOF1Corrector::m_emScaleKey
private
Initial value:
{this,
"TileEMScale", "TileEMScale", "Input Tile EMS calibration constants"}

Name of TileEMScale in condition store.

Definition at line 81 of file TileRawChannelOF1Corrector.h.

◆ m_onlineSampleNoiseKey

SG::ReadCondHandleKey<TileSampleNoise> TileRawChannelOF1Corrector::m_onlineSampleNoiseKey
private
Initial value:
{this,
"TileOnlineSampleNoise", "TileOnlineSampleNoise", "Input online Tile sample noise"}

Name of online TileSampleNoise in condition store.

Definition at line 69 of file TileRawChannelOF1Corrector.h.

◆ m_sampleNoiseKey

SG::ReadCondHandleKey<TileSampleNoise> TileRawChannelOF1Corrector::m_sampleNoiseKey
private
Initial value:
{this,
"TileSampleNoise", "TileSampleNoise", "Input Tile sample noise"}

Name of TileSampleNoise in condition store.

Definition at line 64 of file TileRawChannelOF1Corrector.h.

◆ m_tileCondToolOfc

ToolHandle<ITileCondToolOfc> TileRawChannelOF1Corrector::m_tileCondToolOfc
private
Initial value:
{this,
"TileCondToolOfc", "TileCondToolOfcCoolOF1", "Tile OFC tool"}

Definition at line 72 of file TileRawChannelOF1Corrector.h.

◆ m_tileDspThreshold

ToolHandle<ITileCondToolDspThreshold> TileRawChannelOF1Corrector::m_tileDspThreshold
private
Initial value:
{this,
"TileCondToolDspThreshold", "TileCondToolDspThreshold", "Tile DSP thresholds tool"}

Definition at line 84 of file TileRawChannelOF1Corrector.h.

◆ m_tileHWID

const TileHWID* TileRawChannelOF1Corrector::m_tileHWID
private

Pointer to TileHWID.

Definition at line 59 of file TileRawChannelOF1Corrector.h.

◆ m_tileToolTiming

ToolHandle<TileCondToolTiming> TileRawChannelOF1Corrector::m_tileToolTiming
private
Initial value:
{this,
"TileCondToolTiming", "TileCondToolOnlineTiming", "Tile timing tool"}

Definition at line 75 of file TileRawChannelOF1Corrector.h.

◆ m_zeroAmplitudeWithoutDigits

bool TileRawChannelOF1Corrector::m_zeroAmplitudeWithoutDigits
private

Definition at line 92 of file TileRawChannelOF1Corrector.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileEMScale
Condition object to keep calibration factors of TileCal channels.
Definition: TileEMScale.h:87
ReadOfcFromCool.phase
phase
Definition: ReadOfcFromCool.py:127
TileRawChannelOF1Corrector::m_correctPedestalDifference
bool m_correctPedestalDifference
Definition: TileRawChannelOF1Corrector.h:93
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileSampleNoise
Condition object to keep and provide Tile sample noise.
Definition: TileSampleNoise.h:18
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TileFragHash::TYPE
TYPE
initialize
Definition: TileFragHash.h:33
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileRawChannelOF1Corrector::m_zeroAmplitudeWithoutDigits
bool m_zeroAmplitudeWithoutDigits
Definition: TileRawChannelOF1Corrector.h:92
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TileDigitsContainer
Definition: TileDigitsContainer.h:13
HWIdentifier
Definition: HWIdentifier.h:13
TileFragHash::OptFilterDsp
@ OptFilterDsp
Definition: TileFragHash.h:34
TileFragHash::OptFilterDspCompressed
@ OptFilterDspCompressed
Definition: TileFragHash.h:34
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
TileHWID::adc
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
Definition: TileHWID.h:193
lumiFormat.i
int i
Definition: lumiFormat.py:85
TileRawChannelOF1Corrector::m_emScaleKey
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
Definition: TileRawChannelOF1Corrector.h:81
TileRawChannelOF1Corrector::m_tileToolTiming
ToolHandle< TileCondToolTiming > m_tileToolTiming
Definition: TileRawChannelOF1Corrector.h:75
TileRawChannelOF1Corrector::m_sampleNoiseKey
SG::ReadCondHandleKey< TileSampleNoise > m_sampleNoiseKey
Name of TileSampleNoise in condition store.
Definition: TileRawChannelOF1Corrector.h:64
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileOfcWeightsStruct
Definition: ITileCondToolOfc.h:13
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileRawChannelOF1Corrector::m_tileDspThreshold
ToolHandle< ITileCondToolDspThreshold > m_tileDspThreshold
Definition: TileRawChannelOF1Corrector.h:84
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
TileRawDataCollection::identify
ID identify() const
Definition: TileRawDataCollection.h:71
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
TileDigitsCollection
Definition: TileDigitsCollection.h:18
TileMutableDataContainer::indexFindPtr
Collection * indexFindPtr(IdentifierHash hash)
Look up a (non-const) collection via hash.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileRawChannelOF1Corrector::m_tileHWID
const TileHWID * m_tileHWID
Pointer to TileHWID.
Definition: TileRawChannelOF1Corrector.h:59
TileDigits
Definition: TileDigits.h:30
TileRawChannelOF1Corrector::m_tileCondToolOfc
ToolHandle< ITileCondToolOfc > m_tileCondToolOfc
Definition: TileRawChannelOF1Corrector.h:72
TileRawChannelCollection
Definition: TileRawChannelCollection.h:12
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
weights
Definition: herwig7_interface.h:44
TileRawChannelOF1Corrector::m_onlineSampleNoiseKey
SG::ReadCondHandleKey< TileSampleNoise > m_onlineSampleNoiseKey
Name of online TileSampleNoise in condition store.
Definition: TileRawChannelOF1Corrector.h:69
TileCalibUtils::getDrawerString
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
Definition: TileCalibUtils.cxx:145
TileDigitsCollection::getFragBCID
uint32_t getFragBCID() const
Get BCID.
Definition: TileDigitsCollection.h:118
TileRawChannelOF1Corrector::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileRawChannelOF1Corrector.h:88
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
F
#define F(x, y, z)
Definition: MD5.cxx:112
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition: TileCalibUtils.cxx:60
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TileCalibUtils::MAX_CHAN
static const unsigned int MAX_CHAN
Number of channels in drawer.
Definition: TileCalibUtils.h:141
TileSampleNoise::getPed
float getPed(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const
Definition: TileSampleNoise.h:46