]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Modified structure and new class for all HLT PHOS componentsx
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 15 Oct 2007 15:37:53 +0000 (15:37 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 15 Oct 2007 15:37:53 +0000 (15:37 +0000)
HLT/PHOS/AliHLTPHOSAltroConfig.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSAltroConfig.h [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSBase.cxx
HLT/PHOS/AliHLTPHOSBase.h

diff --git a/HLT/PHOS/AliHLTPHOSAltroConfig.cxx b/HLT/PHOS/AliHLTPHOSAltroConfig.cxx
new file mode 100644 (file)
index 0000000..ac87ba5
--- /dev/null
@@ -0,0 +1,134 @@
+/**************************************************************************
+ * This file is property of and copyright by the Experimental Nuclear     *
+ * Physics Group, Dep. of Physics                                         *
+ * University of Oslo, Norway, 2007                                       *
+ *                                                                        *
+ * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to perthi@fys.uio.no                                *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+#include "AliHLTPHOSAltroConfig.h"
+#include <stdio.h>
+//#include <unistd.h>
+#include <cstdlib>
+
+
+AliHLTPHOSAltroConfig::AliHLTPHOSAltroConfig() : fNPresamples(900), 
+                                                fNSamples(15), 
+                                                fIsAltroZeroSupressed(false),
+                                                fIsAltroBaselineSubtraction(false)
+
+
+{
+  //  fNTotalSamples =  fNPresamples + fNSamples ; 
+  int tmpNSamples = 0;
+  int tmpNPreSamples = 0;
+
+  char *tmpBaseDir = getenv("ALIHLT_BASEDIR");
+  char tmpFileName[256];
+
+  sprintf(tmpFileName, "%s/PHOS/hltAltroConfig.txt", tmpBaseDir);
+
+  if(tmpBaseDir != 0)
+    {
+      FILE *fp = fopen(tmpFileName, "r");
+
+      if(fp == 0)
+       {
+         printf("\nNSamples scanned from file is, ERROR \n");
+         printf("\nNPreSamples scanned from file is. ERROR\n"); 
+         PrintAltroDefaultValues(); 
+       }
+      else
+       {
+         
+         fscanf(fp, "N_SAMPLES %d\n", &tmpNSamples); 
+         fscanf(fp, "N_PRE_SAMPLES %d\n", &tmpNPreSamples);
+         fNSamples = tmpNSamples;
+         fNPresamples = tmpNPreSamples;
+          //fNTotalSamples;
+         fNTotalSamples = fNSamples + fNPresamples;
+         //printf("\nNSamples scanned from file is %d\n", tmpNSamples);
+         //printf("\nNPreSamples scanned from file is %d\n", tmpNPreSamples); 
+         //printf("\nTotalSamplesSamples was set to  %d\n", fNTotalSamples); 
+         //PrintAltroDefaultValues(); 
+         fclose(fp);
+         
+       }
+
+    }
+  else
+    {
+      printf( "\nERROR: could not find ALIHLT_BASEDIR\n" );
+    }
+
+}
+
+
+AliHLTPHOSAltroConfig::~AliHLTPHOSAltroConfig()
+{
+
+}
+
+void 
+AliHLTPHOSAltroConfig:: PrintAltroDefaultValues()
+{
+  printf("\n AliHLTPHOSAltroConfig Default  Values\n");
+  printf("Presamples = %d\n", fNPresamples);
+  printf("NSamples = %d\n", fNSamples);
+
+  if(fIsAltroZeroSupressed == true)
+    {
+      printf("fIsAltroZeroSupressed = true\n");
+    }
+  else
+    {
+      printf("fIsAltroZeroSupressed = false\n");
+    }
+
+  
+  if(fIsAltroBaselineSubtraction == true)
+    {
+      printf("fIsAltroBaselineSubtraction = true\n");
+    }
+  else
+    {
+      printf("fIsAltroBaselineSubtraction = false\n");
+    }
+  //    `fIsSoftwareBaselinesubtraction 
+}
+
+
+void 
+AliHLTPHOSAltroConfig::SetNPresSamples(int presamples)
+{
+  fNPresamples =  presamples;
+}
+
+void 
+AliHLTPHOSAltroConfig::SetNSamples(int samples)
+{
+  fNSamples = samples;
+}
+
+void 
+AliHLTPHOSAltroConfig::SetAltroZeroSupression(bool isZeroSupressed)
+{
+  fIsAltroZeroSupressed = isZeroSupressed;
+}
+
+void 
+AliHLTPHOSAltroConfig::SetAltroBaselineSubtraction(bool isAltroBaselineSubtraction)
+{
+  fIsAltroBaselineSubtraction = isAltroBaselineSubtraction;
+}
+
+
diff --git a/HLT/PHOS/AliHLTPHOSAltroConfig.h b/HLT/PHOS/AliHLTPHOSAltroConfig.h
new file mode 100644 (file)
index 0000000..ceebbe9
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIHLTPHOSALTROCONFIG_H
+#define ALIHLTPHOSALTROCONFIG_H
+
+/**************************************************************************
+ * This file is property of and copyright by the Experimental Nuclear     *
+ * Physics Group, Dep. of Physics                                         *
+ * University of Oslo, Norway, 2007                                       *
+ *                                                                        *
+ * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project.*
+ * Contributors are mentioned in the code where appropriate.              *
+ * Please report bugs to perthi@fys.uio.no                                *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+
+class  AliHLTPHOSAltroConfig
+{
+public:
+  AliHLTPHOSAltroConfig();
+  virtual ~AliHLTPHOSAltroConfig();
+  void SetNPresSamples(int presamples);
+  void SetNSamples(int samples);
+  void SetAltroZeroSupression(bool isZerosupressed);
+  void SetAltroBaselineSubtraction(bool isAltroBaselineSubtraction);
+  //  void SetSoftwareBaselineSubtraction(bool isSoftwareBaselineSubtraction);
+  inline int  GetNPresSamples(){return  fNPresamples;}; 
+  inline int  GetNSamples(){return  fNSamples;}; 
+  inline bool GetIsAltroZroSupresses(){return   fIsAltroZeroSupressed;}; 
+  inline bool GetIsAltroBaselineSubtraction(){return fIsAltroBaselineSubtraction;};
+  void PrintAltroDefaultValues();
+
+protected:
+  //Altro Config
+  int fNPresamples;
+  int fNSamples;
+  int fNTotalSamples;
+  bool fIsAltroZeroSupressed;
+  bool fIsAltroBaselineSubtraction;
+};
+
+#endif
index 5d089e40aa4d062710966c56307dbcd4d948b750..a50d1b41a50e08b7f0ea69d901599602ce5b5cbc 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+
 #include "AliHLTPHOSBase.h"
+#include "AliHLTPHOSConfig.h"
+#include "AliHLTPHOSAltroConfig.h"
 
 
-AliHLTPHOSBase::AliHLTPHOSBase()
+AliHLTPHOSBase::AliHLTPHOSBase(): AliHLTPHOSConfig(),  
+                                 AliHLTPHOSAltroConfig()
 {
-
+  //  fConfigPtr = new AliHLTPHOSConfig();
+  //  fAltroConfigPtr = new AliHLTPHOSAltroConfig();
 }
 
+
 AliHLTPHOSBase::~AliHLTPHOSBase()
 {
 
index de8f7db1dc8fe37d9dcf285a81cf98f2a6433d01..f4d2ef3b32a2ecf3d9e476bd72ccd6913c1bdf10 100644 (file)
 #include <Rtypes.h>
 #include "TString.h"
 #include "AliHLTDataTypes.h"
-//#include "AliHLTPHOSDefinitions.h"
-//#include "AliHLTPHOSCommonDefs.h"
 #include "AliHLTPHOSConstants.h"
+#include "AliHLTPHOSConfig.h"
+#include "AliHLTPHOSAltroConfig.h"
 
 using namespace PhosHLTConst;
-
-
-
 using namespace std;
 
 
-class  AliHLTPHOSBase
+class AliHLTPHOSConfig;
+class AliHLTPHOSAltroConfig;
+
+class  AliHLTPHOSBase : public AliHLTPHOSConfig, public AliHLTPHOSAltroConfig
 {
- public:
+public:
   AliHLTPHOSBase();
   virtual ~AliHLTPHOSBase();
 
 
   template<typename T> 
-    void  DumpData(T *array, int N, int nPerLine)
-    {
-      cout <<   "DumpData N=  " << N <<endl;
-      for(int i= 0; i< N; i++)
-       {
-         if((i%nPerLine == 0)  &&  (i != 0))
-           {
-             printf("\n");
-           }
+  void  DumpData(T *array, int N, int nPerLine)
+  {
+    cout <<   "DumpData N=  " << N <<endl;
+    for(int i= 0; i< N; i++)
+      {
+       if((i%nPerLine == 0)  &&  (i != 0))
+         {
+           printf("\n");
+         }
 
-         cout << array[i]<< "\t";
+       cout << array[i]<< "\t";
 
-       }
-    }
+      }
+  }
 
   template<typename T> 
-    void  Reset(T *array, int N)
-    {
-      for(int i= 0; i< N; i++)
-       {
-         array[i] = 0;
-       }
-    }
+  void  ResetArray(T *array, int N)
+  {
+    for(int i= 0; i< N; i++)
+      {
+       array[i] = 0;
+      }
+  }
  
   template<typename T> 
-    T  MaxValue(T *array, int N)
-    {
-      //   Double_t tmpMax = 0;
+  T  MaxValue(T *array, int N)
+  {
+    //   Double_t tmpMax = 0;
       
-      T tmpMax = 0;
-
-      for(int i = 0; i < N; i++)
-       {
-         if(array[i] > tmpMax)
-           {
-             tmpMax = array[i];
-           }
-       }
+    T tmpMax = 0;
+
+    for(int i = 0; i < N; i++)
+      {
+       if(array[i] > tmpMax)
+         {
+           tmpMax = array[i];
+         }
+      }
   
-      return tmpMax;
-    }
-
-
- private:
-  //  AliHLTPHOSBase(const AliHLTPHOSBase & );
-  // AliHLTPHOSBase & operator = (const AliHLTPHOSBase &);
-
-
-
-  ///  const struct THIS IS STRANGE;
+    return tmpMax;
+  }
 
+  
+protected:
+  AliHLTPHOSConfig *fConfigPtr;
+  AliHLTPHOSConfig *fAltroConfigPtr;
 
+private:
+  AliHLTPHOSBase(const AliHLTPHOSBase & );
+  AliHLTPHOSBase & operator = (const AliHLTPHOSBase &);
 };
 
 #endif