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

Concrete implementation of HIJetSubtractorToolBase. Class used by HIClusterSubtraction and HIJetConstituentSubtractionTool to provide kinematics of a cluster after subtraction given an event shape. This version of the tool does not use the cell information and thus should be faster than HIJetCellSubtractorTool. More...

#include <HIJetClusterSubtractorTool.h>

Inheritance diagram for HIJetClusterSubtractorTool:
Collaboration diagram for HIJetClusterSubtractorTool:

Public Member Functions

 HIJetClusterSubtractorTool (const std::string &myname)
 Implements method defined in base First argument is reference to four vector that is updated to reflect the subtracted kinematics of the IParticle passed in the second arg Method expects cl_in to be a cluster.
virtual void subtract (xAOD::IParticle::FourMom_t &, const xAOD::IParticle *, const xAOD::HIEventShapeContainer *, const HIEventShapeIndex *, const ToolHandle< IHIUEModulatorTool > &, const xAOD::HIEventShape *eshape) const override
 Abstract method where particle itself is not modified IParticle::FourMom_t containing kinematics after subtraction is passed by reference.
virtual void subtractWithMoments (xAOD::CaloCluster *, const xAOD::HIEventShapeContainer *, const HIEventShapeIndex *index, const ToolHandle< IHIUEModulatorTool > &, const xAOD::HIEventShape *eshape) const override
virtual void updateUsingCluster (xAOD::HIEventShapeContainer *shape, const HIEventShapeIndex *index, const xAOD::CaloCluster *cl) const override
 Method to update the shape based on a given cluster two sets of indices are passed by reference and updated by the method sets are queried to see if the cluster has already been used, e.g.
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode initializeTool ()
float minEnergyForMoments () const
float minEnergySigForMoments () const
bool usesCells () const
const xAOD::HIEventShapeContainergetShape () const
const HIEventShapeIndexgetIndex () const
const IHIUEModulatorToolgetModulator () const
void setShape (const xAOD::HIEventShapeContainer *s)
void setIndex (const HIEventShapeIndex *ind)
void setModulator (const IHIUEModulatorTool *mod)
virtual StatusCode configureEvent (const xAOD::HIEventShapeContainer *shape, const HIEventShapeIndex *index, const IHIUEModulatorTool *modulator)
virtual void print () const
 Print the state of the tool.
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
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void setMinEnergyForMoment (float min_E)
void setUpdateClusters (bool up)
bool UpdateClusters () const
void setSubtractedEtaPhi (float E, float &eta, float &phi, float eta0, float phi0, float sig) const
void setUseCells (bool v)
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

 ASG_TOOL_CLASS (HIJetClusterSubtractorTool, IHISubtractorTool)
float getWeight (float eta, float phi, int sample) const
float getWeightEta (float eta, float phi, int sample) const
float getWeightPhi (float eta, float phi, int sample) const
void updateSlice (xAOD::HIEventShape *slice, float ET, float phi0, float area_cluster) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_init
Gaudi::Property< std::string > m_inputFile { this, "InputFile", "cluster.geo.HIJING_2018.root", "File containing cluster geometric moments." }
Gaudi::Property< std::string > m_configDir { this, "ConfigDir", "HIJetCorrection/", "Directory containing configuration file." }
TH3F * m_h3W
TH3F * m_h3Eta
TH3F * m_h3Phi
Gaudi::Property< bool > m_useSamplings { this, "UseSamplings", true, "Boolean for samplings use" }
Gaudi::Property< float > m_EminMoment { this, "MinimumEnergyForMoments", 50., "> E, cluster given tower coordinates" }
Gaudi::Property< float > m_EsigMoment { this, "MinimumSignificanceForMoments", 0.1, "if E after subtr / E total < this cut, cluster given tower coordinates" }
Gaudi::Property< bool > m_updateClusters { this, "UpdateClusters", false, "If true set cluster kinematics to reflect subtraction" }
Gaudi::Property< bool > m_useCells { this, "UseCells", true, "Boolean switch for cells usage" }
const xAOD::HIEventShapeContainerm_shape
const HIEventShapeIndexm_index
const IHIUEModulatorToolm_modulator
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

