]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/CALO/AliHLTCaloUtilities.h
Refactoring and moving some PHOS code which will be used for both calorimeters to...
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloUtilities.h
1 //-*- Mode: C++ -*-
2 // $Id: AliHLTCaloUtilities.h 34264 2009-08-14 18:29:23Z odjuvsla $
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
29 // TODO: Documentation!
30
31 //      AliHLTCaloUtilities
32 class  AliHLTCaloUtilities
33 {
34  public:
35   AliHLTCaloUtilities();
36   virtual ~AliHLTCaloUtilities();
37  
38   bool CheckFile(const char *fileName, const char *opt) const;
39
40   bool ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value = 0 );
41   bool ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value = 0 );
42   bool ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname = 0 );
43   bool ScanSingleArgument(int argc, const char** argv, const char *name);
44
45   template<typename T> 
46     void  DumpData(T *array, int N, int nPerLine)
47     {
48       //   cout <<   "DumpData N=  " << N <<endl;
49       for(int i= 0; i< N; i++)
50         {
51           if((i%nPerLine == 0)  &&  (i != 0))
52             {
53               //printf("\n");
54               cout << endl;
55             }
56
57           cout << array[i]<< "\t";
58         }
59       //     printf("\n");
60       cout << endl;
61     }
62
63   template<typename T> 
64     void  ResetArray(T *array, int N) const
65     {
66       for(int i= 0; i< N; i++)
67         {
68           array[i] = 0;
69         }
70     }
71  
72   template<typename T> 
73     T  MaxValue(T *array, int N) const
74     {
75       T tmpMax = 0;
76
77       for(int i = 0; i < N; i++)
78         {
79           if(array[i] > tmpMax)
80             {
81               tmpMax = array[i];
82             }
83         }
84       return tmpMax;
85     }
86
87
88
89   
90  private:
91   int DoExistArgument(const int argc, const char** argv, const char *argument) const;
92
93 };
94
95 #endif