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