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 142 of file TBBeamQualityEMFractionTool.cxx.

143{//accept
144
145 MsgStream log(msgSvc(),name());
146
147 log << MSG::DEBUG
148 << "TBBeamQualityEMFractionTool: Started Accept"
149 << endmsg;
150
152
153 log << MSG::DEBUG << "m_em_fracnumdet: "<<m_em_fracnumdet<<endmsg;
154 log << MSG::DEBUG << "m_em_fracdendet: "<<m_em_fracdendet<<endmsg;
155 log << MSG::DEBUG << " called for: "<<particles.size()<<" particles"<<endmsg;
156
157 // setting up layers (h6)
158
159 // setting tmp variables
160 // resetting the numerator and denominator to 0
161
162 //long chan =0;
163 float numenergy=0;
164 float denenergy=0;
165 m_Mlayer.assign (500, 0);
166
167 //Accesing the CaloCellContainer
168 const CaloCellContainer* cellContainer = nullptr;
169
170 sc = evtStore()->retrieve(cellContainer);
171 if (sc.isFailure()) {
172 log << MSG::ERROR << "couldn't get the calo cells from storegate" << endmsg;
173 log << MSG::ERROR << "here is what is in storegate: " << evtStore()->dump() << endmsg;
174 return StatusCode::FAILURE;
175 }
176
177 for (const CaloCell* cell_ptr : *cellContainer) {
178
179 //obtaining dde pointer
180 const CaloDetDescrElement* caloDDE_ptr = cell_ptr->caloDDE();
181
182 //obtaining SubCalo
183 //const CaloCell_ID::SUBCALO subcalo = caloDDE_ptr->getSubCalo();
184
185 //obtaining sampling (layer)
186 const CaloCell_ID::CaloSample sampling = caloDDE_ptr->getSampling();
187
188 // This map will have the layers as an index and increment the energy
189 // Does this for ALL layers ( all detectors )
190
191 if (sampling >= 0 && sampling < m_Mlayer.size())
192 m_Mlayer[sampling]+=cell_ptr->energy();
193
194 } //iterating
195
196 // picking out layers of interest and filling numerator and denominator energies.
197
198 for (unsigned int i=0;i<m_em_fracnumsamp.size();++i) {
199 if (m_em_fracnumsamp[i] < m_Mlayer.size())
200 numenergy+=m_Mlayer[m_em_fracnumsamp[i]];
201 }
202
203 for (unsigned int i=0;i<m_em_fracdensamp.size();++i) {
204 if (m_em_fracdensamp[i] < m_Mlayer.size())
205 denenergy+=m_Mlayer[m_em_fracdensamp[i]];
206 }
207
208 if (denenergy!=0) {
209 m_em_frac=numenergy/denenergy;
210
212 return StatusCode::SUCCESS;
213 }
214 else {
215 return StatusCode::FAILURE;
216 }
217 }
218 else {
219 return StatusCode::FAILURE;
220 }
221}//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.
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36

◆ 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 /*
56 // retrieve detector description manager for LAr subsystem
57 const DataHandle<LArDetDescrManager> m_larMgr;
58 sc = detStore()->retrieve(m_larMgr);
59 if (sc.isFailure()) {
60 log << MSG::ERROR << "unable to retrieve LArDetDescrManager from detector store"<< endmsg;
61 return sc;
62 }
63
64 //obtainine Identifier helpers
65 m_hecID_help = m_larMgr->get_hec_id();
66 if (!m_hecID_help) {
67 log << MSG::ERROR << "unable to obtain hec id " << endmsg;
68 return StatusCode::FAILURE;
69 }
70 m_emecID_help = m_larMgr->get_em_id();
71 if (!m_emecID_help) {
72 log << MSG::ERROR << "unable to obtain emec id " << endmsg;
73 return StatusCode::FAILURE;
74 }
75
76 m_fcalID_help = m_larMgr->get_fcal_id();
77 if (!m_fcalID_help) {
78 log << MSG::ERROR << "unable to obtain fcal id " << endmsg;
79 return StatusCode::FAILURE;
80 }
81 */
82
83
84 // retrieve detector description manager for LAr subsystem
85 const CaloCell_ID* idHelper = nullptr;
86 ATH_CHECK( detStore()->retrieve (idHelper, "CaloCell_ID") );
87
88 //obtainine Identifier helpers
89 m_hecID_help = idHelper->hec_idHelper();
90 if (!m_hecID_help) {
91 log << MSG::ERROR << "unable to obtain hec id " << endmsg;
92 return StatusCode::FAILURE;
93 }
94 m_emecID_help = idHelper->em_idHelper();
95 if (!m_emecID_help) {
96 log << MSG::ERROR << "unable to obtain emec id " << endmsg;
97 return StatusCode::FAILURE;
98 }
99
100 m_fcalID_help = idHelper->fcal_idHelper();
101 if (!m_fcalID_help) {
102 log << MSG::ERROR << "unable to obtain fcal id " << endmsg;
103 return StatusCode::FAILURE;
104 }
105
106
107
108 log<<MSG::DEBUG<<"Got to before p_toolSvc"<<endmsg;
109
110 if (m_em_fracnumdet=="HEC") {
111 m_em_fracnumsamp.push_back(8);
112 m_em_fracnumsamp.push_back(9);
113 m_em_fracnumsamp.push_back(10);
114 }
115 if (m_em_fracdendet=="HEC") {
116 m_em_fracdensamp.push_back(8);
117 m_em_fracdensamp.push_back(9);
118 m_em_fracdensamp.push_back(10);
119 }
120 if (m_em_fracnumdet=="EMEC") {
121 m_em_fracnumsamp.push_back(6);
122 m_em_fracnumsamp.push_back(7);
123 }
124 if (m_em_fracdendet=="EMEC") {
125 m_em_fracdensamp.push_back(6);
126 m_em_fracdensamp.push_back(7);
127 }
128 if (m_em_fracnumdet=="FCAL") {
129 m_em_fracnumsamp.push_back(21);
130 m_em_fracnumsamp.push_back(22);
131 m_em_fracnumsamp.push_back(23);
132 }
133 if (m_em_fracdendet=="FCAL") {
134 m_em_fracdensamp.push_back(21);
135 m_em_fracdensamp.push_back(22);
136 m_em_fracdensamp.push_back(23);
137 }
138
139 return StatusCode::SUCCESS;
140}//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: