This is an old revision of the document!
Removing TT hits from long tracks can be a good check to see effects which are caused by the TT.
Add the following two source files f.ex. to Tr/TrackTools. <code c> Gaudi #include “GaudiKernel/AlgFactory.h” #include <boost/foreach.hpp> track interfaces #include “Kernel/ISTChannelIDSelector.h” #include “Event/Track.h”
#include “Kernel/LHCbID.h” #include “TrackRemoveSTIDs.h”
using namespace LHCb;
DECLARE_ALGORITHM_FACTORY( TrackRemoveSTIDs );
TrackRemoveSTIDs::TrackRemoveSTIDs(const std::string& name,
ISvcLocator* pSvcLocator): GaudiAlgorithm(name, pSvcLocator)
{
// constructor
this→declareProperty(“selectorType”, m_selectorType = “STSelectChannelIDByElement”); this→declareProperty(“inputLocation”, m_inputLocation = TrackLocation::Default); }
TrackRemoveSTIDs::~TrackRemoveSTIDs() {
// destructor
}
StatusCode TrackRemoveSTIDs::initialize() {
// Initializes TsaInitialization at the begin of program execution.
StatusCode sc = GaudiAlgorithm::initialize(); if (sc.isFailure()){ return Error("Failed to initialize"); }
// da selector m_selector = tool<ISTChannelIDSelector>(m_selectorType, "RemovalSelector");
return StatusCode::SUCCESS;
}
StatusCode TrackRemoveSTIDs::execute(){
Tracks* trackCont = get<Tracks>(m_inputLocation); // loop and remove the hits for (Tracks::const_iterator iterT = trackCont->begin(); iterT != trackCont->end(); ++iterT){ if ((*iterT)->type() == Track::Long) removeHits(*iterT); } // iterT
return StatusCode::SUCCESS;
};
void TrackRemoveSTIDs::removeHits(Track* aTrack) const{
// get the list of ones to remove.... std::vector<LHCb::LHCbID> tmpCont; const std::vector<LHCb::LHCbID>& ids = aTrack->lhcbIDs(); BOOST_FOREACH(LHCb::LHCbID id, ids) { if (m_selector->select(id.stID()) == true) tmpCont.push_back(id); }
BOOST_FOREACH(LHCb::LHCbID dead, tmpCont){ aTrack->removeFromLhcbIDs(dead); }
}
</>