/*
 * TrackRedGeomCut.h
 *
 *  Created on: 30-nov-2009
 *      Author: S. Ricciarini
 */

/*! @file TrackRedGeomCut.h The TrackRedGeomCut class definition file */

#ifndef TRACKREDGEOMCUT_H_
#define TRACKREDGEOMCUT_H_

#include "../../PamCutBase/PamCutBase.h"
#include <CaloAxis.h>

/*! @brief The track reduced acceptance (i.e. rectangular pipe) cut.
 * This cut checks if the track is inside the reduced acceptance chosen.
 * The check can be done using either the tracker's track or CaloAxis track.
 * CUT DEPENDENCIES: objects pamTrack, xCaloAxis, yCaloAxis.
 */

class TrackRedGeomCut: public PamCut {

public:
  /*! @brief Constructor.
   *
   * The parameters are the X and Y lengths of the rectangular pipe define the reduced acceptance region (centered on PAMELA vertical central axis).
   *
   * @param cutName The cut's name.
   * @param pamTrack The pointer to *pamTrack object
   * @param xDim The X-side length in cm.
   * @param yDim The Y-side length in cm.
   */
  TrackRedGeomCut(const char *cutName, PamTrack **pamTrack, float xDim, float yDim) :
    PamCut(cutName), _pamTrack(pamTrack), _xDim(xDim), _yDim(yDim) {
#ifndef NO_CALOAXIS
    _xCaloAxis = _yCaloAxis = NULL;
#endif /* NO_CALOAXIS */
  }

  /*! @brief Constructor.
   *
   * The CaloAxis arguments are pointers to objects which contain the CaloAxis calorimeter
   * track information for current event.
   *
   * @param cutName The cut's name.
   * @param xCaloAxis The pointer to the CaloAxis object for X axis.
   * @param yCaloAxis The pointer to the CaloAxis object for Y axis.
   * @param xDim The X-side length in cm.
   * @param yDim The Y-side length in cm.
   */

#ifndef NO_CALOAXIS
  TrackRedGeomCut(const char *cutName, CaloAxis *xCaloAxis, CaloAxis *yCaloAxis, float xDim, float yDim) :
    PamCut(cutName), _pamTrack(NULL), _xCaloAxis(xCaloAxis), _yCaloAxis(yCaloAxis), _xDim(xDim), _yDim(yDim) {
  }
#endif /* NO_CALOAXIS */

  /*! @brief Destructor. */
  ~TrackRedGeomCut() {
  }

  /*! @brief The track reduced acceptance check.
   *
   * @param event The event to analyze.
   * @return #CUTOK if the track is inside the reduced acceptance.
   * @return 0 otherwise.
   */
  int Check(PamLevel2 *event);

private:

  PamTrack **_pamTrack;
#ifndef NO_CALOAXIS
  CaloAxis *_xCaloAxis, *_yCaloAxis;
#endif /* NO_CALOAXIS */
  float _xDim;
  float _yDim;

};
#endif /* TRACKREDGEOMCUT_H_ */
