]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDPedestal.cxx
Using AliPHOSLoader instead of AliPHOSGetter
[u/mrichter/AliRoot.git] / PMD / AliPMDPedestal.cxx
1 /***************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15 //
16 //
17 #include "TNamed.h"
18 #include "AliCDBEntry.h"
19 #include "AliPMD.h"
20 #include "AliPMDPedestal.h"
21
22
23 ClassImp(AliPMDPedestal)
24
25 AliPMDPedestal::AliPMDPedestal()
26 {
27   // Default constructor
28   Reset();
29 }
30 // ----------------------------------------------------------------- //
31 AliPMDPedestal::AliPMDPedestal(const char* name)
32 {
33   //constructor
34   TString namst = "Pedestal_";
35   namst += name;
36   SetName(namst.Data());
37   SetTitle(namst.Data());
38   Reset();
39   
40 }
41 // ----------------------------------------------------------------- //
42 AliPMDPedestal::AliPMDPedestal(const AliPMDPedestal &pedestal) :
43   TNamed(pedestal)
44 {
45   // copy constructor
46   SetName(pedestal.GetName());
47   SetTitle(pedestal.GetName());
48   Reset();
49   for(Int_t det = 0; det < kDet; det++)
50   {
51       for(Int_t smn = 0; smn < kModule; smn++)
52       {
53           for(Int_t row = 0; row < kRow; row++)
54           {
55               for(Int_t col = 0; col < kCol; col++)
56               {
57                   fPedMeanRms[det][smn][row][col] =
58                       pedestal.GetPedMeanRms(det,smn,row,col);
59               }
60           }
61       }
62   }
63 }
64 // ----------------------------------------------------------------- //
65 AliPMDPedestal &AliPMDPedestal::operator =(const AliPMDPedestal &pedestal)
66 {
67   //asignment operator
68   SetName(pedestal.GetName());
69   SetTitle(pedestal.GetName());
70   Reset();
71   for(Int_t det = 0; det < kDet; det++)
72   {
73       for(Int_t smn = 0; smn < kModule; smn++)
74       {
75           for(Int_t row = 0; row < kRow; row++)
76           {
77               for(Int_t col = 0; col < kCol; col++)
78               {
79                   fPedMeanRms[det][smn][row][col] = 
80                       pedestal.GetPedMeanRms(det,smn,row,col);
81               }
82           }
83       }
84   }
85   return *this;
86 }
87 // ----------------------------------------------------------------- //
88 AliPMDPedestal::~AliPMDPedestal()
89 {
90   //destructor
91 }
92 // ----------------------------------------------------------------- //
93 void AliPMDPedestal::Reset()
94 {
95   //memset(fgainfact ,1,2*24*96*96*sizeof(Float_t));
96     Float_t mean = 0.0;
97     Float_t rms  = 0.0;
98     for(Int_t det = 0; det < kDet; det++)
99     {
100         for(Int_t smn = 0; smn < kModule; smn++)
101         {
102             for(Int_t row = 0; row < kRow; row++)
103             {
104                 for(Int_t col = 0; col < kCol; col++)
105                 {
106                     Int_t mean1 = (Int_t) (mean*10.);
107                     Int_t rms1  = (Int_t) (rms*10.);
108                     fPedMeanRms[det][smn][row][col] = mean1*100 + rms1;
109                 }
110             }
111         }
112     }
113 }
114 // ----------------------------------------------------------------- //
115 Int_t AliPMDPedestal:: GetPedMeanRms(Int_t det, Int_t smn, Int_t row, Int_t col) const
116 {
117   return fPedMeanRms[det][smn][row][col];
118 }
119 // ----------------------------------------------------------------- //
120
121 void AliPMDPedestal::SetPedMeanRms(Int_t det, Int_t smn, Int_t row,
122                                    Int_t col,Float_t pedmean, Float_t pedrms)
123 {
124     Int_t mean1 = (Int_t) (pedmean*10.);
125     Int_t rms1  = (Int_t) (pedrms*10.); 
126     fPedMeanRms[det][smn][row][col] = mean1*100 + rms1;
127 }
128 // ----------------------------------------------------------------- //
129 void AliPMDPedestal::Print(Option_t *) const
130 {
131   printf("\n ###### Pedestal values for each cells are ####\n");
132   for(Int_t det = 0; det < kDet; det++)
133     {
134       for(Int_t smn = 0; smn < kModule; smn++)
135         {
136           for(Int_t row = 0; row < kRow; row++)
137             {
138               for(Int_t col = 0; col < kCol; col++)
139                 {
140                     printf("Pedestal[%d,%d,%d,%d]= %d \n",det,smn,row,col,
141                            fPedMeanRms[det][smn][row][col]);
142
143                 }
144               printf("\n");
145             }
146         }
147     }
148 }
149 // ----------------------------------------------------------------- //