]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDSensorArray.cxx
New AliTRDSensor classes by Wilfried
[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 //_____________________________________________________________________________
51 AliTRDSensorArray::AliTRDSensorArray (const char * amanda, 
52                                       const char * storeName, 
53                                       Float_t /*diffCut*/,
54                                       TClonesArray * trdSensor) :
55                                         AliDCSSensorArray (),
56                                         fAmanda         (amanda),
57                                         fStoreName      (storeName)
58                                         
59 {
60         //constructor set fMinGraph to 0, fValCut to 0, fDiffCut to 0
61         fSensors        = trdSensor;
62         fMinGraph       = 0;
63         fValCut         = -1;
64         fDiffCut        = -1;
65 }
66
67 //_____________________________________________________________________________
68 AliTRDSensorArray::AliTRDSensorArray (const AliTRDSensorArray & source) :
69                                         fAmanda         (source.fAmanda),
70                                         fStoreName      (source.fStoreName)
71                                         
72 {
73         // copy constructor
74         fSensors        = source.fSensors;
75         fMinGraph       = 0;
76         fValCut         = -1;
77         fDiffCut        = -1;
78 }
79         
80
81 //_____________________________________________________________________________
82 AliTRDSensorArray:: ~AliTRDSensorArray ()
83 {
84   //
85   // Destructor
86   //
87         
88 }
89
90 //_____________________________________________________________________________         
91 AliTRDSensorArray & AliTRDSensorArray::operator=(const AliTRDSensorArray & source)
92 {
93   //
94   // Assignment operator
95   //
96
97         if (&source == this) return *this;
98         new (this) AliTRDSensorArray (source);
99   
100         return *this;  
101 }
102
103 //_____________________________________________________________________________
104 TObjArray *  AliTRDSensorArray::GetList () 
105 {
106         // return TObjArray with a list of AliTRDSensorArray corresponding to each
107         // group of sensor 
108         
109         TObjArray * list = new TObjArray (22);
110         list->SetOwner (kTRUE);
111         AliTRDSensorArray * aH = 0x0;
112         
113         // generic list of sensors
114         TClonesArray listSensor540 ("AliTRDSensor", 540);       
115         TClonesArray listSensor2   ("AliTRDSensor", 2); 
116         TClonesArray listSensor1   ("AliTRDSensor", 1); 
117         listSensor540.SetOwner (kTRUE);
118         listSensor2.SetOwner (kTRUE);
119         listSensor1.SetOwner (kTRUE);
120         for (Int_t i = 0; i < 540; i++) {
121                 new(listSensor540[i]) AliTRDSensor (i, 0, 0, 0);
122         }
123         for (Int_t i = 0; i < 2; i++)
124                 new(listSensor2[i]) AliTRDSensor (i, 0, 0, 0);
125         new(listSensor1[0]) AliTRDSensor (0, 0, 0, 0);
126         
127         
128         // now create and populate   
129         aH = new AliTRDSensorArray ("trd_chamberStatus%03d", "trd_chamberStatus", 
130                                                                 0.5, (TClonesArray*)listSensor540.Clone ());
131         list->Add (aH);
132         
133         aH = new AliTRDSensorArray ("trd_preTrigger",           "trd_preTrigger", 
134                                                                 -1, (TClonesArray*)listSensor1.Clone ());
135         list->Add (aH);
136         aH = new AliTRDSensorArray ("trd_goofieHv",                     "trd_goofieHv",  
137                                                                 -1, (TClonesArray*)listSensor1.Clone ());
138         list->Add (aH);
139         aH = new AliTRDSensorArray ("trd_goofiePeakPos%02d",    "trd_goofiePeakPos",   
140                                                                 -1, (TClonesArray*)listSensor2.Clone ());
141         list->Add (aH);
142         aH = new AliTRDSensorArray ("trd_goofiePeakArea%02d","trd_goofiePeakArea",   
143                                                                 -1, (TClonesArray*)listSensor2.Clone ());
144         list->Add (aH);
145         aH = new AliTRDSensorArray ("trd_goofieTemp%02d",       "trd_goofieTemp",  
146                                                                 -1, (TClonesArray*)listSensor2.Clone ());
147         list->Add (aH);
148         aH = new AliTRDSensorArray ("trd_goofiePressure",       "trd_goofiePressure",  
149                                                                 -1, (TClonesArray*)listSensor1.Clone ());
150         list->Add (aH);
151         aH = new AliTRDSensorArray ("trd_goofieVelocity",       "trd_goofieVelocity",  
152                                                                 -1, (TClonesArray*)listSensor1.Clone ());
153         list->Add (aH);
154         aH = new AliTRDSensorArray ("trd_goofieGain%02d",       "trd_goofieGain",  
155                                                                 -1, (TClonesArray*)listSensor2.Clone ());
156         list->Add (aH);
157         aH = new AliTRDSensorArray ("trd_goofieCO2",            "trd_goofieCO2",  
158                                                                 -1, (TClonesArray*)listSensor1.Clone ());
159         list->Add (aH);
160         aH = new AliTRDSensorArray ("trd_goofieN2",                     "trd_goofieN2", 
161                                                                 -1, (TClonesArray*)listSensor1.Clone ());
162         list->Add (aH);
163         aH = new AliTRDSensorArray ("trd_gasO2",                        "trd_gasO2",  
164                                                                 -1, (TClonesArray*)listSensor1.Clone ());
165         list->Add (aH);
166         aH = new AliTRDSensorArray ("trd_gasH2O",                       "trd_gasH2O",  
167                                                                 -1, (TClonesArray*)listSensor1.Clone ());
168         list->Add (aH);
169         aH = new AliTRDSensorArray ("trd_gasOverpressure",      "trd_gasOverpressure",  
170                                                                 -1, (TClonesArray*)listSensor1.Clone ());
171         list->Add (aH);
172         aH = new AliTRDSensorArray ("trd_envTemp%03d",          "trd_envTemp",  
173                                                                 -1, (TClonesArray*)listSensor540.Clone ());
174         list->Add (aH);
175         aH = new AliTRDSensorArray ("trd_hvAnodeImon%03d",      "trd_hvAnodeImon",       
176                                                                 -1, (TClonesArray*)listSensor540.Clone ());
177         list->Add (aH);
178         aH = new AliTRDSensorArray ("trd_hvDriftImon%03d",      "trd_hvDriftImon",  
179                                                                 -1, (TClonesArray*)listSensor540.Clone ());
180         list->Add (aH);
181         aH = new AliTRDSensorArray ("trd_hvAnodeUmon%03d",      "trd_hvAnodeUmon",  
182                                                                 -1, (TClonesArray*)listSensor540.Clone ());
183         list->Add (aH);
184         aH = new AliTRDSensorArray ("trd_hvDriftUmon%03d",      "trd_hvDriftUmon",  
185                                                                 -1, (TClonesArray*)listSensor540.Clone ());
186         list->Add (aH);
187         aH = new AliTRDSensorArray ("trd_adcClkPhase",          "trd_adcClkPhase", 
188                                                                 -1, (TClonesArray*)listSensor1.Clone ());
189         list->Add (aH);
190         aH = new AliTRDSensorArray ("CavernAtmosPressure",      "CavernAtmosPressure", 
191                                                                 -1, (TClonesArray*)listSensor1.Clone ());
192         list->Add (aH);
193         aH = new AliTRDSensorArray ("LHCLuminosity",            "LHCLuminosity",  
194                                                                 -1, (TClonesArray*)listSensor1.Clone ());
195         list->Add (aH);
196         aH = new AliTRDSensorArray ("L3Current",                        "L3Current",  
197                                                                 -1, (TClonesArray*)listSensor1.Clone ());
198         list->Add (aH);
199                                   
200         return list;
201 }
202
203 //_____________________________________________________________________________
204 TMap* AliTRDSensorArray::ExtractDCS(TMap *dcsMap)
205 {
206         //Return Tmap with TGraph inside corresponding to values in dcsMap
207         return AliDCSSensorArray::ExtractDCS (dcsMap, fAmanda.Data ());
208 }
209
210 //_____________________________________________________________________________
211 void AliTRDSensorArray::SetGraph (TMap * map)
212 {
213         // assigne list of TGraph to the current instance
214         AliDCSSensorArray::SetGraph (map, fAmanda.Data ());
215 }
216
217
218 //_____________________________________________________________________________
219 Int_t AliTRDSensorArray::GetNGraph () const
220 {
221         // return the number of TGraph
222         Int_t nGraph = 0;
223         Int_t nsensors = fSensors->GetEntries();
224         
225         for (Int_t isensor = 0; isensor < nsensors; isensor++) {
226                 AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
227                 if (entry->GetGraph () != 0x0)
228                         nGraph ++;
229         } 
230         return nGraph;
231 }
232
233