ATLAS Offline Software
Loading...
Searching...
No Matches
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
23namespace 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
#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.
return object of the IPixelClusterSplitProbTool
double splitProbability(unsigned int nParticles=2) const
return method : total split probability
virtual InDet::PixelClusterSplitProb splitProbability(const InDet::PixelCluster &origCluster) const override
InDet::PixelClusterSplitProb compileSplitProbability(std::vector< double > &vectorOfProbs) const
ToolHandle< TruthClusterizationFactory > m_truthClusterizationFactory
TruthPixelClusterSplitProbTool(const std::string &t, const std::string &n, const IInterface *p)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Primary Vertex Finder.
ParametersBase< TrackParametersDim, Charged > TrackParameters