]>
Commit | Line | Data |
---|---|---|
dabc4c35 | 1 | #ifndef COMMONDEFS_H |
2 | #define COMMONDEFS_H | |
3 | ||
4 | /************************************************************************** | |
5 | * This file is property of and copyright by the Experimental Nuclear * | |
6 | * Physics Group, Dep. of Physics * | |
7 | * University of Oslo, Norway, 2006 * | |
8 | * * | |
56673b84 | 9 | * Author: Per Thomas Hille perthi@fys.uio.no for the ALICE HLT Project. * |
dabc4c35 | 10 | * Contributors are mentioned in the code where appropriate. * |
11 | * Please report bugs to perthi@fys.uio.no * | |
12 | * * | |
13 | * Permission to use, copy, modify and distribute this software and its * | |
14 | * documentation strictly for non-commercial purposes is hereby granted * | |
15 | * without fee, provided that the above copyright notice appears in all * | |
16 | * copies and that both the copyright notice and this permission notice * | |
17 | * appear in the supporting documentation. The authors make no claims * | |
18 | * about the suitability of this software for any purpose. It is * | |
19 | * provided "as is" without express or implied warranty. * | |
20 | **************************************************************************/ | |
21 | ||
e0c124c5 | 22 | //#include "PhosConst.h" |
dabc4c35 | 23 | |
24 | #define PHOS_CRYSTALS (PHOS_MODS*PHOS_ROWS*PHOS_COLS) // Total number of PHOS crystals | |
25 | ||
26 | //#define unsigned long int PHOS_CHANNELS (PHOS_GAINS*PHOS_CRYSTALS) // Total number of PHOS channels | |
27 | //#define unsigned long int MP_MAP_FILE_NAME "phosmp.map" // Shared memory map file name | |
28 | //#define unsigned long int MP_MAP_FILE_SIZE (PHOS_CHANNELS*1024*8) // Shared memory map file size | |
29 | //#define unsigned long int MP_RESULT_DIR "mp_result" // Directory to store result to | |
30 | ||
31 | #define PHOS_CHANNELS (PHOS_GAINS*PHOS_CRYSTALS) // Total number of PHOS channels | |
32 | #define MP_MAP_FILE_NAME "phosmp.map" // Shared memory map file name | |
33 | #define MP_MAP_FILE_SIZE (PHOS_CHANNELS*1024*8) // Shared memory map file size | |
34 | #define MP_RESULT_DIR "mp_result" // Directory to store result to | |
35 | ||
36 | ||
37 | ////#define unsigned long int TRUE 1 // General purpose definition | |
38 | ////#define FALSE 0 // General purpose definition | |
39 | ||
40 | ||
41 | #define MIN(x,y) ((x)>(y)?(y):(x)) | |
42 | #define MAX(x,y) ((x)>(y)?(x):(y)) | |
43 | #define ADJUST_TO_HIGHER(size,step) ((((size)+(step)-1)/(step))*(step)) | |
44 | #define ADJUST_TO_LOWER(size,step) (((size)/(step))*(step)) | |
45 | ||
46 | ///////////////////////////////////////////// | |
47 | // Find index of maximum in array of any type | |
48 | ///////////////////////////////////////////// | |
49 | ||
50 | #define __IMPLEMENT__findIndexOfMax(type) \ | |
51 | inline int findIndexOfMax(type *data, int count) \ | |
52 | { int m=0; for(int i=1; i<count; i++) if(data[i]>data[m]) m=i; return m;} | |
53 | __IMPLEMENT__findIndexOfMax(char) | |
54 | __IMPLEMENT__findIndexOfMax(unsigned char) | |
55 | __IMPLEMENT__findIndexOfMax(int) | |
56 | __IMPLEMENT__findIndexOfMax(unsigned int) | |
57 | __IMPLEMENT__findIndexOfMax(short int) | |
58 | __IMPLEMENT__findIndexOfMax(unsigned short int) | |
59 | __IMPLEMENT__findIndexOfMax(long long) | |
60 | __IMPLEMENT__findIndexOfMax(unsigned long long) | |
61 | __IMPLEMENT__findIndexOfMax(float) | |
62 | __IMPLEMENT__findIndexOfMax(double) | |
63 | ||
64 | ///////////////////////////////////////////// | |
65 | // Find index of minimum in array of any type | |
66 | ///////////////////////////////////////////// | |
67 | #define __IMPLEMENT__findIndexOfMin(type) \ | |
68 | inline int findIndexOfMin(type *data, int count) \ | |
69 | { int m=0; for(int i=1; i<count; i++) if(data[i]<data[m]) m=i; return m;} | |
70 | __IMPLEMENT__findIndexOfMin(char) | |
71 | __IMPLEMENT__findIndexOfMin(unsigned char) | |
72 | __IMPLEMENT__findIndexOfMin(int) | |
73 | __IMPLEMENT__findIndexOfMin(unsigned int) | |
74 | __IMPLEMENT__findIndexOfMin(short int) | |
75 | __IMPLEMENT__findIndexOfMin(unsigned short int) | |
76 | __IMPLEMENT__findIndexOfMin(long long) | |
77 | __IMPLEMENT__findIndexOfMin(unsigned long long) | |
78 | __IMPLEMENT__findIndexOfMin(float) | |
79 | __IMPLEMENT__findIndexOfMin(double) | |
80 | ||
81 | ////////////////////////////////////// | |
82 | // Fill struct x of any type with zero | |
83 | ////////////////////////////////////// | |
84 | #define FILL_ZERO(x) memset(&(x),0,sizeof(x)) | |
85 | ||
86 | ////////////// | |
87 | // END OF FILE | |
88 | ////////////// | |
da6cfe54 | 89 | |
46072fbe | 90 | #endif |
ea912979 | 91 | |
92 |