]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDSensorArray.cxx
Coverity
[u/mrichter/AliRoot.git] / TRD / AliTRDSensorArray.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 /* $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
35 ClassImp(AliTRDSensorArray)
36
37 //_____________________________________________________________________________
38 AliTRDSensorArray::AliTRDSensorArray() 
39   :AliDCSSensorArray()
40   ,fAmanda("")
41   ,fStoreName("")                                       
42 {
43   //
44   // Default constructor
45   //
46         
47 }
48
49 //_____________________________________________________________________________
50 AliTRDSensorArray::AliTRDSensorArray(const char *amanda 
51                                    , const char *storeName
52                                    , Float_t /*diffCut*/
53                                    , TClonesArray * const trdSensor) 
54   :AliDCSSensorArray()
55   ,fAmanda(amanda)
56   ,fStoreName(storeName)                                
57 {
58   //
59   // Constructor set fMinGraph to 0, fValCut to 0, fDiffCut to 0
60   //
61
62         fSensors        = trdSensor;
63         fMinGraph       = 0;
64         fValCut         = -1;
65         fDiffCut        = -1;
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));
70             //printf("name is %s of %d\n",(const char*)name,k);
71             ((AliDCSSensor *) fSensors->UncheckedAt(k))->SetStringID(name);
72           }
73         }
74         else{
75           TString name (amanda);
76           //printf("name is %s\n",(const char*)name);
77           ((AliDCSSensor *) fSensors->UncheckedAt(0))->SetStringID(name);
78         }
79
80 }
81
82 //_____________________________________________________________________________
83 AliTRDSensorArray::AliTRDSensorArray(const AliTRDSensorArray & source) 
84   :AliDCSSensorArray(source)
85   ,fAmanda(source.fAmanda)
86   ,fStoreName(source.fStoreName)                                
87 {
88   //
89   // Copy constructor
90   //
91
92         fSensors        = source.fSensors;
93         fMinGraph       = 0;
94         fValCut         = -1;
95         fDiffCut        = -1;
96
97 }
98         
99 //_____________________________________________________________________________
100 AliTRDSensorArray::~AliTRDSensorArray()
101 {
102   //
103   // Destructor
104   //
105         
106 }
107
108 //_____________________________________________________________________________         
109 AliTRDSensorArray &AliTRDSensorArray::operator=(const AliTRDSensorArray &source)
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 //_____________________________________________________________________________
122 TObjArray *AliTRDSensorArray::GetList() 
123 {
124   //
125   // Return TObjArray with a list of AliTRDSensorArray corresponding to each
126   // group of sensor 
127   //
128         
129         TObjArray * list = new TObjArray (20);
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", 
150                                     0.5, (TClonesArray*)listSensor540.Clone ());
151         list->Add (aH);
152         
153         aH = new AliTRDSensorArray ("trd_goofieHv",                     "trd_goofieHv",  
154                                     -1, (TClonesArray*)listSensor1.Clone ());
155         list->Add (aH);
156         aH = new AliTRDSensorArray ("trd_goofiePeakPos%02d",    "trd_goofiePeakPos",   
157                                     -1, (TClonesArray*)listSensor2.Clone ());
158         list->Add (aH);
159         aH = new AliTRDSensorArray ("trd_goofiePeakArea%02d","trd_goofiePeakArea",   
160                                     -1, (TClonesArray*)listSensor2.Clone ());
161         list->Add (aH);
162         aH = new AliTRDSensorArray ("trd_goofieTemp%02d",       "trd_goofieTemp",  
163                                     -1, (TClonesArray*)listSensor2.Clone ());
164         list->Add (aH);
165         aH = new AliTRDSensorArray ("trd_goofiePressure",       "trd_goofiePressure",  
166                                     -1, (TClonesArray*)listSensor1.Clone ());
167         list->Add (aH);
168         aH = new AliTRDSensorArray ("trd_goofieVelocity",       "trd_goofieVelocity",  
169                                     -1, (TClonesArray*)listSensor1.Clone ());
170         list->Add (aH);
171         aH = new AliTRDSensorArray ("trd_goofieGain%02d",       "trd_goofieGain",  
172                                     -1, (TClonesArray*)listSensor2.Clone ());
173         list->Add (aH);
174         aH = new AliTRDSensorArray ("trd_goofieCO2",            "trd_goofieCO2",  
175                                     -1, (TClonesArray*)listSensor1.Clone ());
176         list->Add (aH);
177         aH = new AliTRDSensorArray ("trd_goofieN2",                     "trd_goofieN2", 
178                                     -1, (TClonesArray*)listSensor1.Clone ());
179         list->Add (aH);
180         aH = new AliTRDSensorArray ("trd_gasO2",                        "trd_gasO2",  
181                                     -1, (TClonesArray*)listSensor1.Clone ());
182         list->Add (aH);
183         aH = new AliTRDSensorArray ("trd_gasH2O",                       "trd_gasH2O",  
184                                     -1, (TClonesArray*)listSensor1.Clone ());
185         list->Add (aH);
186         aH = new AliTRDSensorArray ("trd_gasCO2",                       "trd_gasCO2",  
187                                     -1, (TClonesArray*)listSensor1.Clone ());
188         list->Add (aH);
189         aH = new AliTRDSensorArray ("trd_gasOverpressure",      "trd_gasOverpressure",  
190                                     -1, (TClonesArray*)listSensor1.Clone ());
191         list->Add (aH);
192         aH = new AliTRDSensorArray ("trd_envTemp%03d",          "trd_envTemp",  
193                                     -1, (TClonesArray*)listSensor540.Clone ());
194         list->Add (aH);
195         aH = new AliTRDSensorArray ("trd_hvAnodeImon%03d",      "trd_hvAnodeImon",       
196                                     -1, (TClonesArray*)listSensor540.Clone ());
197         list->Add (aH);
198         aH = new AliTRDSensorArray ("trd_hvDriftImon%03d",      "trd_hvDriftImon",  
199                                     -1, (TClonesArray*)listSensor540.Clone ());
200         list->Add (aH);
201         aH = new AliTRDSensorArray ("trd_hvAnodeUmon%03d",      "trd_hvAnodeUmon",  
202                                     -1, (TClonesArray*)listSensor540.Clone ());
203         list->Add (aH);
204         aH = new AliTRDSensorArray ("trd_hvDriftUmon%03d",      "trd_hvDriftUmon",  
205                                     -1, (TClonesArray*)listSensor540.Clone ());
206         list->Add (aH);
207                                   
208         return list;
209 }
210
211 //_____________________________________________________________________________
212 TMap* AliTRDSensorArray::ExtractDCS(TMap *dcsMap)
213 {
214   //
215   // Return Tmap with TGraph inside corresponding to values in dcsMap
216   //
217
218         return AliDCSSensorArray::ExtractDCS(dcsMap);
219 }
220
221 //_____________________________________________________________________________
222 void AliTRDSensorArray::SetGraph(TMap *map)
223 {
224   //
225   // Assign list of TGraph to the current instance
226   //
227
228         AliDCSSensorArray::SetGraph(map);
229 }
230
231 //_____________________________________________________________________________
232 Int_t AliTRDSensorArray::GetNGraph() const
233 {
234   //
235   // Return the number of TGraph
236   //
237
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