Concrete implementation of HIJetSubtractorToolBase. Class used by HIClusterSubtraction and HIJetConstituentSubtractionTool to provide kinematics of a cluster after subtraction given an event shape. This version of the tool does not use the cell information and thus should be faster than HIJetCellSubtractorTool.

Author
Aaron Angerami anger.nosp@m.ami@.nosp@m.cern..nosp@m.ch
Date
Jan, 2015

Definition at line 31 of file HIJetClusterSubtractorTool.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

◆ HIJetClusterSubtractorTool()

HIJetClusterSubtractorTool::HIJetClusterSubtractorTool ( const std::string & myname)

Implements method defined in base First argument is reference to four vector that is updated to reflect the subtracted kinematics of the IParticle passed in the second arg Method expects cl_in to be a cluster.

Definition at line 17 of file HIJetClusterSubtractorTool.cxx.

Member Function Documentation

◆ ASG_TOOL_CLASS()

HIJetClusterSubtractorTool::ASG_TOOL_CLASS ( HIJetClusterSubtractorTool ,
IHISubtractorTool  )
private

◆ configureEvent()

StatusCode HIJetSubtractorToolBase::configureEvent ( const xAOD::HIEventShapeContainer * shape,
const HIEventShapeIndex * index,
const IHIUEModulatorTool * modulator )
virtualinherited

Definition at line 39 of file HIJetSubtractorToolBase.cxx.

40{
41 setShape(shape);
42 setIndex(index);
43 setModulator(modulator);
44 return StatusCode::SUCCESS;
45
46}
void setModulator(const IHIUEModulatorTool *mod)
void setIndex(const HIEventShapeIndex *ind)
void setShape(const xAOD::HIEventShapeContainer *s)

◆ 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

◆ getIndex()

const HIEventShapeIndex * HIJetSubtractorToolBase::getIndex ( ) const
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 36 of file HIJetSubtractorToolBase.h.

36{return m_index;};
const HIEventShapeIndex * m_index

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getModulator()

const IHIUEModulatorTool * HIJetSubtractorToolBase::getModulator ( ) const
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 37 of file HIJetSubtractorToolBase.h.

37{return m_modulator;};
const IHIUEModulatorTool * m_modulator

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getShape()

const xAOD::HIEventShapeContainer * HIJetSubtractorToolBase::getShape ( ) const
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 35 of file HIJetSubtractorToolBase.h.

35{return m_shape;};
const xAOD::HIEventShapeContainer * m_shape

◆ getWeight()

float HIJetClusterSubtractorTool::getWeight ( float eta,
float phi,
int sample ) const
private

Definition at line 222 of file HIJetClusterSubtractorTool.cxx.

223{
224 return m_h3W->GetBinContent(m_h3W->FindFixBin(eta,phi,sample));
225}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method

◆ getWeightEta()

float HIJetClusterSubtractorTool::getWeightEta ( float eta,
float phi,
int sample ) const
private

Definition at line 226 of file HIJetClusterSubtractorTool.cxx.

227{
228 return m_h3Eta->GetBinContent(m_h3Eta->FindFixBin(eta,phi,sample));
229}

◆ getWeightPhi()

float HIJetClusterSubtractorTool::getWeightPhi ( float eta,
float phi,
int sample ) const
private

Definition at line 230 of file HIJetClusterSubtractorTool.cxx.

231{
232 return m_h3Phi->GetBinContent(m_h3Phi->FindFixBin(eta,phi,sample));
233}

◆ initialize()

StatusCode HIJetClusterSubtractorTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 215 of file HIJetClusterSubtractorTool.cxx.

216{
217 return initializeTool();
218
219}

◆ initializeTool()

