ATLAS Offline Software
Loading...
Searching...
No Matches
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
24namespace 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
44 ATH_CHECK(m_beamSpotKey.initialize());
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the Pixel subdetector.
ToolHandle< NnClusterizationFactory > m_NnClusterizationFactory
virtual InDet::PixelClusterSplitProb splitProbability(const InDet::PixelCluster &origCluster) const override
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
NnPixelClusterSplitProbTool(const std::string &t, const std::string &n, const IInterface *p)
InDet::PixelClusterSplitProb compileSplitProbability(std::vector< double > &vectorOfProbs) const
return object of the IPixelClusterSplitProbTool
double splitProbability(unsigned int nParticles=2) const
return method : total split probability
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Eigen::Matrix< double, 3, 1 > Vector3D
Primary Vertex Finder.
ParametersBase< TrackParametersDim, Charged > TrackParameters