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

#include <TileRawChannelMaker.h>

Inheritance diagram for TileRawChannelMaker:
Collaboration diagram for TileRawChannelMaker:

Public Member Functions

 TileRawChannelMaker (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor.
virtual ~TileRawChannelMaker ()
 Destructor.
virtual StatusCode initialize () override
 Initialize algorithm.
virtual StatusCode execute () override
 Execute.
virtual StatusCode finalize () override
 Finalize.
virtual bool isClonable () const override final
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

void fitOverflowedChannels (const EventContext &ctx)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< TileDigitsContainerm_digitsContainerKey
std::vector< std::string > m_TileRawChannelBuilderIDVec
 Vector with class name[/instance name] of builder sub-algs.
ToolHandleArray< TileRawChannelBuilderm_tileRawChannelBuilderList
 Vector of builder algtools.
bool m_fitOverflow
ToolHandle< TileRawChannelBuilderm_tileRawChannelBuilderFitOverflow
float m_overflowReplaceTimeCut
float m_overflowReplacePedestalCut
float m_overflowReplaceChi2Cut
std::string m_infoName
const TileInfom_tileInfo
float m_ADCmaxMinusEps
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 42 of file TileRawChannelMaker.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileRawChannelMaker()

TileRawChannelMaker::TileRawChannelMaker ( const std::string & name,
ISvcLocator * pSvcLocator )

Standard constructor.

Parameters
nameName of algorithm
pSvcLocatorService locator

Definition at line 25 of file TileRawChannelMaker.cxx.

27 : AthAlgorithm(name, pSvcLocator)
28 , m_fitOverflow(false)
29 , m_tileInfo(0)
31{
32 declareProperty("FitOverflow", m_fitOverflow, "Fit or not overflows");
33 declareProperty("TileInfoName", m_infoName = "TileInfo");
34
37 m_overflowReplaceChi2Cut = 40000.0;
38}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const TileInfo * m_tileInfo

◆ ~TileRawChannelMaker()

TileRawChannelMaker::~TileRawChannelMaker ( )
virtual

Destructor.

Definition at line 43 of file TileRawChannelMaker.cxx.

43 {
44}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileRawChannelMaker::execute ( )
overridevirtual

Execute.

Definition at line 81 of file TileRawChannelMaker.cxx.

81 {
82
83 const EventContext& ctx = Gaudi::Hive::currentContext();
84
85 // get named TileDigitsContaner from TES
86 SG::ReadHandle<TileDigitsContainer> digitsContaner(m_digitsContainerKey, ctx);
87
88 if (!digitsContaner.isValid()) {
89 ATH_MSG_WARNING( "Can't retrieve TileDigitsContainer '"
90 << m_digitsContainerKey.key() << "' from TDS" );
91
92 return StatusCode::SUCCESS;
93 }
94
95 ATH_MSG_DEBUG( "Got TileDigitsContainer '" << m_digitsContainerKey.key() << "'" );
96
97 // create RawChannel Containers for all sub-algs
98 for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
99 ATH_CHECK( rawChannelBuilder->createContainer(ctx) );
100 rawChannelBuilder->resetDrawer();
101 }
102
103 // clean memory about overflows
104 if (m_fitOverflow) {
105 for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
106 rawChannelBuilder->resetOverflows();
107 }
108 }
109
110 // Iterate over all collections (drawers) with digits
111 for (const TileDigitsCollection* digitsCollection : *digitsContaner) {
112
113 // Iterate over all sub-algs
114 for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
115 // reconstruct all channels in one drawer
116 ATH_CHECK( rawChannelBuilder->build(digitsCollection, ctx) );
117 }
118
119 }
120
121 if (m_fitOverflow
122 && !(*m_tileRawChannelBuilderList.begin())->getOverflowedChannels().empty()) {
124 }
125
126 // commit RawChannel Containers for all sub-algs
127 for (ToolHandle<TileRawChannelBuilder>& rawChannelBuilder : m_tileRawChannelBuilderList) {
128 ATH_CHECK( rawChannelBuilder->commitContainer(ctx) );
129 }
130
131 ATH_MSG_DEBUG( "execute completed successfully" );
132
133 return StatusCode::SUCCESS;
134}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
void fitOverflowedChannels(const EventContext &ctx)
ToolHandleArray< TileRawChannelBuilder > m_tileRawChannelBuilderList
Vector of builder algtools.
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TileRawChannelMaker::finalize ( )
overridevirtual

