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

#include <LArShapeCompleteMakerAlg.h>

Inheritance diagram for LArShapeCompleteMakerAlg:
Collaboration diagram for LArShapeCompleteMakerAlg:

Public Member Functions

 LArShapeCompleteMakerAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~LArShapeCompleteMakerAlg ()
virtual StatusCode initialize () override final
virtual StatusCode execute () override final
virtual StatusCode finalize () 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

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

Private Attributes

const LArOnlineIDm_onlineHelper = nullptr
LArSamples::DataStorem_template
ToolHandle< ILArShapeDumperToolm_dumperTool
unsigned int m_nSamples = 0U
unsigned int m_nPhases = 0U
unsigned int m_iPhase = 0U
Gaudi::Property< int > m_minNPulses {this,"minNPulses",0}
Gaudi::Property< std::string > m_shapeErrorFileName {this,"shapeErrorFileName", {} }
Gaudi::Property< std::string > m_outputTemplateFileName {this,"outputTemplateFileName", {} }
Gaudi::Property< std::string > m_outputFileName {this,"outputFileName", {} }
Gaudi::Property< std::string > m_sgKey {this,"sgKey", {} }
Gaudi::Property< std::string > m_groupingType {this,"groupingType", {} }
SG::ReadCondHandleKey< LArOnOffIdMappingm_onOffMapKey { this, "LArOnOffIdMappingKey", "LArOnOffIdMapping", "LArOnOffIdMapping key" }
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 37 of file LArShapeCompleteMakerAlg.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

◆ LArShapeCompleteMakerAlg()

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

Definition at line 22 of file LArShapeCompleteMakerAlg.cxx.

22 :
23 AthAlgorithm(name, pSvcLocator),
24 m_template(nullptr),
25 m_dumperTool("LArShapeDumperTool")
26{
27 //declareProperty("NSamples", m_nSamples = 5);
28 //declareProperty("NPhases", m_nPhases = 17);
29 //declareProperty("IPhase", m_iPhase = 8);
30 //declareProperty("ShapeErrorFileName", m_shapeErrorFileName);
31 //declareProperty("OutputFileName", m_outputFileName);
32 //declareProperty("OutputTemplateFileName", m_outputTemplateFileName);
33 //declareProperty("StoreGateKey", m_sgKey = "LArResiduals");
34 //declareProperty("MinNPulses", m_minNPulses = 0);
35 //declareProperty("GroupingType", m_groupingType = "ExtendedSubDetector");
36}
AthAlgorithm()
Default constructor:
LArSamples::DataStore * m_template
ToolHandle< ILArShapeDumperTool > m_dumperTool

◆ ~LArShapeCompleteMakerAlg()

LArShapeCompleteMakerAlg::~LArShapeCompleteMakerAlg ( )
virtual

Definition at line 39 of file LArShapeCompleteMakerAlg.cxx.

40{
41}

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 LArShapeCompleteMakerAlg::execute ( )
finaloverridevirtual

Definition at line 56 of file LArShapeCompleteMakerAlg.cxx.

