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 21 of file LArOFPhaseFill.cxx.

21 :
22 AthAlgorithm(name, pSvcLocator),
23 m_lar_on_id(nullptr),
25{ }
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 27 of file LArOFPhaseFill.cxx.

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

◆ 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 67 of file LArOFPhaseFill.cxx.

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