]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMDHotData.cxx
consolidate zero-length arrays (aka struct hack)
[u/mrichter/AliRoot.git] / PMD / AliPMDHotData.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 // Author : Z. Ahmed
17 //
18 #include "TNamed.h"
19 #include "AliCDBEntry.h"
20 #include "AliPMDHotData.h"
21
22
23 ClassImp(AliPMDHotData)
24
25 AliPMDHotData::AliPMDHotData()
26 {
27   // Default constructor
28   Reset();
29 }
30 // ----------------------------------------------------------------- //
31 AliPMDHotData::AliPMDHotData(const char* name)
32 {
33   //constructor
34   TString namst = "hot_";
35   namst += name;
36   SetName(namst.Data());
37   SetTitle(namst.Data());
38   Reset();
39   
40 }
41 // ----------------------------------------------------------------- //
42 AliPMDHotData::AliPMDHotData(const AliPMDHotData& hotda) :
43   TNamed(hotda)
44 {
45   // copy constructor
46   SetName(hotda.GetName());
47   SetTitle(hotda.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                   fHotChannel[det][smn][row][col] = hotda.GetHotChannel(det,smn,row,col);
58                 }
59             }
60         }
61     }
62 }
63 // ----------------------------------------------------------------- //
64 AliPMDHotData &AliPMDHotData::operator =(const AliPMDHotData& hotda)
65 {
66   //asignment operator
67   SetName(hotda.GetName());
68   SetTitle(hotda.GetName());
69   Reset();
70   for(Int_t det = 0; det < kDet; det++)
71     {
72       for(Int_t smn = 0; smn < kModule; smn++)
73         {
74           for(Int_t row = 0; row < kRow; row++)
75             {
76               for(Int_t col = 0; col < kCol; col++)
77                 {
78                   fHotChannel[det][smn][row][col] = hotda.GetHotChannel(det,smn,row,col);
79                 }
80             }
81         }
82     }
83   return *this;
84 }
85 // ----------------------------------------------------------------- //
86 AliPMDHotData::~AliPMDHotData()
87 {
88   //destructor
89 }
90 // ----------------------------------------------------------------- //
91 void AliPMDHotData::Reset()
92 {
93
94   for(Int_t det = 0; det < kDet; det++)
95     {
96       for(Int_t smn = 0; smn < kModule; smn++)
97         {
98           for(Int_t row = 0; row < kRow; row++)
99             {
100             for(Int_t col = 0; col < kCol; col++)
101               {
102                 fHotChannel[det][smn][row][col] = 0.;
103               }
104             }
105         }
106     }
107 }
108 // ----------------------------------------------------------------- //
109 // ----------------------------------------------------------------- //
110 Float_t AliPMDHotData:: GetHotChannel(Int_t det, Int_t smn, Int_t row, Int_t col) const
111 {
112   return fHotChannel[det][smn][row][col];
113 }
114 void AliPMDHotData::SetHotChannel(Int_t det, Int_t smn, Int_t row, Int_t col, Float_t flag)
115 {
116   fHotChannel[det][smn][row][col] = flag;
117 }
118 //------------------------------------------------------------------------------ //
119 void AliPMDHotData::Print(Option_t *) const
120 {
121   printf("\n ######Flag for each cells ####\n");
122   for(Int_t det = 0; det < kDet; det++)
123     {
124       for(Int_t smn = 0; smn < kModule; smn++)
125         {
126           for(Int_t row = 0; row < kRow; row++)
127             {
128               for(Int_t col = 0; col < kCol; col++)
129                 {
130                   printf("Flag[%d,%d,%d,%d]= %4.1f \n",det,smn,row,col,
131                          fHotChannel[det][smn][row][col]);
132                 }
133               printf("\n");
134             }
135         }
136     }
137 }