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

#include <LArOFPhaseFill.h>

Inheritance diagram for LArOFPhaseFill:
Collaboration diagram for LArOFPhaseFill:

Public Member Functions

 LArOFPhaseFill (const std::string &name, ISvcLocator *pSvcLocator)
 ~LArOFPhaseFill ()=default
StatusCode initialize ()
StatusCode execute ()
StatusCode stop ()
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

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

Private Attributes

const LArOnlineID_Basem_lar_on_id
StringProperty m_InputFile {this,"InputFile", "", "Which file to read"}
StringProperty m_keyOFCbin {this,"keyOFCBin","LArOFCBin","Output key of LArOFCBinComlete object"}
StringProperty m_groupingName {this, "GroupingType", "Unknown", "Which grouping type to use"}
Gaudi::Property< unsigned int > m_defaultPhase {this, "DefaultPhase", 0, "Phase used for channels not in input file"}
BooleanProperty m_isID {this, "isID", false, "contains the input file onlineID ?"}
BooleanProperty m_isSC {this, "isSC", false, "Is this the SuperCell ?"}
int 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 22 of file LArOFPhaseFill.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

◆ LArOFPhaseFill()

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

Definition at line 22 of file LArOFPhaseFill.cxx.

22 :
23 AthAlgorithm(name, pSvcLocator),
24 m_lar_on_id(nullptr),
26{ }
AthAlgorithm()
Default constructor:
const LArOnlineID_Base * m_lar_on_id

◆ ~LArOFPhaseFill()

LArOFPhaseFill::~LArOFPhaseFill ( )
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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

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

Definition at line 31 of file LArOFPhaseFill.h.

