Removing TT hits from long tracks can be a good check to see effects which are caused by the TT. TO BE FINISHED WHEN IT WORKED AS I THOUGHT
Add the following two source files f.ex. to Tr/TrackTools. TrackRemoveSTIDs.cpp
// 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() { 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); } }
and TrackRemoveSTIDs.h
// $Id: $ #ifndef _TrackRemoveSTIDs_H_ #define _TrackRemoveSTIDs_H_ /** @class TrackRemoveSTIDs TrackRemoveSTIDs.h * * Clean out tracks with some criteria from the container * * @author M.Needham * @date 30/05/2006 */ #include "GaudiAlg/GaudiAlgorithm.h" #include <string> #include <vector> class ISTChannelIDSelector; namespace LHCb{ class Track; } class TrackRemoveSTIDs: public GaudiAlgorithm { public: // Constructors and destructor TrackRemoveSTIDs(const std::string& name, ISvcLocator* pSvcLocator); virtual ~TrackRemoveSTIDs(); virtual StatusCode initialize(); virtual StatusCode execute(); private: std::string m_inputLocation; ISTChannelIDSelector* m_selector; std::string m_selectorType; void removeHits(LHCb::Track* aTrack) const; }; #endif
In your options file, do something like:
from Configurables import TrackRemoveSTIDs hitRemover = TrackRemoveSTIDs('hitRemover') selector = STSelectChannelIDByElement("ToolSvc.RemovalSelector") selector.elementNames = ["TTa", "TTb"] selector.DetType = "TT" GaudiSequencer("myMC09SelJpsi2MuMuFilterSequence").Members += [myveloClusters, RawBankToSTClusterAlg("CreateTTClusters"), createITClusters, createITLiteClusters, hitRemover]