]>
Commit | Line | Data |
---|---|---|
178dd351 | 1 | //-*- Mode: C++ -*- |
3800a654 | 2 | // $Id: AliHLTCALOUtilities.h 34264 2009-08-14 18:29:23Z odjuvsla $ |
178dd351 | 3 | |
4 | #ifndef ALIHLTCALOUTILITIES_H | |
5 | #define ALIHLTCALOUTILITIES_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 | ||
178dd351 | 29 | // AliHLTCaloUtilities |
30 | class AliHLTCaloUtilities | |
31 | { | |
32 | public: | |
33 | AliHLTCaloUtilities(); | |
34 | virtual ~AliHLTCaloUtilities(); | |
35 | ||
1a53578c | 36 | static bool CheckFile(const char *fileName, const char *opt); |
178dd351 | 37 | |
1a53578c | 38 | // static bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value) |
39 | static bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value = 0 ); | |
40 | static bool ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value = 0 ); | |
41 | static bool ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname = 0 ); | |
42 | static bool ScanSingleArgument(int argc, const char** argv, const char *name); | |
178dd351 | 43 | |
44 | template<typename T> | |
1a53578c | 45 | static void DumpData(T *array, int N, int nPerLine) |
178dd351 | 46 | { |
47 | // cout << "DumpData N= " << N <<endl; | |
48 | for(int i= 0; i< N; i++) | |
49 | { | |
50 | if((i%nPerLine == 0) && (i != 0)) | |
51 | { | |
52 | //printf("\n"); | |
53 | cout << endl; | |
54 | } | |
55 | ||
56 | cout << array[i]<< "\t"; | |
57 | } | |
58 | // printf("\n"); | |
59 | cout << endl; | |
60 | } | |
61 | ||
62 | template<typename T> | |
1a53578c | 63 | static void ResetArray(T *array, int N) |
178dd351 | 64 | { |
65 | for(int i= 0; i< N; i++) | |
66 | { | |
67 | array[i] = 0; | |
68 | } | |
69 | } | |
70 | ||
71 | template<typename T> | |
1a53578c | 72 | static T MaxValue(T *array, int N) |
178dd351 | 73 | { |
74 | T tmpMax = 0; | |
75 | ||
76 | for(int i = 0; i < N; i++) | |
77 | { | |
78 | if(array[i] > tmpMax) | |
79 | { | |
80 | tmpMax = array[i]; | |
81 | } | |
82 | } | |
83 | return tmpMax; | |
84 | } | |
85 | ||
86 | ||
87 | ||
88 | ||
89 | private: | |
1a53578c | 90 | static int DoExistArgument(const int argc, const char** argv, const char *argument); |
178dd351 | 91 | |
92 | }; | |
93 | ||
94 | #endif |