57{
58 if (m_template) return StatusCode::SUCCESS;
59 m_template = new DataStore();
60
61 LArShapeComplete* lsc = new LArShapeComplete();
62
63 if (lsc->setGroupingType(m_groupingType, msg()).isFailure() || lsc->initialize().isFailure()) {
64 ATH_MSG_ERROR("Unable to initialize LArShapeComplete");
65 delete lsc;
66 return StatusCode::FAILURE;
67 };
68
69 TreeShapeErrorGetter* errorGetter = new TreeShapeErrorGetter((std::string) m_shapeErrorFileName);
70
71 SG::ReadCondHandle<LArOnOffIdMapping> onOffMap (m_onOffMapKey);
72
73 for (unsigned int k = 0; k < LArSamples::Definitions::nChannels; k++) {
74
75 HWIdentifier channelID = m_onlineHelper->channel_Id((IdentifierHash)k);
76 const Identifier id = onOffMap->cnvToIdentifier(channelID);
77 if (id.get_compact() == 0xffffffff) {
78 ATH_MSG_WARNING( "Skipping invalid hash = " << k << "." );
79 continue;
80 }
81
82 CellInfo* info = m_dumperTool->makeCellInfo(channelID, id);
83 if (!info) {
84 ATH_MSG_ERROR("Problem making cell info for hash = " << k << ", terminating...");
85 delete errorGetter;
86 return StatusCode::FAILURE;
87 }
88
89 HistoryContainer* histCont = m_template->makeNewHistory(k, info);
90 std::vector<const EventData*> events;
91 for (unsigned int g = 0; g < 3; g++) {
92 DataContainer* data = new DataContainer((CaloGain::CaloGain)g, std::vector<short>(), 0, 0, 0, -1, std::vector<float>());
93 events.push_back(new EventData(-1,-1,-1,-1));
94 histCont->add(data);
95 }
96 History* history = new History(*histCont, events, k, errorGetter);
97
98 for (unsigned int g = 0; g < 3; g++) {
100 const LArSamples::ShapeErrorData* sed = nullptr;
101 if (history) sed = history->shapeErrorData(gain, LArSamples::BestShapeError);
102
103 // The containers
104 std::vector<std::vector<float> > deltaVal, deltaDer;
105
106 // Fill them with 0's to start with
107 std::vector<float> phaseVect(m_nSamples);
108 for (unsigned int j = 0; j < m_nSamples; j++) phaseVect[j] = 0;
109 for (unsigned int i = 0; i < m_nPhases; i++) {
110 deltaVal.push_back(phaseVect);
111 deltaDer.push_back(phaseVect);
112 }
113
114 if (sed && sed->n() > m_minNPulses) {
115 ATH_MSG_DEBUG("--> Setting channel " << k << ", id = " << channelID << ", gain = " << gain << ", size = "
116 << deltaVal.size() << " " << deltaDer.size());
117 for (unsigned int i = 0; i < m_nSamples; i++) {
118 deltaVal[m_iPhase][i] = sed->xi()(i);
119 deltaDer[m_iPhase][i] = sed->xip()(i);
120 ATH_MSG_DEBUG(" xi[" << i << " ] = " << deltaVal[m_iPhase][i]);
121 }
122 }
123 else {
124 ATH_MSG_DEBUG("--> No information for channel " << k<< ", id = " << channelID << ", gain = " << gain);
125 }
126 lsc->set(channelID, gain, deltaVal, deltaDer);
127 }
128 delete history;
129 }
130
131 ATH_MSG_INFO("Writing LArShapeComplete output to " << m_outputFileName );
132 //TFile* out = TFile::Open(m_outputFileName.c_str(), "RECREATE");
133 //out->WriteObjectAny(lsc, "LArShapeComplete", "LArShape");
134 //delete out;
135 if (detStore()->record(lsc, m_sgKey).isFailure()) {
136 ATH_MSG_ERROR("Unable to write LArShapeComplete");
137 return StatusCode::FAILURE;
138 };
139
140 ATH_MSG_INFO( "Done!");
141
142 return StatusCode::SUCCESS;
143}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
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 add(const DataContainer *data)
append data (takes ownership)
const ShapeErrorData * shapeErrorData(CaloGain::CaloGain gain, ShapeErrorType shapeErrorType=BestShapeError, const Residual *res=0) const
Definition History.cxx:302
const TVectorD & xi() const
const TVectorD & xip() const
Gaudi::Property< std::string > m_shapeErrorFileName
Gaudi::Property< std::string > m_groupingType
Gaudi::Property< std::string > m_outputFileName
Gaudi::Property< std::string > m_sgKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffMapKey
Gaudi::Property< int > m_minNPulses
void set(const HWIdentifier &CellID, int gain, const std::vector< std::vector< float > > &vShape, const std::vector< std::vector< float > > &vShapeDer, float timeOffset=0, float timeBinWidth=25./24.)
const ScaledErrorData * sed

◆ 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 LArShapeCompleteMakerAlg::finalize ( )
finaloverridevirtual

Definition at line 146 of file LArShapeCompleteMakerAlg.cxx.

