1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // TPC calibration class for parameters which saved per pad //
20 // Authors: Marian Ivanov and Haavard Helstrup //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliTPCSensorTempArray.h"
25 #include "TLinearFitter.h"
31 ClassImp(AliTPCSensorTempArray)
34 //_____________________________________________________________________________
35 AliTPCSensorTempArray::AliTPCSensorTempArray():AliDCSSensorArray()
38 // AliTPCSensorTempArray default constructor
42 //_____________________________________________________________________________
43 AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t run) : AliDCSSensorArray()
46 // Read configuration from OCDB
51 AliCDBManager::Instance()->Get("TPC/Config/Temperature",run);
53 TTree *tree = (TTree*) entry->GetObject();
54 fSensors = AliTPCSensorTemp::ReadTree(tree);
55 fSensors->BypassStreamer(kFALSE);
58 //_____________________________________________________________________________
59 AliTPCSensorTempArray::AliTPCSensorTempArray(UInt_t startTime, UInt_t endTime,
60 TTree* confTree, const TString& amandaString)
64 // AliTPCSensorTempArray constructor for Shuttle preprocessor
65 // (confTree read from OCDB)
67 fSensors = AliTPCSensorTemp::ReadTree(confTree,amandaString);
68 fSensors->BypassStreamer(kFALSE);
69 fStartTime = TTimeStamp((time_t)startTime,0);
70 fEndTime = TTimeStamp((time_t)endTime,0);
73 //_____________________________________________________________________________
74 AliTPCSensorTempArray::AliTPCSensorTempArray(const char *fname,
75 const TString& amandaString) :
79 // AliTPCSensorTempArray constructor
81 fSensors = AliTPCSensorTemp::ReadList(fname,amandaString);
82 fSensors->BypassStreamer(kFALSE);
86 //_____________________________________________________________________________
87 AliTPCSensorTempArray::AliTPCSensorTempArray(const AliTPCSensorTempArray &c):
91 // AliTPCSensorTempArray copy constructor
96 ///_____________________________________________________________________________
97 AliTPCSensorTempArray::~AliTPCSensorTempArray()
100 // AliTPCSensorTempArray destructor
104 //_____________________________________________________________________________
105 AliTPCSensorTempArray &AliTPCSensorTempArray::operator=(const AliTPCSensorTempArray &c)
108 // Assignment operator
112 new (this) AliTPCSensorTempArray(c);
113 fSensors = (TClonesArray*)c.fSensors->Clone();
119 //_____________________________________________________________________________
120 void AliTPCSensorTempArray::ReadSensors(const char *dbEntry)
123 // Read list of temperature sensors from text file
125 AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
127 AliWarning(Form("No OCDB entry %s available\n",dbEntry));
130 TTree *tree = (TTree*) entry->GetObject();
131 if (tree) fSensors = AliTPCSensorTemp::ReadTree(tree);
135 //_____________________________________________________________________________
136 AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num)
139 // Return sensor information for sensor specified by type, side, sector and num
141 Int_t nsensors = fSensors->GetEntries();
142 for (Int_t isensor=0; isensor<nsensors; isensor++) {
143 AliTPCSensorTemp *entry = (AliTPCSensorTemp*)fSensors->At(isensor);
144 if (entry->GetSide() == side &&
145 entry->GetType() == type &&
146 entry->GetSector() == sector &&
147 entry->GetNum() == num ) return entry;
151 //_____________________________________________________________________________
153 AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t IdDCS){
154 return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
156 //_____________________________________________________________________________
158 AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
159 return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
161 //_____________________________________________________________________________
163 Double_t AliTPCSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){
165 // Extract Linear Vertical Temperature Gradient [K/cm] within the TPC on
168 // Values based on TemperatureSensors within the TPC (type: 3(TPC))
170 // FIXME: Also return residual-distribution, covariance Matrix
171 // or simply chi2 for validity check?
174 TLinearFitter fitter(3,"x0++x1++x2");
178 Int_t nsensors = fSensors->GetEntries();
179 for (Int_t isensor=0; isensor<nsensors; isensor++) { // loop over all sensors
180 AliTPCSensorTemp *entry = (AliTPCSensorTemp*)fSensors->At(isensor);
182 if (entry->GetType()==3 && entry->GetSide()==side) { // take SensorType:TPC
187 Double_t y = entry->GetValue(timeSec); // get temperature value
188 fitter.AddPoint(x,y,1); // add values to LinearFitter
194 fitter.GetParameters(param);
196 return param[2]; // return vertical (Y) tempGradient