particle identification function returning a probability.
88{
89
90 unsigned int pixelhits = 0;
91 nUsedHits=0;
92 nUsedIBLOverflowHits=0;
93 float Pixel_sensorthickness=.025;
94 float IBL_3D_sensorthickness=.023;
95 float IBL_PLANAR_sensorthickness=.020;
96 float dEdxValue=0;
97
98
100 std::multimap<float,int> dEdxMap;
101
102
104 if (recoTrackStates) {
107
108
109 for (; tsosIter != tsosIterEnd; ++tsosIter) {
110 const Trk::MeasurementBase *measurement = (*tsosIter)->measurementOnTrack();
112 if (!(*tsosIter)->trackParameters()) {
113 msg(MSG::WARNING) <<
"No track parameters available for a state of type measurement, returning -1" <<
endmsg;
114 msg(MSG::WARNING) <<
"Don't run this tool on slimmed tracks!" <<
endmsg;
115 return -1;
116 }
117
118 const InDet::PixelClusterOnTrack* pixclus = nullptr;
120 const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(measurement);
122 pixclus = static_cast<const InDet::PixelClusterOnTrack*>(tmpRio);
123 }
124 }
125 if (pixclus) {
126
132
133 float dotProd = (*tsosIter)->trackParameters()->momentum().dot(
134 (*tsosIter)->trackParameters()->associatedSurface().normal());
135 float cosalpha =
136 fabs(dotProd / (*tsosIter)->trackParameters()->momentum().mag());
137
138 if (std::abs(cosalpha)<0.16) { continue; }
139
141
142
143 int iblOverflow=0;
145
146
147 int overflowIBLToT =
149 ->getFEI4OverflowToT();
151
152 for (int pixToT : ToTs) {
153 if (pixToT >= overflowIBLToT) {
154
155 iblOverflow = 1;
156 break;
157 }
158 }
159
160
161
162 if (((eta_module >= -10 && eta_module <= -7) ||
163 (eta_module >= 6 && eta_module <= 9)) &&
164 (fabs(locy) < 10. &&
165 (locx > -8.33 &&
166 locx < 8.3))) {
168 dEdxMap.insert(std::pair<float, int>(dEdxValue, iblOverflow));
169 pixelhits++;
170 if (iblOverflow == 1) {
171 nUsedIBLOverflowHits++;
172 }
173 } else if ((eta_module >= -6 && eta_module <= 5) &&
174 (fabs(locy) < 20. &&
175 (locx > -8.33 &&
176 locx < 8.3))) {
177
178 dEdxValue =
180 dEdxMap.insert(std::pair<float, int>(dEdxValue, iblOverflow));
181 pixelhits++;
182 if (iblOverflow == 1) {
183 nUsedIBLOverflowHits++;
184 }
185 } else {
186 dEdxValue=-1;
187 }
188
189 }
190
191 else if(bec==0 && fabs(locy)<30. && ((locx>-8.20 && locx<-0.60) || (locx>0.50 && locx<8.10))) {
193 dEdxMap.insert(std::pair<float,int>(dEdxValue, iblOverflow));
194 pixelhits++;
195 }
196 else if (std::abs(bec)==2 && fabs(locy)<30. && ((locx>-8.15 && locx<-0.55) || (locx>0.55 && locx<8.15))) {
198 dEdxMap.insert(std::pair<float,int>(dEdxValue, iblOverflow));
199 pixelhits++;
200 }
201 }
202 }
203 }
204 }
205
206
207 float averagedEdx=0.;
208 nUsedHits=0;
209 int IBLOverflow=0;
210
211 for (std::pair<float,int> itdEdx : dEdxMap) {
212 if (itdEdx.second==0) {
213 averagedEdx += itdEdx.first;
214 nUsedHits++;
215 }
216 if (itdEdx.second>0) { IBLOverflow++; }
217
218
219 if (((int)pixelhits>=5) and ((int)nUsedHits>=(int)pixelhits-2)) { break; }
220
221
222 if ((int)IBLOverflow>0 and ((int)pixelhits==3) and (int)nUsedHits==1) { break; }
223 if ((int)IBLOverflow>0 and ((int)pixelhits==4) and (int)nUsedHits==2) { break; }
224
225 if (((int)pixelhits > 1) and ((int)nUsedHits >=(int)pixelhits-1)) { break; }
226
227 if ((int)IBLOverflow>0 and (int)pixelhits==1) {
228 averagedEdx=itdEdx.first;
229 break;
230 }
231 }
232
233 if (nUsedHits>0 or (nUsedHits==0 and(int)IBLOverflow>0 and (int)pixelhits==1)) {
234 if (nUsedHits>0) { averagedEdx=averagedEdx/nUsedHits; }
235
237 ATH_MSG_DEBUG(
"Used hits: " << nUsedHits <<
", IBL overflows: " << IBLOverflow );
238 ATH_MSG_DEBUG(
"Original number of measurements = " << pixelhits <<
"( map size = " << dEdxMap.size() <<
")");
239 return averagedEdx;
240 }
241 return -1;
242}
double charge(const T &p)
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
virtual const PixelCluster * prepRawData() const override final
returns the PrepRawData - is a SiCluster in this scope
const std::vector< int > & totList() const
float totalCharge() const
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
Identifier identify() const
return the identifier -extends MeasurementBase
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
DataVector< const Trk::TrackStateOnSurface > TrackStates