Pedestal class
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 13:57:06 +0000 (13:57 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 13:57:06 +0000 (13:57 +0000)
PMD/AliPMDPedestal.cxx [new file with mode: 0644]
PMD/AliPMDPedestal.h [new file with mode: 0644]

diff --git a/PMD/AliPMDPedestal.cxx b/PMD/AliPMDPedestal.cxx
new file mode 100644 (file)
index 0000000..1e18b12
--- /dev/null
@@ -0,0 +1,149 @@
+/***************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * 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 "TNamed.h"
+#include "AliCDBEntry.h"
+#include "AliPMD.h"
+#include "AliPMDPedestal.h"
+
+
+ClassImp(AliPMDPedestal)
+
+AliPMDPedestal::AliPMDPedestal()
+{
+  // Default constructor
+  Reset();
+}
+// ----------------------------------------------------------------- //
+AliPMDPedestal::AliPMDPedestal(const char* name)
+{
+  //constructor
+  TString namst = "Pedestal_";
+  namst += name;
+  SetName(namst.Data());
+  SetTitle(namst.Data());
+  Reset();
+  
+}
+// ----------------------------------------------------------------- //
+AliPMDPedestal::AliPMDPedestal(const AliPMDPedestal &pedestal) :
+  TNamed(pedestal)
+{
+  // copy constructor
+  SetName(pedestal.GetName());
+  SetTitle(pedestal.GetName());
+  Reset();
+  for(Int_t det = 0; det < kDet; det++)
+  {
+      for(Int_t smn = 0; smn < kModule; smn++)
+      {
+         for(Int_t row = 0; row < kRow; row++)
+         {
+             for(Int_t col = 0; col < kCol; col++)
+             {
+                 fPedMeanRms[det][smn][row][col] =
+                     pedestal.GetPedMeanRms(det,smn,row,col);
+             }
+         }
+      }
+  }
+}
+// ----------------------------------------------------------------- //
+AliPMDPedestal &AliPMDPedestal::operator =(const AliPMDPedestal &pedestal)
+{
+  //asignment operator
+  SetName(pedestal.GetName());
+  SetTitle(pedestal.GetName());
+  Reset();
+  for(Int_t det = 0; det < kDet; det++)
+  {
+      for(Int_t smn = 0; smn < kModule; smn++)
+      {
+         for(Int_t row = 0; row < kRow; row++)
+         {
+             for(Int_t col = 0; col < kCol; col++)
+             {
+                 fPedMeanRms[det][smn][row][col] = 
+                     pedestal.GetPedMeanRms(det,smn,row,col);
+             }
+         }
+      }
+  }
+  return *this;
+}
+// ----------------------------------------------------------------- //
+AliPMDPedestal::~AliPMDPedestal()
+{
+  //destructor
+}
+// ----------------------------------------------------------------- //
+void AliPMDPedestal::Reset()
+{
+  //memset(fgainfact ,1,2*24*96*96*sizeof(Float_t));
+    Float_t mean = 0.0;
+    Float_t rms  = 0.0;
+    for(Int_t det = 0; det < kDet; det++)
+    {
+       for(Int_t smn = 0; smn < kModule; smn++)
+       {
+           for(Int_t row = 0; row < kRow; row++)
+           {
+               for(Int_t col = 0; col < kCol; col++)
+               {
+                   Int_t mean1 = (Int_t) (mean*10.);
+                   Int_t rms1  = (Int_t) (rms*10.);
+                   fPedMeanRms[det][smn][row][col] = mean1*100 + rms1;
+               }
+           }
+       }
+    }
+}
+// ----------------------------------------------------------------- //
+Int_t AliPMDPedestal:: GetPedMeanRms(Int_t det, Int_t smn, Int_t row, Int_t col) const
+{
+  return fPedMeanRms[det][smn][row][col];
+}
+// ----------------------------------------------------------------- //
+
+void AliPMDPedestal::SetPedMeanRms(Int_t det, Int_t smn, Int_t row,
+                                  Int_t col,Float_t pedmean, Float_t pedrms)
+{
+    Int_t mean1 = (Int_t) (pedmean*10.);
+    Int_t rms1  = (Int_t) (pedrms*10.); 
+    fPedMeanRms[det][smn][row][col] = mean1*100 + rms1;
+}
+// ----------------------------------------------------------------- //
+void AliPMDPedestal::Print(Option_t *) const
+{
+  printf("\n ###### Pedestal values for each cells are ####\n");
+  for(Int_t det = 0; det < kDet; det++)
+    {
+      for(Int_t smn = 0; smn < kModule; smn++)
+       {
+         for(Int_t row = 0; row < kRow; row++)
+           {
+             for(Int_t col = 0; col < kCol; col++)
+               {
+                   printf("Pedestal[%d,%d,%d,%d]= %d \n",det,smn,row,col,
+                          fPedMeanRms[det][smn][row][col]);
+
+               }
+             printf("\n");
+           }
+       }
+    }
+}
+// ----------------------------------------------------------------- //
diff --git a/PMD/AliPMDPedestal.h b/PMD/AliPMDPedestal.h
new file mode 100644 (file)
index 0000000..3c68fb8
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef ALIPMDPEDESTAL_H
+#define ALIPMDPEDESTAL_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+class TNamed;
+class AliCDBEntry;
+class AliPMD;
+
+class AliPMDPedestal: public TNamed
+{
+ public:
+  AliPMDPedestal();
+  AliPMDPedestal(const char* name);
+  AliPMDPedestal(const AliPMDPedestal &pedestal);
+  AliPMDPedestal& operator= (const AliPMDPedestal &pedestal);
+  virtual ~AliPMDPedestal();
+  void  Reset();
+  void  SetPedMeanRms(Int_t det, Int_t smn, Int_t row, Int_t col,
+                     Float_t pedmean, Float_t pedrms);
+  Int_t GetPedMeanRms(Int_t det, Int_t smn, Int_t row, Int_t col) const;
+  virtual void Print(Option_t *) const;
+  
+ protected:
+
+  enum
+      {
+         kDet    = 2,   // Number of planes
+         kModule = 24,  // Number of modules per plane
+         kRow    = 48,  // Row
+          kCol    = 96   // Column
+      };
+
+  Int_t fPedMeanRms[kDet][kModule][kRow][kCol];
+
+  ClassDef(AliPMDPedestal,1) // Pedestal class
+};
+#endif