Finalize.

Definition at line 139 of file TileRawChannelMaker.cxx.

139 {
140
141 ATH_MSG_INFO(" finalize completed successfully" );
142
143 return StatusCode::SUCCESS;
144}
#define ATH_MSG_INFO(x)

◆ fitOverflowedChannels()

void TileRawChannelMaker::fitOverflowedChannels ( const EventContext & ctx)
private

Definition at line 146 of file TileRawChannelMaker.cxx.

146 {
147
148 for (ToolHandle<TileRawChannelBuilder> rawChannelBuilder : m_tileRawChannelBuilderList) {
149
150 Overflows_t overflows = rawChannelBuilder->getOverflowedChannels();
151
152 for (std::pair<TileRawChannel*, const TileDigits*>& overflow : overflows) {
153
154 TileRawChannel* rwCh = overflow.first;
155 const TileDigits* pDigits = overflow.second;
156
157 TileRawChannel* fittedRwCh = m_tileRawChannelBuilderFitOverflow->rawChannel(pDigits, ctx);
158
159 bool fitOK = ( ( fabs(fittedRwCh->time()) < m_overflowReplaceTimeCut ) &&
160 ( fittedRwCh->pedestal() < m_overflowReplacePedestalCut ) &&
161 ( fittedRwCh->quality() < m_overflowReplaceChi2Cut ) );
162
163 int nSatSamples = 0;
164 std::vector<double> digits = pDigits->get_digits();
165 for (size_t ii = 0; ii<digits.size(); ii++) {
166 if (digits[ii] > m_ADCmaxMinusEps) nSatSamples++;
167 }
168
169 // NOTE: Optimal filtering is always run first and the fit method is used just in cases when there is an overflow.
170 // NOTE: Mathematically, a maximum pedestal range is [-460.607488, 4556.603392] and it happens for the phase 0.1 ns.
171 // Therefore, we use the following intervals:
172 // - if optimal filtering is used: (-500, 4600)
173 // - if fit method is used: (5000, 9095)
174 // NOTE: Overlay magic number is 4800.
175
176 if ( !fitOK || nSatSamples > 2) {
177 // If the fit is bad, reset the energy.
178 //The same if the number of saturated samples is 3 (or bigger)
179
180 //If we reject pulse, the quality must be above 9999 in order to mask the
181 // channel. So we set it at 10000 * nSatSamples. But if the fit completely fails,
182 // the quality is 100000, and we can keep this info in quality as well.
183 float quality = 10000. * ( (nSatSamples) ? nSatSamples : 9);
184 if (fittedRwCh->quality() > 99999.9) quality += 100000.;
185 rwCh->insert(0.0, 0.0, quality);
186
187 // 20000 - Indicates overflow, 9400 - indicates bad fit or >2 saturations.
188 // 30000 - Indicates overflow + underflow, 9400 - indicates bad fit or >2 saturations.
189 float pedestal = (rwCh->pedestal() < 29500.) ? (29400.)
190 : (39400.);
191 ATH_MSG_DEBUG("Overflow " << (std::string)(*rwCh) <<
192 " change ped from " << rwCh->pedestal() << " to " << pedestal);
193 rwCh->setPedestal(pedestal);
194 } else {
195 //If the fit is OK replace
196
197 //The range of the quality factor is very different in the fit (0-100k)
198 //than in the OF (0-255). So we rescale by a factor of 400.
199 rwCh->insert(fittedRwCh->amplitude(),
200 fittedRwCh->time(),
201 fittedRwCh->quality()*(1./400.));
202 // 20000 - Indicates overflow, 5000 - indicates fitted
203 // 30000 - Indicates overflow + underflow, 5000 - indicates fitted.
204 float pedestal = (rwCh->pedestal() < 29500.) ? fittedRwCh->pedestal() + 25000.
205 : fittedRwCh->pedestal() + 35000.;
206 ATH_MSG_DEBUG("Overflow " << (std::string)(*rwCh) <<
207 " change ped from " << rwCh->pedestal() << " to " << pedestal);
208 rwCh->setPedestal(pedestal);
209 }
210
211 }
212 }
213
214}
std::vector< std::pair< TileRawChannel *, const TileDigits * > > Overflows_t
std::vector< double > get_digits(void) const
Definition TileDigits.h:65
ToolHandle< TileRawChannelBuilder > m_tileRawChannelBuilderFitOverflow
float pedestal(void) const
float time(int ind=0) const
float quality(int ind=0) const
void setPedestal(float ped)
int insert(float amplitude, float time, float quality)
float amplitude(int ind=0) const

