Include pressure sensors. Read Config entry from OCDB (Haavard)
[u/mrichter/AliRoot.git] / TPC / AliTPCSensorTemp.cxx
CommitLineData
54472e4f 1/**************************************************************************
2 * Copyright(c) 2006-07, 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// Class describing TPC temperature sensors (including pointers to graphs/fits//
20// Authors: Marian Ivanov, Haavard Helstrup and Martin Siska //
21// //
22////////////////////////////////////////////////////////////////////////////////
23
24// Running instructions:
25/*
26 TClonesArray * arr = AliTPCSensorTemp::ReadList("TempSensor.txt");
27 TFile f("TempSensors.root","RECREATE");
28 TTree * tree = new TTree("TempSensor", "TempSensor");
29 tree->Branch("Temp",&arr);
30 tree->Fill();
31 tree->Write();
32
33 */
34//
35
49dfd67a 36
54472e4f 37#include "AliTPCSensorTemp.h"
ee256dfd 38ClassImp(AliTPCSensorTemp)
54472e4f 39
40
e4dce695 41const Float_t kASideX[18][5]={
49dfd67a 42 { 99.56, 117.59, 160.82, 186.92, 213.11},
43 { 87.56, 103.4, 141.42, 164.37, 187.41},
44 { 64.99, 76.75, 104.97, 122.00, 139.1},
45 { 34.58, 40.84, 55.85, 64.92, 74.01},
46 { 0, 0, 0, 0, 0},
47 {-34.58, -40.84, -55.85, -64.92, -74.01},
48 {-64.99, -76.75, -104.97, -122.0, -139.1},
49 {-87.56, -103.4, -141.42, -164.37, -187.41},
50 {-99.56, -117.59, -160.82, -186.92, -213.11},
51 {-99.56, -117.59, -160.82, -186.92, -213.11},
52 {-87.56, -103.4, -141.42, -164.37, -187.41},
53 {-64.99, -76.75, -104.97, -122, -139.1},
54 {-34.58, -40.84, -55.85, -64.92, -74.01},
55 { 0, 0, 0, 0, 0},
56 { 34.58, 40.84, 55.85, 64.92, 74.01},
57 { 64.99, 76.75, 104.97, 122, 139.1},
58 { 87.56, 103.4, 141.42, 164.37, 187.41},
59 { 99.56, 117.59, 160.82, 186.92, 213.11}};
e4dce695 60
61const Float_t kASideY[18][5]={
49dfd67a 62 { 17.56, 20.73, 28.36, 32.96, 37.58},
63 { 50.55, 59.7, 81.65, 94.9, 108.2},
64 { 77.45, 91.47, 125.1, 145.4, 165.77},
65 { 95.0, 112.3, 153.45, 178.35, 203.35},
e4dce695 66 {101.1, 119.4, 163.3, 189.8, 216.4},
49dfd67a 67 { 95.0, 112.2, 153.45, 178.35, 203.35},
68 { 77.45, 91.47, 125.1, 145.4, 165.77},
69 { 50.55, 59.7, 81.65, 94.9, 108.2},
70 { 17.56, 20.73, 28.36, 32.96, 37.58},
71 {-17.56, -20.73, -28.36, -32.96, -37.58},
72 {-50.55, -59.7, -81.65, -94.9, -108.2},
73 {-77.45, -91.47, -125.1, -145.4, -165.77},
74 {-95.0, -112.2, -153.45, -178.35, -203.35},
75 {-101.1, -119.4, -163.3, -189.8, -216.4},
76 {-95.0, -112.2, -153.45, -178.35, -203.35},
77 {-77.45, -91.47, -125.1, -145.4, -165.77},
78 {-50.55, -59.7, -81.65, -94.9, -108.2},
79 {-17.56, -20.73, -28.36, -32.96, -37.58}};
e4dce695 80
81const Float_t kCSideX[18][5]={
49dfd67a 82 { 99.56, 117.59, 160.82, 186.92, 213.11},
83 { 87.56, 103.4, 141.42, 164.37, 187.41},
84 { 64.99, 76.75, 104.97, 122, 139.1},
85 { 34.58, 40.84, 55.85, 64.92, 74.01},
86 { 0, 0, 0, 0, 0},
87 {-34.58, -40.84, -55.85, -64.92, -74.01},
88 {-64.99, -76.75, -104.97, -122, -139.1},
89 {-87.56, -103.4, -141.42, -164.37, -187.41},
90 {-99.56, -117.59, -160.82, -186.92, -213.11},
91 {-99.56, -117.59, -160.82, -186.92, -213.11},
92 {-87.56, -103.4, -141.42, -164.37, -187.41},
93 {-64.99, -76.75, -104.97, -122, -139.1},
94 {-34.58, -40.84, -55.85, -64.92, -74.01},
95 { 0, 0, 0, 0, 0},
96 { 34.58, 40.84, 55.85, 64.92, 74.01},
97 { 64.99, 76.75, 104.97, 122, 139.1},
98 { 87.56, 103.4, 141.42, 164.37, 187.41},
99 { 99.56, 117.59, 160.82, 186.92, 213.11}};
e4dce695 100
101const Float_t kCSideY[18][5]={
49dfd67a 102 { 17.56, 20.73, 28.36, 32.96, 37.58},
103 { 50.55, 59.7, 81.65, 94.9, 108.2},
104 { 77.45, 91.47, 125.1, 145.4, 165.77},
105 { 95.0, 112.2, 153.54, 178.35, 203.35},
e4dce695 106 {101.1, 119.4, 163.3, 189.8, 216.4},
49dfd67a 107 { 95.0, 112.2, 153.45, 178.35, 203.35},
108 { 77.45, 91.47, 125.1, 145.4, 165.77},
109 { 50.55, 59.7, 81.65, 94.9, 108.2},
110 { 17.56, 20.73, 28.36, 32.96, 37.58},
111 {-17.56, -20.73, -28.36, -32.96, -37.58},
112 {-50.55, -59.7, -81.56, -94.9, -108.2},
113 {-77.45, -91.47, -125.1, -145.4, -165.77},
114 {-95.0, -112.2, -153.45, -178.35, -203.35},
e4dce695 115 {-101.1, -119.4, -163.3, -189.8, -216.4},
49dfd67a 116 {-95.0, -112.2, -153.45, -178.35, -203.35},
117 {-77.45, -91.47, -125.1, -145.4, -165.77},
118 {-50.55, -59.7, -81.65, -94.9, -108.2},
119 {-17.56, -20.73, -28.36, -32.96, -37.58}};
e4dce695 120
121const Float_t kIFCrad[5] = {67.2, 64.4, 60.7, 64.4, 67.2};
122
49dfd67a 123const Float_t kTSrad[4] = {67.2, 61.5, 67.2, 61.5};
124const Float_t kTSz[4] = {240.0, 90.0, 240.0, 90.0};
e4dce695 125
126
54472e4f 127AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
128 fType(0),
129 fSide(0),
130 fSector(0),
131 fNum(0)
132{
133 //
134 // Standard constructor
135 //
136}
137
138AliTPCSensorTemp::AliTPCSensorTemp(const AliTPCSensorTemp& source) :
139 AliDCSSensor(source),
140 fType(source.fType),
141 fSide(source.fSide),
142 fSector(source.fSector),
143 fNum(source.fNum)
144
145//
146// Copy constructor
147//
148{ }
149
150AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){
151//
152// assignment operator
153//
154 if (&source == this) return *this;
155 new (this) AliTPCSensorTemp(source);
156
157 return *this;
158}
159
54472e4f 160
54472e4f 161
49dfd67a 162TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) {
54472e4f 163 //
164 // read values from ascii file
165 //
166 TTree * tree = new TTree("asci","asci");
167 tree->ReadFile(fname,"");
168
169 Int_t nentries = tree->GetEntries();
170 Int_t sensor=0;
171 Int_t sector=0;
172 char type[100];
173 char side[100];
174 Int_t num=0;
175 Int_t echa=0;
176 //Double_t x=0;
177 //Double_t y=0;
178 //Double_t z=0;
179 //String_t namedtp[100];
180
181 tree->SetBranchAddress("Sensor",&sensor);
182 tree->SetBranchAddress("Type",&type);
183 tree->SetBranchAddress("Side",&side);
184 tree->SetBranchAddress("Sec",&sector);
185 tree->SetBranchAddress("Num",&num);
186 tree->SetBranchAddress("ECha",&echa);
187 //tree->SetBranchAddress("X",&x);
188 //tree->SetBranchAddress("Y",&y);
189 //tree->SetBranchAddress("Z",&z);
190
49dfd67a 191 // firstSensor = (Int_t)tree->GetMinimum("ECha");
192 // lastSensor = (Int_t)tree->GetMaximum("ECha");
54472e4f 193
194 TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries);
195
196 for (Int_t isensor=0; isensor<nentries; isensor++){
197 AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp;
198 tree->GetEntry(isensor);
199 temp->SetId(sensor);
200 temp->SetIdDCS(echa);
201 if (side[0]=='C') temp->SetSide(1);
202 temp->SetSector(sector);
203 temp->SetNum(num);
204 //temp->SetType(type);
205 if (bcmp(type,"ROC",3)==0) temp->SetType(0);
206 if (bcmp(type,"OFC",3)==0) temp->SetType(1);
207 if (bcmp(type,"IFC",3)==0) temp->SetType(2);
208 if (bcmp(type,"TPC",3)==0) temp->SetType(3);
209 if (bcmp(type,"ELM",3)==0) temp->SetType(4);
210 if (bcmp(type,"TS",2)==0) temp->SetType(5);
211 if (bcmp(type,"COOL",3)==0)temp->SetType(6);
212 //temp->SetX(x);
213
214 if (temp->GetType()==0){
e4dce695 215// temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
216 if (side[0]=='C') {
217 temp->SetX(kCSideX[sector][num]);
218 } else {
219 temp->SetX(kASideX[sector][num]);
220 }
54472e4f 221 }
222 if ((temp->GetType()==1) || (temp->GetType()==4)){
e4dce695 223 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
54472e4f 224 }
49dfd67a 225 if (temp->GetType()==2) {
226 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*60.7);
227 }
228 if (temp->GetType()==3) {
229 if (num==0) {
230 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*87.5);
231 } else {
232 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*241.8);
233 }
234 }
235 if (temp->GetType()==5){
236 temp->SetX(TMath::Cos(sector*0.524+(num+1)*0.131)*kTSrad[num]);
54472e4f 237 }
49dfd67a 238 if (temp->GetType()==6){
54472e4f 239 temp->SetX(0);
240 }
241
242 //temp->SetY(y);
243 if (temp->GetType()==0){
e4dce695 244// temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
245 if (side[0]=='C') {
246 temp->SetY(kCSideY[sector][num]);
247 } else {
248 temp->SetY(kASideY[sector][num]);
249 }
54472e4f 250 }
251 if ((temp->GetType()==1) || (temp->GetType()==4)){
e4dce695 252 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
54472e4f 253 }
49dfd67a 254 if (temp->GetType()==2){
255 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*60.7);
256 }
257 if (temp->GetType()==3) {
258 if (num==0) {
259 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*87.5);
260 } else {
261 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*241.8);
262 }
263 }
264
265 if (temp->GetType()==5){
266 temp->SetY(TMath::Sin(sector*0.524+(num+1)*0.131)*kTSrad[num]);
54472e4f 267 }
49dfd67a 268
269 if (temp->GetType()==6){
54472e4f 270 temp->SetY(0);
271 }
49dfd67a 272
54472e4f 273 //temp->SetZ(z);
49dfd67a 274 if ((temp->GetType()==0 ||
275 temp->GetType()==4 || temp->GetType()==6) &&
276 temp->GetSide()==0) {
277 temp->SetZ(250);
278 }
279 if ((temp->GetType()==0 || temp->GetType()==4 ||
280 temp->GetType()==6) && temp->GetSide()==1){
281 temp->SetZ(-250);
282 }
283 if(temp->GetType()==2 && temp->GetSide()==0) {
284 temp->SetZ(52.4);
285 }
286 if(temp->GetType()==2 && temp->GetSide()==1) {
287 temp->SetZ(-52.4);
288 }
289
290 if(temp->GetType()==3 && temp->GetSide()==0) {
291 temp->SetZ(247);
54472e4f 292 }
49dfd67a 293 if(temp->GetType()==3 && temp->GetSide()==1) {
294 temp->SetZ(-247);
54472e4f 295 }
49dfd67a 296
297 if((temp->GetType()==1 ) && (num==0)) {
e4dce695 298 temp->SetZ(240);
54472e4f 299 }
49dfd67a 300 if((temp->GetType()==1 ) && (num==1)) {
e4dce695 301 temp->SetZ(168.4);
54472e4f 302 }
49dfd67a 303 if((temp->GetType()==1 ) && (num==2)) {
e4dce695 304 temp->SetZ(51);
54472e4f 305 }
49dfd67a 306 if((temp->GetType()==1 ) && (num==3)) {
e4dce695 307 temp->SetZ(-51);
54472e4f 308 }
49dfd67a 309 if((temp->GetType()==1 ) && (num==4)) {
e4dce695 310 temp->SetZ(-168.4);
54472e4f 311 }
49dfd67a 312 if((temp->GetType()==1 ) && (num==5)) {
e4dce695 313 temp->SetZ(-240);
54472e4f 314 }
49dfd67a 315
316 if(temp->GetType()==5 && temp->GetSide()==0) {
317 temp->SetZ(kTSz[num]);
318 }
319 if(temp->GetType()==5 && temp->GetSide()==1) {
320 temp->SetZ(-kTSz[num]);
321 }
322
323
54472e4f 324 }
325 delete tree;
326 return array;
327}