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

#include <TBBeamQualityEMFractionTool.h>

Inheritance diagram for TBBeamQualityEMFractionTool:
Collaboration diagram for TBBeamQualityEMFractionTool:

Public Member Functions

 TBBeamQualityEMFractionTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TBBeamQualityEMFractionTool ()
virtual StatusCode initializeTool () override
virtual StatusCode accept (const std::vector< std::string > &) override
virtual StatusCode reject (const std::vector< std::string > &)
virtual StatusCode initialize () override
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()

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.

Protected Attributes

const LArEM_IDm_emecID_help
const LArHEC_IDm_hecID_help
const LArFCAL_IDm_fcalID_help
float m_em_fraccut
std::vector< double > m_em_fracnumsamp
std::vector< double > m_em_fracdensamp
std::string m_em_fracnumdet
std::string m_em_fracdendet
std::vector< float > m_Mlayer
float m_em_frac

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

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 24 of file TBBeamQualityEMFractionTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TBBeamQualityEMFractionTool()

TBBeamQualityEMFractionTool::TBBeamQualityEMFractionTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 22 of file TBBeamQualityEMFractionTool.cxx.

25 : TBBeamQualityTool(type,name,parent),
26 m_emecID_help(nullptr),
27 m_hecID_help(nullptr),
28 m_fcalID_help(nullptr),
29 m_em_frac(0)
30{
31 declareInterface<TBBeamQualityTool>(this);
32 declareProperty("EM_fraccut",m_em_fraccut=0.2);
33 declareProperty("EM_fracnumsamp",m_em_fracnumsamp);
34 declareProperty("EM_fracdensamp",m_em_fracdensamp);
35 declareProperty("EM_fracnumdet",m_em_fracnumdet="none");
36 declareProperty("EM_fracdendet",m_em_fracdendet="none");
37}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
TBBeamQualityTool(const std::string &name, const std::string &type, const IInterface *parent)

◆ ~TBBeamQualityEMFractionTool()

TBBeamQualityEMFractionTool::~TBBeamQualityEMFractionTool ( )
virtual

Definition at line 39 of file TBBeamQualityEMFractionTool.cxx.

40{ }

Member Function Documentation

◆ accept()

StatusCode TBBeamQualityEMFractionTool::accept ( const std::vector< std::string > & particles)
overridevirtual

Implements TBBeamQualityTool.

Definition at line 113 of file TBBeamQualityEMFractionTool.cxx.

114{//accept
115
116 MsgStream log(msgSvc(),name());
117
118 log << MSG::DEBUG
119 << "TBBeamQualityEMFractionTool: Started Accept"
120 << endmsg;
121
123
124 log << MSG::DEBUG << "m_em_fracnumdet: "<<m_em_fracnumdet<<endmsg;
125 log << MSG::DEBUG << "m_em_fracdendet: "<<m_em_fracdendet<<endmsg;
126 log << MSG::DEBUG << " called for: "<<particles.size()<<" particles"<<endmsg;
127
128 // setting up layers (h6)
129
130 // setting tmp variables
131 // resetting the numerator and denominator to 0
132
133 //long chan =0;
134 float numenergy=0;
135 float denenergy=0;
136 m_Mlayer.assign (500, 0);
137
138 //Accesing the CaloCellContainer
139 const CaloCellContainer* cellContainer = nullptr;
140
141 sc = evtStore()->retrieve(cellContainer);
142 if (sc.isFailure()) {
143 log << MSG::ERROR << "couldn't get the calo cells from storegate" << endmsg;
144 log << MSG::ERROR << "here is what is in storegate: " << evtStore()->dump() << endmsg;
145 return StatusCode::FAILURE;
146 }
147
148 for (const CaloCell* cell_ptr : *cellContainer) {
149
150 //obtaining dde pointer
151 const CaloDetDescrElement* caloDDE_ptr = cell_ptr->caloDDE();
152
153 //obtaining SubCalo
154 //const CaloCell_ID::SUBCALO subcalo = caloDDE_ptr->getSubCalo();
155
156 //obtaining sampling (layer)
157 const CaloCell_ID::CaloSample sampling = caloDDE_ptr->getSampling();
158
159 // This map will have the layers as an index and increment the energy
160 // Does this for ALL layers ( all detectors )
161
162 if (sampling >= 0 && sampling < m_Mlayer.size())
163 m_Mlayer[sampling]+=cell_ptr->energy();
164
165 } //iterating
166
167 // picking out layers of interest and filling numerator and denominator energies.
168
169 for (unsigned int i=0;i<m_em_fracnumsamp.size();++i) {
170 if (m_em_fracnumsamp[i] < m_Mlayer.size())
171 numenergy+=m_Mlayer[m_em_fracnumsamp[i]];
172 }
173
174 for (unsigned int i=0;i<m_em_fracdensamp.size();++i) {
175 if (m_em_fracdensamp[i] < m_Mlayer.size())
176 denenergy+=m_Mlayer[m_em_fracdensamp[i]];
177 }
178
179 if (denenergy!=0) {
180 m_em_frac=numenergy/denenergy;
181
183 return StatusCode::SUCCESS;
184 }
185 else {
186 return StatusCode::FAILURE;
187 }
188 }
189 else {
190 return StatusCode::FAILURE;
191 }
192}//accept
#define endmsg
static Double_t sc
ServiceHandle< StoreGateSvc > & evtStore()
CaloSampling::CaloSample CaloSample
Definition CaloCell_ID.h:53
CaloCell_ID::CaloSample getSampling() const
cell sampling
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ initialize()

StatusCode TBBeamQualityTool::initialize ( )
overridevirtualinherited

