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

#include <LArCaliWaveSelector.h>

Inheritance diagram for LArCaliWaveSelector:
Collaboration diagram for LArCaliWaveSelector:

Public Member Functions

 LArCaliWaveSelector (const std::string &name, ISvcLocator *pSvcLocator)
 ~LArCaliWaveSelector ()
StatusCode initialize ()
StatusCode execute ()
StatusCode stop ()
StatusCode finalize ()
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 parseSelection ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< LArOnOffIdMappingm_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
const CaloCell_IDm_cellID
std::map< DetGain, int > m_mapDAC
unsigned short m_gmask
std::vector< std::string > m_keyList
std::vector< std::string > m_selectionList
std::string m_outputKey
std::string m_groupingType
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 28 of file LArCaliWaveSelector.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

◆ LArCaliWaveSelector()

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

Definition at line 23 of file LArCaliWaveSelector.cxx.

24 : AthAlgorithm(name, pSvcLocator),
25 m_cellID(nullptr),
26 m_gmask(0),
27 m_groupingType("ExtendedFeedThrough")
28{
29 declareProperty("SelectionList", m_selectionList); // Vector of strings of det/lay/gain/DAC -> "EMB/0/0/200"
30 // Known detectors EMB, EMEC, HEC, FCAL
31 // Available layers 0-3, gains 0-2, DAC 0-65000
32 declareProperty("KeyList", m_keyList);
33 declareProperty("KeyOutput", m_outputKey);
34 declareProperty("GroupingType", m_groupingType);
35}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< std::string > m_keyList
std::vector< std::string > m_selectionList
const CaloCell_ID * m_cellID

◆ ~LArCaliWaveSelector()

LArCaliWaveSelector::~LArCaliWaveSelector ( )
default

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 LArCaliWaveSelector::execute ( )
inline

Definition at line 35 of file LArCaliWaveSelector.h.

35{ return StatusCode::SUCCESS;};

◆ 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 LArCaliWaveSelector::finalize ( )
inline

Definition at line 37 of file LArCaliWaveSelector.h.

37{ return StatusCode::SUCCESS;}

◆ initialize()

StatusCode LArCaliWaveSelector::initialize ( )

Definition at line 40 of file LArCaliWaveSelector.cxx.

