]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/CALO/AliHLTCaloUtilities.h
Wrong versiion was committed before, this is the correct one
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloUtilities.h
CommitLineData
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
27using namespace std;
28
178dd351 29class AliHLTCaloUtilities
30{
31 public:
32 AliHLTCaloUtilities();
33 virtual ~AliHLTCaloUtilities();
1a53578c 34 static bool CheckFile(const char *fileName, const char *opt);
1a53578c 35 static bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value = 0 );
36 static bool ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value = 0 );
37 static bool ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname = 0 );
38 static bool ScanSingleArgument(int argc, const char** argv, const char *name);
178dd351 39
40 template<typename T>
1a53578c 41 static void DumpData(T *array, int N, int nPerLine)
178dd351 42 {
178dd351 43 for(int i= 0; i< N; i++)
44 {
45 if((i%nPerLine == 0) && (i != 0))
46 {
178dd351 47 cout << endl;
48 }
49
50 cout << array[i]<< "\t";
51 }
178dd351 52 cout << endl;
53 }
54
55 template<typename T>
1a53578c 56 static void ResetArray(T *array, int N)
178dd351 57 {
58 for(int i= 0; i< N; i++)
59 {
60 array[i] = 0;
61 }
62 }
63
64 template<typename T>
1a53578c 65 static T MaxValue(T *array, int N)
178dd351 66 {
67 T tmpMax = 0;
68
69 for(int i = 0; i < N; i++)
70 {
71 if(array[i] > tmpMax)
72 {
73 tmpMax = array[i];
74 }
75 }
76 return tmpMax;
77 }
178dd351 78
5d3119bd 79
80private:
1a53578c 81 static int DoExistArgument(const int argc, const char** argv, const char *argument);
178dd351 82
83};
84
85#endif