ATLAS Offline Software
Loading...
Searching...
No Matches
HIJetMaxOverMeanTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
5
7
9{
10 declareInterface<IJetDecorator>(this);
11}
12
13
15{
16 if( m_jetContainerName.empty() ){
17 ATH_MSG_ERROR("HIJetMaxOverMeanTool needs to have its input jet container name configured!");
18 return StatusCode::FAILURE;
19 }
20 //Preped Jet Container Name
23
24 ATH_CHECK( m_jetMaxConstituentETKey.initialize() );
25 ATH_CHECK( m_jetMaxOverMeanKey.initialize() );
26
27 return StatusCode::SUCCESS;
28
29}
30
32 {
33 //Decorator handlers
36 for(const xAOD::Jet* jet : jets)
37 {
38 float max=-999;
39 float sum=0;
40 float count=0;
41 const xAOD::JetConstituentVector constituents = jet->getConstituents();
42 for (const auto *constituent : constituents)
43 {
44 float et=constituent->e()/std::cosh(constituent->eta());
45 if(et > max) max=et;
46 sum+=et;
47 count++;
48 }
49 if(count==0.) sum=0;
50 else sum/=count;
51 float D=0;
52 if(sum!=0.) D=max/sum;
53
54 // set the attributes
55 jetMaxConstituentETDecorHandle(*jet) = max;
56 jetMaxOverMeanDecorHandle(*jet) = D;
57
58 }
59 return StatusCode::SUCCESS;
60}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for adding a decoration to an object.
#define max(a, b)
Definition cfImp.cxx:41
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetMaxConstituentETKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetMaxOverMeanKey
HIJetMaxOverMeanTool(const std::string &t)
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_jetContainerName
Handle class for adding a decoration to an object.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
A vector of jet constituents at the scale used during jet finding.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Extra patterns decribing particle interation process.