Removal of warnings and compliance with ALICE coding conventions (Raphaƫl)
[u/mrichter/AliRoot.git] / VZERO / AliVZERODataFEE.cxx
1 /**************************************************************************\r
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3  *                                                                        *\r
4  * Author: The ALICE Off-line Project.                                    *\r
5  * Contributors are mentioned in the code where appropriate.              *\r
6  *                                                                        *\r
7  * Permission to use, copy, modify and distribute this software and its   *\r
8  * documentation strictly for non-commercial purposes is hereby granted   *\r
9  * without fee, provided that the above copyright notice appears in all   *\r
10  * copies and that both the copyright notice and this permission notice   *\r
11  * appear in the supporting documentation. The authors make no claims     *\r
12  * about the suitability of this software for any purpose. It is          *\r
13  * provided "as is" without express or implied warranty.                  *\r
14  **************************************************************************/\r
15 // ---------------------\r
16 // Class AliVZERODataFEE\r
17 // ---------------------\r
18 // Used to process the TMap of DCS values comming from the shuttle.\r
19 // It stores into a TMap the FEE parameters for the given run number\r
20 //\r
21 \r
22 #include <TTimeStamp.h>\r
23 #include <TObjString.h>\r
24 #include <TMap.h>\r
25 \r
26 #include "AliDCSValue.h"\r
27 #include "AliLog.h"\r
28 #include "AliVZERODataFEE.h"\r
29 \r
30 ClassImp(AliVZERODataFEE)\r
31 \r
32 //_____________________________________________________________________________\r
33 AliVZERODataFEE::AliVZERODataFEE() :\r
34         TObject(),\r
35         fRun(0),\r
36         fStartTime(0),\r
37         fEndTime(0),\r
38         fIsProcessed(kFALSE),\r
39         fParameters(NULL)\r
40 {\r
41         // Default constructor\r
42 }\r
43 \r
44 //_____________________________________________________________________________\r
45 AliVZERODataFEE::AliVZERODataFEE(Int_t nRun, UInt_t startTime, UInt_t endTime) : \r
46         TObject(),\r
47         fRun(nRun),\r
48         fStartTime(startTime),\r
49         fEndTime(endTime),\r
50         fIsProcessed(kFALSE),\r
51         fParameters(new TMap())\r
52 {\r
53         // Constructor\r
54         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,\r
55                                  TTimeStamp(startTime).AsString(),\r
56                                  TTimeStamp(endTime).AsString()));\r
57         fParameters->SetOwnerValue();\r
58         Init();\r
59 }\r
60 \r
61 //_____________________________________________________________________________\r
62 AliVZERODataFEE::~AliVZERODataFEE()\r
63 {\r
64         delete fAliasNames;\r
65         delete fParameters;\r
66 }\r
67 \r
68 //_____________________________________________________________________________\r
69 void AliVZERODataFEE::Init(){\r
70         // Initialization of DCS aliases\r
71         int iAlias = 0;\r
72 \r
73         // CCIU Parameters\r
74         \r
75         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAThreshold";\r
76         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCThreshold";\r
77         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGAThreshold";\r
78         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGCThreshold";\r
79         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAForBGThreshold";\r
80         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCForBGThreshold";\r
81         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrLow";\r
82         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrHigh";\r
83         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrLow";\r
84         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrHigh";\r
85         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrLow";\r
86         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrHigh";\r
87         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrLow";\r
88         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrHigh";\r
89         for(int i=1;i<=5;i++) {\r
90                 fAliasNames[iAlias] = "V00/FEE/CCIU/TriggerSelect";\r
91                 fAliasNames[iAlias++] += Form("%d",i);\r
92         }\r
93         \r
94         // CIU  Parameters\r
95         \r
96         for(int iCIU = 0; iCIU<8 ; iCIU++){\r
97                 for(int iParam=0; iParam<kNCIUParam;iParam++){\r
98                         fAliasNames[iAlias] = "V00/FEE/";\r
99                         fAliasNames[iAlias] += Form("CIU%d/",iCIU+1);\r
100                         \r
101                         fAliasNames[iAlias] += GetFEEParamName(iParam);\r
102                         iAlias++;\r
103                 }\r
104                 for(int iParam=kNCIUParam; iParam<kNCIUParam+kNChannelParam;iParam++){\r
105                         for(int iCh=1;iCh<=8;iCh++){\r
106                                 fAliasNames[iAlias] = "V00/FEE/";\r
107                                 fAliasNames[iAlias] += Form("CIU%d/",iCIU+1);\r
108                         \r
109                                 fAliasNames[iAlias] += GetFEEParamName(iParam);\r
110                                 fAliasNames[iAlias] += Form("%d",iCh);\r
111                         \r
112                                 iAlias++;\r
113                         }\r
114                 }\r
115                 \r
116         }\r
117 \r
118         if(iAlias!=kNAliases) \r
119                 AliError(Form("Number of FEE Aliases defined not correct"));\r
120         \r
121 }\r
122 //_____________________________________________________________________________\r
123 void AliVZERODataFEE::ProcessData(TMap& aliasMap){\r
124 // Process the TMap of DCS data\r
125         \r
126         if(!(fAliasNames[0])) Init();\r
127         \r
128         TObjArray *aliasArr;\r
129         AliDCSValue* aValue;\r
130 \r
131         // starting loop on aliases\r
132         for(int iAlias=0; iAlias<kNAliases; iAlias++){\r
133                 \r
134                 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());\r
135                 if(!aliasArr){\r
136                         AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));\r
137                         return;\r
138                 }\r
139                                 \r
140                 if(aliasArr->GetEntries()<1){\r
141                         AliError(Form("Alias %s has no entries!", fAliasNames[iAlias].Data()));\r
142                         continue;\r
143                 }\r
144                 \r
145                 TIter iterarray(aliasArr);\r
146                                 \r
147                 AliDCSValue * lastVal = NULL;\r
148                 while((aValue = (AliDCSValue*) iterarray.Next())) lastVal = aValue; // Take only the last value\r
149                 \r
150                 //AliInfo(Form("%s %f",fAliasNames[iAlias].Data(), val));\r
151                 fParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal);\r
152                 \r
153         }\r
154         \r
155         // calculate mean and rms of the first two histos\r
156         // and convert index to aliroot channel\r
157     \r
158         fIsProcessed=kTRUE;\r
159         \r
160 }\r
161 //_____________________________________________________________________________\r
162 \r
163 TString AliVZERODataFEE::GetFEEParamName(Int_t iParam){\r
164 // Return the name of the FEE Parameter iParam\r
165         TString result;\r
166         if(iParam>kNCIUParam + kNChannelParam -1) {\r
167                 AliError(Form("Requesting FEE parameter number %d. Max parameter number is : %d",iParam,kNCIUParam + kNChannelParam-1));\r
168                 return result;\r
169         }\r
170         switch (iParam) {\r
171                 case 0: result = "Clk1Win1"; break;\r
172                 case 1: result = "Clk2Win1"; break;\r
173                 case 2: result = "Clk1Win2"; break;\r
174                 case 3: result = "Clk2Win2"; break;\r
175                 case 4: result = "DelayClk1Win1"; break;\r
176                 case 5: result = "DelayClk2Win1"; break;\r
177                 case 6: result = "DelayClk1Win2"; break;\r
178                 case 7: result = "DelayClk2Win2"; break;\r
179                 case 8: result = "LatchWin1"; break;\r
180                 case 9: result = "LatchWin2"; break;\r
181                 case 10: result = "ResetWin1"; break;\r
182                 case 11: result = "ResetWin2"; break;\r
183                 case 12: result = "PedestalSubtraction"; break;\r
184                 case 13: result = "EnableCharge"; break;\r
185                 case 14: result = "EnableTiming"; break;\r
186                 case 15: result = "PedEven"; break;\r
187                 case 16: result = "PedOdd"; break;\r
188                 case 17: result = "PedCutEven"; break;\r
189                 case 18: result = "PedCutOdd"; break;\r
190                 case 19: result = "DelayHit"; break;\r
191                 case 20: result = "DiscriThr"; break;\r
192         }\r
193         return result;\r
194 }\r
195 \r
196 void AliVZERODataFEE::PrintAliases(){\r
197         for(int i=0;i<kNAliases;i++) AliInfo(Form("%s",fAliasNames[i].Data()));\r
198 }\r
199 \r