ATLAS Offline Software
NnPixelClusterSplitProbTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 
20 #include "VxVertex/RecVertex.h"
21 
22 
23 
24 namespace InDet
25 {
26 
27 
28  NnPixelClusterSplitProbTool::NnPixelClusterSplitProbTool(const std::string& t, const std::string& n, const IInterface* p)
29  :base_class(t,n,p)
30  {
31  }
32 
33 
35  {
36 
37 
38  if (m_NnClusterizationFactory.retrieve().isFailure())
39  {
40  ATH_MSG_ERROR(" Unable to retrieve "<< m_NnClusterizationFactory );
41  return StatusCode::FAILURE;
42  }
43 
45 
46  ATH_MSG_DEBUG(" Cluster split prob tool initialized successfully "<< m_NnClusterizationFactory );
47  return StatusCode::SUCCESS;
48  }
49 
50 
52  {
53 
54  Amg::Vector3D beamSpotPosition(0,0,0);
57  beamSpotPosition = beamSpotHandle->beamPos();
58  }
59 
60  std::vector<double> vectorOfProbs=m_NnClusterizationFactory->estimateNumberOfParticles(origCluster,beamSpotPosition);
61 
62  ATH_MSG_VERBOSE(" Got splitProbability, size of vector: " << vectorOfProbs.size() );
63 
64  if (vectorOfProbs.empty())
65  {
66  std::vector<double> vectorOfSplitProbs;
67  vectorOfSplitProbs.push_back(-100);
68  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
69  ATH_MSG_VERBOSE(" Returning single split prob equal to -100 " );
70  return clusterSplitProb;
71  }
72 
73 
75  " P(1): " << vectorOfProbs[0] <<
76  " P(2): " << vectorOfProbs[1] <<
77  " P(>=3): " << vectorOfProbs[2] );
78 
79 
80  return compileSplitProbability(vectorOfProbs);
81  }
82 
84  {
85 
86  Amg::Vector3D beamSpotPosition(0,0,0);
89  beamSpotPosition = beamSpotHandle->beamPos();
90  }
91 
92  std::vector<double> vectorOfProbs=m_NnClusterizationFactory->estimateNumberOfParticles(origCluster, trackParameters.associatedSurface(), trackParameters);
93 
94  ATH_MSG_VERBOSE(" Got splitProbability, size of vector: " << vectorOfProbs.size() );
95 
96  if (vectorOfProbs.empty())
97  {
98  std::vector<double> vectorOfSplitProbs;
99  vectorOfSplitProbs.push_back(-100);
100  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
101  ATH_MSG_VERBOSE(" Returning single split prob equal to -100 " );
102  return clusterSplitProb;
103  }
104 
105 
107  " P(1): " << vectorOfProbs[0] <<
108  " P(2): " << vectorOfProbs[1] <<
109  " P(>=3): " << vectorOfProbs[2] );
110 
111 
112  return compileSplitProbability(vectorOfProbs);
113  }
114 
115 
116 
118  {
119 
120 
121  double sum=0;
122 
123  std::vector<double>::iterator begin=vectorOfProbs.begin();
124  std::vector<double>::iterator end=vectorOfProbs.end();
125 
126  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
127  {
128  sum+=*iter;
129  }
130 
131 
132  ATH_MSG_VERBOSE(" Sum of cluster probabilities is: "<<sum);
133 
134  std::vector<double> vectorOfSplitProbs;
135 
136  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
137  {
138  (*iter)/=sum;
139  }
140 
141  if (m_priorMultiplicityContent.value().size()<vectorOfProbs.size())
142  {
143  ATH_MSG_ERROR("Prior compatibilities count " << m_priorMultiplicityContent.value().size() << " is too small: please correct through job properties.");
144  return InDet::PixelClusterSplitProb(std::vector<double>());
145  }
146 
147  double psum=0;
148  int count=0;
149  for (std::vector<double>::iterator iter=begin;iter!=end;++iter,++count)
150  {
151  psum+=(*iter)/m_priorMultiplicityContent.value()[count];
152  }
153 
154  count=0;
155  for (std::vector<double>::iterator iter=begin;iter!=end;++iter,++count)
156  {
157  (*iter)/=m_priorMultiplicityContent.value()[count];
158  (*iter)/=psum;
159  }
160 
161  double sumTest=0;
162 
163  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
164  {
165  ATH_MSG_VERBOSE("After update prob is: " << *iter);
166  sumTest+=*iter;
167  }
168 
169  ATH_MSG_VERBOSE(" Sum of cluster probabilities is: "<<sumTest);
170  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
171  {
172  if (iter!=begin)
173  {
174  vectorOfSplitProbs.push_back(*iter);
175  }
176  }
177 
178  ATH_MSG_VERBOSE(" normalized P(1->2): " << vectorOfSplitProbs[0] << " P(2->3): " << vectorOfSplitProbs[1] );
179 
180  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
181 
182  ATH_MSG_VERBOSE("SplitProb: " << clusterSplitProb.splitProbability(2) << " -->3 " << clusterSplitProb.splitProbability(3) );
183 
184  return clusterSplitProb;
185  }
186 
187 
188 
189 
190 
191 }//end namespace
192 
193 
194 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
RecVertex.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
InDet::PixelClusterSplitProb
Definition: PixelClusterSplitProb.h:25
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
InDet::NnPixelClusterSplitProbTool::NnPixelClusterSplitProbTool
NnPixelClusterSplitProbTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: NnPixelClusterSplitProbTool.cxx:28
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
InDet::NnPixelClusterSplitProbTool::m_priorMultiplicityContent
DoubleArrayProperty m_priorMultiplicityContent
Definition: NnPixelClusterSplitProbTool.h:58
PixelClusterSplitProb.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
IPixelClusterSplitProbTool.h
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::NnPixelClusterSplitProbTool::m_useBeamSpotInfo
BooleanProperty m_useBeamSpotInfo
Definition: NnPixelClusterSplitProbTool.h:60
InDet::NnPixelClusterSplitProbTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: NnPixelClusterSplitProbTool.h:56
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
InDet::NnPixelClusterSplitProbTool::compileSplitProbability
InDet::PixelClusterSplitProb compileSplitProbability(std::vector< double > &vectorOfProbs) const
Definition: NnPixelClusterSplitProbTool.cxx:117
InDet::NnPixelClusterSplitProbTool::m_NnClusterizationFactory
ToolHandle< NnClusterizationFactory > m_NnClusterizationFactory
Definition: NnPixelClusterSplitProbTool.h:55
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
InDet::NnPixelClusterSplitProbTool::initialize
StatusCode initialize() override
Definition: NnPixelClusterSplitProbTool.cxx:34
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDet::NnPixelClusterSplitProbTool::splitProbability
virtual InDet::PixelClusterSplitProb splitProbability(const InDet::PixelCluster &origCluster) const override
Definition: NnPixelClusterSplitProbTool.cxx:51
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
NnPixelClusterSplitProbTool.h
NnClusterizationFactory.h
InDet::PixelClusterSplitProb::splitProbability
double splitProbability(unsigned int nParticles=2) const
return method : total split probability
Definition: PixelClusterSplitProb.h:60