StatusCode HIJetClusterSubtractorTool::initializeTool ( )
virtual

Definition at line 169 of file HIJetClusterSubtractorTool.cxx.

170{
172 {
173 std::string local_path=static_cast<std::string>(m_configDir)+m_inputFile;
174 std::string full_path=PathResolverFindCalibFile(local_path);
175 ATH_MSG_INFO("Reading input file "<< m_inputFile << " from " << full_path);
176 TFile* f=TFile::Open(full_path.c_str());
177 if(f==nullptr)
178 {
179 ATH_MSG_FATAL("Cannot read config file " << full_path );
180 return StatusCode::FAILURE;
181 }
182
183 m_h3W=(TH3F*)f->GetObjectChecked("h3_w","TH3F");
184 if(m_h3W==nullptr)
185 {
186 ATH_MSG_FATAL("Cannot find TH3F m_h3W in config file " << full_path );
187 return StatusCode::FAILURE;
188 }
189
190 m_h3Eta=(TH3F*)f->GetObjectChecked("h3_eta","TH3F");
191 if(m_h3Eta==nullptr)
192 {
193 ATH_MSG_FATAL("Cannot find TH3F m_h3Eta in config file " << full_path );
194 return StatusCode::FAILURE;
195 }
196
197 m_h3Phi=(TH3F*)f->GetObjectChecked("h3_phi","TH3F");
198 if(m_h3Phi==nullptr)
199 {
200 ATH_MSG_FATAL("Cannot find TH3F m_h3Phi in config file " << full_path );
201 return StatusCode::FAILURE;
202 }
203 m_h3W->SetDirectory(0);
204 m_h3Eta->SetDirectory(0);
205 m_h3Phi->SetDirectory(0);
206
207 f->Close();
208 }
209 m_init=true;
210 return StatusCode::SUCCESS;
211
212}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< std::string > m_configDir
Gaudi::Property< std::string > m_inputFile
Gaudi::Property< bool > m_useSamplings

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

◆ minEnergyForMoments()

float HIJetSubtractorToolBase::minEnergyForMoments ( ) const
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 30 of file HIJetSubtractorToolBase.h.

30{return m_EminMoment;};
Gaudi::Property< float > m_EminMoment

◆ minEnergySigForMoments()

float HIJetSubtractorToolBase::minEnergySigForMoments ( ) const
inlineinherited

Definition at line 31 of file HIJetSubtractorToolBase.h.

31{return m_EsigMoment;};
Gaudi::Property< float > m_EsigMoment

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

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

◆ print()

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

◆ setIndex()

void HIJetSubtractorToolBase::setIndex ( const HIEventShapeIndex * ind)
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 39 of file HIJetSubtractorToolBase.h.

39{m_index=ind;};

◆ setMinEnergyForMoment()

void HIJetSubtractorToolBase::setMinEnergyForMoment ( float min_E)
inlineprotectedinherited

Definition at line 57 of file HIJetSubtractorToolBase.h.

57{ m_EminMoment=min_E; };

◆ setModulator()

void HIJetSubtractorToolBase::setModulator ( const IHIUEModulatorTool * mod)
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 40 of file HIJetSubtractorToolBase.h.

◆ setShape()

void HIJetSubtractorToolBase::setShape ( const xAOD::HIEventShapeContainer * s)
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 38 of file HIJetSubtractorToolBase.h.

◆ setSubtractedEtaPhi()

void HIJetSubtractorToolBase::setSubtractedEtaPhi ( float E,
float & eta,
float & phi,
float eta0,
float phi0,
float sig ) const
protectedinherited

Definition at line 23 of file HIJetSubtractorToolBase.cxx.

24{
25 phi=TVector2::Phi_mpi_pi(phi);
26 if(!HIJetRec::inTowerBoundary(eta0,phi0,eta,phi))
27 {
28 eta=eta0;
29 phi=phi0;
30 }
31 else if( E < minEnergyForMoments() || ( (sig > 0) && sig < minEnergySigForMoments() ) )
32 {
33 eta=eta0;
34 phi=phi0;
35 }
36
37}
bool inTowerBoundary(float eta0, float phi0, float eta, float phi)

