<commit_before>#include "orbit_mpi.hh"
#include "pyORBIT_Object.hh"

#include "wrap_bunch.hh"

#include <iostream>

#include "CircleApertureShape.hh"
#include "EllipseApertureShape.hh"
#include "RectangularApertureShape.hh"

namespace wrap_py_base_aperture_shape{

#ifdef __cplusplus
extern "C" {
#endif

	/** 
	Constructor for python class wrapping c++ Circle, Ellipse, and Rectangular ApertureShape instances.
	*/
	static PyObject* PrimitiveApertureShape_new(PyTypeObject *type, PyObject *args, PyObject *kwds){
		pyORBIT_Object* self;
		self = (pyORBIT_Object *) type->tp_alloc(type, 0);
		self->cpp_obj = NULL;
		return (PyObject *) self;
	}
	
  /** This is implementation of the __init__ method */
  static int PrimitiveApertureShape_init(pyORBIT_Object *self, PyObject *args, PyObject *kwds){
  	const char* name = NULL;
  	double param1 =  0.0;
  	double param2 = -1.0;
  	if(!PyArg_ParseTuple(	args,"sd|d:parameters",&name,&param1,&param2)){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape(shapeType, par1[,par2]) - no right parameters. Stop.");
  	}
  	std::string typeName(name);
  	self->cpp_obj = NULL;
  	if(typeName == "circle"){
  		self->cpp_obj =  new CircleApertureShape();
  		((CircleApertureShape*) self->cpp_obj)->setRadius(param1);
  	} 
  	if(typeName == "ellipse"){
  		self->cpp_obj =  new EllipseApertureShape();
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("PrimitiveApertureShape(ellipse, par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((EllipseApertureShape*) self->cpp_obj)->setHalfAxisX(param1);
  		((EllipseApertureShape*) self->cpp_obj)->setHalfAxisY(param2);
  	}   	
  	if(typeName == "rectangular"){
  		self->cpp_obj =  new RectangularApertureShape();
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("PrimitiveApertureShape(rectangular, par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((RectangularApertureShape*) self->cpp_obj)->setHalfX(param1);
  		((RectangularApertureShape*) self->cpp_obj)->setHalfY(param2);  		
  	}   	
  	if(self->cpp_obj == NULL){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape(shapeType, par1[,par2]) - shapeType should be circle,ellipse, or rectangular. Stop.");
  	}
	  ((BaseApertureShape*) self->cpp_obj)->setPyWrapper((PyObject*) self);	  
    return 0;
  }

	// Sets or returns the center of the shape in X-direction 
  static PyObject* PrimitiveApertureShape_centerX(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape = (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		int nVars = PyTuple_Size(args);
		if(nVars >= 1){
			double center = 0.;
			if(!PyArg_ParseTuple(	args,"d:centerX",&center)){
				ORBIT_MPI_Finalize("PrimitiveApertureShape.centerX(...) - call should be - centerX([center]). Stop.");
			}
			cpp_BaseApertureShape->setCenterX(center);
    }
		return Py_BuildValue("d",cpp_BaseApertureShape->getCenterX());
  }
  
	// Sets or returns the center of the shape in Y-direction 
  static PyObject* PrimitiveApertureShape_centerY(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		int nVars = PyTuple_Size(args);
		if(nVars >= 1){
			double center = 0.;
			if(!PyArg_ParseTuple(	args,"d:centerY",&center)){
				ORBIT_MPI_Finalize("PrimitiveApertureShape.centerY(...) - call should be - centerY([center]). Stop.");
			}
			cpp_BaseApertureShape->setCenterY(center);
    }
		return Py_BuildValue("d",cpp_BaseApertureShape->getCenterY());
  }	  

	// name([name]) - sets or returns the name of the shape 
  static PyObject* PrimitiveApertureShape_name(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;		
    const char* name = NULL;
    if(!PyArg_ParseTuple(	args,"|s:name",&name)){
      ORBIT_MPI_Finalize("PrimitiveApertureShape.name(...) - call should be - name([name]). Stop.");
    }
		if(name != NULL){
      std::string name_str(name);
      cpp_BaseApertureShape->setName(name_str);
		}
		return Py_BuildValue("s",cpp_BaseApertureShape->getName().c_str());
  }
  
	// typeName() - returns the type name of the shape 
  static PyObject* PrimitiveApertureShape_typeName(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;
		int nVars = PyTuple_Size(args);
		if(nVars != 0){
			ORBIT_MPI_Finalize("PrimitiveApertureShape.typeName() - has no parameters. Stop.");
    }
		return Py_BuildValue("s",cpp_BaseApertureShape->getTypeName().c_str());
  }  
  
	// Returns the parameters of the shape like radius of the circle 
  static PyObject* PrimitiveApertureShape_getParamsDict(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		PyObject* paramsDict = PyDict_New();
		std::string typeName = cpp_BaseApertureShape->getTypeName();
		double param1 =  0.0;
		double param2 = -1.0;
  	if(typeName == "circle"){
  		param1 = ((CircleApertureShape*) cpp_BaseApertureShape)->getRadius();
  		PyObject* pyRadius = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"radius",pyRadius);
  		Py_DECREF(pyRadius);
  	} 
  	if(typeName == "ellipse"){
  		param1 = ((EllipseApertureShape*) cpp_BaseApertureShape)->getHalfAxisX();
  		param2 = ((EllipseApertureShape*) cpp_BaseApertureShape)->getHalfAxisY();
  		PyObject* pyHalfX = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"halfAxisX",pyHalfX);
  		Py_DECREF(pyHalfX);
  		PyObject* pyHalfY = Py_BuildValue("d",param2);
  		PyDict_SetItemString(paramsDict,"halfAxisY",pyHalfY);
  		Py_DECREF(pyHalfY);
  	}   	
  	if(typeName == "rectangular"){
  		param1 = ((RectangularApertureShape*) cpp_BaseApertureShape)->getHalfX();
  		param2 = ((RectangularApertureShape*) cpp_BaseApertureShape)->getHalfY();
  		PyObject* pyHalfX = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"halfSizeX",pyHalfX);
  		Py_DECREF(pyHalfX);
  		PyObject* pyHalfY = Py_BuildValue("d",param2);
  		PyDict_SetItemString(paramsDict,"halfSizeY",pyHalfY);
  		Py_DECREF(pyHalfY);  		
  	}
		return paramsDict;
  }

	// Sets the parameters of the shape like radius of the circle etc.
  static PyObject* PrimitiveApertureShape_setParams(PyObject *self, PyObject *args){
  	double param1 =  0.0;
  	double param2 = -1.0;
  	if(!PyArg_ParseTuple(	args,"d|d:parameters",&param1,&param2)){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape.setParams(par1[,par2]) - no right parameters. Stop.");
  	}
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	  	
  	std::string typeName = cpp_BaseApertureShape->getTypeName();
  	int settings_done = 0;
  	std::cout << "debug PrimitiveApertureShape_setParams 1 "<<std::endl;
  	if(typeName == "circle"){
  		((CircleApertureShape*) cpp_BaseApertureShape)->setRadius(param1);
  		settings_done = 1;
  	} 
  	if(typeName == "ellipse"){
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("ellipse PrimitiveApertureShape.setParams(par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((EllipseApertureShape*) cpp_BaseApertureShape)->setHalfAxisX(param1);
  		((EllipseApertureShape*) cpp_BaseApertureShape)->setHalfAxisY(param2);
  		settings_done = 1;
  	}   	<commit_msg>Debug printing line was removed<commit_after>#include "orbit_mpi.hh"
#include "pyORBIT_Object.hh"

#include "wrap_bunch.hh"

#include <iostream>

#include "CircleApertureShape.hh"
#include "EllipseApertureShape.hh"
#include "RectangularApertureShape.hh"

namespace wrap_py_base_aperture_shape{

#ifdef __cplusplus
extern "C" {
#endif

	/** 
	Constructor for python class wrapping c++ Circle, Ellipse, and Rectangular ApertureShape instances.
	*/
	static PyObject* PrimitiveApertureShape_new(PyTypeObject *type, PyObject *args, PyObject *kwds){
		pyORBIT_Object* self;
		self = (pyORBIT_Object *) type->tp_alloc(type, 0);
		self->cpp_obj = NULL;
		return (PyObject *) self;
	}
	
  /** This is implementation of the __init__ method */
  static int PrimitiveApertureShape_init(pyORBIT_Object *self, PyObject *args, PyObject *kwds){
  	const char* name = NULL;
  	double param1 =  0.0;
  	double param2 = -1.0;
  	if(!PyArg_ParseTuple(	args,"sd|d:parameters",&name,&param1,&param2)){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape(shapeType, par1[,par2]) - no right parameters. Stop.");
  	}
  	std::string typeName(name);
  	self->cpp_obj = NULL;
  	if(typeName == "circle"){
  		self->cpp_obj =  new CircleApertureShape();
  		((CircleApertureShape*) self->cpp_obj)->setRadius(param1);
  	} 
  	if(typeName == "ellipse"){
  		self->cpp_obj =  new EllipseApertureShape();
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("PrimitiveApertureShape(ellipse, par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((EllipseApertureShape*) self->cpp_obj)->setHalfAxisX(param1);
  		((EllipseApertureShape*) self->cpp_obj)->setHalfAxisY(param2);
  	}   	
  	if(typeName == "rectangular"){
  		self->cpp_obj =  new RectangularApertureShape();
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("PrimitiveApertureShape(rectangular, par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((RectangularApertureShape*) self->cpp_obj)->setHalfX(param1);
  		((RectangularApertureShape*) self->cpp_obj)->setHalfY(param2);  		
  	}   	
  	if(self->cpp_obj == NULL){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape(shapeType, par1[,par2]) - shapeType should be circle,ellipse, or rectangular. Stop.");
  	}
	  ((BaseApertureShape*) self->cpp_obj)->setPyWrapper((PyObject*) self);	  
    return 0;
  }

	// Sets or returns the center of the shape in X-direction 
  static PyObject* PrimitiveApertureShape_centerX(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape = (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		int nVars = PyTuple_Size(args);
		if(nVars >= 1){
			double center = 0.;
			if(!PyArg_ParseTuple(	args,"d:centerX",&center)){
				ORBIT_MPI_Finalize("PrimitiveApertureShape.centerX(...) - call should be - centerX([center]). Stop.");
			}
			cpp_BaseApertureShape->setCenterX(center);
    }
		return Py_BuildValue("d",cpp_BaseApertureShape->getCenterX());
  }
  
	// Sets or returns the center of the shape in Y-direction 
  static PyObject* PrimitiveApertureShape_centerY(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		int nVars = PyTuple_Size(args);
		if(nVars >= 1){
			double center = 0.;
			if(!PyArg_ParseTuple(	args,"d:centerY",&center)){
				ORBIT_MPI_Finalize("PrimitiveApertureShape.centerY(...) - call should be - centerY([center]). Stop.");
			}
			cpp_BaseApertureShape->setCenterY(center);
    }
		return Py_BuildValue("d",cpp_BaseApertureShape->getCenterY());
  }	  

	// name([name]) - sets or returns the name of the shape 
  static PyObject* PrimitiveApertureShape_name(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;		
    const char* name = NULL;
    if(!PyArg_ParseTuple(	args,"|s:name",&name)){
      ORBIT_MPI_Finalize("PrimitiveApertureShape.name(...) - call should be - name([name]). Stop.");
    }
		if(name != NULL){
      std::string name_str(name);
      cpp_BaseApertureShape->setName(name_str);
		}
		return Py_BuildValue("s",cpp_BaseApertureShape->getName().c_str());
  }
  
	// typeName() - returns the type name of the shape 
  static PyObject* PrimitiveApertureShape_typeName(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;
		int nVars = PyTuple_Size(args);
		if(nVars != 0){
			ORBIT_MPI_Finalize("PrimitiveApertureShape.typeName() - has no parameters. Stop.");
    }
		return Py_BuildValue("s",cpp_BaseApertureShape->getTypeName().c_str());
  }  
  
	// Returns the parameters of the shape like radius of the circle 
  static PyObject* PrimitiveApertureShape_getParamsDict(PyObject *self, PyObject *args){
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	
		PyObject* paramsDict = PyDict_New();
		std::string typeName = cpp_BaseApertureShape->getTypeName();
		double param1 =  0.0;
		double param2 = -1.0;
  	if(typeName == "circle"){
  		param1 = ((CircleApertureShape*) cpp_BaseApertureShape)->getRadius();
  		PyObject* pyRadius = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"radius",pyRadius);
  		Py_DECREF(pyRadius);
  	} 
  	if(typeName == "ellipse"){
  		param1 = ((EllipseApertureShape*) cpp_BaseApertureShape)->getHalfAxisX();
  		param2 = ((EllipseApertureShape*) cpp_BaseApertureShape)->getHalfAxisY();
  		PyObject* pyHalfX = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"halfAxisX",pyHalfX);
  		Py_DECREF(pyHalfX);
  		PyObject* pyHalfY = Py_BuildValue("d",param2);
  		PyDict_SetItemString(paramsDict,"halfAxisY",pyHalfY);
  		Py_DECREF(pyHalfY);
  	}   	
  	if(typeName == "rectangular"){
  		param1 = ((RectangularApertureShape*) cpp_BaseApertureShape)->getHalfX();
  		param2 = ((RectangularApertureShape*) cpp_BaseApertureShape)->getHalfY();
  		PyObject* pyHalfX = Py_BuildValue("d",param1);
  		PyDict_SetItemString(paramsDict,"halfSizeX",pyHalfX);
  		Py_DECREF(pyHalfX);
  		PyObject* pyHalfY = Py_BuildValue("d",param2);
  		PyDict_SetItemString(paramsDict,"halfSizeY",pyHalfY);
  		Py_DECREF(pyHalfY);  		
  	}
		return paramsDict;
  }

	// Sets the parameters of the shape like radius of the circle etc.
  static PyObject* PrimitiveApertureShape_setParams(PyObject *self, PyObject *args){
  	double param1 =  0.0;
  	double param2 = -1.0;
  	if(!PyArg_ParseTuple(	args,"d|d:parameters",&param1,&param2)){
  		ORBIT_MPI_Finalize("PrimitiveApertureShape.setParams(par1[,par2]) - no right parameters. Stop.");
  	}
    pyORBIT_Object* pyPrimitiveApertureShape= (pyORBIT_Object*) self;
		BaseApertureShape* cpp_BaseApertureShape = (BaseApertureShape*) pyPrimitiveApertureShape->cpp_obj;	  	
  	std::string typeName = cpp_BaseApertureShape->getTypeName();
  	int settings_done = 0;
  	if(typeName == "circle"){
  		((CircleApertureShape*) cpp_BaseApertureShape)->setRadius(param1);
  		settings_done = 1;
  	} 
  	if(typeName == "ellipse"){
  		if(param2 < 0.){
  			ORBIT_MPI_Finalize("ellipse PrimitiveApertureShape.setParams(par1,par2) - par2 is not there or < 0. Stop.");
  		}
  		((EllipseApertureShape*) cpp_BaseApertureShape)->setHalfAxisX(param1);
  		((EllipseApertureShape*) cpp_BaseApertureShape)->setHalfAxisY(param2);
  		settings_done = 1;
  	}   	
{'fraction_non_alphanumeric': 0.1310097719869707, 'fraction_numerical': 0.00970684039087948, 'mean_word_length': 5.0011727912431585, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 93, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5006238', 'n_tokens_mistral': 5835, 'n_tokens_neox': 5695, 'n_words': 947}