41{
42 ATH_MSG_INFO ( " in initialize.." );
43
44 // Default list
45 if (m_keyList.empty()) { m_keyList.emplace_back("LArCaliWave"); }
47
48 ATH_CHECK( detStore()->retrieve (m_cellID, "CaloCell_ID") );
49 if (!m_cellID) {
50 ATH_MSG_ERROR ( "Could not access CaloCell_ID helper" );
51 return StatusCode::FAILURE;
52 }
53
54 ATH_CHECK( m_cablingKey.initialize() );
55
56 return StatusCode::SUCCESS;
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey

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

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

◆ parseSelection()

void LArCaliWaveSelector::parseSelection ( )
private

Definition at line 141 of file LArCaliWaveSelector.cxx.

142{
143 int det,lay,gain,DAC;
144 std::string selstr;
145 for(unsigned i=0; i<m_selectionList.size(); ++i) {
146 std::string::size_type det_delimiter( m_selectionList[i].find('/') );
147 if( std::string::npos == det_delimiter ){
148 ATH_MSG_WARNING ( "Bad selection string: "<< m_selectionList[i] << " skipped...." );
149 continue;
150 }
151 std::string det_string = m_selectionList[i].substr(0, det_delimiter);
152 if(det_string=="EMB") {
153 det = 0;
154 } else if (det_string == "EMEC") {
155 det = 1;
156 } else if (det_string == "HEC") {
157 det = 2;
158 } else if (det_string == "FCAL") {
159 det = 3;
160 } else {
161 ATH_MSG_WARNING ( "Bad detector substring: " << det_string << " skipped ... " );
162 continue;
163 }
164 std::string::size_type lay_delimiter( m_selectionList[i].find('/',det_delimiter+1) );
165 lay = atoi(m_selectionList[i].substr(det_delimiter+1, lay_delimiter).c_str());
166 if(lay < 0 || lay > 3) {
167 ATH_MSG_WARNING ( "Bad layer: " << lay << " skipped..." );
168 continue;
169 }
170 std::string::size_type gain_delimiter( m_selectionList[i].find('/',lay_delimiter+1) );
171 gain = atoi(m_selectionList[i].substr(lay_delimiter+1, gain_delimiter).c_str());
172 if(gain < 0 || gain > 2) {
173 ATH_MSG_WARNING ( "Bad gain: " << gain << " skipped..." );
174 continue;
175 }
176 DAC = atoi(m_selectionList[i].substr(gain_delimiter+1).c_str());
177 if(DAC < 0 || DAC > 65000) {
178 ATH_MSG_WARNING ( "Bad DAC: " << DAC << " skipped..." );
179 continue;
180 }
181
182 // Now we have all numbers
183 m_mapDAC[std::make_pair( std::make_pair(det,lay), gain)] = DAC;
184 m_gmask |= (0x1<<gain);
185 }
186}
#define ATH_MSG_WARNING(x)
std::map< DetGain, int > m_mapDAC
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...

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

◆ stop()

StatusCode LArCaliWaveSelector::stop ( )

Definition at line 60 of file LArCaliWaveSelector.cxx.

61{
62 ATH_MSG_INFO ( " in stop.." );
63
64 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
65 const LArOnOffIdMapping* cabling{*cablingHdl};
66 if(!cabling){
67 ATH_MSG_ERROR("Do not have mapping object " << m_cablingKey.key() );
68 return StatusCode::FAILURE;
69 }
70
71 // create empty LArCaliWaveContainer to store DAC selected LArCaliWave
72 // make it view container
73// LArCaliWaveContainer* selectedCaliWaveContainer = new LArCaliWaveContainer(SG::VIEW_ELEMENTS);
74 auto selectedCaliWaveContainer = std::make_unique<LArCaliWaveContainer>();
75 CHECK( selectedCaliWaveContainer->setGroupingType(m_groupingType,msg()));
76 CHECK( selectedCaliWaveContainer->initialize());
77
78 std::vector<std::string>::const_iterator key_it = m_keyList.begin();
79 std::vector<std::string>::const_iterator key_it_e = m_keyList.end();
80
81 for (;key_it!=key_it_e; ++key_it) {
82 const LArCaliWaveContainer* larCaliWaveContainer;
83 StatusCode sc = detStore()->retrieve(larCaliWaveContainer,*key_it);
84 if (sc.isFailure()) {
85 ATH_MSG_WARNING ( "No LArCaliWaveContainer in StoreGate with key = " << *key_it );
86 continue;
87 } else {
88 ATH_MSG_INFO ( "Reading LArCaliWaveContainer with key = " << *key_it );
89 }
90
91 int det, lay;
92 for ( unsigned gain = CaloGain::LARHIGHGAIN ; gain < CaloGain::LARNGAIN ; ++gain ) {
93 if(!( (0x1<<gain) & m_gmask) ) continue;
94
95 CaliMapIt cali_it = larCaliWaveContainer->begin(gain) ;
96 CaliMapIt cali_it_e = larCaliWaveContainer->end(gain) ;
97
98 if ( cali_it == cali_it_e ) {
99 ATH_MSG_DEBUG ( "No wave with gain = " << gain << " in container with key = " << *key_it );
100 continue;
101 } else {
102 ATH_MSG_DEBUG ( "processing gain = " << gain );
103 }
104 for ( ; cali_it != cali_it_e; ++cali_it) {
105
106 CaliWaveIt wave_it = cali_it->begin();
107 CaliWaveIt wave_it_e = cali_it->end();
108 if ( wave_it == wave_it_e ) {
109 ATH_MSG_DEBUG ( "Empty channel found..." );
110 continue;
111 }
112
113 HWIdentifier chid = cali_it.channelId();
114 Identifier cell_id = cabling->cnvToIdentifier(chid);
115 if(m_cellID->is_em_barrel(cell_id)){ det = 0;
116 } else if(m_cellID->is_em_endcap(cell_id)) { det = 1;
117 } else if(m_cellID->is_hec(cell_id)) { det = 2;
118 } else if(m_cellID->is_fcal(cell_id)) { det = 3;
119 } else {
120 ATH_MSG_ERROR ( "Wrong ID in LArCaliWaveContainer: "<<m_cellID->print_to_string(cell_id));
121 continue;
122 }
123 lay = m_cellID->sampling(cell_id);
124 DetGain dg = std::make_pair( std::make_pair(det,lay), gain);
125 if( m_mapDAC.find(dg) == m_mapDAC.end() ) continue;
126
127 for ( ; wave_it != wave_it_e; ++wave_it) {
128 if(wave_it->getDAC() == m_mapDAC[dg]) {
129 (selectedCaliWaveContainer->get(chid,gain)).push_back(*wave_it);
130 break;
131 }
132 }
133 }
134 }
135 }
136
137 ATH_CHECK( detStore()->record(std::move(selectedCaliWaveContainer),m_outputKey) );
138 return StatusCode::SUCCESS;
139}
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
LArCaliWaveContainer::LArCaliWaves::const_iterator CaliWaveIt
LArCaliWaveContainer::ConstConditionsMapIterator CaliMapIt
std::pair< std::pair< int, int >, int > DetGain
static Double_t sc
MsgStream & msg() const
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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}
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

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

SG::ReadCondHandleKey<LArOnOffIdMapping> LArCaliWaveSelector::m_cablingKey {this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}
private

Definition at line 41 of file LArCaliWaveSelector.h.

41{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};

◆ m_cellID

const CaloCell_ID* LArCaliWaveSelector::m_cellID
private

Definition at line 45 of file LArCaliWaveSelector.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_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_gmask

unsigned short LArCaliWaveSelector::m_gmask
private

Definition at line 48 of file LArCaliWaveSelector.h.

◆ m_groupingType

std::string LArCaliWaveSelector::m_groupingType
private

Definition at line 53 of file LArCaliWaveSelector.h.

◆ m_keyList

std::vector<std::string> LArCaliWaveSelector::m_keyList
private

Definition at line 50 of file LArCaliWaveSelector.h.

◆ m_mapDAC

std::map<DetGain, int> LArCaliWaveSelector::m_mapDAC
private

Definition at line 47 of file LArCaliWaveSelector.h.

◆ m_outputKey

std::string LArCaliWaveSelector::m_outputKey
private

Definition at line 52 of file LArCaliWaveSelector.h.

◆ m_selectionList

std::vector<std::string> LArCaliWaveSelector::m_selectionList
private

Definition at line 51 of file LArCaliWaveSelector.h.

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