◆ setUpdateClusters()

void HIJetSubtractorToolBase::setUpdateClusters ( bool up)
inlineprotectedinherited

Definition at line 58 of file HIJetSubtractorToolBase.h.

◆ setUseCells()

void HIJetSubtractorToolBase::setUseCells ( bool v)
inlineprotectedinherited

Definition at line 64 of file HIJetSubtractorToolBase.h.

◆ subtract()

void HIJetClusterSubtractorTool::subtract ( xAOD::IParticle::FourMom_t & ,
const xAOD::IParticle * ,
const xAOD::HIEventShapeContainer * ,
const HIEventShapeIndex * ,
const ToolHandle< IHIUEModulatorTool > & ,
const xAOD::HIEventShape * shape ) const
overridevirtual

Abstract method where particle itself is not modified IParticle::FourMom_t containing kinematics after subtraction is passed by reference.

Implements IHISubtractorTool.

Definition at line 26 of file HIJetClusterSubtractorTool.cxx.

27{
28
29 const xAOD::CaloCluster* cl=static_cast<const xAOD::CaloCluster*>(cl_in);
30 float E_unsubtr=cl->e(HIJetRec::unsubtractedClusterState());
31 float eta_unsubtr=cl->eta(HIJetRec::unsubtractedClusterState());
32 float phi_unsubtr=cl->phi(HIJetRec::unsubtractedClusterState());
33
34 float E_subtr=0;
35 float E_eta_subtr=0;
36 float E_phi_subtr=0;
37 const float eta0=cl->eta0();
38 const float phi0=cl->phi0();
39 float mod=1;
40 if(modulator) mod=modulator->getModulation(phi0, eshape);
41
42 float energy=E_unsubtr;
43 float eta=eta0;
44 float phi=phi0;
45
46 static const SG::ConstAccessor<float> HIEtaPhiWeightAcc("HIEtaPhiWeight");
47 if(HIEtaPhiWeightAcc.isAvailable(*cl))
48 {
49 float DF_weight=HIEtaPhiWeightAcc(*cl);
50 if(DF_weight!=0.) mod/=DF_weight;
51 }
52
53 if(shape==nullptr)
54 {
55 ATH_MSG_ERROR("No HIEventShape supplied, cannot do subtraction");
56 return;
57 }
58
60 {
61 if(index==nullptr)
62 {
63 ATH_MSG_ERROR("No HIEventShapeIndex supplied, cannot do subtraction");
64 return;
65 }
66
67 for(unsigned int sample=0; sample<24; sample++)
68 {
70 if(!cl->hasSampling(s)) continue;
71
72 float nCells=index->getShape(eta0,sample,shape)->nCells();
73 float rho=0;
74 if(nCells!=0.) rho=index->getShape(eta0,sample,shape)->rho()/nCells;
75 rho*=mod*std::cosh(eta0);
76
77 E_subtr+=rho*getWeight(eta0,phi0,sample);
78 E_eta_subtr+=rho*getWeightEta(eta0,phi0,sample);
79 E_phi_subtr+=rho*getWeightPhi(eta0,phi0,sample);
80 }
81
82 energy=E_unsubtr-E_subtr;
83 if(energy!=0.)
84 {
85 eta=eta_unsubtr+(eta_unsubtr*E_subtr-E_eta_subtr)/energy;
86 phi=phi_unsubtr+(phi_unsubtr*E_subtr-E_phi_subtr)/energy;
87 }
88 setSubtractedEtaPhi(energy,eta,phi,eta0,phi0,E_subtr==0 ? energy : energy/E_subtr);
89 }
90 else
91 {
92 unsigned int es_bin=HI::TowerBins::findBinEta(eta0);
93
94 float area=shape->at(es_bin)->area();
95 float rho=(area==0.) ? 0. : shape->at(es_bin)->et()/area;
96
97 rho*=mod*std::cosh(eta0);
99 energy=E_unsubtr-E_subtr;
100 eta=eta_unsubtr;
101 phi=phi_unsubtr;
102
103 ATH_MSG_VERBOSE("Subtracting"
104 << std::setw(8) << eta0
105 << std::setw(8) << phi0
106 << std::setw(10) << std::setprecision(3) << modulator->getModulation(phi0, eshape)
107 << std::setw(10) << std::setprecision(3) << mod
108 << std::setw(10) << std::setprecision(3) << modulator->getModulation(phi0, eshape)/mod
109 << std::setw(10) << std::setprecision(3) << area
110 << std::setw(10) << std::setprecision(3) << rho*area
111 << std::setw(10) << std::setprecision(3) << E_unsubtr*1e-3
112 << std::setw(10) << std::setprecision(3) << E_subtr*1e-3
113 << std::setw(10) << std::setprecision(3) << E_unsubtr*1e-3/std::cosh(eta0)
114 << std::setw(10) << std::setprecision(3) << E_subtr*1e-3/std::cosh(eta0));
115
116
117
118
119 }
120 float ET=energy/std::cosh(eta);
121 subtr_mom.SetPxPyPzE(ET*std::cos(phi),ET*std::sin(phi),ET*std::sinh(eta),energy);
122}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
double area(double R)
float et(const xAOD::jFexSRJetRoI *j)
float getWeightPhi(float eta, float phi, int sample) const
float getWeight(float eta, float phi, int sample) const
float getWeightEta(float eta, float phi, int sample) const
void setSubtractedEtaPhi(float E, float &eta, float &phi, float eta0, float phi0, float sig) const
float area() const
obtain the area of the eta slice
str index
Definition DeMoScan.py:362
constexpr xAOD::CaloCluster::State unsubtractedClusterState()
constexpr float getBinArea()
Definition HIEventDefs.h:34
unsigned int findBinEta(float eta)
Definition HIEventDefs.h:46
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
setRawEt setRawPhi nCells