147{
148 ATH_MSG_INFO( "Writing template..." );
149 //m_template->writeTrees(m_outputTemplateFileName.c_str());
150 m_template->writeTrees(((std::string)m_outputTemplateFileName).c_str());
151 ATH_MSG_INFO("done..." );
152 return StatusCode::SUCCESS;
153}
Gaudi::Property< std::string > m_outputTemplateFileName

◆ initialize()

StatusCode LArShapeCompleteMakerAlg::initialize ( )
finaloverridevirtual

Definition at line 44 of file LArShapeCompleteMakerAlg.cxx.

45{
46
47 ATH_CHECK(detStore()->retrieve(m_onlineHelper, "LArOnlineID"));
48
49 ATH_CHECK( m_onOffMapKey.initialize() );
50
51 //return StatusCode::SUCCESS;
52 return AthAlgorithm::initialize();
53}
#define ATH_CHECK
Evaluate an expression and check for errors.
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 }

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

ToolHandle<ILArShapeDumperTool> LArShapeCompleteMakerAlg::m_dumperTool
private

Definition at line 56 of file LArShapeCompleteMakerAlg.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_groupingType

Gaudi::Property<std::string> LArShapeCompleteMakerAlg::m_groupingType {this,"groupingType", {} }
private

Definition at line 68 of file LArShapeCompleteMakerAlg.h.

68{this,"groupingType", {} };

◆ m_iPhase

unsigned int LArShapeCompleteMakerAlg::m_iPhase = 0U
private

Definition at line 60 of file LArShapeCompleteMakerAlg.h.

◆ m_minNPulses

Gaudi::Property<int> LArShapeCompleteMakerAlg::m_minNPulses {this,"minNPulses",0}
private

Definition at line 63 of file LArShapeCompleteMakerAlg.h.

63{this,"minNPulses",0}; //default

◆ m_nPhases

unsigned int LArShapeCompleteMakerAlg::m_nPhases = 0U
private

Definition at line 59 of file LArShapeCompleteMakerAlg.h.

◆ m_nSamples

unsigned int LArShapeCompleteMakerAlg::m_nSamples = 0U
private

Definition at line 58 of file LArShapeCompleteMakerAlg.h.

◆ m_onlineHelper

const LArOnlineID* LArShapeCompleteMakerAlg::m_onlineHelper = nullptr
private

Definition at line 52 of file LArShapeCompleteMakerAlg.h.

◆ m_onOffMapKey

SG::ReadCondHandleKey<LArOnOffIdMapping> LArShapeCompleteMakerAlg::m_onOffMapKey { this, "LArOnOffIdMappingKey", "LArOnOffIdMapping", "LArOnOffIdMapping key" }
private

Definition at line 73 of file LArShapeCompleteMakerAlg.h.

74{ this, "LArOnOffIdMappingKey", "LArOnOffIdMapping", "LArOnOffIdMapping key" };

◆ m_outputFileName

Gaudi::Property<std::string> LArShapeCompleteMakerAlg::m_outputFileName {this,"outputFileName", {} }
private

Definition at line 66 of file LArShapeCompleteMakerAlg.h.

66{this,"outputFileName", {} };

◆ m_outputTemplateFileName

Gaudi::Property<std::string> LArShapeCompleteMakerAlg::m_outputTemplateFileName {this,"outputTemplateFileName", {} }
private

Definition at line 65 of file LArShapeCompleteMakerAlg.h.

65{this,"outputTemplateFileName", {} };

◆ m_sgKey

Gaudi::Property<std::string> LArShapeCompleteMakerAlg::m_sgKey {this,"sgKey", {} }
private

Definition at line 67 of file LArShapeCompleteMakerAlg.h.

67{this,"sgKey", {} };

◆ m_shapeErrorFileName

Gaudi::Property<std::string> LArShapeCompleteMakerAlg::m_shapeErrorFileName {this,"shapeErrorFileName", {} }
private

Definition at line 64 of file LArShapeCompleteMakerAlg.h.

64{this,"shapeErrorFileName", {} };

◆ m_template

LArSamples::DataStore* LArShapeCompleteMakerAlg::m_template
private

Definition at line 54 of file LArShapeCompleteMakerAlg.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: