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