/* This is "strgeom.h" */ /* * We will start by defining Extern so that it defines our global * structures in the MAIN file but not in any other files */ #ifdef MAIN #define Extern #else #define Extern extern #endif #define MAXINFO 12 #define MAXDSP 6 #define MAXLINK 4 /* * Here we are defining a structure to hold all the geometry * information for the silicon planes * We have: * 16 character identifier * plane number * station * is -1 for single sided detectors) * x0, y0, z0 of the plane in cm (if we pick a coordinate system * where the beam is going in the +z direction, then * if the beam goes into the page, x0 is the right edge * of the silicon plane ane y0 is the bottom edge. * phi (angle wrt x) of the plane in radians * theta (angle wrt y) of the plane in radians * pitch: pitch in cm * StpAng: angle of strips wrt x axis of silicon in radians * MaxStp: max number of strips on the plane * yrot, zrot distance from y0 and z0 to the axis of theta rotation */ typedef struct { char id[16]; int plane; int station; float xp; float yp; float zp; float phi; float theta; float pitch; float StpAng; float xwid; int MaxStp; float yrot; float zrot; } PlaneInfo; Extern PlaneInfo infotab[MAXINFO]; int NumberOfPlanes; /* * Here we define the structure used to configure * the DSP readout. This info will also be needed * to unpack the raw data. The format is to have * a structure for each dsp that contains the * following information for each link (each * dsp can read up to four links with 1 link * corresponding to one hack): * plane_num[MAXLINK] : should correspond to same * numbering convention as in Planeinfo * unpk_algorp[MAXLINK]: tells the unpacking * algorithm how the strips are connected * hi[MAXLINK]: says whether bit 1 on or off * corresponds to a hit * nchips: number of chips on the link (must * be the same for all links on a dsp) * * The structure bina_config contains the * run number and the number of time buckets * being read out as well as the Dsp_config * for each Dsp. */ typedef struct { /* This was called plane_num, but I changed it to link because that seemed right */ int link[MAXLINK]; int unpk_algor[MAXLINK]; int hi[MAXLINK]; int nchips; float sysdac[4]; int lldac[4]; char sys_name[30]; /* name of system file to download */ char trig_control[30]; /* name of trigger control file */ } Dsp_config; typedef struct { int run_num; int num_timbuc; int ndsp; Dsp_config dsp_config[MAXDSP]; } Bina_config; Extern Bina_config bina_config; Extern int num_dsp; /* * Here we define some other structures */ typedef struct {float x; float y;} TwoPoint; typedef struct {float x; float y; float z;} ThreePoint; /* * Here are the function prototypes */ void gendat(); void ReadPlaneInfo(FILE *fp); void GraphPlaneGeom(unsigned int); TwoPoint MakeTwoPoint(float x, float y); TwoPoint RotTwoPoint(TwoPoint TwoPt, TwoPoint Center, float Theta); TwoPoint AddTwoPoint(TwoPoint Two1, TwoPoint Two2); TwoPoint SubTwoPoint(TwoPoint Two1, TwoPoint Two2); ThreePoint MakeThreePoint(float x, float y, float z); ThreePoint DoRotTheta(float xfrac, float strip, int plane); FILE *InfoFileOpen( void ); int InfoNumLinks( int ); int InfoNumDSP( void ); int InfoLinkActive( int, int ); char *InfoSysName( int ); char *InfoTrigName( int ); /* * And some common structures */ Extern int PlaneFromIndex[MAXINFO]; Extern int IndexFromPlane[MAXINFO];