]>
Commit | Line | Data |
---|---|---|
54472e4f | 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 | ||
17 | /////////////////////////////////////////////////////////////////////////////// | |
18 | // // | |
19 | // TPC calibration class for parameters which saved per pad // | |
20 | // Authors: Marian Ivanov and Haavard Helstrup // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include "AliTPCSensorTempArray.h" | |
3a887e1a | 25 | #include "TLinearFitter.h" |
26 | #include "TVectorD.h" | |
67a165ed | 27 | #include "AliLog.h" |
28 | ||
29 | ||
54472e4f | 30 | |
31 | ClassImp(AliTPCSensorTempArray) | |
32 | ||
54472e4f | 33 | |
34 | //_____________________________________________________________________________ | |
24938b4c | 35 | AliTPCSensorTempArray::AliTPCSensorTempArray():AliDCSSensorArray() |
54472e4f | 36 | { |
37 | // | |
38 | // AliTPCSensorTempArray default constructor | |
39 | // | |
ffa7e8be | 40 | |
54472e4f | 41 | } |
42 | //_____________________________________________________________________________ | |
24938b4c | 43 | AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t run) : AliDCSSensorArray() |
54472e4f | 44 | { |
24938b4c | 45 | // |
46 | // Read configuration from OCDB | |
47 | // | |
48 | ||
49 | ||
50 | AliCDBEntry *entry = | |
51 | AliCDBManager::Instance()->Get("TPC/Config/Temperature",run); | |
52 | TTree *tree = (TTree*) entry->GetObject(); | |
53 | fSensors = AliTPCSensorTemp::ReadTree(tree); | |
54 | fSensors->BypassStreamer(kFALSE); | |
55 | ||
54472e4f | 56 | } |
57 | //_____________________________________________________________________________ | |
ffa7e8be | 58 | AliTPCSensorTempArray::AliTPCSensorTempArray(UInt_t startTime, UInt_t endTime, |
67a165ed | 59 | TTree* confTree, const TString& amandaString) |
24938b4c | 60 | :AliDCSSensorArray() |
54472e4f | 61 | { |
62 | // | |
24938b4c | 63 | // AliTPCSensorTempArray constructor for Shuttle preprocessor |
64 | // (confTree read from OCDB) | |
54472e4f | 65 | // |
67a165ed | 66 | fSensors = AliTPCSensorTemp::ReadTree(confTree,amandaString); |
24938b4c | 67 | fSensors->BypassStreamer(kFALSE); |
63f49d7b | 68 | fStartTime = TTimeStamp((time_t)startTime,0); |
69 | fEndTime = TTimeStamp((time_t)endTime,0); | |
54472e4f | 70 | } |
71 | ||
72 | //_____________________________________________________________________________ | |
5a163c08 | 73 | AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname, |
74 | const TString& amandaString) : | |
24938b4c | 75 | AliDCSSensorArray() |
54472e4f | 76 | { |
77 | // | |
78 | // AliTPCSensorTempArray constructor | |
79 | // | |
5a163c08 | 80 | fSensors = AliTPCSensorTemp::ReadList(fname,amandaString); |
54472e4f | 81 | fSensors->BypassStreamer(kFALSE); |
54472e4f | 82 | } |
83 | ||
84 | ||
85 | //_____________________________________________________________________________ | |
86 | AliTPCSensorTempArray::AliTPCSensorTempArray(const AliTPCSensorTempArray &c): | |
24938b4c | 87 | AliDCSSensorArray(c) |
54472e4f | 88 | { |
89 | // | |
90 | // AliTPCSensorTempArray copy constructor | |
91 | // | |
92 | ||
93 | } | |
94 | ||
95 | ///_____________________________________________________________________________ | |
96 | AliTPCSensorTempArray::~AliTPCSensorTempArray() | |
97 | { | |
98 | // | |
99 | // AliTPCSensorTempArray destructor | |
100 | // | |
54472e4f | 101 | } |
102 | ||
103 | //_____________________________________________________________________________ | |
104 | AliTPCSensorTempArray &AliTPCSensorTempArray::operator=(const AliTPCSensorTempArray &c) | |
105 | { | |
106 | // | |
107 | // Assignment operator | |
108 | // | |
67a165ed | 109 | if (this != &c) { |
110 | fSensors->Delete(); | |
111 | new (this) AliTPCSensorTempArray(c); | |
112 | fSensors = (TClonesArray*)c.fSensors->Clone(); | |
113 | } | |
54472e4f | 114 | return *this; |
54472e4f | 115 | } |
116 | ||
54472e4f | 117 | |
54472e4f | 118 | //_____________________________________________________________________________ |
67a165ed | 119 | void AliTPCSensorTempArray::ReadSensors(const char *dbEntry) |
54472e4f | 120 | { |
121 | // | |
122 | // Read list of temperature sensors from text file | |
123 | // | |
67a165ed | 124 | AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry); |
24938b4c | 125 | TTree *tree = (TTree*) entry->GetObject(); |
126 | fSensors = AliTPCSensorTemp::ReadTree(tree); | |
54472e4f | 127 | |
24938b4c | 128 | } |
54472e4f | 129 | |
e4dce695 | 130 | //_____________________________________________________________________________ |
131 | AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num) | |
132 | { | |
133 | // | |
134 | // Return sensor information for sensor specified by type, side, sector and num | |
135 | // | |
136 | Int_t nsensors = fSensors->GetEntries(); | |
137 | for (Int_t isensor=0; isensor<nsensors; isensor++) { | |
138 | AliTPCSensorTemp *entry = (AliTPCSensorTemp*)fSensors->At(isensor); | |
139 | if (entry->GetSide() == side && | |
140 | entry->GetType() == type && | |
141 | entry->GetSector() == sector && | |
142 | entry->GetNum() == num ) return entry; | |
143 | } | |
144 | return 0; | |
145 | } | |
146 | //_____________________________________________________________________________ | |
49dfd67a | 147 | |
e4dce695 | 148 | AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t IdDCS){ |
149 | return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS)); | |
150 | } | |
151 | //_____________________________________________________________________________ | |
49dfd67a | 152 | |
e4dce695 | 153 | AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){ |
154 | return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z)); | |
155 | } | |
3a887e1a | 156 | //_____________________________________________________________________________ |
157 | ||
158 | Double_t AliTPCSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){ | |
159 | // | |
160 | // Extract Linear Vertical Temperature Gradient [K/cm] within the TPC on | |
161 | // Shaft Side(A): 0 | |
162 | // Muon Side(C): 1 | |
163 | // Values based on TemperatureSensors within the TPC (type: 3(TPC)) | |
164 | // | |
165 | // FIXME: Also return residual-distribution, covariance Matrix | |
166 | // or simply chi2 for validity check? | |
167 | // | |
168 | ||
169 | TLinearFitter fitter(3,"x0++x1++x2"); | |
170 | TVectorD param(3); | |
171 | Int_t i = 0; | |
172 | ||
173 | Int_t nsensors = fSensors->GetEntries(); | |
174 | for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over all sensors | |
175 | AliTPCSensorTemp *entry = (AliTPCSensorTemp*)fSensors->At(isensor); | |
176 | ||
177 | if (entry->GetType()==3 && entry->GetSide()==side) { // take SensorType:TPC | |
178 | Double_t x[3]; | |
179 | x[0]=1; | |
180 | x[1]=entry->GetX(); | |
181 | x[2]=entry->GetY(); | |
182 | Double_t y = entry->GetValue(timeSec); // get temperature value | |
183 | fitter.AddPoint(x,y,1); // add values to LinearFitter | |
184 | i++; | |
185 | } | |
186 | ||
187 | } | |
188 | fitter.Eval(); | |
189 | fitter.GetParameters(param); | |
190 | ||
191 | return param[2]; // return vertical (Y) tempGradient | |
192 | ||
193 | } |