Definition at line 30 of file TBBeamQualityTool.cxx.

32{
33 return this->initializeTool();
34}
virtual StatusCode initializeTool()

◆ initializeTool()

StatusCode TBBeamQualityEMFractionTool::initializeTool ( )
overridevirtual

Reimplemented from TBBeamQualityTool.

Definition at line 42 of file TBBeamQualityEMFractionTool.cxx.

43{ //init
44 MsgStream log(msgSvc(),name());
45 log << MSG::DEBUG
46 << "initialize"
47 << endmsg;
48
50
51 m_hecID_help = NULL;
52 m_emecID_help = NULL;
53 m_fcalID_help = NULL;
54
55 // retrieve detector description manager for LAr subsystem
56 const CaloCell_ID* idHelper = nullptr;
57 ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
58
59 //obtainine Identifier helpers
60 m_hecID_help = idHelper->hec_idHelper();
61 if (!m_hecID_help) {
62 log << MSG::ERROR << "unable to obtain hec id " << endmsg;
63 return StatusCode::FAILURE;
64 }
65 m_emecID_help = idHelper->em_idHelper();
66 if (!m_emecID_help) {
67 log << MSG::ERROR << "unable to obtain emec id " << endmsg;
68 return StatusCode::FAILURE;
69 }
70
71 m_fcalID_help = idHelper->fcal_idHelper();
72 if (!m_fcalID_help) {
73 log << MSG::ERROR << "unable to obtain fcal id " << endmsg;
74 return StatusCode::FAILURE;
75 }
76
77
78
79 log<<MSG::DEBUG<<"Got to before p_toolSvc"<<endmsg;
80
81 if (m_em_fracnumdet=="HEC") {
82 m_em_fracnumsamp.push_back(8);
83 m_em_fracnumsamp.push_back(9);
84 m_em_fracnumsamp.push_back(10);
85 }
86 if (m_em_fracdendet=="HEC") {
87 m_em_fracdensamp.push_back(8);
88 m_em_fracdensamp.push_back(9);
89 m_em_fracdensamp.push_back(10);
90 }
91 if (m_em_fracnumdet=="EMEC") {
92 m_em_fracnumsamp.push_back(6);
93 m_em_fracnumsamp.push_back(7);
94 }
95 if (m_em_fracdendet=="EMEC") {
96 m_em_fracdensamp.push_back(6);
97 m_em_fracdensamp.push_back(7);
98 }
99 if (m_em_fracnumdet=="FCAL") {
100 m_em_fracnumsamp.push_back(21);
101 m_em_fracnumsamp.push_back(22);
102 m_em_fracnumsamp.push_back(23);
103 }
104 if (m_em_fracdendet=="FCAL") {
105 m_em_fracdensamp.push_back(21);
106 m_em_fracdensamp.push_back(22);
107 m_em_fracdensamp.push_back(23);
108 }
109
110 return StatusCode::SUCCESS;
111}//init
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
Definition CaloCell_ID.h:75
const LArEM_ID * em_idHelper() const
access to EM idHelper
Definition CaloCell_ID.h:63
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
Definition CaloCell_ID.h:69

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ interfaceID()

const InterfaceID & TBBeamQualityTool::interfaceID ( )
inlinestaticinherited

Definition at line 42 of file TBBeamQualityTool.h.

42{ return IID_TBBeamQualityTool;}
static const InterfaceID IID_TBBeamQualityTool("TBBeamQualityTool", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::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< AlgTool > >::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.

◆ reject()

StatusCode TBBeamQualityTool::reject ( const std::vector< std::string > & particles)
virtualinherited

Definition at line 41 of file TBBeamQualityTool.cxx.

42{
43 return this->accept(particles).isFailure()
44 ? StatusCode::SUCCESS
45 : StatusCode::FAILURE;
46}
virtual StatusCode accept(const std::vector< std::string > &)=0

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_em_frac

float TBBeamQualityEMFractionTool::m_em_frac
protected

Definition at line 55 of file TBBeamQualityEMFractionTool.h.

◆ m_em_fraccut

float TBBeamQualityEMFractionTool::m_em_fraccut
protected

Definition at line 48 of file TBBeamQualityEMFractionTool.h.

◆ m_em_fracdendet

std::string TBBeamQualityEMFractionTool::m_em_fracdendet
protected

Definition at line 52 of file TBBeamQualityEMFractionTool.h.

◆ m_em_fracdensamp

std::vector<double> TBBeamQualityEMFractionTool::m_em_fracdensamp
protected

Definition at line 50 of file TBBeamQualityEMFractionTool.h.

◆ m_em_fracnumdet

std::string TBBeamQualityEMFractionTool::m_em_fracnumdet
protected

Definition at line 51 of file TBBeamQualityEMFractionTool.h.

◆ m_em_fracnumsamp

std::vector<double> TBBeamQualityEMFractionTool::m_em_fracnumsamp
protected

Definition at line 49 of file TBBeamQualityEMFractionTool.h.

◆ m_emecID_help

const LArEM_ID* TBBeamQualityEMFractionTool::m_emecID_help
protected

Definition at line 42 of file TBBeamQualityEMFractionTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fcalID_help

const LArFCAL_ID* TBBeamQualityEMFractionTool::m_fcalID_help
protected

Definition at line 44 of file TBBeamQualityEMFractionTool.h.

◆ m_hecID_help

const LArHEC_ID* TBBeamQualityEMFractionTool::m_hecID_help
protected

Definition at line 43 of file TBBeamQualityEMFractionTool.h.

◆ m_Mlayer

std::vector<float> TBBeamQualityEMFractionTool::m_Mlayer
protected

Definition at line 53 of file TBBeamQualityEMFractionTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: