103 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Retrieving AOD TrackParticle" <<
endmsg;
106 typedef std::pair< Rec::TrackParticleContainer , std::string > tracksNamePair;
107 std::vector< tracksNamePair > requestedTrackColls;
112 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve requested priority track collection "
126 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve requested track collection " << (*CollNameItr) <<
endmsg;
138 requestedTrackColls.push_back( tracksNamePair(*tracks,(*CollNameItr)) );
148 if (
msgLvl(MSG::WARNING))
msg(MSG::WARNING) <<
"Unable to retrieve track collection iterator" <<
endmsg;
149 return StatusCode::SUCCESS;
153 for (; trackCollIter!=trackCollEnd; ++trackCollIter) {
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;
166 if ( (trackCollIter.
key() ==
"AtlfastTrackParticles")) {
167 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Always ignoring collection " << trackCollIter.
key() <<
endmsg;
173 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Unable to retrieve collection " << trackCollIter.
key() <<
endmsg;
182 requestedTrackColls.push_back(tracksNamePair(*tracks,trackCollIter.
key()));
192 std::vector<tracksNamePair>::iterator tracksNamePairItr = requestedTrackColls.begin();
193 for ( ; tracksNamePairItr != requestedTrackColls.end(); ++tracksNamePairItr){
197 std::string collectionName = (*tracksNamePairItr).second;
200 if ( tpc->
size() == 0){
201 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Ignoring empty track collection " << collectionName <<
endmsg;
203 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
"Retrieving data for track collection " << collectionName <<
endmsg;
219 DataVect covMatrix; covMatrix.reserve(tpc->
size() * 15 );
226 std::string labelStr =
"unknownHits";
230 for (tpcItr=tpc->
begin(); tpcItr!=tpc->
end(); ++tpcItr) {
236 chi2.push_back(
DataType((*tpcItr)->fitQuality()->chiSquared()));
237 numDoF.push_back(
DataType((*tpcItr)->fitQuality()->numberDoF()));
238 trackAuthor.push_back( (*tpcItr)->info().trackFitter() );
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;
254 if (((*tpcItr)->perigee()->parameters())[
Trk::qOverP]==0) {
257 pt.push_back(
DataType((*tpcItr)->perigee()->charge() * (*tpcItr)->perigee()->pT()/1000.));
260 d0.push_back(
DataType(((*tpcItr)->perigee()->parameters())[
Trk::d0]/CLHEP::cm));
261 z0.push_back(
DataType((*tpcItr)->perigee()->parameters()[
Trk::z0]/CLHEP::cm));
264 if ((*tpcItr)->perigee()->parameters()[
Trk::theta] == 0.) {
265 cotTheta.push_back(
DataType(9999.));
278 dynamic_cast<const Trk::Perigee*
>((*tpcItr)->perigee());
279 const AmgSymMatrix(5)* covariance = per ? per->covariance() : NULL;
280 if (per && covariance) {
282 double measuredTheta = (*tpcItr)->perigee()->parameters()[
Trk::theta];
283 double measuredQoverp = (*tpcItr)->perigee()->parameters()[
Trk::qOverP];
285 covVert = covariance->similarity(theJac);
287 for (
int ii=0; ii<20; ii++){
294 const long scale = 10000;
296 covMatrix.push_back(
DataType(covVert(0)*scale/100.));
297 covMatrix.push_back(
DataType(covVert(1)*scale/100.));
298 covMatrix.push_back(
DataType(covVert(2)*scale/100.));
299 covMatrix.push_back(
DataType(covVert(3)*scale/100.));
300 covMatrix.push_back(
DataType(covVert(4)*scale/100.));
303 for (
int i=0; i<10; i++){
304 covMatrix.push_back(
DataType( 0. ));
333 DataMap[
"trackAuthor"] = trackAuthor;
334 DataMap[
"numPolyline"] = numPolyline;
344 DataMap[
"cotTheta"] = cotTheta;
345 DataMap[
"covMatrix multiple=\"15\""] = covMatrix;
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;
358 return StatusCode::RECOVERABLE;
361 if (
msgLvl(MSG::DEBUG))
msg(MSG::DEBUG) <<
dataTypeName() <<
" collection " << collectionName <<
" retrieved with " <<
id.size() <<
" entries"<<
endmsg;
365 return StatusCode::SUCCESS;
virtual std::string dataTypeName() const
Return the name of the data type.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
std::string m_PriorityTrackCollection
First track collections to retrieve, shown as default in Atlantis.
const std::string m_typeName
The data type that is generated by this retriever.
bool m_doWriteHLT
Wether to write HLTAutoKey objects.
std::vector< std::string > m_OtherTrackCollections
Track collections to retrieve in the sequence they are given, all if empty.
TrackParticleRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
void getPolylineFromTrackParticle(const Rec::TrackParticle *track, DataVect &polylineX, DataVect &polylineY, DataVect &polylineZ, DataVect &numPolyline)
Get polyline hits if available.