/**
 * @file folder.hh
 * @author David Gerick, Renata Kopecna
 * @date 2018-04-24
 *
 */

#ifndef FOLDER_H
#define FOLDER_H

#include <options.hh>
#include <assert.h>

namespace fcnc {
    class event;

///An abstract base class to fold angles accordingly
class folder {
public:
    int scheme;
    ///constructor
    folder(options *o):
        scheme(o->folding)
    {
        
        if(!o->full_angular){
            assert(scheme >= 0);
            assert(scheme <= 4);
        }
        o->update_angle_ranges();
    };

    ///fold the set of angles according to the chosen folding scheme
    void fold(event* e);

    ///inverse fold the set of angles according to the chosen folding scheme
    void invers_fold(const event* e, event *u_phi, event *u_ctl, event *u_full);

        /*
        phi /^\
             |         :
             |   (2)   :   (4)
             |         :
             |---------+--------
             |         :
             |   (1)   :   (3)
             |_________________>
                           cos(theta)

        (1): original event (e)
        (2): unfolded in phi (u_phi)
        (3): unfolded in ctl (u_ctl)
        (4): twice unfolded (u_full)

        */

    void test_inv_folding();

    int get_scheme();
    void set_scheme(int s);

};
}

#endif

