#ifndef __JAANET__JEVTWEIGHTTOOLKIT__ #define __JAANET__JEVTWEIGHTTOOLKIT__ #include #include "km3net-dataformat/offline/Head.hh" #include "km3net-dataformat/offline/Evt.hh" #include "JLang/JSharedPointer.hh" #include "JAAnet/JHead.hh" #include "JAAnet/JHeadToolkit.hh" #include "JAAnet/JEvtWeight.hh" #include "JAAnet/JEvtWeightDAQ.hh" #include "JAAnet/JEvtWeightMupage.hh" #include "JAAnet/JEvtWeightCorsika.hh" #include "JAAnet/JEvtWeightGSeaGen.hh" #include "JAAnet/JEvtWeightKM3BUU.hh" /** * \author bjung */ namespace JAANET { using JLANG::JSharedPointer; using JLANG::JValueOutOfRange; /** * Look-up table for event weighters. */ struct JEvtWeighter : public std::vector< JSharedPointer > { /* * Constructor */ JEvtWeighter() { this->push_back(new JEvtWeightGSeaGen()); this->push_back(new JEvtWeightKM3BUU()); this->push_back(new JEvtWeightCorsika()); this->push_back(new JEvtWeightMupage()); this->push_back(new JEvtWeightDAQ()); } /** * Get event weighter corresponding to given header. * * \param header header * \return event weighter */ const JEvtWeight& operator()(const JHead& header) const { for (const_iterator i = this->begin(); i != this->end(); ++i) { if ((*i)->check(header)) { return *(*i); } } THROW(JValueOutOfRange, "JEvtWeighter::operator(): No event weighter found for given header."); } }; extern JEvtWeighter getEventWeighter; //!< Function object for mapping header to event weighter. } #endif