31{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

◆ initialize()

StatusCode LArOFPhaseFill::initialize ( )

Definition at line 28 of file LArOFPhaseFill.cxx.

29{
30 if(m_isSC) {
31 ATH_MSG_INFO("Processing LAr SuperCells");
32 const LArOnline_SuperCellID* onlID;
33 ATH_CHECK(detStore()->retrieve(onlID,"LArOnline_SuperCellID"));
34 m_lar_on_id=onlID; // cast to base-class
35 } else {
36 ATH_MSG_INFO("Processing regular LArCells");
37 const LArOnlineID* onlID;
38 ATH_CHECK(detStore()->retrieve(onlID, "LArOnlineID"));
39 m_lar_on_id=onlID; // cast to base-class
40 }
41
42 if ( m_groupingName == "Unknown" ) {
44 } else if ( m_groupingName == "SingleGroup" ) {
46 } else if ( m_groupingName == "SubDetector" ) {
48 } else if ( m_groupingName == "FeedThrough" ) {
50 } else if ( m_groupingName == "ExtendedFeedThrough" ) {
52 } else if ( m_groupingName == "ExtendedSubDet" ) {
54 } else if ( m_groupingName == "SuperCells" ) {
56 } else {
57 ATH_MSG_ERROR ( "Grouping type " << m_groupingName << " is not foreseen!" );
58 ATH_MSG_ERROR( "Only \"Unknown\", \"SingleGroup\", \"SubDetector\", \"FeedThrough\", \"ExtendedFeedThrough\", \"ExtendedSubDetector\" and \"SuperCells\" are allowed" ) ;
59 return StatusCode::FAILURE ;
60 }
61
63
64 return StatusCode::SUCCESS;
65}
#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
StringProperty m_groupingName
BooleanProperty m_isSC
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.

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

◆ stop()

StatusCode LArOFPhaseFill::stop ( )

Definition at line 68 of file LArOFPhaseFill.cxx.

69{
70 ATH_MSG_DEBUG(" In stop() " );
71
72 typedef std::pair<HWIdentifier, int> idi;
73 std::map<idi, uint > inmap;
74 uint b_ec=0, p_n=0, ft=0, sl=0, ch=0, g=0, onlid=0;
75 uint count, gmax;
77
78 // Open a file and read it - if exists
79 if(m_InputFile.size() > 0) {
80 std::ifstream in (m_InputFile.toString());
81 if(!in.good()) {
82 ATH_MSG_ERROR("Could not open map file "<<m_InputFile);
83 ATH_MSG_ERROR("Using default phase " << m_defaultPhase << " for all channels");
84 } else {
85 uint phase;
86 count = 0;
87 char line[100];
88 do {
89 in.getline(line,99);
90 if((!in.good()) || in.eof()) break;
91 if(line[0]=='#') continue;
92 std::istringstream iss(line);
93 if(m_isID)
94 if(m_isSC)
95 iss>>std::dec>>onlid>>phase;
96 else
97 iss>>std::dec>>onlid>>g>>phase;
98 else{
99 if(m_isSC)
100 iss>>std::dec>>b_ec>>p_n>>ft>>sl>>ch>>g>>phase;
101 if(!iss.good()) {
102 ATH_MSG_WARNING("Wrong line: "<<line);
103 continue;
104 }
105 if(b_ec > 1) {
106 ATH_MSG_ERROR("Wrong barrel_ec: "<<b_ec<<", not taken");
107 continue;
108 }
109 if(p_n > 1) {
110 ATH_MSG_ERROR("Wrong pos_neg: "<<p_n<<", not taken");
111 continue;
112 }
113 if(ft > 31) {
114 ATH_MSG_ERROR("Wrong FTH: "<<ft<<", not taken");
115 continue;
116 }
117 if(sl == 0 || sl > 15) {
118 ATH_MSG_ERROR("Wrong slot: "<<sl<<", not taken");
119 continue;
120 }
121 if(ch > 127) {
122 ATH_MSG_ERROR("Wrong channel: "<<ch<<", not taken");
123 continue;
124 }
125 if((int)g < (int)CaloGain::LARHIGHGAIN || g > CaloGain::LARLOWGAIN) {
126 ATH_MSG_ERROR("Wrong gain: "<<g<<", not taken");
127 continue;
128 }
129 if(phase > 50) {
130 ATH_MSG_ERROR("Wrong phase: "<<phase<<", not taken");
131 continue;
132 }
133 }
134 HWIdentifier oc;
135 if(m_isID) oc=HWIdentifier(onlid); else oc = m_lar_on_id->channel_Id(b_ec, p_n, ft, sl, ch);
136 ATH_MSG_DEBUG("Read " << onlid << " gain " << g <<" phase: "<<phase);
137 inmap[std::make_pair(oc,g)] = phase;
138 ++count;
139 }while(!in.eof());
140 ATH_MSG_INFO(count<<" lines read out");
141 }
142 }
143
144 std::vector<HWIdentifier>::const_iterator it = m_lar_on_id->channel_begin();
145 std::vector<HWIdentifier>::const_iterator it_e = m_lar_on_id->channel_end();
146
148 LArOFCBinComplete* OFCbin = new LArOFCBinComplete();
150 ATH_CHECK( OFCbin->initialize() );
151
152 int fphase;
153 count = 0;
154 for(; it!=it_e;++it){
155 const HWIdentifier id = *it;
156 sl = m_lar_on_id->slot(id);
157 ch = m_lar_on_id->channel(id);
158 ft = m_lar_on_id->feedthrough(id);
159 p_n = m_lar_on_id->pos_neg(id);
160 b_ec = m_lar_on_id->barrel_ec(id);
161 HWIdentifier oc = m_lar_on_id->channel_Id(b_ec, p_n, ft, sl, ch);
162 if(id != oc) {
163 std::cout <<"Something wrong: "<<id<<" "<<oc<<std::endl;
164 }
165 ++count;
166 for(g = CaloGain::LARHIGHGAIN; g <= gmax; ++g) {
167 if(inmap.find(std::make_pair(oc,g)) != inmap.end()) {
168 fphase = inmap[std::make_pair(oc,g)];
169 } else{
170 fphase = m_defaultPhase;
171 }
172 ATH_MSG_DEBUG("B_EC: "<<b_ec<<" Pos_Neg: "<<p_n<<" FT: "<<ft<<" Slot: "<<sl<<" Chan: "<<ch<<" Phase: "<<fphase);
173 OFCbin->set(id,g,fphase);
174 }
175 }
176
177 ATH_MSG_DEBUG(" Loop over " << count << " cells" );
178 ATH_CHECK( detStore()->record(OFCbin, m_keyOFCbin) );
179 return StatusCode::SUCCESS;
180}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
unsigned int uint
static Double_t sc
void setGroupingType(GroupingType type)
allow group type to be set externally - need to (re)initialize after setting grouping type
virtual StatusCode initialize()
Initialization done after creation or read back - derived classes may augment the functionality.
void set(const HWIdentifier &chid, const int &gain, const int &bin)
BooleanProperty m_isID
Gaudi::Property< unsigned int > m_defaultPhase
StringProperty m_keyOFCbin
StringProperty m_InputFile
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
@ LARLOWGAIN
Definition CaloGain.h:18
@ 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_defaultPhase

Gaudi::Property<unsigned int> LArOFPhaseFill::m_defaultPhase {this, "DefaultPhase", 0, "Phase used for channels not in input file"}
private

Definition at line 42 of file LArOFPhaseFill.h.

42{this, "DefaultPhase", 0, "Phase used for channels not in input file"};

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

StringProperty LArOFPhaseFill::m_groupingName {this, "GroupingType", "Unknown", "Which grouping type to use"}
private

Definition at line 41 of file LArOFPhaseFill.h.

41{this, "GroupingType", "Unknown", "Which grouping type to use"};

◆ m_groupingType

int LArOFPhaseFill::m_groupingType
private

Definition at line 45 of file LArOFPhaseFill.h.

◆ m_InputFile

StringProperty LArOFPhaseFill::m_InputFile {this,"InputFile", "", "Which file to read"}
private

Definition at line 39 of file LArOFPhaseFill.h.

39{this,"InputFile", "", "Which file to read"};

◆ m_isID

BooleanProperty LArOFPhaseFill::m_isID {this, "isID", false, "contains the input file onlineID ?"}
private

Definition at line 43 of file LArOFPhaseFill.h.

43{this, "isID", false, "contains the input file onlineID ?"};

◆ m_isSC

BooleanProperty LArOFPhaseFill::m_isSC {this, "isSC", false, "Is this the SuperCell ?"}
private

Definition at line 44 of file LArOFPhaseFill.h.

44{this, "isSC", false, "Is this the SuperCell ?"};

◆ m_keyOFCbin

StringProperty LArOFPhaseFill::m_keyOFCbin {this,"keyOFCBin","LArOFCBin","Output key of LArOFCBinComlete object"}
private

Definition at line 40 of file LArOFPhaseFill.h.

40{this,"keyOFCBin","LArOFCBin","Output key of LArOFCBinComlete object"};

◆ m_lar_on_id

const LArOnlineID_Base* LArOFPhaseFill::m_lar_on_id
private

Definition at line 37 of file LArOFPhaseFill.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: