ATLAS Offline Software
TruthPixelClusterSplitProbTool.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 namespace InDet
24 {
25 
26 
27  TruthPixelClusterSplitProbTool::TruthPixelClusterSplitProbTool(const std::string& t, const std::string& n, const IInterface* p)
28  :base_class(t,n,p)
29  {
30  declareInterface<IPixelClusterSplitProbTool>(this);
31  }
32 
33 
35  {
36 
37  if (m_truthClusterizationFactory.retrieve().isFailure())
38  {
39  ATH_MSG_ERROR(" Unable to retrieve "<< m_truthClusterizationFactory );
40  return StatusCode::FAILURE;
41  }
42 
43  ATH_MSG_DEBUG(" Cluster split prob tool initialized successfully "<< m_truthClusterizationFactory );
44  return StatusCode::SUCCESS;
45  }
46 
47 
49  {
50  std::vector<double> vectorOfProbs=m_truthClusterizationFactory->estimateNumberOfParticles(origCluster);
51 
52  ATH_MSG_VERBOSE(" Got splitProbability, size of vector: " << vectorOfProbs.size() );
53 
54  if (vectorOfProbs.empty())
55  {
56  std::vector<double> vectorOfSplitProbs;
57  vectorOfSplitProbs.push_back(-100);
58  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
59  ATH_MSG_VERBOSE(" Returning single split prob equal to -100 " );
60  return clusterSplitProb;
61  }
62 
63 
65  " P(1): " << vectorOfProbs[0] <<
66  " P(2): " << vectorOfProbs[1] <<
67  " P(>=3): " << vectorOfProbs[2] );
68 
69 
70  return compileSplitProbability(vectorOfProbs);
71  }
72 
74  {
75  std::vector<double> vectorOfProbs=m_truthClusterizationFactory->estimateNumberOfParticles(origCluster);
76 
77  ATH_MSG_VERBOSE(" Got splitProbability, size of vector: " << vectorOfProbs.size() );
78 
79  if (vectorOfProbs.empty())
80  {
81  std::vector<double> vectorOfSplitProbs;
82  vectorOfSplitProbs.push_back(-100);
83  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
84  ATH_MSG_VERBOSE(" Returning single split prob equal to -100 " );
85  return clusterSplitProb;
86  }
87 
88 
90  " P(1): " << vectorOfProbs[0] <<
91  " P(2): " << vectorOfProbs[1] <<
92  " P(>=3): " << vectorOfProbs[2] );
93 
94 
95  return compileSplitProbability(vectorOfProbs);
96  }
97 
98 
99 
101  {
102 
103 
104  double sum=0;
105 
106  std::vector<double>::iterator begin=vectorOfProbs.begin();
107  std::vector<double>::iterator end=vectorOfProbs.end();
108 
109  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
110  {
111  sum+=*iter;
112  }
113 
114 
115  ATH_MSG_VERBOSE(" Sum of cluster probabilities is: "<<sum);
116 
117  std::vector<double> vectorOfSplitProbs;
118 
119  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
120  {
121  (*iter)/=sum;
122  }
123 
124  if (m_priorMultiplicityContent.size()<vectorOfProbs.size())
125  {
126  ATH_MSG_ERROR("Prior compatibilities count " << m_priorMultiplicityContent.size() << " is too small: please correct through job properties.");
127  return InDet::PixelClusterSplitProb(std::vector<double>());
128  }
129 
130  double psum=0;
131  int count=0;
132  for (std::vector<double>::iterator iter=begin;iter!=end;++iter,++count)
133  {
134  psum+=(*iter)/m_priorMultiplicityContent[count];
135  }
136 
137  count=0;
138  for (std::vector<double>::iterator iter=begin;iter!=end;++iter,++count)
139  {
141  (*iter)/=psum;
142  }
143 
144  double sumTest=0;
145 
146  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
147  {
148  ATH_MSG_VERBOSE("After update prob is: " << *iter);
149  sumTest+=*iter;
150  }
151 
152  ATH_MSG_VERBOSE(" Sum of cluster probabilities is: "<<sumTest);
153  for (std::vector<double>::iterator iter=begin;iter!=end;++iter)
154  {
155  if (iter!=begin)
156  {
157  vectorOfSplitProbs.push_back(*iter);
158  }
159  }
160 
161  ATH_MSG_VERBOSE(" normalized P(1->2): " << vectorOfSplitProbs[0] << " P(2->3): " << vectorOfSplitProbs[1] );
162 
163  PixelClusterSplitProb clusterSplitProb(vectorOfSplitProbs);
164 
165  ATH_MSG_VERBOSE("SplitProb: " << clusterSplitProb.splitProbability(2) << " -->3 " << clusterSplitProb.splitProbability(3) );
166 
167  return clusterSplitProb;
168  }
169 
170 
171 
172 
173 
174 }//end namespace
175 
176 
177 
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
InDet::TruthPixelClusterSplitProbTool::splitProbability
virtual InDet::PixelClusterSplitProb splitProbability(const InDet::PixelCluster &origCluster) const override
Definition: TruthPixelClusterSplitProbTool.cxx:48
InDet::PixelClusterSplitProb
Definition: PixelClusterSplitProb.h:25
TruthPixelClusterSplitProbTool.h
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
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
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
Trk::ParametersBase
Definition: ParametersBase.h:55
InDet::TruthPixelClusterSplitProbTool::TruthPixelClusterSplitProbTool
TruthPixelClusterSplitProbTool(const std::string &t, const std::string &n, const IInterface *p)
Definition: TruthPixelClusterSplitProbTool.cxx:27
TruthClusterizationFactory.h
InDet::TruthPixelClusterSplitProbTool::initialize
virtual StatusCode initialize() override
Definition: TruthPixelClusterSplitProbTool.cxx:34
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
InDet::TruthPixelClusterSplitProbTool::m_priorMultiplicityContent
DoubleArrayProperty m_priorMultiplicityContent
Definition: TruthPixelClusterSplitProbTool.h:55
InDet::TruthPixelClusterSplitProbTool::compileSplitProbability
InDet::PixelClusterSplitProb compileSplitProbability(std::vector< double > &vectorOfProbs) const
Definition: TruthPixelClusterSplitProbTool.cxx:100
InDet::TruthPixelClusterSplitProbTool::m_truthClusterizationFactory
ToolHandle< TruthClusterizationFactory > m_truthClusterizationFactory
Definition: TruthPixelClusterSplitProbTool.h:53
InDet::PixelClusterSplitProb::splitProbability
double splitProbability(unsigned int nParticles=2) const
return method : total split probability
Definition: PixelClusterSplitProb.h:60