ATLAS Offline Software
HIJetSignificanceTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
11  : asg::AsgTool(name)
12 {
13  declareInterface<IJetDecorator>(this);
14 }
15 
16 
18 {
19  //First we chekc that jet container name is defined
20  if( m_jetContainerName.empty() ){
21  ATH_MSG_ERROR("HIJetSignificanceTool needs to have its input jet container name configured!");
22  return StatusCode::FAILURE;
23  }
24  //Preped Jet Container Name
30 
31  //Keys Initialization
32  ATH_CHECK( m_jetSignificanceKey.initialize() );
33  ATH_CHECK( m_jetCellSignificanceKey.initialize() );
34  ATH_CHECK( m_jetCellSigSamplingKey.initialize() );
35  ATH_CHECK( m_jetNMaxSigTileKey.initialize() );
36  ATH_CHECK( m_jetSignificanceTileKey.initialize() );
37 
38  return StatusCode::SUCCESS;
39 }
40 
41 
43 {
44  //From decor keys to handlers
50 
51  //Here we were passing through JetConstituentVector. Now we access this directly and in a loop of jets, not for single instances
52  //const xAOD::JetConstituentVector constituents = jets.getConstituents();
53  //for(xAOD::JetConstituentVector::iterator itr = constituents.begin(); itr != constituents.end(); ++itr)
54  for(const xAOD::Jet* jet : jets)
55  {
56  float significance=0;
57  float cell_sig=0;
58  int cell_sig_sampling=-1;
59  int n_sig_max_tile=0;
60  float sig_tile=0;
61  float E_tile=0;
62  // loop over raw constituents. Look for clusters
63  size_t num = jet->numConstituents();
64  for(size_t i = 0; i < num; i++)
65  {
66  const xAOD::CaloCluster* cl=static_cast<const xAOD::CaloCluster*>( (jet->rawConstituent(i)) );
67  if( !cl) continue;
68 
69  double m=0;
70  double m2=0;
71  unsigned int samp_max=CaloSampling::Unknown;
72 
73 
74  double cl_E=cl->altE(); //signifiance moments were computed from unsubtracted cell energies
75  double sigma_cl=0;
76 
77  for(unsigned int isample=12; isample<21; isample++) E_tile+=cl->eSample( (CaloSampling::CaloSample) isample);
78 
79  if(cl->retrieveMoment(xAOD::CaloCluster::SIGNIFICANCE,m) )
80  {
81  sigma_cl=cl_E/m;
82  significance+=sigma_cl*sigma_cl;
83  }
84  if(cl->retrieveMoment(xAOD::CaloCluster::CELL_SIG_SAMPLING,m2))
85  {
86  samp_max=static_cast<unsigned int>(m2);
87  if(CaloSampling::getSamplingName(samp_max).find("Tile")!=std::string::npos)
88  {
89  n_sig_max_tile++;
90  sig_tile+=sigma_cl*sigma_cl;
91  }
92  }
93 
94  if( cl->retrieveMoment(xAOD::CaloCluster::CELL_SIGNIFICANCE,m) )
95  {
96  if( m > cell_sig )
97  {
98  cell_sig=m;
99  if(samp_max!=CaloSampling::Unknown) cell_sig_sampling=samp_max;
100  }
101  }
102  }
103  significance=jet->jetP4(xAOD::JetEMScaleMomentum).E()/std::sqrt(significance);
104  sig_tile=E_tile/std::sqrt(sig_tile);
105 
106  // set the attributes
107  jetSignificanceDecorHandle(*jet) = significance;
108  jetCellSignificanceDecorHandle(*jet) = cell_sig;
109  jetCellSigSamplingDecorHandle(*jet) = cell_sig_sampling;
110  jetNMaxSigTileDecorHandle(*jet) = n_sig_max_tile;
111  jetSignificanceTileDecorHandle(*jet) = sig_tile;
112 
113  }//End of loop over jets
114 
115  return StatusCode::SUCCESS;
116 }
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
HIJetSignificanceTool::m_jetSignificanceTileKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetSignificanceTileKey
Definition: HIJetSignificanceTool.h:46
asg
Definition: DataHandleTestTool.h:28
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCluster.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::CaloCluster_v1::CELL_SIG_SAMPLING
@ CELL_SIG_SAMPLING
CaloSample of the cell with the largest |E|/sig.
Definition: CaloCluster_v1.h:161
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
HIJetSignificanceTool::HIJetSignificanceTool
HIJetSignificanceTool(const std::string &name)
Definition: HIJetSignificanceTool.cxx:10
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HIJetSignificanceTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: HIJetSignificanceTool.h:48
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
HIJetSignificanceTool::m_jetCellSignificanceKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetCellSignificanceKey
Definition: HIJetSignificanceTool.h:43
xAOD::JetEMScaleMomentum
@ JetEMScaleMomentum
Definition: JetTypes.h:28
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
HIJetSignificanceTool::m_jetSignificanceKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetSignificanceKey
Definition: HIJetSignificanceTool.h:42
HIJetSignificanceTool.h
HIJetSignificanceTool::m_jetNMaxSigTileKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetNMaxSigTileKey
Definition: HIJetSignificanceTool.h:45
HIJetSignificanceTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: HIJetSignificanceTool.cxx:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::CaloCluster_v1::SIGNIFICANCE
@ SIGNIFICANCE
Cluster significance.
Definition: CaloCluster_v1.h:157
HIJetSignificanceTool::m_jetCellSigSamplingKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetCellSigSamplingKey
Definition: HIJetSignificanceTool.h:44
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::CaloCluster_v1::CELL_SIGNIFICANCE
@ CELL_SIGNIFICANCE
Cell significance = E/sig of the cell with the largest |E|/sig.
Definition: CaloCluster_v1.h:159
CaloSampling::getSamplingName
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
Definition: Calorimeter/CaloGeoHelpers/Root/CaloSampling.cxx:18
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
HIJetSignificanceTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: HIJetSignificanceTool.cxx:17