Line data Source code
1 : #ifndef ALIITSDCSDATASDD_H
2 : #define ALIITSDCSDATASDD_H
3 :
4 : /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5 : * See cxx source for full Copyright notice */
6 :
7 : /* $Id$ */
8 :
9 : ///////////////////////////////////////////////////////////////////
10 : // Class to define object containing SDD DCS data //
11 : // Origin: F.Prino, Torino, prino@to.infn.it //
12 : // V.Pospisil, CTU Prague, gdermog@seznam.cz //
13 : ///////////////////////////////////////////////////////////////////
14 :
15 : #include<TObject.h>
16 : #include<TArrayF.h>
17 : #include<TArrayI.h>
18 : #include<TArrayC.h>
19 : #include<TArrayS.h>
20 :
21 0 : class AliITSDCSDataSDD : public TObject
22 : {
23 :
24 : public:
25 : AliITSDCSDataSDD( void );
26 : // Default constructor
27 0 : ~AliITSDCSDataSDD( void ){};
28 : // Destructor is void
29 :
30 : /* There are allowed ranges of temperatures and medium voltages
31 :
32 : MV ....... 0.0 - 65.535 V
33 : TL, TR ... 0.0 - 655.35 C
34 :
35 : because these variables are stores in UShort_t arrays (it halves
36 : needed space). If value of any variable exceed allowed range,
37 : something very stupid would be stored.
38 : */
39 :
40 : void SetNPointsTempLeft( Int_t npts );
41 : void SetNPointsTempRight( Int_t npts );
42 : void SetNPointsHV( Int_t npts );
43 : void SetNPointsMV( Int_t npts );
44 : void SetNPointsStatus( Int_t npts );
45 : // Sets sizes of the DCS variable arrays
46 :
47 : void SetValueTempLeft(Int_t time, Float_t temperature );
48 : void SetValueTempRight(Int_t time, Float_t temperature );
49 : void SetValueHV(Int_t time, Float_t voltage );
50 : void SetValueMV(Int_t time, Float_t voltage );
51 : void SetValueStatus(Int_t time, Char_t status );
52 : // Inserts value of a DCS variable into the appropriate array.
53 : // Resizes and sorts array if necessary.
54 :
55 : void Compress(); // Minimize array sizes
56 :
57 0 : Int_t GetTempLeftRecords() const {return fTempLeftSetPoints;}
58 0 : Int_t GetTempRightRecords() const {return fTempRightSetPoints;}
59 0 : Int_t GetHVRecords() const {return fHVSetPoints;}
60 0 : Int_t GetMVRecords() const {return fMVSetPoints;}
61 0 : Int_t GetStatusRecords() const {return fStatusSetPoints;}
62 : // Returns number of stored values of specific DCS variable
63 :
64 0 : Int_t GetTempLeftSize() const {return fTempLeftMaxPoints;}
65 0 : Int_t GetTempRightSize() const {return fTempRightMaxPoints;}
66 0 : Int_t GetHVSize() const {return fHVMaxPoints;}
67 0 : Int_t GetMVSize() const {return fMVMaxPoints;}
68 0 : Int_t GetStatusSize() const {return fStatusMaxPoints;}
69 : // Returns size of selected array
70 :
71 0 : Float_t GetTempLeftIdx( Int_t index ) const { UShort_t val = (UShort_t)fTempLeft.At(index);
72 0 : return (Float_t)val / fgkTPrec; };
73 0 : Float_t GetTempRightIdx( Int_t index ) const { UShort_t val = (UShort_t)fTempRight.At(index);
74 0 : return (Float_t)val / fgkTPrec;};
75 0 : Float_t GetHVIdx( Int_t index ) const { return fHV.At(index);};
76 0 : Float_t GetMVIdx( Int_t index ) const { UShort_t val = (UShort_t)fMV.At(index);
77 0 : return (Float_t)val / fgkMVPrec;};
78 0 : Char_t GetStatusIdx( Int_t index ) const { return fStatus.At(index);};
79 : // Returns value of specific DCS variable by index in the array
80 :
81 0 : Bool_t GetOKStatIdx( Int_t index ) const { return (Bool_t)(fStatus.At(index) & 1 ); };
82 0 : Bool_t GetTempLeftStatIdx( Int_t index ) const { return (Bool_t)(fStatus.At(index) & 2 ); };
83 0 : Bool_t GetTempRightStatIdx( Int_t index ) const { return (Bool_t)(fStatus.At(index) & 4 ); };
84 : // Return status of a readout device by index in the array
85 :
86 0 : Int_t GetTempLeftTimeIdx( Int_t index ) const {return fTempLeftTimeStamp.At(index);};
87 0 : Int_t GetTempRightTimeIdx( Int_t index ) const {return fTempRightTimeStamp.At(index);};
88 0 : Int_t GetHVTimeIdx( Int_t index ) const {return fHVTimeStamp.At(index);};
89 0 : Int_t GetMVTimeIdx( Int_t index ) const {return fMVTimeStamp.At(index);};
90 0 : Int_t GetStatusTimeIdx( Int_t index ) const {return fStatusTimeStamp.At(index);};
91 : // Returns time stamp of specific DCS variable by index in the array
92 :
93 0 : Float_t GetTempLeft( Int_t time ) const { Int_t i = FindIndex( time, fTempLeftTimeStamp, fTempLeftSetPoints );
94 0 : return ( i < 0 ) ? -1.0 : GetTempLeftIdx( i ); }
95 0 : Float_t GetTempRight( Int_t time ) const { Int_t i = FindIndex( time, fTempRightTimeStamp, fTempRightSetPoints );
96 0 : return ( i < 0 ) ? -1.0 : GetTempRightIdx( i ); }
97 0 : Float_t GetHV( Int_t time ) const { Int_t i = FindIndex( time, fHVTimeStamp, fHVSetPoints );
98 0 : return ( i < 0 ) ? -1.0 : GetHVIdx( i ); }
99 0 : Float_t GetMV( Int_t time ) const { Int_t i = FindIndex( time, fMVTimeStamp, fMVSetPoints );
100 0 : return ( i < 0 ) ? -1.0 : GetMVIdx( i ); }
101 0 : Char_t GetStatus( Int_t time ) const { Int_t i = FindIndex( time, fStatusTimeStamp, fStatusSetPoints );
102 0 : return ( i < 0 ) ? -1 : GetStatusIdx( i ); }
103 : // Returns value of specific DCS variable by time stamp
104 :
105 0 : Bool_t GetOKStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 1 ); };
106 0 : Bool_t GetTempLeftStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 2 ); };
107 0 : Bool_t GetTempRightStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 4 ); };
108 : // Return status of a readout device in given time
109 :
110 : Float_t GetDriftField( Int_t timeStamp ) const;
111 : // Returns drift field counted for specific time
112 :
113 : Float_t GetDriftSpeed( Int_t /*timeStamp*/ ) const; /* --- DUMMY --- */
114 : // Returns drift speed counted for specific time. Calculation is based on temerature
115 : // taken from DCS. This metod is not dedicated for normal usage, it should be used
116 : // only in cases that the injectors for given module fails.
117 : //
118 : // Presently only a prototype, returns -1.0.
119 :
120 : void PrintValues( FILE *output = stdout ) const;
121 : // Displays stored DCS varable values or writes it into a text file
122 : private:
123 :
124 : TArrayS fTempLeft; // Temperature on left side. If there is stored a negative value
125 : // something wrong happend with the temperature chip.
126 : // Temperatures and medium voltages are stored as UShort_t, which
127 : // takes half memory as Float_t. It makes ranges
128 : //
129 : // MV ....... 0.0 - 65.535 volts
130 : // TL, TR ... 0.0 - 655.35 C
131 : //
132 : // which should be enough.
133 : //
134 : TArrayI fTempLeftTimeStamp; // Time stamps of the temperatures on left side
135 : Int_t fTempLeftMaxPoints; // Size of the arrays
136 : Int_t fTempLeftSetPoints; // Number of filled array cells (number of set values)
137 :
138 :
139 : TArrayS fTempRight; // Temperature on right side. If there is stored a negative value
140 : // something wrong happend with the temperature chip.
141 : TArrayI fTempRightTimeStamp; // Time stamps of temperatures on right side
142 : Int_t fTempRightMaxPoints; // Size of the arrays
143 : Int_t fTempRightSetPoints; // Number of filled array cells (number of set values)
144 :
145 :
146 : TArrayF fHV; // High voltage on SDD
147 : TArrayI fHVTimeStamp; // Time stamps of HV
148 : Int_t fHVMaxPoints; // Size of the arrays
149 : Int_t fHVSetPoints; // Number of filled array cells (number of set values)
150 :
151 :
152 : TArrayS fMV; // Medium voltage on SDD
153 : TArrayI fMVTimeStamp; // Time stamps of MV
154 : Int_t fMVMaxPoints; // Size of the arrays
155 : Int_t fMVSetPoints; // Number of filled array cells (number of set values)
156 :
157 : TArrayC fStatus; // Status of temperature and voltage readout
158 : //
159 : // bit 0 - _OK
160 : // bit 1 - _TEMP_L_STATE
161 : // bit 2 - _TEMP_R_STATE
162 :
163 : TArrayI fStatusTimeStamp; // Time stamps of MV
164 : Int_t fStatusMaxPoints; // Size of the arrays
165 : Int_t fStatusSetPoints; // Number of filled array cells (number of set values)
166 :
167 :
168 : static const Float_t fgkTPrec; // Number of temperature decimal places stored
169 : static const Float_t fgkMVPrec; // Number of medium voltage decimal places stored
170 : // There are three possibilities :
171 : // 10.0 ..... one decimal place
172 : // 100.0 .... two decimal places
173 : // 1000.0 ... three decimal places
174 : // Values are set in AliITSDCSDataSDD.cxx, by default
175 : // it is fgkTPrec = 100.0, fgkMVPrec = 1000.0
176 :
177 : Int_t FindIndex( Int_t timeStamp, const TArrayI &timeStampArray, Int_t n ) const;
178 : // Provides binary search in the time array. Returns index in the array of time
179 : // stamps by selected value. Returns -1 if the time is less than time stamp in
180 : // the timeArray[0]
181 :
182 118 : ClassDef(AliITSDCSDataSDD, 3)
183 :
184 : }; /*class AliITSDCSDataSDD*/
185 :
186 : #endif
|