Separating well and badly reconstructed pileup vertices. Adding statistics of associa...
[u/mrichter/AliRoot.git] / ITS / AliITSDCSDataSDD.h
CommitLineData
cfaccd71 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///////////////////////////////////////////////////////////////////
cfaccd71 10// Class to define object containing SDD DCS data //
11// Origin: F.Prino, Torino, prino@to.infn.it //
e22bf775 12// V.Pospisil, CTU Prague, gdermog@seznam.cz //
cfaccd71 13///////////////////////////////////////////////////////////////////
14
15#include<TObject.h>
16#include<TArrayF.h>
17#include<TArrayI.h>
e22bf775 18#include<TArrayC.h>
dc5eacf8 19#include<TArrayS.h>
cfaccd71 20
dc5eacf8 21class AliITSDCSDataSDD : public TObject
22{
cfaccd71 23
24 public:
e22bf775 25 AliITSDCSDataSDD( void );
26 // Default constructor
27 ~AliITSDCSDataSDD( void ){};
28 // Destructor is void
29
dc5eacf8 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
e22bf775 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
dc5eacf8 55 void Compress(); // Minimize array sizes
e22bf775 56
57 Int_t GetTempLeftRecords() const {return fTempLeftSetPoints;}
58 Int_t GetTempRightRecords() const {return fTempRightSetPoints;}
59 Int_t GetHVRecords() const {return fHVSetPoints;}
60 Int_t GetMVRecords() const {return fMVSetPoints;}
61 Int_t GetStatusRecords() const {return fStatusSetPoints;}
62 // Returns number of stored values of specific DCS variable
63
64 Int_t GetTempLeftSize() const {return fTempLeftMaxPoints;}
65 Int_t GetTempRightSize() const {return fTempRightMaxPoints;}
66 Int_t GetHVSize() const {return fHVMaxPoints;}
67 Int_t GetMVSize() const {return fMVMaxPoints;}
68 Int_t GetStatusSize() const {return fStatusMaxPoints;}
69 // Returns size of selected array
70
dc5eacf8 71 Float_t GetTempLeftIdx( Int_t index ) const { UShort_t val = (UShort_t)fTempLeft.At(index);
72 return (Float_t)val / fgkTPrec; };
73 Float_t GetTempRightIdx( Int_t index ) const { UShort_t val = (UShort_t)fTempRight.At(index);
74 return (Float_t)val / fgkTPrec;};
75 Float_t GetHVIdx( Int_t index ) const { return fHV.At(index);};
76 Float_t GetMVIdx( Int_t index ) const { UShort_t val = (UShort_t)fMV.At(index);
77 return (Float_t)val / fgkMVPrec;};
78 Char_t GetStatusIdx( Int_t index ) const { return fStatus.At(index);};
e22bf775 79 // Returns value of specific DCS variable by index in the array
80
81 Bool_t GetOKStatIdx( Int_t index ) const { return (Bool_t)(fStatus.At(index) & 1 ); };
82 Bool_t GetTempLeftStatIdx( Int_t index ) const { return (Bool_t)(fStatus.At(index) & 2 ); };
83 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 Int_t GetTempLeftTimeIdx( Int_t index ) const {return fTempLeftTimeStamp.At(index);};
87 Int_t GetTempRightTimeIdx( Int_t index ) const {return fTempRightTimeStamp.At(index);};
88 Int_t GetHVTimeIdx( Int_t index ) const {return fHVTimeStamp.At(index);};
89 Int_t GetMVTimeIdx( Int_t index ) const {return fMVTimeStamp.At(index);};
90 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
dc5eacf8 93 Float_t GetTempLeft( Int_t time ) const { Int_t i = FindIndex( time, fTempLeftTimeStamp, fTempLeftSetPoints );
94 return ( i < 0 ) ? -1.0 : GetTempLeftIdx( i ); }
95 Float_t GetTempRight( Int_t time ) const { Int_t i = FindIndex( time, fTempRightTimeStamp, fTempRightSetPoints );
96 return ( i < 0 ) ? -1.0 : GetTempRightIdx( i ); }
97 Float_t GetHV( Int_t time ) const { Int_t i = FindIndex( time, fHVTimeStamp, fHVSetPoints );
98 return ( i < 0 ) ? -1.0 : GetHVIdx( i ); }
99 Float_t GetMV( Int_t time ) const { Int_t i = FindIndex( time, fMVTimeStamp, fMVSetPoints );
100 return ( i < 0 ) ? -1.0 : GetMVIdx( i ); }
101 Char_t GetStatus( Int_t time ) const { Int_t i = FindIndex( time, fStatusTimeStamp, fStatusSetPoints );
102 return ( i < 0 ) ? -1 : GetStatusIdx( i ); }
e22bf775 103 // Returns value of specific DCS variable by time stamp
104
dc5eacf8 105 Bool_t GetOKStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 1 ); };
106 Bool_t GetTempLeftStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 2 ); };
107 Bool_t GetTempRightStat( Int_t time ) const { return (Bool_t)( GetStatus( time ) & 4 ); };
e22bf775 108 // Return status of a readout device in given time
109
dc5eacf8 110 Float_t GetDriftField( Int_t timeStamp ) const;
e22bf775 111 // Returns drift field counted for specific time
cfaccd71 112
dc5eacf8 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.
e22bf775 119
120 void PrintValues( FILE *output = stdout ) const;
121 // Displays stored DCS varable values or writes it into a text file
cfaccd71 122 private:
123
dc5eacf8 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 ClassDef(AliITSDCSDataSDD, 3)
cfaccd71 183
e22bf775 184}; /*class AliITSDCSDataSDD*/
cfaccd71 185
186#endif