Retrieve all the data.
This is largely a chopped copy of TrkJiveXML/TrackRetriever.
100 {
101
102
103 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Retrieving AOD TrackParticle" <<
endmsg;
104
105
106 typedef std::pair< Rec::TrackParticleContainer , std::string > tracksNamePair;
107 std::vector< tracksNamePair > requestedTrackColls;
108
109
110 const Rec::TrackParticleContainer* tracks = NULL ;
112 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve requested priority track collection "
114 } else {
115
117 }
118
119
120
121
124 const Rec::TrackParticleContainer* tracks = NULL ;
126 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve requested track collection " << (*CollNameItr) <<
endmsg;
127 continue ;
128 }
129
130
131
132
133
134
135
136
137
138 requestedTrackColls.push_back( tracksNamePair(*tracks,(*CollNameItr)) );
139
140 }
141
142
144
145
146 SG::ConstIterator<Rec::TrackParticleContainer> trackCollIter, trackCollEnd;
148 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve track collection iterator" <<
endmsg;
149 return StatusCode::SUCCESS;
150 }
151
152
153 for (; trackCollIter!=trackCollEnd; ++trackCollIter) {
154
155
157
158
159 if ((trackCollIter.
key().find(
"HLT",0) != std::string::npos) && (!
m_doWriteHLT)){
160 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Ignoring HLT-AutoKey collection " << trackCollIter.
key() <<
endmsg;
161 continue ;
162 }
163
164
165
166 if ( (trackCollIter.
key() ==
"AtlfastTrackParticles")) {
167 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Always ignoring collection " << trackCollIter.
key() <<
endmsg;
168 continue ;
169 }
170
171
173 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Unable to retrieve collection " << trackCollIter.
key() <<
endmsg;
174 continue ;
175 }
176
177
178
179
180
181
182 requestedTrackColls.push_back(tracksNamePair(*tracks,trackCollIter.
key()));
183 }
184 }
185
190
191
192 std::vector<tracksNamePair>::iterator tracksNamePairItr = requestedTrackColls.begin();
193 for ( ; tracksNamePairItr != requestedTrackColls.end(); ++tracksNamePairItr){
194
195
196 const Rec::TrackParticleContainer* tpc =&((*tracksNamePairItr).first);
197 std::string collectionName = (*tracksNamePairItr).second;
198
199
200 if ( tpc->
size() == 0){
201 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Ignoring empty track collection " << collectionName <<
endmsg;
202 } else {
203 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Retrieving data for track collection " << collectionName <<
endmsg;
204 }
205
206
212
213
220
225
226 std::string labelStr = "unknownHits";
227
228
230 for (tpcItr=tpc->
begin(); tpcItr!=tpc->
end(); ++tpcItr) {
231
236 chi2.push_back(
DataType((*tpcItr)->fitQuality()->chiSquared()));
237 numDoF.push_back(
DataType((*tpcItr)->fitQuality()->numberDoF()));
238 trackAuthor.push_back( (*tpcItr)->info().trackFitter() );
239
240 const Trk::TrackSummary* tSum = (*tpcItr)->trackSummary();
241 if(tSum){
246 labelStr =
"_PixelHits"+
DataType( nPixelHits ).toString() +
"_SCTHits"+
DataType( nSCTHits ).toString() +
247 "_BLayerHits"+
DataType( nBLayerHits ).toString() +
"_TRTHits"+
DataType( nTRTHits ).toString() ;
248 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Author: " << (*tpcItr)->info().trackFitter() <<
" Pixel hits: " <<
nPixelHits
249 <<
", SCT hits: " <<
nSCTHits <<
" BLayer hits: " << nBLayerHits
250 <<
", TRT hits: " <<
nTRTHits <<
", pT[GeV]= " << (*tpcItr)->perigee()->pT()/1000. <<
endmsg;
251 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Label: " << labelStr <<
endmsg;
252 }
253
254 if (((*tpcItr)->perigee()->parameters())[
Trk::qOverP]==0) {
256 } else {
257 pt.push_back(
DataType((*tpcItr)->perigee()->charge() * (*tpcItr)->perigee()->pT()/1000.));
258 }
259
263
264 if ((*tpcItr)->perigee()->parameters()[
Trk::theta] == 0.) {
266 } else {
268 }
269
270
271
272
273
276
278 dynamic_cast<const Trk::
Perigee*>((*tpcItr)->perigee());
279 const
AmgSymMatrix(5)* covariance = per ? per->covariance() : NULL;
280 if (per && covariance) {
281
284 const Trk::JacobianThetaPToCotThetaPt theJac( measuredTheta, measuredQoverp );
285 covVert = covariance->similarity(theJac);
286 }else{
287 for ( int ii=0; ii<20; ii++){
288 covVert(ii) = 0.;
289 }
290 }
291
292
293
294 const long scale = 10000;
295
301
302
303 for (
int i=0;
i<10;
i++){
305 }
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
324
325 }
326
327
329
333 DataMap[
"trackAuthor"] = trackAuthor;
334 DataMap[
"numPolyline"] = numPolyline;
335
336
337
338
346 }
347
348
349 if ( polylineX.size() > 0){
350 std::string numPolyPerTrack =
DataType(polylineX.size()/((
double)
id.size())).toString();
351 DataMap[
"polylineX multiple=\"" + numPolyPerTrack +
"\""] = polylineX;
352 DataMap[
"polylineY multiple=\"" + numPolyPerTrack +
"\""] = polylineY;
353 DataMap[
"polylineZ multiple=\"" + numPolyPerTrack +
"\""] = polylineZ;
354 }
355
356
358 return StatusCode::RECOVERABLE;
359
360
361 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
dataTypeName() <<
" collection " << collectionName <<
" retrieved with " <<
id.size() <<
" entries"<<
endmsg;
362 }
363
364
365 return StatusCode::SUCCESS;
366
367 }
#define AmgSymMatrix(dim)
ServiceHandle< StoreGateSvc > & evtStore()
bool msgLvl(const MSG::Level lvl) const
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.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual std::string dataTypeName() const
Return the name of the data type.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
const std::string & key() const
Get the key string with which the current object was stored.
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
double chi2(TH1 *h0, TH1 *h1)
std::string label(const std::string &format, int i)
float nSCTHits(const U &p)
float nTRTHits(const U &p)
float nPixelHits(const U &p)
void getPolylineFromTrackParticle(const Rec::TrackParticle *track, DataVect &polylineX, DataVect &polylineY, DataVect &polylineZ, DataVect &numPolyline)
Get polyline hits if available.
std::map< std::string, DataVect > DataMap
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
@ numberOfSCTHits
number of SCT holes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHits
number of TRT outliers
@ numberOfInnermostPixelLayerHits
these are the hits in the 1st pixel layer