sum.h
1 /***************************************************************************
2  sum.h - description
3  -------------------
4  begin : Thu Mar 8 2007
5  copyright : (C) 2000-2015 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef RECOSUM_H
19 #define RECOSUM_H
20 
21 
22 #include "step.h"
23 
24 
25 /*
26  * Template class to sum up data in one or more dimensions.
27  * The rank of the unmodified collected data dimensions is is given by 'Nunmod'.
28  * The particular unmodified dimension are given in 'Unmod' by a specialization of 'RecoDim'.
29  * The numer of dimensions to sum up is given in 'Nsum' and specified in 'Sum' by
30  * a specialization of 'RecoDim'.
31  * The dimensions to sum up are expected leftmost in the input data array.
32  * The optional parameter 'Magn' specifies whether only the magnitude will
33  * be accumulated instead of the complex values.
34  */
35 template<unsigned int Nunmod, class Unmod, unsigned int Nsum, class Sum, bool Magn=false>
36 class RecoSum : public RecoStep, public Labeled {
37 
38  public:
39  RecoSum(const STD_string& sum_label) : Labeled(sum_label) {}
40 
41  private:
42 
43  // implementing virtual functions of RecoStep
44  STD_string label() const {return get_label();}
45  STD_string description() const {return "Sum up data in one or more dimensions";}
46  bool process(RecoData& rd, RecoController& controller);
47  RecoCoord input_coord() const {RecoCoord result=Unmod::preset_coord(RecoIndex::collected); Sum::modify(RecoIndex::collected,result); return result;}
48  void modify_coord(RecoCoord& coord) const {Sum::modify(RecoIndex::single,coord);}
49  RecoStep* allocate() const {return new RecoSum(get_label());}
50  void init() {}
51 
52 };
53 
54 
55 
56 #endif
57 
Labeled(const STD_string &label="unnamed")
Definition: tjlabel.h:38
const STD_string & get_label() const
Definition: tjlabel.h:48
averagesum, cyclesum, repmagnsum, repsum: Sum up data in one or more dimensions
Definition: sum.h:36