Modified files to use constants declared in the
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSCommonDefs.h
CommitLineData
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 * *
9 * Author: Per Thomas Hille perthi@fys.uio.no for the ALICE DCS Project. *
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
22#include "PhosConst.h"
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