1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/*******************************************************************************
*
* McStas, neutron ray-tracing package
* Copyright 1997-2002, All rights reserved
* Risoe National Laboratory, Roskilde, Denmark
* Institut Laue Langevin, Grenoble, France
*
* Library: share/monitor_nd-lib.h
*
* %Identification
* Written by: EF
* Date: Aug 28, 2002
* Origin: ILL
* Modified by: TW, Nov 2020: introduced user doubles
* Release: McStas 1.6
* Version: $Revision$
*
* This file is to be imported by the monitor_nd related components
* It handles some shared functions.
*
* Usage: within SHARE
* %include "monitor_nd-lib"
*
*******************************************************************************/
#ifndef MONITOR_ND_LIB_H
#define MONITOR_ND_LIB_H "$Revision$"
#define MONnD_COORD_NMAX 30 /* max number of variables to record */
typedef struct MonitornD_Defines
{
int COORD_NONE ;
int COORD_X ;
int COORD_Y ;
int COORD_Z ;
int COORD_RADIUS;
int COORD_VX ;
int COORD_VY ;
int COORD_VZ ;
int COORD_V ;
int COORD_T ;
int COORD_P ;
int COORD_SX ;
int COORD_SY ;
int COORD_SZ ;
int COORD_KX ;
int COORD_KY ;
int COORD_KZ ;
int COORD_K ;
int COORD_ENERGY;
int COORD_LAMBDA;
int COORD_KXY ;
int COORD_KYZ ;
int COORD_KXZ ;
int COORD_VXY ;
int COORD_VYZ ;
int COORD_VXZ ;
int COORD_HDIV ;
int COORD_VDIV ;
int COORD_ANGLE ;
int COORD_NCOUNT;
int COORD_THETA ;
int COORD_PHI ;
int COORD_USER1 ;
int COORD_USER2 ;
int COORD_USER3 ;
int COORD_USERDOUBLE0 ;
int COORD_USERDOUBLE1 ;
int COORD_USERDOUBLE2 ;
int COORD_USERDOUBLE3 ;
int COORD_USERDOUBLE4 ;
int COORD_USERDOUBLE5 ;
int COORD_USERDOUBLE6 ;
int COORD_USERDOUBLE7 ;
int COORD_USERDOUBLE8 ;
int COORD_USERDOUBLE9 ;
int COORD_USERDOUBLE10 ;
int COORD_USERDOUBLE11 ;
int COORD_USERDOUBLE12 ;
int COORD_USERDOUBLE13 ;
int COORD_USERDOUBLE14 ;
int COORD_USERDOUBLE15 ;
int COORD_XY ;
int COORD_XZ ;
int COORD_YZ ;
int COORD_PIXELID;
/* token modifiers */
int COORD_VAR ; /* next token should be a variable or normal option */
int COORD_MIN ; /* next token is a min value */
int COORD_MAX ; /* next token is a max value */
int COORD_DIM ; /* next token is a bin value */
int COORD_FIL ; /* next token is a filename */
int COORD_EVNT ; /* next token is a buffer size value */
int COORD_3HE ; /* next token is a 3He pressure value */
int COORD_LOG ; /* next variable will be in log scale */
int COORD_ABS ; /* next variable will be in abs scale */
int COORD_SIGNAL; /* next variable will be the signal var */
int COORD_AUTO ; /* set auto limits */
char TOKEN_DEL[32]; /* token separators */
char SHAPE_SQUARE; /* shape of the monitor */
char SHAPE_DISK ;
char SHAPE_SPHERE;
char SHAPE_CYLIND;
char SHAPE_BANANA; /* cylinder without top/bottom, on restricted angular area */
char SHAPE_BOX ;
char SHAPE_PREVIOUS;
char SHAPE_OFF;
} MonitornD_Defines_type;
typedef struct MonitornD_Variables
{
double area;
double Sphere_Radius ;
double Cylinder_Height ;
char Flag_With_Borders ; /* 2 means xy borders too */
char Flag_List ; /* 1 store 1 buffer, 2 is list all, 3 list all+append */
char Flag_Multiple ; /* 1 when n1D, 0 for 2D */
char Flag_Verbose ;
int Flag_Shape ;
char Flag_Auto_Limits ; /* get limits from first Buffer */
char Flag_Absorb ; /* monitor is also a slit */
char Flag_per_cm2 ; /* flux is per cm2 */
char Flag_log ; /* log10 of the flux */
char Flag_parallel ; /* set neutron state back after detection (parallel components) */
char Flag_Binary_List ;
char Flag_capture ; /* lambda monitor with lambda/lambda(2200m/s = 1.7985 Angs) weightening */
int Flag_signal ; /* 0:monitor p, else monitor a mean value */
int Flag_mantid ; /* 0:normal monitor, else do mantid-event specifics */
int Flag_OFF ; /* Flag to indicate external geometry from OFF file */
long long OFF_polyidx; /* When intersection is done externally by off_intersect, this gives the
polygon number, i.e. pixel index */
unsigned long Coord_Number ; /* total number of variables to monitor, plus intensity (0) */
unsigned long Coord_NumberNoPixel; /* same but without counting PixelID */
unsigned long Buffer_Block ; /* Buffer size for list or auto limits */
long long Neutron_Counter ; /* event counter, simulation total counts is mcget_ncount() */
unsigned long Buffer_Counter ; /* index in Buffer size (for realloc) */
unsigned long Buffer_Size ;
int Coord_Type[MONnD_COORD_NMAX]; /* type of variable */
char Coord_Label[MONnD_COORD_NMAX][30]; /* label of variable */
char Coord_Var[MONnD_COORD_NMAX][30]; /* short id of variable */
long Coord_Bin[MONnD_COORD_NMAX]; /* bins of variable array */
long Coord_BinProd[MONnD_COORD_NMAX]; /* product of bins of variable array */
double Coord_Min[MONnD_COORD_NMAX];
double Coord_Max[MONnD_COORD_NMAX];
char Monitor_Label[MONnD_COORD_NMAX*30];/* Label for monitor */
char Mon_File[128]; /* output file name */
/* these don't seem to be used anymore as they are superseded by _particle
double cx, cy, cz;
double cvx, cvy, cvz;
double ckx, cky, ckz;
double csx, csy, csz;
double cEx, cEy, cEz;
double cs1, cs2, ct, cphi, cp; */
double He3_pressure;
char Flag_UsePreMonitor ; /* use a previously stored neutron parameter set */
char UserName1[128];
char UserName2[128];
char UserName3[128];
char UserVariable1[128];
char UserVariable2[128];
char UserVariable3[128];
double UserDoubles[16];
char option[CHAR_BUF_LENGTH];
long long int Nsum;
double psum, p2sum;
double **Mon2D_N;
double **Mon2D_p;
double **Mon2D_p2;
double *Mon2D_Buffer;
unsigned long PixelID;
double mxmin,mxmax,mymin,mymax,mzmin,mzmax;
double mean_dx, mean_dy, min_x, min_y, max_x, max_y, mean_p;
char compcurname[128];
Coords compcurpos;
Rotation compcurrot;
} MonitornD_Variables_type;
/* monitor_nd-lib function prototypes */
/* ========================================================================= */
void Monitor_nD_Init(MonitornD_Defines_type *, MonitornD_Variables_type *, MCNUM, MCNUM, MCNUM, MCNUM, MCNUM, MCNUM, MCNUM, MCNUM, MCNUM, int);
#pragma acc routine
int Monitor_nD_Trace(MonitornD_Defines_type *, MonitornD_Variables_type *, _class_particle* _particle);
MCDETECTOR Monitor_nD_Save(MonitornD_Defines_type *, MonitornD_Variables_type *);
void Monitor_nD_Finally(MonitornD_Defines_type *, MonitornD_Variables_type *);
void Monitor_nD_McDisplay(MonitornD_Defines_type *, MonitornD_Variables_type *);
#endif
/* end of monitor_nd-lib.h */
|