Line data Source code
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 : /// \class AliTPCSensorTemp
18 : /// \brief Class describing TPC temperature sensors (including pointers to graphs/fits
19 : ///
20 : /// \author Marian Ivanov, Haavard Helstrup and Martin Siska
21 :
22 : // Running instructions:
23 : /*
24 : TClonesArray * arr = AliTPCSensorTemp::ReadList("TempSensor.txt","tpc_PT_%d.Temperature");
25 : TFile f("TempSensors.root","RECREATE");
26 : TTree * tree = new TTree("TempSensor", "TempSensor");
27 : tree->Branch("Temp",&arr);
28 : tree->Fill();
29 : tree->Write();
30 :
31 : */
32 :
33 : //
34 :
35 : #include <strings.h>
36 : #include "AliTPCSensorTemp.h"
37 : /// \cond CLASSIMP
38 24 : ClassImp(AliTPCSensorTemp)
39 : /// \endcond
40 :
41 :
42 :
43 : const Float_t kASideX[18][5]={
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}};
62 :
63 : const Float_t kASideY[18][5]={
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},
68 : {101.1, 119.4, 163.3, 189.8, 216.4},
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},
77 : {-101.1, -119.4, -163.3, -189.8, -216.4},
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}};
82 :
83 : const Float_t kCSideX[18][5]={
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}};
102 :
103 : const Float_t kCSideY[18][5]={
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},
108 : {101.1, 119.4, 163.3, 189.8, 216.4},
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},
117 : {-101.1, -119.4, -163.3, -189.8, -216.4},
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}};
122 :
123 : const Float_t kIFCrad[5] = {67.2, 64.4, 60.7, 64.4, 67.2};
124 :
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};
127 :
128 : //______________________________________________________________________________________________
129 :
130 1233 : AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(),
131 1233 : fType(0),
132 1233 : fSide(0),
133 1233 : fSector(0),
134 1233 : fNum(0)
135 6165 : {
136 : /// Standard constructor
137 :
138 2466 : }
139 : //______________________________________________________________________________________________
140 :
141 : AliTPCSensorTemp::AliTPCSensorTemp(const AliTPCSensorTemp& source) :
142 0 : AliDCSSensor(source),
143 0 : fType(source.fType),
144 0 : fSide(source.fSide),
145 0 : fSector(source.fSector),
146 0 : fNum(source.fNum)
147 :
148 : //
149 : // Copy constructor
150 : //
151 0 : { }
152 : //______________________________________________________________________________________________
153 :
154 : AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){
155 : /// assignment operator
156 :
157 0 : if (&source == this) return *this;
158 0 : new (this) AliTPCSensorTemp(source);
159 :
160 0 : return *this;
161 0 : }
162 : //______________________________________________________________________________________________
163 :
164 : TClonesArray * AliTPCSensorTemp::ReadList(const char *fname,
165 : const TString& amandaString) {
166 : /// read values from ascii file
167 :
168 0 : TTree * tree = new TTree("asci","asci");
169 0 : tree->ReadFile(fname,"");
170 0 : TClonesArray *arr = ReadTree(tree, amandaString);
171 0 : delete tree;
172 0 : return arr;
173 0 : }
174 :
175 : //______________________________________________________________________________________________
176 :
177 : TClonesArray * AliTPCSensorTemp::ReadTree(TTree *tree,
178 : const TString& amandaString) {
179 :
180 0 : Int_t nentries = tree->GetEntries();
181 0 : Int_t sensor=0;
182 0 : Int_t sector=0;
183 0 : char type[100];
184 0 : char side[100];
185 0 : Int_t num=0;
186 0 : 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 0 : tree->SetBranchAddress("Sensor",&sensor);
193 0 : tree->SetBranchAddress("Type",&type);
194 0 : tree->SetBranchAddress("Side",&side);
195 0 : tree->SetBranchAddress("Sec",§or);
196 0 : tree->SetBranchAddress("Num",&num);
197 0 : tree->SetBranchAddress("ECha",&echa);
198 : //tree->SetBranchAddress("X",&x);
199 : //tree->SetBranchAddress("Y",&y);
200 : //tree->SetBranchAddress("Z",&z);
201 :
202 : // firstSensor = (Int_t)tree->GetMinimum("ECha");
203 : // lastSensor = (Int_t)tree->GetMaximum("ECha");
204 :
205 0 : TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries);
206 :
207 0 : for (Int_t isensor=0; isensor<nentries; isensor++){
208 0 : AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp;
209 0 : tree->GetEntry(isensor);
210 0 : temp->SetId(sensor);
211 0 : temp->SetIdDCS(echa);
212 0 : TString stringID = Form (amandaString.Data(),echa);
213 0 : temp->SetStringID(stringID);
214 0 : if (side[0]=='C') temp->SetSide(1);
215 0 : temp->SetSector(sector);
216 0 : temp->SetNum(num);
217 : //temp->SetType(type);
218 0 : if (bcmp(type,"ROC",3)==0) temp->SetType(0);
219 0 : if (bcmp(type,"OFC",3)==0) temp->SetType(1);
220 0 : if (bcmp(type,"IFC",3)==0) temp->SetType(2);
221 0 : if (bcmp(type,"TPC",3)==0) temp->SetType(3);
222 0 : if (bcmp(type,"ELM",3)==0) temp->SetType(4);
223 0 : if (bcmp(type,"TS",2)==0) temp->SetType(5);
224 0 : if (bcmp(type,"COOL",3)==0)temp->SetType(6);
225 : //temp->SetX(x);
226 :
227 0 : if (temp->GetType()==0){
228 : // temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
229 0 : if (side[0]=='C') {
230 0 : temp->SetX(kCSideX[sector][num]);
231 0 : } else {
232 0 : temp->SetX(kASideX[sector][num]);
233 : }
234 : }
235 0 : if ((temp->GetType()==1) || (temp->GetType()==4)){
236 0 : temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
237 0 : }
238 0 : if (temp->GetType()==2) {
239 0 : temp->SetX(TMath::Cos((2*sector+1)*0.1745)*60.7);
240 0 : }
241 0 : if (temp->GetType()==3) {
242 0 : if (num==0) {
243 0 : temp->SetX(TMath::Cos((2*sector+1)*0.1745)*87.5);
244 0 : } else {
245 0 : temp->SetX(TMath::Cos((2*sector+1)*0.1745)*241.8);
246 : }
247 : }
248 0 : if (temp->GetType()==5){
249 0 : temp->SetX(TMath::Cos(sector*0.524+(num+1)*0.131)*kTSrad[num]);
250 0 : }
251 0 : if (temp->GetType()==6){
252 0 : temp->SetX(0);
253 0 : }
254 :
255 : //temp->SetY(y);
256 0 : if (temp->GetType()==0){
257 : // temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
258 0 : if (side[0]=='C') {
259 0 : temp->SetY(kCSideY[sector][num]);
260 0 : } else {
261 0 : temp->SetY(kASideY[sector][num]);
262 : }
263 : }
264 0 : if ((temp->GetType()==1) || (temp->GetType()==4)){
265 0 : temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
266 0 : }
267 0 : if (temp->GetType()==2){
268 0 : temp->SetY(TMath::Sin((2*sector+1)*0.1745)*60.7);
269 0 : }
270 0 : if (temp->GetType()==3) {
271 0 : if (num==0) {
272 0 : temp->SetY(TMath::Sin((2*sector+1)*0.1745)*87.5);
273 0 : } else {
274 0 : temp->SetY(TMath::Sin((2*sector+1)*0.1745)*241.8);
275 : }
276 : }
277 :
278 0 : if (temp->GetType()==5){
279 0 : temp->SetY(TMath::Sin(sector*0.524+(num+1)*0.131)*kTSrad[num]);
280 0 : }
281 :
282 0 : if (temp->GetType()==6){
283 0 : temp->SetY(0);
284 0 : }
285 :
286 : //temp->SetZ(z);
287 0 : if ((temp->GetType()==0 ||
288 0 : temp->GetType()==4 || temp->GetType()==6) &&
289 0 : temp->GetSide()==0) {
290 0 : temp->SetZ(250);
291 0 : }
292 0 : if ((temp->GetType()==0 || temp->GetType()==4 ||
293 0 : temp->GetType()==6) && temp->GetSide()==1){
294 0 : temp->SetZ(-250);
295 0 : }
296 0 : if(temp->GetType()==2 && temp->GetSide()==0) {
297 0 : temp->SetZ(52.4);
298 0 : }
299 0 : if(temp->GetType()==2 && temp->GetSide()==1) {
300 0 : temp->SetZ(-52.4);
301 0 : }
302 :
303 0 : if(temp->GetType()==3 && temp->GetSide()==0) {
304 0 : temp->SetZ(247);
305 0 : }
306 0 : if(temp->GetType()==3 && temp->GetSide()==1) {
307 0 : temp->SetZ(-247);
308 0 : }
309 :
310 0 : if((temp->GetType()==1 ) && (num==0)) {
311 0 : temp->SetZ(240);
312 0 : }
313 0 : if((temp->GetType()==1 ) && (num==1)) {
314 0 : temp->SetZ(168.4);
315 0 : }
316 0 : if((temp->GetType()==1 ) && (num==2)) {
317 0 : temp->SetZ(51);
318 0 : }
319 0 : if((temp->GetType()==1 ) && (num==3)) {
320 0 : temp->SetZ(-51);
321 0 : }
322 0 : if((temp->GetType()==1 ) && (num==4)) {
323 0 : temp->SetZ(-168.4);
324 0 : }
325 0 : if((temp->GetType()==1 ) && (num==5)) {
326 0 : temp->SetZ(-240);
327 0 : }
328 :
329 0 : if ( num < (Int_t)(sizeof(kTSz)/sizeof(kTSz[0]))) {
330 0 : if(temp->GetType()==5 && temp->GetSide()==0) {
331 0 : temp->SetZ(kTSz[num]);
332 0 : }
333 0 : if(temp->GetType()==5 && temp->GetSide()==1) {
334 0 : temp->SetZ(-kTSz[num]);
335 0 : }
336 : }
337 :
338 0 : }
339 0 : return array;
340 0 : }
|