Fix for memory leaks in digits TClonesArrays (Matevz)
[u/mrichter/AliRoot.git] / VZERO / AliVZERODataFEE.cxx
CommitLineData
e370cdfe 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
30ClassImp(AliVZERODataFEE)\r
31\r
32//_____________________________________________________________________________\r
33AliVZERODataFEE::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
45AliVZERODataFEE::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
62AliVZERODataFEE::~AliVZERODataFEE()\r
63{\r
64 delete fAliasNames;\r
65 delete fParameters;\r
66}\r
67\r
68//_____________________________________________________________________________\r
69void 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
d5deaaa5 99 fAliasNames[iAlias] += Form("CIU%d/",iCIU);\r
e370cdfe 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
d5deaaa5 107 fAliasNames[iAlias] += Form("CIU%d/",iCIU);\r
e370cdfe 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
123void 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
e370cdfe 150 fParameters->Add(new TObjString(fAliasNames[iAlias].Data()),lastVal);\r
151 \r
152 }\r
153 \r
e370cdfe 154 fIsProcessed=kTRUE;\r
155 \r
156}\r
157//_____________________________________________________________________________\r
158\r
159TString AliVZERODataFEE::GetFEEParamName(Int_t iParam){\r
160// Return the name of the FEE Parameter iParam\r
161 TString result;\r
162 if(iParam>kNCIUParam + kNChannelParam -1) {\r
163 AliError(Form("Requesting FEE parameter number %d. Max parameter number is : %d",iParam,kNCIUParam + kNChannelParam-1));\r
164 return result;\r
165 }\r
166 switch (iParam) {\r
167 case 0: result = "Clk1Win1"; break;\r
168 case 1: result = "Clk2Win1"; break;\r
169 case 2: result = "Clk1Win2"; break;\r
170 case 3: result = "Clk2Win2"; break;\r
171 case 4: result = "DelayClk1Win1"; break;\r
172 case 5: result = "DelayClk2Win1"; break;\r
173 case 6: result = "DelayClk1Win2"; break;\r
174 case 7: result = "DelayClk2Win2"; break;\r
175 case 8: result = "LatchWin1"; break;\r
176 case 9: result = "LatchWin2"; break;\r
177 case 10: result = "ResetWin1"; break;\r
178 case 11: result = "ResetWin2"; break;\r
179 case 12: result = "PedestalSubtraction"; break;\r
d5deaaa5 180 case 13: result = "EnableCharge"; break;\r
181 case 14: result = "EnableTiming"; break;\r
182 case 15: result = "PedEven"; break;\r
183 case 16: result = "PedOdd"; break;\r
184 case 17: result = "PedCutEven"; break;\r
185 case 18: result = "PedCutOdd"; break;\r
186 case 19: result = "DelayHit"; break;\r
187 case 20: result = "DiscriThr"; break;\r
e370cdfe 188 }\r
189 return result;\r
190}\r
191\r
192void AliVZERODataFEE::PrintAliases(){\r
193 for(int i=0;i<kNAliases;i++) AliInfo(Form("%s",fAliasNames[i].Data()));\r
194}\r
195\r