AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCSensorTempArray.cxx
Go to the documentation of this file.
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 
21 
22 #include "AliTPCSensorTempArray.h"
23 #include "TLinearFitter.h"
24 #include "TVectorD.h"
25 #include "AliLog.h"
26 
27 
28 
32 
33 
34 //_____________________________________________________________________________
36 {
37  //
38  // AliTPCSensorTempArray default constructor
39  //
40 
41 }
42 //_____________________________________________________________________________
43 AliTPCSensorTempArray::AliTPCSensorTempArray(Int_t run) : AliDCSSensorArray()
44 {
46 
47 
48  AliCDBEntry *entry =
49  AliCDBManager::Instance()->Get("TPC/Config/Temperature",run);
50  if (entry) {
51  TTree *tree = (TTree*) entry->GetObject();
52  fSensors = AliTPCSensorTemp::ReadTree(tree);
53  fSensors->BypassStreamer(kFALSE);
54  }
55 }
56 //_____________________________________________________________________________
58  TTree* confTree, const TString& amandaString)
59  :AliDCSSensorArray()
60 {
63 
64  fSensors = AliTPCSensorTemp::ReadTree(confTree,amandaString);
65  fSensors->BypassStreamer(kFALSE);
66  fStartTime = TTimeStamp((time_t)startTime,0);
67  fEndTime = TTimeStamp((time_t)endTime,0);
68 }
69 
70 //_____________________________________________________________________________
72  const TString& amandaString) :
73  AliDCSSensorArray()
74 {
76 
77  fSensors = AliTPCSensorTemp::ReadList(fname,amandaString);
78  fSensors->BypassStreamer(kFALSE);
79 }
80 
81 
82 //_____________________________________________________________________________
84  AliDCSSensorArray(c)
85 {
87 
88 }
89 
92 {
94 
95 }
96 
97 //_____________________________________________________________________________
99 {
101 
102  if (this != &c) {
103  fSensors->Delete();
104  new (this) AliTPCSensorTempArray(c);
105  fSensors = (TClonesArray*)c.fSensors->Clone();
106  }
107  return *this;
108 }
109 
110 
111 //_____________________________________________________________________________
112 void AliTPCSensorTempArray::ReadSensors(const char *dbEntry)
113 {
115 
116  AliCDBEntry *entry = AliCDBManager::Instance()->Get(dbEntry);
117  if (!entry) {
118  AliWarning(Form("No OCDB entry %s available\n",dbEntry));
119  return;
120  }
121  TTree *tree = (TTree*) entry->GetObject();
122  if (tree) fSensors = AliTPCSensorTemp::ReadTree(tree);
123 
124 }
125 
126 //_____________________________________________________________________________
127 AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num)
128 {
130 
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 //_____________________________________________________________________________
142 
144  return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(IdDCS));
145 }
146 //_____________________________________________________________________________
147 
148 AliTPCSensorTemp* AliTPCSensorTempArray::GetSensor(Double_t x, Double_t y, Double_t z){
149  return dynamic_cast<AliTPCSensorTemp*>(AliDCSSensorArray::GetSensor(x,y,z));
150 }
151 //_____________________________________________________________________________
152 
153 Double_t AliTPCSensorTempArray::GetTempGradientY(UInt_t timeSec, Int_t side){
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  }
Int_t GetNum() const
Class describing TPC temperature sensors (including pointers to graphs/fits.
static TClonesArray * ReadList(const char *fname, const TString &amandaString=kAmandaStringTPC)
TTree * tree
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Double_t GetTempGradientY(UInt_t timeSec, Int_t side)
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
Int_t GetSector() const
AliTPCSensorTempArray & operator=(const AliTPCSensorTempArray &c)
Int_t GetType() const
TPC calibration class for parameters which saved per pad.
static TClonesArray * ReadTree(TTree *tree, const TString &amandaString=kAmandaStringTPC)
AliTPCSensorTemp * GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num)
Int_t GetSide() const
char * fname
void ReadSensors(const char *dbEntry)