Fixes for the trunk: compilation on Lion (Yves)
[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 fParameters;\r
65 }\r
66 \r
67 //_____________________________________________________________________________\r
68 void AliVZERODataFEE::Init(){\r
69         // Initialization of DCS aliases\r
70         int iAlias = 0;\r
71 \r
72         // CCIU Parameters\r
73         \r
74         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAThreshold";\r
75         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCThreshold";\r
76         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGAThreshold";\r
77         fAliasNames[iAlias++] = "V00/FEE/CCIU/BGCThreshold";\r
78         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBAForBGThreshold";\r
79         fAliasNames[iAlias++] = "V00/FEE/CCIU/BBCForBGThreshold";\r
80         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrLow";\r
81         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0AThrHigh";\r
82         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrLow";\r
83         fAliasNames[iAlias++] = "V00/FEE/CCIU/CentralityV0CThrHigh";\r
84         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrLow";\r
85         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0AThrHigh";\r
86         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrLow";\r
87         fAliasNames[iAlias++] = "V00/FEE/CCIU/MultV0CThrHigh";\r
88         for(int i=1;i<=5;i++) {\r
89                 fAliasNames[iAlias] = "V00/FEE/CCIU/TriggerSelect";\r
90                 fAliasNames[iAlias++] += Form("%d",i);\r
91         }\r
92         \r
93         // CIU  Parameters\r
94         \r
95         for(int iCIU = 0; iCIU<8 ; iCIU++){\r
96                 for(int iParam=0; iParam<kNCIUParam;iParam++){\r
97                         fAliasNames[iAlias] = "V00/FEE/";\r
98                         fAliasNames[iAlias] += Form("CIU%d/",iCIU);\r
99                         \r
100                         fAliasNames[iAlias] += GetFEEParamName(iParam);\r
101                         iAlias++;\r
102                 }\r
103                 for(int iParam=kNCIUParam; iParam<kNCIUParam+kNChannelParam;iParam++){\r
104                         for(int iCh=1;iCh<=8;iCh++){\r
105                                 fAliasNames[iAlias] = "V00/FEE/";\r
106                                 fAliasNames[iAlias] += Form("CIU%d/",iCIU);\r
107                         \r
108                                 fAliasNames[iAlias] += GetFEEParamName(iParam);\r
109                                 fAliasNames[iAlias] += Form("%d",iCh);\r
110                         \r
111                                 iAlias++;\r
112                         }\r
113                 }\r
114                 \r
115         }\r
116 \r
117         if(iAlias!=kNAliases) \r
118                 AliError(Form("Number of FEE Aliases defined not correct"));\r
119         \r
120 }\r
121 //_____________________________________________________________________________\r
122 void AliVZERODataFEE::ProcessData(TMap& aliasMap){\r
123 // Process the TMap of DCS data\r
124         \r
125         if(!(fAliasNames[0])) Init();\r
126         \r
127         TObjArray *aliasArr;\r
128         AliDCSValue* aValue;\r
129 \r
130         // starting loop on aliases\r
131         for(int iAlias=0; iAlias<kNAliases; iAlias++){\r
132                 \r
133                 aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[iAlias].Data());\r
134                 if(!aliasArr){\r
135                         AliError(Form("Alias %s not found!", fAliasNames[iAlias].Data()));\r
136                         return;\r
137                 }\r
138                                 \r
139                 if(aliasArr->GetEntries()<1){\r
140                         AliError(Form("Alias %s has no entries!", fAliasNames[iAlias].Data()));\r
141                         continue;\r
142                 }\r
143                 \r
144                 TIter iterarray(aliasArr);\r
145                                 \r
146                 AliDCSValue * lastVal = NULL;\r
147                 while((aValue = (AliDCSValue*) iterarray.Next())) lastVal = aValue; // Take only the last value\r
148                 \r
149                 fParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal);\r
150                 \r
151         }\r
152         \r
153         fIsProcessed=kTRUE;\r
154         \r
155 }\r
156 //_____________________________________________________________________________\r
157 \r
158 TString AliVZERODataFEE::GetFEEParamName(Int_t iParam){\r
159 // Return the name of the FEE Parameter iParam\r
160         TString result;\r
161         if(iParam>kNCIUParam + kNChannelParam -1) {\r
162                 AliError(Form("Requesting FEE parameter number %d. Max parameter number is : %d",iParam,kNCIUParam + kNChannelParam-1));\r
163                 return result;\r
164         }\r
165         switch (iParam) {\r
166                 case 0: result = "Clk1Win1"; break;\r
167                 case 1: result = "Clk2Win1"; break;\r
168                 case 2: result = "Clk1Win2"; break;\r
169                 case 3: result = "Clk2Win2"; break;\r
170                 case 4: result = "DelayClk1Win1"; break;\r
171                 case 5: result = "DelayClk2Win1"; break;\r
172                 case 6: result = "DelayClk1Win2"; break;\r
173                 case 7: result = "DelayClk2Win2"; break;\r
174                 case 8: result = "LatchWin1"; break;\r
175                 case 9: result = "LatchWin2"; break;\r
176                 case 10: result = "ResetWin1"; break;\r
177                 case 11: result = "ResetWin2"; break;\r
178                 case 12: result = "PedestalSubtraction"; break;\r
179                 case 13: result = "EnableCharge"; break;\r
180                 case 14: result = "EnableTiming"; break;\r
181                 case 15: result = "PedEven"; break;\r
182                 case 16: result = "PedOdd"; break;\r
183                 case 17: result = "PedCutEven"; break;\r
184                 case 18: result = "PedCutOdd"; break;\r
185                 case 19: result = "DelayHit"; break;\r
186                 case 20: result = "DiscriThr"; break;\r
187         }\r
188         return result;\r
189 }\r
190 \r
191 void AliVZERODataFEE::PrintAliases(){\r
192         for(int i=0;i<kNAliases;i++) AliInfo(Form("%s",fAliasNames[i].Data()));\r
193 }\r
194 \r