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