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