]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TPC/AliTPCSensorTemp.cxx
Adding possibility to get the Reconstruction parameters from OCDB (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCSensorTemp.cxx
... / ...
CommitLineData
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
36
37#include "AliTPCSensorTemp.h"
38ClassImp(AliTPCSensorTemp)
39
40
41
42const Float_t kASideX[18][5]={
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}};
61
62const Float_t kASideY[18][5]={
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},
67 {101.1, 119.4, 163.3, 189.8, 216.4},
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}};
81
82const Float_t kCSideX[18][5]={
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}};
101
102const Float_t kCSideY[18][5]={
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},
107 {101.1, 119.4, 163.3, 189.8, 216.4},
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},
116 {-101.1, -119.4, -163.3, -189.8, -216.4},
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}};
121
122const Float_t kIFCrad[5] = {67.2, 64.4, 60.7, 64.4, 67.2};
123
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};
126
127//______________________________________________________________________________________________
128
129AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
130 fType(0),
131 fSide(0),
132 fSector(0),
133 fNum(0)
134{
135 //
136 // Standard constructor
137 //
138}
139//______________________________________________________________________________________________
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{ }
152//______________________________________________________________________________________________
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}
163//______________________________________________________________________________________________
164
165TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) {
166 //
167 // read values from ascii file
168 //
169 TTree * tree = new TTree("asci","asci");
170 tree->ReadFile(fname,"");
171 TClonesArray *arr = ReadTree(tree);
172 delete tree;
173 return arr;
174}
175
176//______________________________________________________________________________________________
177
178TClonesArray * AliTPCSensorTemp::ReadTree(TTree *tree,
179 const TString& amandaString) {
180
181 Int_t nentries = tree->GetEntries();
182 Int_t sensor=0;
183 Int_t sector=0;
184 char type[100];
185 char side[100];
186 Int_t num=0;
187 Int_t echa=0;
188 //Double_t x=0;
189 //Double_t y=0;
190 //Double_t z=0;
191 //String_t namedtp[100];
192
193 tree->SetBranchAddress("Sensor",&sensor);
194 tree->SetBranchAddress("Type",&type);
195 tree->SetBranchAddress("Side",&side);
196 tree->SetBranchAddress("Sec",&sector);
197 tree->SetBranchAddress("Num",&num);
198 tree->SetBranchAddress("ECha",&echa);
199 //tree->SetBranchAddress("X",&x);
200 //tree->SetBranchAddress("Y",&y);
201 //tree->SetBranchAddress("Z",&z);
202
203 // firstSensor = (Int_t)tree->GetMinimum("ECha");
204 // lastSensor = (Int_t)tree->GetMaximum("ECha");
205
206 TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries);
207
208 for (Int_t isensor=0; isensor<nentries; isensor++){
209 AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp;
210 tree->GetEntry(isensor);
211 temp->SetId(sensor);
212 temp->SetIdDCS(echa);
213 TString stringID = Form (amandaString.Data(),echa);
214 temp->SetStringID(stringID);
215 if (side[0]=='C') temp->SetSide(1);
216 temp->SetSector(sector);
217 temp->SetNum(num);
218 //temp->SetType(type);
219 if (bcmp(type,"ROC",3)==0) temp->SetType(0);
220 if (bcmp(type,"OFC",3)==0) temp->SetType(1);
221 if (bcmp(type,"IFC",3)==0) temp->SetType(2);
222 if (bcmp(type,"TPC",3)==0) temp->SetType(3);
223 if (bcmp(type,"ELM",3)==0) temp->SetType(4);
224 if (bcmp(type,"TS",2)==0) temp->SetType(5);
225 if (bcmp(type,"COOL",3)==0)temp->SetType(6);
226 //temp->SetX(x);
227
228 if (temp->GetType()==0){
229// temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
230 if (side[0]=='C') {
231 temp->SetX(kCSideX[sector][num]);
232 } else {
233 temp->SetX(kASideX[sector][num]);
234 }
235 }
236 if ((temp->GetType()==1) || (temp->GetType()==4)){
237 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
238 }
239 if (temp->GetType()==2) {
240 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*60.7);
241 }
242 if (temp->GetType()==3) {
243 if (num==0) {
244 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*87.5);
245 } else {
246 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*241.8);
247 }
248 }
249 if (temp->GetType()==5){
250 temp->SetX(TMath::Cos(sector*0.524+(num+1)*0.131)*kTSrad[num]);
251 }
252 if (temp->GetType()==6){
253 temp->SetX(0);
254 }
255
256 //temp->SetY(y);
257 if (temp->GetType()==0){
258// temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
259 if (side[0]=='C') {
260 temp->SetY(kCSideY[sector][num]);
261 } else {
262 temp->SetY(kASideY[sector][num]);
263 }
264 }
265 if ((temp->GetType()==1) || (temp->GetType()==4)){
266 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
267 }
268 if (temp->GetType()==2){
269 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*60.7);
270 }
271 if (temp->GetType()==3) {
272 if (num==0) {
273 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*87.5);
274 } else {
275 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*241.8);
276 }
277 }
278
279 if (temp->GetType()==5){
280 temp->SetY(TMath::Sin(sector*0.524+(num+1)*0.131)*kTSrad[num]);
281 }
282
283 if (temp->GetType()==6){
284 temp->SetY(0);
285 }
286
287 //temp->SetZ(z);
288 if ((temp->GetType()==0 ||
289 temp->GetType()==4 || temp->GetType()==6) &&
290 temp->GetSide()==0) {
291 temp->SetZ(250);
292 }
293 if ((temp->GetType()==0 || temp->GetType()==4 ||
294 temp->GetType()==6) && temp->GetSide()==1){
295 temp->SetZ(-250);
296 }
297 if(temp->GetType()==2 && temp->GetSide()==0) {
298 temp->SetZ(52.4);
299 }
300 if(temp->GetType()==2 && temp->GetSide()==1) {
301 temp->SetZ(-52.4);
302 }
303
304 if(temp->GetType()==3 && temp->GetSide()==0) {
305 temp->SetZ(247);
306 }
307 if(temp->GetType()==3 && temp->GetSide()==1) {
308 temp->SetZ(-247);
309 }
310
311 if((temp->GetType()==1 ) && (num==0)) {
312 temp->SetZ(240);
313 }
314 if((temp->GetType()==1 ) && (num==1)) {
315 temp->SetZ(168.4);
316 }
317 if((temp->GetType()==1 ) && (num==2)) {
318 temp->SetZ(51);
319 }
320 if((temp->GetType()==1 ) && (num==3)) {
321 temp->SetZ(-51);
322 }
323 if((temp->GetType()==1 ) && (num==4)) {
324 temp->SetZ(-168.4);
325 }
326 if((temp->GetType()==1 ) && (num==5)) {
327 temp->SetZ(-240);
328 }
329
330 if(temp->GetType()==5 && temp->GetSide()==0) {
331 temp->SetZ(kTSz[num]);
332 }
333 if(temp->GetType()==5 && temp->GetSide()==1) {
334 temp->SetZ(-kTSz[num]);
335 }
336
337
338 }
339 return array;
340}