Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:30

0001 /*
0002  *  qp_command.h  --
0003  *  Definitions for commands on resulting ntuple expressions
0004  *
0005  *  Original: 20-Apr-1995 15:42
0006  *
0007  *  Author:   Maarten Ballintijn <Maarten.Ballintijn@cern.ch>
0008  *
0009  *  $Id$
0010  *
0011  *  $Log$
0012  *  Revision 1.19  1999/07/02 12:31:46  couet
0013  *  - hplot_interface.h is now replaced by hplot.h in CVSCOSRC
0014  *  - bug fixed in qp_execute.c: the zones were not properly reset after a
0015  *    NT/SCAN with option SPIDER
0016  *
0017  *  Revision 1.18  1996/08/30 10:04:28  lecointe
0018  *  Restored Gouraud Shading in NT/PLOT
0019  *
0020  *  Revision 1.17  1996/08/21 12:55:34  lecointe
0021  *  Restore the spider plot in ntuple/scan
0022  *
0023  *  Revision 1.16  1996/04/23 18:38:10  maartenb
0024  *  - Add RCS keywords
0025  *
0026  *
0027  */
0028 
0029 #ifndef CERN_QP_COMMAND
0030 #define CERN_QP_COMMAND
0031 
0032 #include    <stdio.h>
0033 
0034 
0035 #include    "qp_query.h"
0036 #include    "qp_value.h"
0037 #include    "smap.h"
0038 
0039 
0040 #define HFILL_BSIZE 2048    /* buffer size for filling and plotting */
0041 #define PRINTFUN_SIZE   35  /* minimum buffer size for print functions */
0042 #define MAX_MAP_STRINGS 512 /* the max number of strings in a histo */
0043 
0044 
0045 typedef     float (*CvtFun)( void *, void * );
0046 typedef struct _cvt_call_back_ {
0047     CvtFun      f;
0048     void *      d;
0049 } CvtCallBack;
0050 
0051 typedef     void (*PrintFun)( String, void * );
0052 
0053 /* does not seem needed at the moment */
0054 #if 0
0055 typedef struct _print_call_back_ {
0056     PrintFun        f;
0057     void *      d;
0058 } PrintCallBack;
0059 #endif
0060 
0061 
0062 
0063 typedef     void (*TableCallBack)( int * );
0064 
0065 
0066 typedef enum _cmd_type_ {
0067     CMD_NULL,
0068     CMD_MINMAX,
0069     CMD_MINMAXAVG,
0070     CMD_VFILL,
0071     CMD_HFILL1,
0072     CMD_HFILL2,
0073     CMD_SCAT2,
0074     CMD_SCAT3,
0075     CMD_SCAT4,
0076     CMD_GOURAUD,
0077     CMD_LOOP,
0078     CMD_DUMP,
0079     CMD_SCAN,
0080     CMD_SPIDERSCAN
0081 } CmdType;
0082 
0083 
0084 typedef struct _extreme_ {
0085     DataType    dtyp;
0086     Uval        min;
0087     Uval        max;
0088     SMap        sm;
0089 } Extreme;
0090 
0091 typedef struct _extremeavg_ {
0092     DataType    dtyp;
0093     Uval        min;
0094     Uval        max;
0095     double      avg;
0096     SMap        sm;
0097 } ExtremeAvg;
0098 
0099 
0100 #if 0
0101 typedef struct _qp_cmd_null_ {
0102     /* input part */
0103     /* runtime part */
0104 } QPCmdNull;
0105 #endif
0106 
0107 
0108 typedef struct _qp_cmd_minmax_ {
0109     /* input part */
0110     /* runtime part */
0111     bool        has_events; /* atleast one event passed the cuts */
0112     int     n;  /* number of expressions to minmax */
0113     Extreme     *el;    /* list of Extreme struct for each expression */
0114 } QPCmdMinMax;
0115 
0116 
0117 typedef struct _qp_cmd_minmaxavg_ {
0118     /* input part */
0119     /* runtime part */
0120     bool        has_events; /* atleast one event passed the cuts */
0121     int     n;          /* number of expressions to minmax */
0122     int     evt_count;  /* Number of selected events */
0123     ExtremeAvg  *el;    /* list of Extreme struct for each expression */
0124 } QPCmdMinMaxAvg;
0125 
0126 
0127 #if 0
0128 typedef struct _qp_cmd_vfill_ {
0129     /* input part */
0130     /* runtime part */
0131 } QPCmdVFill;
0132 #endif
0133 
0134 
0135 typedef struct _qp_cmd_hfill1_ {
0136     /* input part */
0137     int     idh;    /* histogram id */
0138     /* runtime part */
0139     int     n;
0140     float       *x;
0141     float       *w;
0142     CvtCallBack cvt_x;  /* function to convert x to float */
0143     int     step_x;
0144 } QPCmdHFill1;
0145 
0146 
0147 typedef struct _qp_cmd_hfill2_ {
0148     /* input part */
0149     int     idh;    /* histogram id */
0150     /* runtime part */
0151     CvtCallBack cvt_x;  /* function to convert x to float */
0152     int     step_x;
0153     CvtCallBack cvt_y;  /* function to convert y to float */
0154     int     step_y;
0155 } QPCmdHFill2;
0156 
0157 
0158 typedef struct _qp_cmd_scat2_ {
0159     /* input part */
0160     int     idh;    /* histogram id */
0161     bool        line;   /* connect points with lines */
0162     bool        logx;
0163     bool        logy;
0164     /* runtime part */
0165     int     n;
0166     int     *ievt;
0167     float       *x;
0168     float       *y;
0169     CvtCallBack cvt_x;  /* function to convert x to float */
0170     int     step_x;
0171     CvtCallBack cvt_y;  /* function to convert y to float */
0172     int     step_y;
0173 } QPCmdScat2;
0174 
0175 
0176 typedef struct _qp_cmd_scat3_ {
0177     /* input part */
0178     bool        line;   /* connect points with lines */
0179     bool        logx;   /* x-axis is logarithmic */
0180     bool        logy;   /* y-axis is logarithmic */
0181     bool        logz;   /* z-axis is logarithmic */
0182     /* runtime part */
0183     int     n;
0184     int     *ievt;
0185     float       *x;
0186     float       *y;
0187     float       *z;
0188     CvtCallBack cvt_x;  /* function to convert x to float */
0189     int     step_x;
0190     CvtCallBack cvt_y;  /* function to convert y to float */
0191     int     step_y;
0192     CvtCallBack cvt_z;  /* function to convert z to float */
0193     int     step_z;
0194 } QPCmdScat3;
0195 
0196 
0197 typedef struct _qp_cmd_scat4_ {
0198     /* input part */
0199     bool        line;   /* connect points with lines */
0200     float       col_min;/* minimum value of the color attribute */
0201     float       col_max;/* maximum value of the color attribute */
0202     bool        logx;   /* x-axis is logarithmic */
0203     bool        logy;   /* y-axis is logarithmic */
0204     bool        logz;   /* z-axis is logarithmic */
0205     /* runtime part */
0206     int     n;  /* nummber of values in the buffers */
0207     int     *ievt;  /* buffers for the values to be plotted */
0208     float       *x;
0209     float       *y;
0210     float       *z;
0211     float       *c;
0212     CvtCallBack cvt_x;  /* function to convert x to float */
0213     int     step_x;
0214     CvtCallBack cvt_y;  /* function to convert y to float */
0215     int     step_y;
0216     CvtCallBack cvt_z;  /* function to convert z to float */
0217     int     step_z;
0218     CvtCallBack cvt_c;  /* function to convert c to float */
0219     int     step_c;
0220 } QPCmdScat4;
0221 
0222 
0223 typedef struct _qp_cmd_gouraud_ {
0224     /* input part */
0225     bool        logx;   /* x-axis is logarithmic */
0226     bool        logy;   /* y-axis is logarithmic */
0227     bool        logz;   /* z-axis is logarithmic */
0228     /* runtime part */
0229         float           min[3]; /* Minimum value for each selected elements */
0230         float           max[3]; /* Maximum value for each selected elements */
0231         float           s[3];   /* Isosurface values        */
0232         int     nx;     /* Nb of bin in X dimension */
0233     int     ny;     /* Nb of bin in Y dimension */
0234     int     nz;     /* Nb of bin in Z dimension */
0235     float       dx;     /* X interval               */
0236     float       dy;     /* Y interval               */
0237     float       dz;     /* Z interval               */
0238     float       *x;     /* X coord values           */
0239     float       *y;     /* Y coord values           */
0240     float       *z;     /* Z coord values           */
0241     float       *value; /* 3D Histogram values      */
0242     CvtCallBack cvt_x;  /* function to convert x to float */
0243     int     step_x;
0244     CvtCallBack cvt_y;  /* function to convert y to float */
0245     int     step_y;
0246     CvtCallBack cvt_z;  /* function to convert z to float */
0247     int     step_z;
0248 } QPCmdGouraud;
0249 
0250 #if 0
0251 typedef struct _qp_cmd_loop_ {
0252     /* input part */
0253     /* runtime part */
0254 } QPCmdLoop;
0255 #endif
0256 
0257 
0258 typedef struct _qp_cmd_dump_ {
0259     /* input part */
0260     FILE *      fp;     /* Stream to dump on (stdout or file) */
0261     String      sep1;       /* value separator */
0262     String      sep2;       /* expression separator */
0263     /* runtime part */
0264     PrintFun    f[MAX_EXPRS];   /* format function for each expression*/
0265 } QPCmdDump;
0266 
0267 
0268 typedef struct _qp_cmd_scan_ {
0269     /* input part */
0270     bool        pawpp;      /* use Paw++ table widget for display */
0271     /* runtime part */
0272     TableCallBack   matlab;     /* Callback to set labels in paw++ */
0273     TableCallBack   matrow;     /* Callback to set values in paw++ */
0274     PrintFun    f[MAX_EXPRS];   /* format function for each expression*/
0275     int     fw[MAX_EXPRS];  /* field width, space for value */
0276     String      sep;        /* horizontal separator line */
0277     String      title;      /* title line */
0278     String      buf;        /* buffer for line */
0279     int     max_line;   /* maximum number of lines to print */
0280     int     cur_line;   /* number of lines already printed */
0281     bool        no_prompt;  /* no more questions your honor ! */
0282     bool        evt_count;  /* Number of selected events */
0283 } QPCmdScan;
0284 
0285 typedef struct _qp_cmd_spider_scan_ {
0286     /* input part */
0287     /* runtime part */
0288         CvtCallBack cvt[MAX_EXPRS]; /* Conversion function for each expression*/
0289         float           min[MAX_EXPRS]; /* Minimum value for each selected elements */
0290         float           max[MAX_EXPRS]; /* Maximum value for each selected elements */
0291         float           avg[MAX_EXPRS]; /* Average value for each selected elements */
0292         int             t_code[MAX_EXPRS];/* Type code for each selected elements */
0293         float           saved[8];       /* Some graphic parameters to be changed and 
0294                        restored at the end */
0295     float       rzone;          /* number of zones -> max(horizontally,vertically) */
0296         char            *expr_str;      /* concatenated names of the scanned elements */
0297     int     max_line;   /* maximum number of events to scan between prompts */
0298     int     cur_line;   /* number of events already scaned */
0299     bool        no_prompt;  /* no more questions your honor ! */
0300     int     evt_count;  /* Number of selected events */
0301     int     spider_type;    /* 1=contour 2=wedges*/
0302     bool        use_average;    /* if TRUE, draw the average spider*/
0303 } QPCmdSpiderScan;
0304 
0305 
0306 typedef struct _qp_cmd_ {
0307     CmdType     command;
0308 
0309     /* CmdType dependent part */
0310     union {
0311 #if 0
0312         QPCmdNull       null;
0313 #endif
0314         QPCmdMinMax     minmax;
0315         QPCmdMinMaxAvg      minmaxavg;
0316 #if 0
0317         QPCmdVFill      vfill;
0318 #endif
0319         QPCmdHFill1     hfill1;
0320         QPCmdHFill2     hfill2;
0321         QPCmdScat2      scat2;
0322         QPCmdScat3      scat3;
0323         QPCmdScat4      scat4;
0324         QPCmdGouraud        gouraud;
0325 #if 0
0326         QPCmdLoop       loop;
0327 #endif
0328         QPCmdDump       dump;
0329         QPCmdScan       scan;
0330         QPCmdSpiderScan     sp_scan;
0331     } u;
0332 
0333 } QPCmd;
0334 
0335 
0336 extern int const    datatype_width[];
0337 
0338 
0339 QPCmd *
0340 qpcmd_new( CmdType cmd );
0341 
0342 void
0343 qpcmd_free( QPCmd * cmd );
0344 
0345 void
0346 qpcmd_getminmax( QPCmd * cmd, int i, float * min, float * max );
0347 
0348 void
0349 qpcmd_getminmaxavg( QPCmd * cmd, int i, float * min, float * max , float * avg );
0350 
0351 SMap
0352 qpcmd_labels(  QPCmd * cmd, int i );
0353 
0354 
0355 CvtCallBack
0356 datatype_to_cvtcallback( DataType dtype, void * cbd );
0357 
0358 PrintFun
0359 datatype_to_printfun( DataType dtype );
0360 
0361 PrintFun
0362 datatype_to_dumpfun( DataType dtype );
0363 
0364 int
0365 datatype_to_typecode( DataType dtype);
0366 
0367 #endif  /*  CERN_QP_COMMAND */
0368