◆ subtractWithMoments()

void HIJetClusterSubtractorTool::subtractWithMoments ( xAOD::CaloCluster * cl,
const xAOD::HIEventShapeContainer * shape,
const HIEventShapeIndex * index,
const ToolHandle< IHIUEModulatorTool > & modulator,
const xAOD::HIEventShape * eshape ) const
overridevirtual

Implements IHISubtractorTool.

Definition at line 162 of file HIJetClusterSubtractorTool.cxx.

163{
165 subtract(subtr_mom, cl, shape, index, modulator, eshape);
167}
virtual void subtract(xAOD::IParticle::FourMom_t &, const xAOD::IParticle *, const xAOD::HIEventShapeContainer *, const HIEventShapeIndex *, const ToolHandle< IHIUEModulatorTool > &, const xAOD::HIEventShape *eshape) const override
Abstract method where particle itself is not modified IParticle::FourMom_t containing kinematics afte...
TLorentzVector FourMom_t
Definition of the 4-momentum type.
constexpr xAOD::CaloCluster::State subtractedClusterState()
void setClusterP4(const xAOD::CaloCluster::FourMom_t &p, xAOD::CaloCluster *cl, xAOD::CaloCluster::State s)

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

◆ UpdateClusters()

bool HIJetSubtractorToolBase::UpdateClusters ( ) const
inlineprotectedinherited

Definition at line 60 of file HIJetSubtractorToolBase.h.

60{ return m_updateClusters; };

◆ updateSlice()

void HIJetClusterSubtractorTool::updateSlice ( xAOD::HIEventShape * slice,
float ET,
float phi0,
float area_cluster ) const
private

Definition at line 235 of file HIJetClusterSubtractorTool.cxx.

