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

Tool to check if object is in an affected region. More...

#include <CaloAffectedTool.h>

Inheritance diagram for CaloAffectedTool:
Collaboration diagram for CaloAffectedTool:

Public Member Functions

 CaloAffectedTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~CaloAffectedTool ()
virtual bool isAffected (const xAOD::IParticle *p, const CaloAffectedRegionInfoVec *vAff, float deta=0., float dphi=0., int layer_min=0, int layer_max=-1, int problemType=-1) const override
virtual bool listAffected (const xAOD::IParticle *p, const CaloAffectedRegionInfoVec *vAff, std::vector< int > &layer_list, std::vector< int > &problem_list, float deta=0, float dphi=0, int problemType=-1) const override
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.

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

Tool to check if object is in an affected region.

Author
G.Unal @ changed to use conditions object by P. Strizenec

Definition at line 25 of file CaloAffectedTool.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

◆ CaloAffectedTool()

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

Definition at line 12 of file CaloAffectedTool.cxx.

14 :
15 AthAlgTool(type, name, parent)
16{
17 declareInterface<ICaloAffectedTool>(this);
18}
AthAlgTool()
Default constructor:

◆ ~CaloAffectedTool()

CaloAffectedTool::~CaloAffectedTool ( )
virtualdefault

Member Function Documentation

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ 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 CaloAffectedTool::initialize ( )
overridevirtual

Definition at line 27 of file CaloAffectedTool.cxx.

27 {
28 return StatusCode::SUCCESS;
29}

◆ 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 & ICaloAffectedTool::interfaceID ( )
inlinestaticinherited

Definition at line 32 of file ICaloAffectedTool.h.

32 {
33 static const InterfaceID IID_ICaloAffectedTool("ICaloAffectedTool", 2 , 0);
34 return IID_ICaloAffectedTool;
35 }

◆ isAffected()

bool CaloAffectedTool::isAffected ( const xAOD::IParticle * p,
const CaloAffectedRegionInfoVec * vAff,
float deta = 0.,
float dphi = 0.,
int layer_min = 0,
int layer_max = -1,
int problemType = -1 ) const
overridevirtual

Implements ICaloAffectedTool.

Definition at line 34 of file CaloAffectedTool.cxx.

35{
36
37 if(!vAff) return false;
38
39 static const float epsilon=1e-6;
40
41 //std::cout << " in isAffected " << p->eta() << " " << p->phi() << std::endl;
42
43 std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = vAff->begin();
44 std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = vAff->end();
45 for (;reg1 != reg2; ++reg1) {
46 const CaloAffectedRegionInfo* region = &(*reg1);
47
48 int problem=region->get_problem();
49 //std::cout << " problem,problemType " << problem << " " << problemType << std::endl;
50 if (problemType>=0 && (problem != problemType)) continue;
51
52 int layermin=region->get_layer_min();
53 int layermax=region->get_layer_max();
54 //std::cout << " layermin, layermax " << layermin << " " << layermax << std::endl;
55 if ((layer_max>=layer_min) && (layermax < layer_min || layermin > layer_max)) continue;
56
57
58 float etamin=region->get_eta_min();
59 float etamax=region->get_eta_max();
60 float eta = p->eta();
61 //std::cout << " eta region " << etamin << " " << etamax << std::endl;
62 if ((eta+deta)<etamin || (eta-deta)>etamax) continue;
63
64 float phimin=region->get_phi_min();
65 float phimax=region->get_phi_max();
66 float phi = p->phi();
67 //std::cout << " phi region " << phimin << " " << phimax << std::endl;
68 float phi2 = CaloPhiRange::fix(phi+dphi+epsilon);
69 float phi1 = CaloPhiRange::fix(phi-dphi-epsilon);
70
71 if ((phimax >= phimin) && (phi2 >= phi1) && (phi2<phimin || phi1>phimax)) continue;
72 if ((phimax >= phimin) && (phi2 <= phi1) && (phi1>phimax && phi2<phimin)) continue;
73 if ((phimax <= phimin) && (phi2 >= phi1) && (phi1>phimax && phi2<phimin)) continue;
74
75 //std::cout << " in region " << std::endl;
76
77 return true;
78
79 }
80
81 return false;
82
83}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
float get_eta_max() const
get eta max of region
float get_phi_min() const
get phi min of region
int get_layer_max() const
get layer max of region
float get_eta_min() const
get eta min of region
int get_problem() const
get problem type
int get_layer_min() const
get layer min of region
float get_phi_max() const
get phi max of region
static double fix(double phi)

◆ listAffected()

bool CaloAffectedTool::listAffected ( const xAOD::IParticle * p,
const CaloAffectedRegionInfoVec * vAff,
std::vector< int > & layer_list,
std::vector< int > & problem_list,
float deta = 0,
float dphi = 0,
int problemType = -1 ) const
overridevirtual

Implements ICaloAffectedTool.

Definition at line 86 of file CaloAffectedTool.cxx.

87{
88
89 if(!vAff) return false;
90
91 bool found = false;
92
93 static const float epsilon=1e-6;
94
95 layer_list.clear();
96 problem_list.clear();
97
98
99 std::vector<CaloAffectedRegionInfo>::const_iterator reg1 = vAff->begin();
100 std::vector<CaloAffectedRegionInfo>::const_iterator reg2 = vAff->end();
101 for (;reg1 != reg2; ++reg1) {
102 const CaloAffectedRegionInfo* region = &(*reg1);
103
104 int problem=region->get_problem();
105 if (problemType>=0 && (problem != problemType)) continue;
106
107 int layermin=region->get_layer_min();
108 int layermax=region->get_layer_max();
109
110 float etamin=region->get_eta_min();
111 float etamax=region->get_eta_max();
112 float eta = p->eta();
113 if ((eta+deta)<etamin || (eta-deta)>etamax) continue;
114
115 float phimin=region->get_phi_min();
116 float phimax=region->get_phi_max();
117 float phi = p->phi();
118 float phi2 = CaloPhiRange::fix(phi+dphi+epsilon);
119 float phi1 = CaloPhiRange::fix(phi-dphi-epsilon);
120
121 if ((phimax >= phimin) && (phi2 >= phi1) && (phi2<phimin || phi1>phimax)) continue;
122 if ((phimax >= phimin) && (phi2 <= phi1) && (phi1>phimax && phi2<phimin)) continue;
123 if ((phimax <= phimin) && (phi2 >= phi1) && (phi1>phimax && phi2<phimin)) continue;
124
125 found = true;
126
127 for (int ilayer=layermin;ilayer<=layermax;ilayer++) {
128 layer_list.push_back(ilayer);
129 problem_list.push_back(problem);
130 }
131
132
133 }
134
135 return found;
136
137}

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

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