Skip to content
Snippets Groups Projects

WIP: fix MCLinking in TDR branch for LHCb::Tracks

Closed Renato Quagliani requested to merge TDR-rquaglia_fixhackMCLinking into TDR
2 files
+ 15
22
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -6,14 +6,8 @@
#include "GaudiKernel/IDataManagerSvc.h"
#include "GaudiKernel/SmartIF.h"
// from Event
#include "Event/Track.h"
#include "Linker/LinkerWithKey.h"
#include "Event/MCParticle.h"
#include "Event/MCVertex.h"
// local
#include "PrTrackConverter.h"
@@ -30,8 +24,6 @@ DECLARE_COMPONENT( PrTrackConverter )
declareProperty( "RootOfOutContainers", m_rootOfOutContainers = "/Event/Rec/Track/Copy" );
///Event/Rec/Track/Copy....
declareProperty( "SingleContainer", m_singleContainer = "" );
declareProperty( "TrackContainerIDs", m_containerIDs = { LHCb::Track::classID() + 0x60000, LHCb::Track::Selection::classID() });
}
@@ -84,37 +76,39 @@ StatusCode PrTrackConverter::execute() {
DataObject* tmp(NULL);
sc = eventSvc()->findObject( id, tmp );
if ( sc && NULL != tmp ) {
//for( unsigned int clID : m_containerIDs){
//info()<<"tmp->clID() = "<<tmp->clID() << " clID match "<<clID<<endmsg;
//if ( tmp->clID() == clID ) {
trackContainers.push_back( id );
//}
//}
}
}
}else{
info()<<"mgr->objectLeaves doesnt work"<<endmsg;
}
}
info()<<"trackContainers.size() = "<<trackContainers.size()<<endmsg;
if( msgLevel::DEBUG){
debug()<<"Amoung of loaded TrackContainers = "<<trackContainers.size()<<endmsg;
}
for ( std::vector<std::string>::iterator itS = trackContainers.begin();
trackContainers.end() != itS; ++itS ) {
info() << "processing container: " << *itS << endmsg ;
if( msgLevel::DEBUG){
debug() << "Containers found, append to list : " << *itS << endmsg ;
}
// Retrieve the Tracks
std::vector<LHCb::Track>* tracks = getIfExists<std::vector<LHCb::Track> > ( *itS );
if ( tracks->size() ==0 ) {
info()<<"Container "<<*itS<< " empty"<<endmsg;
info()<<"Container "<<*itS<< " is empty"<<endmsg;
continue;
}
// Loop over the Tracks
LHCb::Tracks* tracks_copy = new LHCb::Tracks();
std::string track_cont_out = *itS;
info()<<"in track container = "<<(*itS)<<endmsg;
if( msgLevel::DEBUG){
debug()<<"Processing track container = "<<(*itS)<<". It contains "<<tracks->size() <<" Tracks" << endmsg;
}
boost::replace_all( track_cont_out, m_rootOfContainers, m_rootOfOutContainers );
info()<<"Will re-create a keyed container afterward at TS location : "<<track_cont_out<<endmsg;
if( msgLevel::DEBUG){
debug()<<"Copied Keyed track container at location "<<track_cont_out<<endmsg;
}
put( tracks_copy , track_cont_out );
info()<<"Not working the put! "<<track_cont_out<<endmsg;
for( auto& original_track : *tracks ){
LHCb::Track* tr = new LHCb::Track;
Loading