00001 /*************************************************************************** 00002 sum.h - description 00003 ------------------- 00004 begin : Thu Mar 8 2007 00005 copyright : (C) 2001 by Thies Jochimsen 00006 email : jochimse@cns.mpg.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef RECOSUM_H 00019 #define RECOSUM_H 00020 00021 00022 #include "step.h" 00023 00024 00025 /* 00026 * Template class to sum up data in one or more dimensions. 00027 * The rank of the unmodified collected data dimensions is is given by 'Nunmod'. 00028 * The particular unmodified dimension are given in 'Unmod' by a specialization of 'RecoDim'. 00029 * The numer of dimensions to sum up is given in 'Nsum' and specified in 'Sum' by 00030 * a specialization of 'RecoDim'. 00031 * The dimensions to sum up are expected leftmost in the input data array. 00032 * The optional parameter 'Magn' specifies whether only the magnitude will 00033 * be accumulated instead of the complex values. 00034 */ 00035 template<unsigned int Nunmod, class Unmod, unsigned int Nsum, class Sum, bool Magn=false> 00036 class RecoSum : public RecoStep, public Labeled { 00037 00038 public: 00039 RecoSum(const STD_string& sum_label) : Labeled(sum_label) {} 00040 00041 private: 00042 00043 // implementing virtual functions of RecoStep 00044 STD_string label() const {return get_label();} 00045 STD_string description() const {return "Sum up data in one or more dimensions";} 00046 bool process(RecoData& rd, RecoController& controller); 00047 RecoCoord input_coord() const {RecoCoord result=Unmod::preset_coord(RecoIndex::collected); Sum::modify(RecoIndex::collected,result); return result;} 00048 void modify_coord(RecoCoord& coord) const {Sum::modify(RecoIndex::single,coord);} 00049 RecoStep* allocate() const {return new RecoSum(get_label());} 00050 void init() {} 00051 00052 }; 00053 00054 00055 00056 #endif 00057
1.5.6