236{
237 if(area_cluster==0.)
238 {
239 area_cluster=1.;
240
241 if(ET==0.)
242 {
243 ATH_MSG_INFO("Provided cluster area was 0, check if the input file " << m_inputFile << " from " << PathResolverFindCalibFile(static_cast<std::string>(m_configDir)+m_inputFile) << " was generated with the currently used geometry. See ATLHI-472");
244 }
245 else
246 {
247 ATH_MSG_ERROR("Provided cluster area was 0, the HIEventShape will be incorrect! Check if the input file " << m_inputFile << " from " << PathResolverFindCalibFile(static_cast<std::string>(m_configDir)+m_inputFile) << " was generated with the currently used geometry. See ATLHI-472");
248 }
249 }
250
251 float area_slice=slice->area();
252 float area_sf=1.;
253
254 if(area_slice!=0.) area_sf-=area_cluster/area_slice;
255 slice->setNCells( std::floor(area_sf*slice->nCells()) );
256 slice->setEt(slice->et()-ET);
257 slice->setArea(area_slice-area_cluster);
258
259 slice->setRho(slice->rho() - ET/area_cluster);
260
261
262 for(unsigned int ih=0; ih<slice->etCos().size(); ih++)
263 {
264 float ih_f=ih+1;
265 float tmp_cos = slice->etCos().at(ih);
266 slice->etCos()[ih] = tmp_cos + cos(ih_f*phi0)*ET;
267
268 float tmp_sin = slice->etSin().at(ih);
269 slice->etSin()[ih] = tmp_sin + sin(ih_f*phi0)*ET;
270 }
271}

◆ updateUsingCluster()

void HIJetClusterSubtractorTool::updateUsingCluster ( xAOD::HIEventShapeContainer * shape,
const HIEventShapeIndex * index,
const xAOD::CaloCluster * cl ) const
overridevirtual

Method to update the shape based on a given cluster two sets of indices are passed by reference and updated by the method sets are queried to see if the cluster has already been used, e.g.

by another jet seed checking/updating sets prevents double counting eta-bin set used to determine eta-averaged flow

Implements IHISubtractorTool.

Definition at line 124 of file HIJetClusterSubtractorTool.cxx.

125{
126
127 float eta0=cl->eta0();
128 float phi0=cl->phi0();
129
131 {
132 for(unsigned int sample=0; sample<24; sample++)
133 {
135 if(!cl->hasSampling(s)) continue;
136 float esamp=cl->eSample(s);
137 float ET=esamp/std::cosh(eta0);
138 xAOD::HIEventShape* slice=shape->at(index->getIndex(eta0,sample));
139 float area_cluster=getWeight(eta0,phi0,sample);
140 //update members
141 updateSlice(slice,ET,phi0,area_cluster);
142 }
143 }
144 else
145 {
146 unsigned int es_bin=HI::TowerBins::findBinEta(eta0);
147 xAOD::HIEventShape* slice=shape->at(es_bin);
148 constexpr float area_cluster=HI::TowerBins::getBinArea();
149 float ET=cl->e(HIJetRec::unsubtractedClusterState())/std::cosh(eta0);
150 static const SG::ConstAccessor<float> HIEtaPhiWeightAcc("HIEtaPhiWeight");
151 if(HIEtaPhiWeightAcc.isAvailable(*cl))
152 {
153 float HI_weight=HIEtaPhiWeightAcc(*cl);
154 ET*=HI_weight;
155 }
156 //update members
157 updateSlice(slice,ET,phi0,area_cluster);
158 }
159}
const T * at(size_type n) const
Access an element, as an rvalue.
void updateSlice(xAOD::HIEventShape *slice, float ET, float phi0, float area_cluster) const
HIEventShape_v2 HIEventShape
Definition of the latest event info version.

◆ 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

◆ usesCells()

bool HIJetSubtractorToolBase::usesCells ( ) const
inlinevirtualinherited

Implements IHISubtractorTool.

