| 1 | /////////////////////////////////////////////////////////////////
|
|---|
| 2 | //
|
|---|
| 3 | // checkmc.h
|
|---|
| 4 | //
|
|---|
| 5 | // Created: Thu May 7 16:24:22 1998
|
|---|
| 6 | // Authors: Jose Carlos Gonzalez et al.
|
|---|
| 7 | // Purpose: include file for checkmc.cxx
|
|---|
| 8 | // Notes: version 2-10-98
|
|---|
| 9 | //
|
|---|
| 10 | /////////////////////////////////////////////////////////////////
|
|---|
| 11 |
|
|---|
| 12 | // @T \newpage
|
|---|
| 13 |
|
|---|
| 14 | // @section Source code of {\tt checkmc.h}
|
|---|
| 15 |
|
|---|
| 16 | /* @text
|
|---|
| 17 | This section shows the include file {\tt checkmc.h}
|
|---|
| 18 | @endtext */
|
|---|
| 19 |
|
|---|
| 20 | // @subsection Include files
|
|---|
| 21 |
|
|---|
| 22 | // @code
|
|---|
| 23 | #include <iostream.h>
|
|---|
| 24 | #include <fstream.h>
|
|---|
| 25 | #include <stdlib.h>
|
|---|
| 26 | #include <stdio.h>
|
|---|
| 27 | #include <string.h>
|
|---|
| 28 | #include <stdarg.h>
|
|---|
| 29 | #include <math.h>
|
|---|
| 30 | #include <float.h>
|
|---|
| 31 | #include <sys/types.h>
|
|---|
| 32 | #include <dirent.h>
|
|---|
| 33 |
|
|---|
| 34 | #include "jcmacros.h"
|
|---|
| 35 | #include "jcdebug.h"
|
|---|
| 36 |
|
|---|
| 37 | #include "COREventHeader.hxx"
|
|---|
| 38 | #include "CORParticle.hxx"
|
|---|
| 39 | #include "CORStatfile.hxx"
|
|---|
| 40 |
|
|---|
| 41 | // @endcode
|
|---|
| 42 |
|
|---|
| 43 | // @subsection Macro-definitions, and constants
|
|---|
| 44 |
|
|---|
| 45 | // @code
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | #ifndef VERSION
|
|---|
| 50 |
|
|---|
| 51 | #define PROGRAM checkmc
|
|---|
| 52 | #define VERSION 1.0
|
|---|
| 53 |
|
|---|
| 54 | #define GLUE_prep(x,y) #x" "#y
|
|---|
| 55 | #define GLUE_postp(x,y) GLUE_prep(x,y)
|
|---|
| 56 |
|
|---|
| 57 | const char SIGNATURE[] = GLUE_postp( PROGRAM, VERSION );
|
|---|
| 58 |
|
|---|
| 59 | #endif // ! VERSION
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 | #define NORM(x) (sqrt(SQR(x[0])+SQR(x[1])+SQR(x[2]))) /* Norm(vector) */
|
|---|
| 64 | #define RAD(x) ((x)*0.0174532925199433)
|
|---|
| 65 | #define DEG(x) ((x)*57.2957795130823)
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | // now we define the list PAR_ITEM_LIST of possible items in
|
|---|
| 70 | // the CT definition file.
|
|---|
| 71 |
|
|---|
| 72 | #define PAR_ITEM_LIST /* LIST OF ITEMS IN THE CT DEFINITION FILE */ \
|
|---|
| 73 | T(data_paths), /* begin of the list of source data paths */ \
|
|---|
| 74 | T(output_file), /* output file */ \
|
|---|
| 75 | T(verbose_level), /* defines verbose level of the output */ \
|
|---|
| 76 | T(max_events), /* maximum number of event to read */ \
|
|---|
| 77 | T(reference_histo), /* reference histogram */ \
|
|---|
| 78 | T(end_file) /* end of the parameters file */
|
|---|
| 79 |
|
|---|
| 80 | #define T(x) x // define T() as the name as it is
|
|---|
| 81 |
|
|---|
| 82 | enum PAR_ITEM_TYPE {
|
|---|
| 83 | PAR_ITEM_LIST
|
|---|
| 84 | };
|
|---|
| 85 |
|
|---|
| 86 | #undef T
|
|---|
| 87 |
|
|---|
| 88 | #define T(x) #x // define T() as the string of x
|
|---|
| 89 |
|
|---|
| 90 | const char *const PAR_ITEM_NAMES[] = {
|
|---|
| 91 | PAR_ITEM_LIST
|
|---|
| 92 | };
|
|---|
| 93 |
|
|---|
| 94 | #undef T
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 | #define LINE_MAX_LENGTH 120
|
|---|
| 98 | #define ITEM_MAX_LENGTH 40
|
|---|
| 99 | #define PATH_MAX_LENGTH 120
|
|---|
| 100 |
|
|---|
| 101 | #define NTHSTEP 79 // assumes thstep = 10 g/cm2 (790/10 = 79)
|
|---|
| 102 |
|
|---|
| 103 | // maximum number of bins for the 1D histograms
|
|---|
| 104 | #define NMAXBINS 100
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | // Verbose Levels
|
|---|
| 108 | enum VerboseLevel {
|
|---|
| 109 | VERBOSE_QUIET,
|
|---|
| 110 | VERBOSE_MINIMAL,
|
|---|
| 111 | VERBOSE_NORMAL,
|
|---|
| 112 | VERBOSE_MAXIMAL
|
|---|
| 113 | };
|
|---|
| 114 |
|
|---|
| 115 | #define VERBOSE_DEFAULT VERBOSE_MINIMAL
|
|---|
| 116 |
|
|---|
| 117 | // @endcode
|
|---|
| 118 |
|
|---|
| 119 | /* @text
|
|---|
| 120 | Definition of the dimensions of the diagnostics messages array in
|
|---|
| 121 | monitor_event()
|
|---|
| 122 | @endtext */
|
|---|
| 123 | // @code
|
|---|
| 124 | #define DIAGX 256
|
|---|
| 125 | #define DIAGY 20
|
|---|
| 126 | // @endcode
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | /* @text
|
|---|
| 130 | Data for the atmosphere: useful for conversion between height and thickness.
|
|---|
| 131 | @endtext */
|
|---|
| 132 |
|
|---|
| 133 | // @code
|
|---|
| 134 |
|
|---|
| 135 | float AATM[5] = {
|
|---|
| 136 | -186.5562e0,
|
|---|
| 137 | -94.919e0,
|
|---|
| 138 | 0.61289e0,
|
|---|
| 139 | 0.e0,
|
|---|
| 140 | .01128292e0 };
|
|---|
| 141 | float BATM[5] = {
|
|---|
| 142 | 1222.6562e0,
|
|---|
| 143 | 1144.9069e0,
|
|---|
| 144 | 1305.5948e0,
|
|---|
| 145 | 540.1778e0,
|
|---|
| 146 | 0.e0 };
|
|---|
| 147 | float CATM[5] = {
|
|---|
| 148 | 994186.38e0,
|
|---|
| 149 | 878153.55e0,
|
|---|
| 150 | 636143.04e0,
|
|---|
| 151 | 772170.16e0,
|
|---|
| 152 | 1.e-9};
|
|---|
| 153 | float DATM[5] = {
|
|---|
| 154 | 1.00584761581626e-06,
|
|---|
| 155 | 1.13875301193054e-06,
|
|---|
| 156 | 1.57197349828743e-06,
|
|---|
| 157 | 1.29505133946124e-06,
|
|---|
| 158 | 1.00000000000000e+09}; // = 1 / CATM
|
|---|
| 159 |
|
|---|
| 160 | // @endcode
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 | // @subsection Prototypes of functions
|
|---|
| 164 |
|
|---|
| 165 | //++
|
|---|
| 166 | // prototypes
|
|---|
| 167 | //--
|
|---|
| 168 |
|
|---|
| 169 | //@code
|
|---|
| 170 |
|
|---|
| 171 | void present(void);
|
|---|
| 172 | void log(const char *funct, char *fmt, ...);
|
|---|
| 173 | void error(const char *funct, char *fmt, ...);
|
|---|
| 174 | void readparam(void);
|
|---|
| 175 | int get_num_of_paths(void);
|
|---|
| 176 | char *get_path_name(int i);
|
|---|
| 177 | char *get_output_filename(void);
|
|---|
| 178 | int get_max_events(void);
|
|---|
| 179 | float thick( float height, float theta );
|
|---|
| 180 | float height( float thk, float theta );
|
|---|
| 181 | void monitor_event(char diag[DIAGX][DIAGY], int *ndiag, const char* primary,
|
|---|
| 182 | const float a, const float b, const char* message);
|
|---|
| 183 |
|
|---|
| 184 | // @endcode
|
|---|
| 185 |
|
|---|
| 186 | // @text
|
|---|
| 187 | // CFortran routines will be used.
|
|---|
| 188 | // @endtext
|
|---|
| 189 |
|
|---|
| 190 | // @code
|
|---|
| 191 | #include <stdlib.h>
|
|---|
| 192 | #include <cfortran.h>
|
|---|
| 193 | // #include <packlib.h>
|
|---|
| 194 | #include "hbook.h"
|
|---|
| 195 | //#include "minuit.h"
|
|---|
| 196 | //#include "kuip.h"
|
|---|
| 197 | //#include "zebra.h"
|
|---|
| 198 |
|
|---|
| 199 | #define PAWC_SIZE 1000000
|
|---|
| 200 |
|
|---|
| 201 | float pawc_[PAWC_SIZE];
|
|---|
| 202 |
|
|---|
| 203 | // extern "C"
|
|---|
| 204 | //{
|
|---|
| 205 | // extern void hlimit_(int*);
|
|---|
| 206 | // extern void hropen_(int*, char*, char*, char*, int*, int*, int, int, int);
|
|---|
| 207 | // extern void hbookn_(int*, char*, int*, char*, int*, char*, int, int, int);
|
|---|
| 208 | // extern void hrout_(int*, int*, char*, int);
|
|---|
| 209 | // extern void hrend_(char*, int);
|
|---|
| 210 | // extern void hfn_(int*, float*);
|
|---|
| 211 | // }
|
|---|
| 212 | // @endcode
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 | char* strconcat(const char* s1, const char* s2, char* s3)
|
|---|
| 216 | {
|
|---|
| 217 | for (int i=0;s3[i]=s1[i]; ++i);
|
|---|
| 218 | for (int i=strlen(s1);s3[i]=s2[i-strlen(s1)]; ++i);
|
|---|
| 219 | return s3;
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 |
|
|---|