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

#include <LArShapeCompleteMaker.h>

Inheritance diagram for LArShapeCompleteMaker:
Collaboration diagram for LArShapeCompleteMaker:

Public Member Functions

 LArShapeCompleteMaker (const std::string &name, ISvcLocator *pSvcLocator)
 ~LArShapeCompleteMaker ()
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
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
unsigned int m_nPhases
unsigned int m_iPhase
int m_minNPulses
std::string m_shapeErrorFileName
std::string m_outputFileName
std::string m_outputTemplateFileName
std::string m_sgKey
std::string m_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

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

◆ LArShapeCompleteMaker()

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

Definition at line 24 of file LArShapeCompleteMaker.cxx.

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

◆ ~LArShapeCompleteMaker()

LArShapeCompleteMaker::~LArShapeCompleteMaker ( )

Definition at line 41 of file LArShapeCompleteMaker.cxx.

42{
43}

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 LArShapeCompleteMaker::execute ( )
overridevirtual

Definition at line 57 of file LArShapeCompleteMaker.cxx.

58{
59 if (m_template) return StatusCode::SUCCESS;
60 m_template = new DataStore();
61
62 auto lsc = std::make_unique<LArShapeComplete>();
63
64 if (lsc->setGroupingType(m_groupingType, msg()).isFailure() || lsc->initialize().isFailure()) {
65 ATH_MSG_ERROR("Unable to initialize LArShapeComplete");
66 return StatusCode::FAILURE;
67 };
68
69 SG::ReadCondHandle<LArOnOffIdMapping> onOffMap (m_onOffMapKey);
70
71 auto errorGetter = std::make_unique<TreeShapeErrorGetter>(m_shapeErrorFileName);
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 return StatusCode::FAILURE;
86 }
87
88 HistoryContainer* histCont = m_template->makeNewHistory(k, info);
89 std::vector<const EventData*> events;
90 for (unsigned int g = 0; g < 3; g++) {
91 DataContainer* data = new DataContainer((CaloGain::CaloGain)g, std::vector<short>(), 0, 0, 0, -1, std::vector<float>());
92 events.push_back(new EventData(-1,-1,-1,-1));
93 histCont->add(data);
94 }
95 History* history = new History(*histCont, events, k, errorGetter.get());
96
97 for (unsigned int g = 0; g < 3; g++) {
99 const LArSamples::ShapeErrorData* sed = nullptr;
100 if (history) sed = history->shapeErrorData(gain, LArSamples::BestShapeError);
101
102 // The containers
103
104 // Fill them with 0's to start with
105 std::vector<float> phaseVect(m_nSamples,0);
106 std::vector<std::vector<float> > deltaVal(m_nPhases, phaseVect);
107 std::vector<std::vector<float> > deltaDer(m_nPhases, phaseVect);
108
109
110 if (sed && sed->n() > m_minNPulses) {
111 ATH_MSG_DEBUG("--> Setting channel " << k << ", id = " << channelID << ", gain = " << gain << ", size = "
112 << deltaVal.size() << " " << deltaDer.size());
113 for (unsigned int i = 0; i < m_nSamples; i++) {
114 deltaVal[m_iPhase][i] = sed->xi()(i);
115 deltaDer[m_iPhase][i] = sed->xip()(i);
116 ATH_MSG_DEBUG(" xi[" << i << " ] = " << deltaVal[m_iPhase][i]);
117 }
118 }
119 else {
120 ATH_MSG_DEBUG("--> No information for channel " << k<< ", id = " << channelID << ", gain = " << gain);
121 }
122 lsc->set(channelID, gain, deltaVal, deltaDer);
123 }
124 delete history;
125 }
126
127 ATH_MSG_INFO("Writing LArShapeComplete output to " << m_outputFileName );
128 //TFile* out = TFile::Open(m_outputFileName.c_str(), "RECREATE");
129 //out->WriteObjectAny(lsc, "LArShapeComplete", "LArShape");
130 //delete out;
131 if (detStore()->record(std::move(lsc), m_sgKey).isFailure()) {
132 ATH_MSG_ERROR("Unable to write LArShapeComplete");
133 return StatusCode::FAILURE;
134 };
135
136 ATH_MSG_INFO( "Done!");
137
138 return StatusCode::SUCCESS;
139}
#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 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
const LArOnlineID * m_onlineHelper
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffMapKey
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 LArShapeCompleteMaker::finalize ( )
overridevirtual

Definition at line 142 of file LArShapeCompleteMaker.cxx.

143{
144 ATH_MSG_INFO( "Writing template..." );
145 m_template->writeTrees(m_outputTemplateFileName.c_str());
146 ATH_MSG_INFO("done..." );
147 return StatusCode::SUCCESS;
148}

◆ initialize()

StatusCode LArShapeCompleteMaker::initialize ( )
overridevirtual

Definition at line 46 of file LArShapeCompleteMaker.cxx.

47{
48
49 ATH_CHECK(detStore()->retrieve(m_onlineHelper, "LArOnlineID"));
50
51 ATH_CHECK( m_onOffMapKey.initialize() );
52
53 return StatusCode::SUCCESS;
54}
#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> LArShapeCompleteMaker::m_dumperTool
private

Definition at line 47 of file LArShapeCompleteMaker.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

std::string LArShapeCompleteMaker::m_groupingType
private

Definition at line 52 of file LArShapeCompleteMaker.h.

◆ m_iPhase

unsigned int LArShapeCompleteMaker::m_iPhase
private

Definition at line 49 of file LArShapeCompleteMaker.h.

◆ m_minNPulses

int LArShapeCompleteMaker::m_minNPulses
private

Definition at line 50 of file LArShapeCompleteMaker.h.

◆ m_nPhases

unsigned int LArShapeCompleteMaker::m_nPhases
private

Definition at line 49 of file LArShapeCompleteMaker.h.

◆ m_nSamples

unsigned int LArShapeCompleteMaker::m_nSamples
private

Definition at line 49 of file LArShapeCompleteMaker.h.

◆ m_onlineHelper

const LArOnlineID* LArShapeCompleteMaker::m_onlineHelper = nullptr
private

Definition at line 43 of file LArShapeCompleteMaker.h.

◆ m_onOffMapKey

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

Definition at line 54 of file LArShapeCompleteMaker.h.

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

◆ m_outputFileName

std::string LArShapeCompleteMaker::m_outputFileName
private

Definition at line 51 of file LArShapeCompleteMaker.h.

◆ m_outputTemplateFileName

std::string LArShapeCompleteMaker::m_outputTemplateFileName
private

Definition at line 51 of file LArShapeCompleteMaker.h.

◆ m_sgKey

std::string LArShapeCompleteMaker::m_sgKey
private

Definition at line 51 of file LArShapeCompleteMaker.h.

◆ m_shapeErrorFileName

std::string LArShapeCompleteMaker::m_shapeErrorFileName
private

Definition at line 51 of file LArShapeCompleteMaker.h.

◆ m_template

LArSamples::DataStore* LArShapeCompleteMaker::m_template {}
private

Definition at line 45 of file LArShapeCompleteMaker.h.

45{};

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