]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | ||
2589c3a3 | 4 | #ifndef ALIHLTPHOSUTILITIES_H |
5 | #define ALIHLTPHOSUTILITIES_H | |
6 | ||
7 | /************************************************************************** | |
8 | * This file is property of and copyright by the Experimental Nuclear * | |
9 | * Physics Group, Dep. of Physics * | |
10 | * University of Oslo, Norway, 2007 * | |
11 | * * | |
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 * | |
15 | * * | |
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 | **************************************************************************/ | |
24 | ||
25 | #include <iostream> | |
26 | ||
27 | using namespace std; | |
28 | ||
29 | // AliHLTPHOSUtilities | |
30 | class AliHLTPHOSUtilities | |
31 | { | |
32 | public: | |
33 | AliHLTPHOSUtilities(); | |
34 | virtual ~AliHLTPHOSUtilities(); | |
35 | ||
36 | bool CheckFile(const char *fileName, const char *opt) const; | |
37 | ||
9a2451f1 | 38 | static bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value = 0 ); |
39 | static bool ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value = 0 ); | |
40 | static bool ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname = 0 ); | |
41 | static bool ScanSingleArgument(int argc, const char** argv, const char *name); | |
2589c3a3 | 42 | |
43 | template<typename T> | |
44 | void DumpData(T *array, int N, int nPerLine) | |
45 | { | |
46 | // cout << "DumpData N= " << N <<endl; | |
47 | for(int i= 0; i< N; i++) | |
48 | { | |
49 | if((i%nPerLine == 0) && (i != 0)) | |
50 | { | |
87434909 | 51 | //printf("\n"); |
52 | cout << endl; | |
2589c3a3 | 53 | } |
54 | ||
55 | cout << array[i]<< "\t"; | |
56 | } | |
87434909 | 57 | // printf("\n"); |
58 | cout << endl; | |
2589c3a3 | 59 | } |
60 | ||
61 | template<typename T> | |
62 | void ResetArray(T *array, int N) const | |
63 | { | |
64 | for(int i= 0; i< N; i++) | |
65 | { | |
66 | array[i] = 0; | |
67 | } | |
68 | } | |
69 | ||
70 | template<typename T> | |
71 | T MaxValue(T *array, int N) const | |
72 | { | |
73 | T tmpMax = 0; | |
74 | ||
75 | for(int i = 0; i < N; i++) | |
76 | { | |
77 | if(array[i] > tmpMax) | |
78 | { | |
79 | tmpMax = array[i]; | |
80 | } | |
81 | } | |
2589c3a3 | 82 | return tmpMax; |
83 | } | |
84 | ||
9d05c97d | 85 | |
86 | ||
2589c3a3 | 87 | |
88 | private: | |
9a2451f1 | 89 | static int DoExistArgument(const int argc, const char** argv, const char *argument) ; |
2589c3a3 | 90 | |
91 | }; | |
92 | ||
93 | #endif |