Coverity fix
[u/mrichter/AliRoot.git] / TRD / AliTRDSensorArray.cxx
CommitLineData
cd4fc278 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/* $Id$ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// This class perform operation on DCS Sensor //
21// The configuration of each sensor is included inside this class //
22// Use the methode GetList to get all the configuration //
23// //
24// Author: //
25// W. Monange (w.monange@gsi.de) //
26// //
27////////////////////////////////////////////////////////////////////////////
28
29#include <TObjArray.h>
30#include <TClonesArray.h>
31
32#include "AliTRDSensorArray.h"
33#include "AliTRDSensor.h"
34
35ClassImp(AliTRDSensorArray)
36
37//_____________________________________________________________________________
4d836fc4 38AliTRDSensorArray::AliTRDSensorArray()
39 :AliDCSSensorArray()
40 ,fAmanda("")
41 ,fStoreName("")
cd4fc278 42{
4d836fc4 43 //
44 // Default constructor
45 //
cd4fc278 46
47}
48
cd4fc278 49//_____________________________________________________________________________
4d836fc4 50AliTRDSensorArray::AliTRDSensorArray(const char *amanda
51 , const char *storeName
52 , Float_t /*diffCut*/
53 , TClonesArray * const trdSensor)
54 :AliDCSSensorArray()
55 ,fAmanda(amanda)
56 ,fStoreName(storeName)
cd4fc278 57{
4d836fc4 58 //
59 // Constructor set fMinGraph to 0, fValCut to 0, fDiffCut to 0
60 //
61
cd4fc278 62 fSensors = trdSensor;
63 fMinGraph = 0;
64 fValCut = -1;
65 fDiffCut = -1;
2ff01398 66 Int_t entries = fSensors->GetEntriesFast();
67 if(entries > 1){
68 for(Int_t k = 0; k < entries; k++){
69 TString name (Form(amanda, k));
e83f456c 70 //printf("name is %s of %d\n",(const char*)name,k);
2ff01398 71 ((AliDCSSensor *) fSensors->UncheckedAt(k))->SetStringID(name);
72 }
73 }
74 else{
75 TString name (amanda);
e83f456c 76 //printf("name is %s\n",(const char*)name);
2ff01398 77 ((AliDCSSensor *) fSensors->UncheckedAt(0))->SetStringID(name);
78 }
79
cd4fc278 80}
81
82//_____________________________________________________________________________
4d836fc4 83AliTRDSensorArray::AliTRDSensorArray(const AliTRDSensorArray & source)
84 :AliDCSSensorArray(source)
85 ,fAmanda(source.fAmanda)
86 ,fStoreName(source.fStoreName)
cd4fc278 87{
4d836fc4 88 //
89 // Copy constructor
90 //
91
cd4fc278 92 fSensors = source.fSensors;
93 fMinGraph = 0;
94 fValCut = -1;
95 fDiffCut = -1;
4d836fc4 96
cd4fc278 97}
98
cd4fc278 99//_____________________________________________________________________________
4d836fc4 100AliTRDSensorArray::~AliTRDSensorArray()
cd4fc278 101{
102 //
103 // Destructor
104 //
105
106}
107
108//_____________________________________________________________________________
4d836fc4 109AliTRDSensorArray &AliTRDSensorArray::operator=(const AliTRDSensorArray &source)
cd4fc278 110{
111 //
112 // Assignment operator
113 //
114
115 if (&source == this) return *this;
116 new (this) AliTRDSensorArray (source);
117
118 return *this;
119}
120
121//_____________________________________________________________________________
4d836fc4 122TObjArray *AliTRDSensorArray::GetList()
cd4fc278 123{
4d836fc4 124 //
125 // Return TObjArray with a list of AliTRDSensorArray corresponding to each
126 // group of sensor
127 //
cd4fc278 128
131392b3 129 TObjArray * list = new TObjArray (20);
cd4fc278 130 list->SetOwner (kTRUE);
131 AliTRDSensorArray * aH = 0x0;
132
133 // generic list of sensors
134 TClonesArray listSensor540 ("AliTRDSensor", 540);
135 TClonesArray listSensor2 ("AliTRDSensor", 2);
136 TClonesArray listSensor1 ("AliTRDSensor", 1);
137 listSensor540.SetOwner (kTRUE);
138 listSensor2.SetOwner (kTRUE);
139 listSensor1.SetOwner (kTRUE);
140 for (Int_t i = 0; i < 540; i++) {
141 new(listSensor540[i]) AliTRDSensor (i, 0, 0, 0);
142 }
143 for (Int_t i = 0; i < 2; i++)
144 new(listSensor2[i]) AliTRDSensor (i, 0, 0, 0);
145 new(listSensor1[0]) AliTRDSensor (0, 0, 0, 0);
146
147
148 // now create and populate
149 aH = new AliTRDSensorArray ("trd_chamberStatus%03d", "trd_chamberStatus",
2ff01398 150 0.5, (TClonesArray*)listSensor540.Clone ());
cd4fc278 151 list->Add (aH);
152
cd4fc278 153 aH = new AliTRDSensorArray ("trd_goofieHv", "trd_goofieHv",
2ff01398 154 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 155 list->Add (aH);
156 aH = new AliTRDSensorArray ("trd_goofiePeakPos%02d", "trd_goofiePeakPos",
2ff01398 157 -1, (TClonesArray*)listSensor2.Clone ());
cd4fc278 158 list->Add (aH);
159 aH = new AliTRDSensorArray ("trd_goofiePeakArea%02d","trd_goofiePeakArea",
2ff01398 160 -1, (TClonesArray*)listSensor2.Clone ());
cd4fc278 161 list->Add (aH);
162 aH = new AliTRDSensorArray ("trd_goofieTemp%02d", "trd_goofieTemp",
2ff01398 163 -1, (TClonesArray*)listSensor2.Clone ());
cd4fc278 164 list->Add (aH);
165 aH = new AliTRDSensorArray ("trd_goofiePressure", "trd_goofiePressure",
2ff01398 166 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 167 list->Add (aH);
168 aH = new AliTRDSensorArray ("trd_goofieVelocity", "trd_goofieVelocity",
2ff01398 169 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 170 list->Add (aH);
171 aH = new AliTRDSensorArray ("trd_goofieGain%02d", "trd_goofieGain",
2ff01398 172 -1, (TClonesArray*)listSensor2.Clone ());
cd4fc278 173 list->Add (aH);
174 aH = new AliTRDSensorArray ("trd_goofieCO2", "trd_goofieCO2",
2ff01398 175 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 176 list->Add (aH);
177 aH = new AliTRDSensorArray ("trd_goofieN2", "trd_goofieN2",
2ff01398 178 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 179 list->Add (aH);
180 aH = new AliTRDSensorArray ("trd_gasO2", "trd_gasO2",
2ff01398 181 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 182 list->Add (aH);
183 aH = new AliTRDSensorArray ("trd_gasH2O", "trd_gasH2O",
2ff01398 184 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 185 list->Add (aH);
e83f456c 186 aH = new AliTRDSensorArray ("trd_gasCO2", "trd_gasCO2",
187 -1, (TClonesArray*)listSensor1.Clone ());
188 list->Add (aH);
cd4fc278 189 aH = new AliTRDSensorArray ("trd_gasOverpressure", "trd_gasOverpressure",
2ff01398 190 -1, (TClonesArray*)listSensor1.Clone ());
cd4fc278 191 list->Add (aH);
192 aH = new AliTRDSensorArray ("trd_envTemp%03d", "trd_envTemp",
2ff01398 193 -1, (TClonesArray*)listSensor540.Clone ());
cd4fc278 194 list->Add (aH);
195 aH = new AliTRDSensorArray ("trd_hvAnodeImon%03d", "trd_hvAnodeImon",
2ff01398 196 -1, (TClonesArray*)listSensor540.Clone ());
cd4fc278 197 list->Add (aH);
198 aH = new AliTRDSensorArray ("trd_hvDriftImon%03d", "trd_hvDriftImon",
2ff01398 199 -1, (TClonesArray*)listSensor540.Clone ());
cd4fc278 200 list->Add (aH);
201 aH = new AliTRDSensorArray ("trd_hvAnodeUmon%03d", "trd_hvAnodeUmon",
2ff01398 202 -1, (TClonesArray*)listSensor540.Clone ());
cd4fc278 203 list->Add (aH);
204 aH = new AliTRDSensorArray ("trd_hvDriftUmon%03d", "trd_hvDriftUmon",
2ff01398 205 -1, (TClonesArray*)listSensor540.Clone ());
cd4fc278 206 list->Add (aH);
cd4fc278 207
208 return list;
209}
210
211//_____________________________________________________________________________
212TMap* AliTRDSensorArray::ExtractDCS(TMap *dcsMap)
213{
4d836fc4 214 //
215 // Return Tmap with TGraph inside corresponding to values in dcsMap
216 //
217
218 return AliDCSSensorArray::ExtractDCS(dcsMap);
cd4fc278 219}
220
221//_____________________________________________________________________________
4d836fc4 222void AliTRDSensorArray::SetGraph(TMap *map)
cd4fc278 223{
4d836fc4 224 //
225 // Assign list of TGraph to the current instance
226 //
cd4fc278 227
4d836fc4 228 AliDCSSensorArray::SetGraph(map);
229}
cd4fc278 230
231//_____________________________________________________________________________
4d836fc4 232Int_t AliTRDSensorArray::GetNGraph() const
cd4fc278 233{
4d836fc4 234 //
235 // Return the number of TGraph
236 //
237
cd4fc278 238 Int_t nGraph = 0;
239 Int_t nsensors = fSensors->GetEntries();
240
241 for (Int_t isensor = 0; isensor < nsensors; isensor++) {
242 AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
243 if (entry->GetGraph () != 0x0)
244 nGraph ++;
245 }
246 return nGraph;
247}
248
249