]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSUtilities.h
Online Fourier analysis
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSUtilities.h
1 #ifndef ALIHLTPHOSUTILITIES_H
2 #define ALIHLTPHOSUTILITIES_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, 2007                                       *
8  *                                                                        *
9  * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT 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 <iostream>
23
24 using namespace std;
25
26 //      AliHLTPHOSUtilities
27 class  AliHLTPHOSUtilities
28 {
29  public:
30   AliHLTPHOSUtilities();
31   virtual ~AliHLTPHOSUtilities();
32  
33   bool CheckFile(const char *fileName, const char *opt) const;
34
35   bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value = 0 );
36   bool ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value = 0 );
37   bool ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname = 0 );
38   bool ScanSingleArgument(int argc, const char** argv, const char *name);
39
40   template<typename T> 
41     void  DumpData(T *array, int N, int nPerLine)
42     {
43       //   cout <<   "DumpData N=  " << N <<endl;
44       for(int i= 0; i< N; i++)
45         {
46           if((i%nPerLine == 0)  &&  (i != 0))
47             {
48               printf("\n");
49             }
50
51           cout << array[i]<< "\t";
52         }
53       printf("\n");
54     }
55
56   template<typename T> 
57     void  ResetArray(T *array, int N) const
58     {
59       for(int i= 0; i< N; i++)
60         {
61           array[i] = 0;
62         }
63     }
64  
65   template<typename T> 
66     T  MaxValue(T *array, int N) const
67     {
68       T tmpMax = 0;
69
70       for(int i = 0; i < N; i++)
71         {
72           if(array[i] > tmpMax)
73             {
74               tmpMax = array[i];
75             }
76         }
77   
78       return tmpMax;
79     }
80
81
82
83   
84  private:
85   int DoExistArgument(const int argc, const char** argv, const char *argument) const;
86
87 };
88
89 #endif