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