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