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