Newer
Older
TB_Chris / TbIO / src / .svn / text-base / TbPacketRecycler.h.svn-base
  1. // Gaudi
  2. #include "GaudiKernel/IToolSvc.h"
  3.  
  4. // Tb/TbEvent
  5. #include "Event/TbHit.h"
  6. #include "Event/TbTrigger.h"
  7. #include "Event/TbCluster.h"
  8.  
  9. // Tb/TbKernel
  10. #include "TbKernel/TbAlgorithm.h"
  11. #include "TbKernel/TbConstants.h"
  12.  
  13. // Local
  14. #include "TbRawStream.h"
  15.  
  16. /** @class TbPacketRecycler TbPacketRecycler.h
  17. *
  18. * Algorithm to move unprocessed data in the overlap into the next event
  19. * designed to prevent clusters / tracks being cut between events
  20. *
  21. * @author Tim Evans (timothy.david.evans@cern.ch)
  22. * @date 2014-04-01
  23. */
  24.  
  25. class TbPacketRecycler : public TbAlgorithm {
  26. public:
  27. /// Constructor
  28. TbPacketRecycler(const std::string& name, ISvcLocator* pSvcLocator);
  29. /// Destructor
  30. virtual ~TbPacketRecycler() {}
  31.  
  32. virtual StatusCode initialize(); ///< Algorithm initialization
  33. virtual StatusCode execute(); ///< Algorithm execution
  34.  
  35. private:
  36. std::vector<TbRawStream*> m_streams;
  37. std::string m_hitLocation;
  38. std::string m_trgLocation;
  39. std::string m_clusLocation;
  40. template <typename TYPE>
  41. void recycle(KeyedContainer<TYPE, Containers::HashMap>* container,
  42. TbRawStream* s);
  43. void removeClusters(LHCb::TbClusters* clusters);
  44. template <typename TYPE>
  45. void addToCache(std::vector<TYPE*> cache, TYPE* packet) {
  46. cache.push_back(packet);
  47. }
  48. };
  49.  
  50. template <>
  51. void TbPacketRecycler::addToCache(std::vector<LHCb::TbHit*> cache,
  52. LHCb::TbHit* packet) {
  53. cache.push_back(packet);
  54. }