Extra semilon removed
[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
76e459d6 36#include <strings.h>
54472e4f 37#include "AliTPCSensorTemp.h"
ee256dfd 38ClassImp(AliTPCSensorTemp)
54472e4f 39
40
e4dce695 41const Float_t kASideX[18][5]={
42 { 99.6, 117.7, 161.2, 187.3, 213.5},
43 { 87.6, 103.7, 142.6, 165.6, 188.6},
44 { 65.0, 77.3, 106.8, 123.8, 140.9},
45 { 34.6, 41.5, 58.1, 67.2, 76.3},
46 { 0, 0.7, 2.4, 2.4, 2.4},
47 {-34.6, -40.2, -53.6, -62.7, -71.7},
48 {-65.0, -76.2, -103.1, -120.2, -137.2},
49 {-87.6, -103.1, -140.2, -163.2, -186.2},
50 {-99.6, -117.5, -160.4, -186.5, -212.6},
51 {-99.6, -117.7, -161.2, -187.3, -213.5},
52 {-87.6, -103.7, -142.6, -165.6, -188.6},
53 {-65.0, -77.3, -106.8, -123.8, -140.9},
54 {-34.6, -41.5, -58.1, -67.2, -76.3},
55 { 0, -0.7, -2.4, -2.4, -2.4},
56 { 34.6, 40.2, 53.6, 62.7, 71.7},
57 { 65.0, 76.2, 103.1, 120.2, 137.2},
58 { 87.6, 103.1, 140.2, 163.2, 186.2},
59 { 99.6, 117.5, 160.4, 186.5, 212.6}};
60
61const Float_t kASideY[18][5]={
62 { 17.6, 20.1, 26.0, 30.6, 35.2},
63 { 50.6, 59.1, 79.5, 92.8, 106.1},
64 { 77.4, 91.0, 123.5, 143.9, 164.2},
65 { 95.0, 112.0, 152.6, 177.5, 202.5},
66 {101.1, 119.4, 163.3, 189.8, 216.4},
67 { 95.0, 112.4, 154.2, 179.2, 204.1},
68 { 77.4, 91.9, 126.6, 146.9, 167.3},
69 { 50.6, 60.3, 83.7, 97.0, 110.3},
70 { 17.6, 21.4, 30.7, 35.3, 39.9},
71 {-17.6, -20.1, -26.0, -30.6, -35.2},
72 {-50.6, -59.1, -79.5, -92.8, -106.1},
73 {-77.4, -91.0, -123.5, -143.9, -164.2},
74 {-95.0, -112.0, -152.6, -177.5, -202.5},
75 {-101.1, -119.4, -163.3, -189.8, -216.4},
76 {-95.0, -112.4, -154.2, -179.2, -204.1},
77 {-77.4, -91.9, -126.6, -146.9, -167.3},
78 {-50.6, -60.3, -83.7, -97.0, -110.3},
79 {-17.6, -21.4, -30.7, -35.3, -39.9}};
80
81const Float_t kCSideX[18][5]={
82 { 99.6, 117.5, 160.4, 186.5, 212.6},
83 { 87.6, 103.1, 140.2, 163.2, 186.2},
84 { 65.0, 76.2, 103.1, 120.2, 137.2},
85 { 34.6, 40.2, 53.6, 62.7, 71.7},
86 { 0, -0.7, -2.4, -2.4, -2.4},
87 {-34.6, -41.5, -58.1, -67.2, -76.3},
88 {-65.0, -77.3, -106.8, -123.8, -140.9},
89 {-87.6, -103.7, -142.6, -165.6, -188.6},
90 {-99.6, -117.7, -161.2, -187.3, -213.5},
91 {-99.6, -117.5, -160.4, -186.5, -212.6},
92 {-87.6, -103.1, -140.2, -163.2, -186.2},
93 {-65.0, -76.2, -103.1, -120.2, -137.2},
94 {-34.6, -40.2, -53.6, -62.7, -71.7},
95 { 0, 0.7, 2.4, 2.4, 2.4},
96 { 34.6, 41.5, 58.1, 67.2, 76.3},
97 { 65.0, 77.3, 106.8, 123.8, 140.9},
98 { 87.6, 103.7, 142.6, 165.6, 188.6},
99 { 99.6, 117.7, 161.2, 187.3, 213.5}};
100
101const Float_t kCSideY[18][5]={
102 { 17.6, 21.4, 30.7, 35.3, 39.9},
103 { 50.6, 60.3, 83.7, 97.0, 110.3},
104 { 77.4, 91.9, 126.6, 146.9, 167.3},
105 { 95.0, 112.4, 154.2, 179.2, 204.1},
106 {101.1, 119.4, 163.3, 189.8, 216.4},
107 { 95.0, 112.0, 152.6, 177.5, 202.5},
108 { 77.4, 91.0, 123.5, 143.9, 164.2},
109 { 50.6, 59.1, 79.5, 92.8, 106.1},
110 { 17.6, 20.1, 26.0, 30.6, 35.2},
111 {-17.6, -21.4, -30.7, -35.3, -39.9},
112 {-50.6, -60.3, -83.7, -97.0, -110.3},
113 {-77.4, -91.9, -126.6, -146.9, -167.3},
114 {-95.0, -112.4, -154.2, -179.2, -204.1},
115 {-101.1, -119.4, -163.3, -189.8, -216.4},
116 {-95.0, -112.0, -152.6, -177.5, -202.5},
117 {-77.4, -91.0, -123.5, -143.9, -164.2},
118 {-50.6, -59.1, -79.5, -92.8, -106.1},
119 {-17.6, -20.1, -26.0, -30.6, -35.2}};
120
121const Float_t kIFCrad[5] = {67.2, 64.4, 60.7, 64.4, 67.2};
122
123
124
54472e4f 125AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
126 fType(0),
127 fSide(0),
128 fSector(0),
129 fNum(0)
130{
131 //
132 // Standard constructor
133 //
134}
135
136AliTPCSensorTemp::AliTPCSensorTemp(const AliTPCSensorTemp& source) :
137 AliDCSSensor(source),
138 fType(source.fType),
139 fSide(source.fSide),
140 fSector(source.fSector),
141 fNum(source.fNum)
142
143//
144// Copy constructor
145//
146{ }
147
148AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){
149//
150// assignment operator
151//
152 if (&source == this) return *this;
153 new (this) AliTPCSensorTemp(source);
154
155 return *this;
156}
157
158TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) {
159
160 Int_t firstSensor, lastSensor;
161 return ReadListInd(fname,firstSensor,lastSensor);
162}
163
164TClonesArray * AliTPCSensorTemp::ReadListInd(const char *fname,
165 Int_t& firstSensor,
ffa7e8be 166 Int_t& lastSensor) {
54472e4f 167 //
168 // read values from ascii file
169 //
170 TTree * tree = new TTree("asci","asci");
171 tree->ReadFile(fname,"");
172
173 Int_t nentries = tree->GetEntries();
174 Int_t sensor=0;
175 Int_t sector=0;
176 char type[100];
177 char side[100];
178 Int_t num=0;
179 Int_t echa=0;
180 //Double_t x=0;
181 //Double_t y=0;
182 //Double_t z=0;
183 //String_t namedtp[100];
184
185 tree->SetBranchAddress("Sensor",&sensor);
186 tree->SetBranchAddress("Type",&type);
187 tree->SetBranchAddress("Side",&side);
188 tree->SetBranchAddress("Sec",&sector);
189 tree->SetBranchAddress("Num",&num);
190 tree->SetBranchAddress("ECha",&echa);
191 //tree->SetBranchAddress("X",&x);
192 //tree->SetBranchAddress("Y",&y);
193 //tree->SetBranchAddress("Z",&z);
194
195 firstSensor = (Int_t)tree->GetMinimum("ECha");
196 lastSensor = (Int_t)tree->GetMaximum("ECha");
197
198 TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries);
199
200 for (Int_t isensor=0; isensor<nentries; isensor++){
201 AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp;
202 tree->GetEntry(isensor);
203 temp->SetId(sensor);
204 temp->SetIdDCS(echa);
205 if (side[0]=='C') temp->SetSide(1);
206 temp->SetSector(sector);
207 temp->SetNum(num);
208 //temp->SetType(type);
209 if (bcmp(type,"ROC",3)==0) temp->SetType(0);
210 if (bcmp(type,"OFC",3)==0) temp->SetType(1);
211 if (bcmp(type,"IFC",3)==0) temp->SetType(2);
212 if (bcmp(type,"TPC",3)==0) temp->SetType(3);
213 if (bcmp(type,"ELM",3)==0) temp->SetType(4);
214 if (bcmp(type,"TS",2)==0) temp->SetType(5);
215 if (bcmp(type,"COOL",3)==0)temp->SetType(6);
216 //temp->SetX(x);
217
218 if (temp->GetType()==0){
e4dce695 219// temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
220 if (side[0]=='C') {
221 temp->SetX(kCSideX[sector][num]);
222 } else {
223 temp->SetX(kASideX[sector][num]);
224 }
54472e4f 225 }
226 if ((temp->GetType()==1) || (temp->GetType()==4)){
e4dce695 227 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
54472e4f 228 }
229 if ((temp->GetType()==2) || (temp->GetType()==3)){
e4dce695 230 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*kIFCrad[num]);
54472e4f 231 }
232 if ((temp->GetType()==5) || (temp->GetType()==6)){
233 temp->SetX(0);
234 }
235
236 //temp->SetY(y);
237 if (temp->GetType()==0){
e4dce695 238// temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
239 if (side[0]=='C') {
240 temp->SetY(kCSideY[sector][num]);
241 } else {
242 temp->SetY(kASideY[sector][num]);
243 }
54472e4f 244 }
245 if ((temp->GetType()==1) || (temp->GetType()==4)){
e4dce695 246 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
54472e4f 247 }
248 if ((temp->GetType()==2) || (temp->GetType()==3)){
e4dce695 249 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*kIFCrad[num]);
54472e4f 250 }
251 if ((temp->GetType()==5) || (temp->GetType()==6)){
252 temp->SetY(0);
253 }
254 //temp->SetZ(z);
255 if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==0) {
e4dce695 256 temp->SetZ(250);
54472e4f 257 }
258 if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){
e4dce695 259 temp->SetZ(-250);
54472e4f 260 }
261 if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) {
e4dce695 262 temp->SetZ(240);
54472e4f 263 }
264 if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) {
e4dce695 265 temp->SetZ(168.4);
54472e4f 266 }
267 if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) {
e4dce695 268 temp->SetZ(51);
54472e4f 269 }
270 if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) {
e4dce695 271 temp->SetZ(-51);
54472e4f 272 }
273 if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) {
e4dce695 274 temp->SetZ(-168.4);
54472e4f 275 }
276 if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) {
e4dce695 277 temp->SetZ(-240);
54472e4f 278 }
54472e4f 279 }
280 delete tree;
281 return array;
282}