AliRoot Core  3dc7879 (3dc7879)
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 
30 ClassImp(AliTPCSensorTempArray)
32 
33 
34 //_____________________________________________________________________________
36 {
37  //
38  // AliTPCSensorTempArray default constructor
39  //
40 
41 }
42 //_____________________________________________________________________________
44 {
46 
47 
48  AliCDBEntry *entry =
49  AliCDBManager::Instance()->Get("TPC/Config/Temperature",run);
50  if (entry) {
51  TTree *tree = (TTree*) entry->GetObject();
53  fSensors->BypassStreamer(kFALSE);
54  }
55 }
56 //_____________________________________________________________________________
58  TTree* confTree, const TString& amandaString)
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) :
74 {
76 
77  fSensors = AliTPCSensorTemp::ReadList(fname,amandaString);
78  fSensors->BypassStreamer(kFALSE);
79 }
80 
81 
82 //_____________________________________________________________________________
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
Double_t GetX() const
Definition: AliDCSSensor.h:45
Class describing TPC temperature sensors (including pointers to graphs/fits.
static TClonesArray * ReadList(const char *fname, const TString &amandaString=kAmandaStringTPC)
AliDCSSensor * GetSensor(Int_t IdDCS)
#define AliWarning(message)
Definition: AliLog.h:541
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
Double_t GetTempGradientY(UInt_t timeSec, Int_t side)
TObject * GetObject()
Definition: AliCDBEntry.h:56
TTree * tree
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
Int_t GetSector() const
AliTPCSensorTempArray & operator=(const AliTPCSensorTempArray &c)
Definition: AliCDBEntry.h:18
Int_t GetType() const
Double_t GetValue(UInt_t timeSec)
TPC calibration class for parameters which saved per pad.
static TClonesArray * ReadTree(TTree *tree, const TString &amandaString=kAmandaStringTPC)
TClonesArray * fSensors
AliTPCSensorTemp * GetSensor(Int_t type, Int_t side, Int_t sector, Int_t num)
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
Int_t GetSide() const
char * fname
Double_t GetY() const
Definition: AliDCSSensor.h:46
void ReadSensors(const char *dbEntry)