Definition at line 32 of file HIJetSubtractorToolBase.h.

32{return m_useCells;};

Member Data Documentation

◆ m_configDir

Gaudi::Property< std::string > HIJetClusterSubtractorTool::m_configDir { this, "ConfigDir", "HIJetCorrection/", "Directory containing configuration file." }
private

Definition at line 62 of file HIJetClusterSubtractorTool.h.

62{ this, "ConfigDir", "HIJetCorrection/", "Directory containing configuration file." };

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

Gaudi::Property< float > HIJetSubtractorToolBase::m_EminMoment { this, "MinimumEnergyForMoments", 50., "> E, cluster given tower coordinates" }
privateinherited

Definition at line 46 of file HIJetSubtractorToolBase.h.

46{ this, "MinimumEnergyForMoments", 50., "> E, cluster given tower coordinates" };

◆ m_EsigMoment

Gaudi::Property< float > HIJetSubtractorToolBase::m_EsigMoment { this, "MinimumSignificanceForMoments", 0.1, "if E after subtr / E total < this cut, cluster given tower coordinates" }
privateinherited

Definition at line 47 of file HIJetSubtractorToolBase.h.

47{ this, "MinimumSignificanceForMoments", 0.1, "if E after subtr / E total < this cut, cluster given tower coordinates" };

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

TH3F* HIJetClusterSubtractorTool::m_h3Eta
private

Definition at line 65 of file HIJetClusterSubtractorTool.h.

◆ m_h3Phi

TH3F* HIJetClusterSubtractorTool::m_h3Phi
private

Definition at line 66 of file HIJetClusterSubtractorTool.h.

◆ m_h3W

TH3F* HIJetClusterSubtractorTool::m_h3W
private

Definition at line 64 of file HIJetClusterSubtractorTool.h.

◆ m_index

const HIEventShapeIndex* HIJetSubtractorToolBase::m_index
privateinherited

Definition at line 52 of file HIJetSubtractorToolBase.h.

◆ m_init

bool HIJetClusterSubtractorTool::m_init
private

Definition at line 53 of file HIJetClusterSubtractorTool.h.

◆ m_inputFile

Gaudi::Property< std::string > HIJetClusterSubtractorTool::m_inputFile { this, "InputFile", "cluster.geo.HIJING_2018.root", "File containing cluster geometric moments." }
private

Definition at line 60 of file HIJetClusterSubtractorTool.h.

60{ this, "InputFile", "cluster.geo.HIJING_2018.root", "File containing cluster geometric moments." };

◆ m_modulator

const IHIUEModulatorTool* HIJetSubtractorToolBase::m_modulator
privateinherited

Definition at line 53 of file HIJetSubtractorToolBase.h.

◆ m_shape

const xAOD::HIEventShapeContainer* HIJetSubtractorToolBase::m_shape
privateinherited

Definition at line 51 of file HIJetSubtractorToolBase.h.

◆ m_updateClusters

Gaudi::Property< bool > HIJetSubtractorToolBase::m_updateClusters { this, "UpdateClusters", false, "If true set cluster kinematics to reflect subtraction" }
privateinherited

Definition at line 48 of file HIJetSubtractorToolBase.h.

48{ this, "UpdateClusters", false, "If true set cluster kinematics to reflect subtraction" };

◆ m_useCells

Gaudi::Property< bool > HIJetSubtractorToolBase::m_useCells { this, "UseCells", true, "Boolean switch for cells usage" }
privateinherited

Definition at line 49 of file HIJetSubtractorToolBase.h.

49{ this, "UseCells", true, "Boolean switch for cells usage" };

◆ m_useSamplings

Gaudi::Property< bool > HIJetClusterSubtractorTool::m_useSamplings { this, "UseSamplings", true, "Boolean for samplings use" }
private

Definition at line 68 of file HIJetClusterSubtractorTool.h.

68{ this, "UseSamplings", true, "Boolean for samplings use" };

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