◆ initialize()

StatusCode TileRawChannelMaker::initialize ( )
overridevirtual

Initialize algorithm.

Definition at line 49 of file TileRawChannelMaker.cxx.

49 {
50
51 ATH_MSG_DEBUG( "starting to retrieve list " << m_tileRawChannelBuilderList);
53
55
57 ATH_MSG_INFO( "TileRawChannelBuilder list is empty - will not do anything");
58 m_fitOverflow = false;
59 }
60
61 if (m_fitOverflow) {
63 } else {
65 }
66
67 ATH_CHECK( m_digitsContainerKey.initialize() );
68
69 ATH_MSG_INFO( "Initialization completed successfully");
70
71 // TileInfo
73 m_ADCmaxMinusEps = m_tileInfo->ADCmax() - 0.01; // indicates channels which were masked in background dataset
74
75 return StatusCode::SUCCESS;
76}
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool TileRawChannelMaker::isClonable ( ) const
inlinefinaloverridevirtual

Definition at line 53 of file TileRawChannelMaker.h.

53{ return true; }

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_ADCmaxMinusEps

float TileRawChannelMaker::m_ADCmaxMinusEps
private

Definition at line 86 of file TileRawChannelMaker.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_digitsContainerKey

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

Definition at line 60 of file TileRawChannelMaker.h.

60 {this,"TileDigitsContainer","TileDigitsCnt",
61 "Input Tile digits container key"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_fitOverflow

bool TileRawChannelMaker::m_fitOverflow
private

Definition at line 75 of file TileRawChannelMaker.h.

◆ m_infoName

std::string TileRawChannelMaker::m_infoName
private

Definition at line 84 of file TileRawChannelMaker.h.

◆ m_overflowReplaceChi2Cut

float TileRawChannelMaker::m_overflowReplaceChi2Cut
private

Definition at line 81 of file TileRawChannelMaker.h.

◆ m_overflowReplacePedestalCut

float TileRawChannelMaker::m_overflowReplacePedestalCut
private

Definition at line 80 of file TileRawChannelMaker.h.

◆ m_overflowReplaceTimeCut

float TileRawChannelMaker::m_overflowReplaceTimeCut
private

Definition at line 79 of file TileRawChannelMaker.h.

◆ m_tileInfo

const TileInfo* TileRawChannelMaker::m_tileInfo
private

Definition at line 85 of file TileRawChannelMaker.h.

◆ m_tileRawChannelBuilderFitOverflow

ToolHandle<TileRawChannelBuilder> TileRawChannelMaker::m_tileRawChannelBuilderFitOverflow
private
Initial value:
{this,
"TileRawChannelBuilderFitOverflow", "", "Tile raw channels builder tool to fit overflows"}

Definition at line 76 of file TileRawChannelMaker.h.

76 {this,
77 "TileRawChannelBuilderFitOverflow", "", "Tile raw channels builder tool to fit overflows"};

◆ m_TileRawChannelBuilderIDVec

std::vector<std::string> TileRawChannelMaker::m_TileRawChannelBuilderIDVec
private

Vector with class name[/instance name] of builder sub-algs.

Definition at line 66 of file TileRawChannelMaker.h.

◆ m_tileRawChannelBuilderList

ToolHandleArray<TileRawChannelBuilder> TileRawChannelMaker::m_tileRawChannelBuilderList
private
Initial value:
{this,
"TileRawChannelBuilder", {}, "Tile raw channels builder tools"}

Vector of builder algtools.

Definition at line 72 of file TileRawChannelMaker.h.

72 {this,
73 "TileRawChannelBuilder", {}, "Tile raw channels builder tools"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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