#ifndef __JTRIGGER__JTIMESLICECLONE__ #define __JTRIGGER__JTIMESLICECLONE__ #include #include "JTrigger/JSuperFrameClone1D.hh" #include "JTrigger/JTimeslice.hh" #include "JTrigger/JHitToolkit.hh" #include "JLang/JClass.hh" #include "JGeometry3D/JMatrix3D.hh" #include "JGeometry3D/JRotation3D.hh" #include "JDetector/JModuleRouter.hh" /** * \author mdejong */ namespace JTRIGGER {} namespace JPP { using namespace JTRIGGER; } namespace JTRIGGER { using JGEOMETRY3D::JMatrix3D; using JGEOMETRY3D::JRotation3D; using JDETECTOR::JModuleRouter; /** * Clone of JTimeslice. */ template class JTimesliceClone : public std::vector< JSuperFrameClone1D >, public JHitToolkit { public: typedef typename JLANG::JClass::argument_type argument_type; typedef JSuperFrameClone1D value_type; typedef typename std::vector::iterator iterator; typedef typename std::vector::const_iterator const_iterator; typedef typename std::vector::reverse_iterator reverse_iterator; typedef typename std::vector::const_reverse_iterator const_reverse_iterator; /** * Default constructor. */ JTimesliceClone() {} /** * Constructor. * * The cloned data are organised according the input time slice. * * \param input super frame */ JTimesliceClone(const JTimeslice& input) { for (typename JTimeslice::const_iterator i = input.begin(); i != input.end(); ++i) { this->push_back(JSuperFrameClone1D(*i)); } } /** * Constructor. * * The cloned data are organised according the module router. * * \param input super frame * \param router module router */ JTimesliceClone(const JTimeslice& input, const JModuleRouter& router) { this->resize(router.getReference().size()); for (typename JTimeslice::const_iterator i = input.begin(); i != input.end(); ++i) { (*this)[router.getAddress(i->getModuleID()).first] = JSuperFrameClone1D(*i); } } /** * Transform. * * \param R matrix */ JTimesliceClone& transform(const JMatrix3D& R) { for (iterator i = this->begin(); i != this->end(); ++i) { i->transform(R); } return *this; } /** * Rotate. * * \param R rotation matrix */ JTimesliceClone& rotate(const JRotation3D& R) { for (iterator i = this->begin(); i != this->end(); ++i) { i->rotate(R); } return *this; } /** * Rotate back. * * \param R rotation matrix */ JTimesliceClone& rotate_back(const JRotation3D& R) { for (iterator i = this->begin(); i != this->end(); ++i) { i->rotate_back(R); } return *this; } }; } #endif