]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSBase.h
- handling of global AliHLTSystem singleton moved to BASE
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSBase.h
1 #ifndef ALIHLTPHOSBASE_H
2 #define ALIHLTPHOSBASE_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 #include <Rtypes.h>
24 #include "TString.h"
25 #include "AliHLTDataTypes.h"
26 #include "AliHLTPHOSConstants.h"
27 #include "AliHLTPHOSConfig.h"
28 #include "AliHLTPHOSAltroConfig.h"
29 #include "AliHLTLogging.h"
30
31 using namespace PhosHLTConst;
32 using namespace std;
33
34 //
35 // Base class for all PHOS HLT classes.
36 // The class contains some utility functions
37 // and also loads data about the HLT configuration
38 // and the altro/FEE configuration
39 //
40
41
42 class  AliHLTPHOSBase : public AliHLTPHOSConfig, public AliHLTPHOSAltroConfig
43 {
44  public:
45   AliHLTPHOSBase();
46   virtual ~AliHLTPHOSBase();
47   bool CheckFile(const char *fileName, const char *opt) const;
48
49
50   template<typename T> 
51   void  DumpData(T *array, int N, int nPerLine)
52   {
53     cout <<   "DumpData N=  " << N <<endl;
54     for(int i= 0; i< N; i++)
55       {
56         if((i%nPerLine == 0)  &&  (i != 0))
57           {
58             printf("\n");
59           }
60
61         cout << array[i]<< "\t";
62       }
63   }
64
65   template<typename T> 
66   void  ResetArray(T *array, int N) const
67   {
68     for(int i= 0; i< N; i++)
69       {
70         array[i] = 0;
71       }
72   }
73  
74   template<typename T> 
75   T  MaxValue(T *array, int N) const
76   {
77     T tmpMax = 0;
78
79     for(int i = 0; i < N; i++)
80       {
81         if(array[i] > tmpMax)
82           {
83             tmpMax = array[i];
84           }
85       }
86   
87     return tmpMax;
88   }
89
90   
91 protected:
92   AliHLTPHOSConfig *fConfigPtr;        // object holding HLT configuration data
93   AliHLTPHOSConfig *fAltroConfigPtr;   // object holding Altro configuration data
94
95 private:
96   AliHLTLogging *fLogPtr;
97
98   AliHLTPHOSBase(const AliHLTPHOSBase & );
99   AliHLTPHOSBase & operator = (const AliHLTPHOSBase &);
100 };
101
102 #endif