]>
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 | /* | |
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" | |
38 | ClassImp(AliTPCSensorTemp); | |
39 | ||
40 | ||
41 | AliTPCSensorTemp::AliTPCSensorTemp(): AliDCSSensor(), | |
42 | fType(0), | |
43 | fSide(0), | |
44 | fSector(0), | |
45 | fNum(0) | |
46 | { | |
47 | // | |
48 | // Standard constructor | |
49 | // | |
50 | } | |
51 | ||
52 | AliTPCSensorTemp::AliTPCSensorTemp(const AliTPCSensorTemp& source) : | |
53 | AliDCSSensor(source), | |
54 | fType(source.fType), | |
55 | fSide(source.fSide), | |
56 | fSector(source.fSector), | |
57 | fNum(source.fNum) | |
58 | ||
59 | // | |
60 | // Copy constructor | |
61 | // | |
62 | { } | |
63 | ||
64 | AliTPCSensorTemp& AliTPCSensorTemp::operator=(const AliTPCSensorTemp& source){ | |
65 | // | |
66 | // assignment operator | |
67 | // | |
68 | if (&source == this) return *this; | |
69 | new (this) AliTPCSensorTemp(source); | |
70 | ||
71 | return *this; | |
72 | } | |
73 | ||
74 | TClonesArray * AliTPCSensorTemp::ReadList(const char *fname) { | |
75 | ||
76 | Int_t firstSensor, lastSensor; | |
77 | return ReadListInd(fname,firstSensor,lastSensor); | |
78 | } | |
79 | ||
80 | TClonesArray * AliTPCSensorTemp::ReadListInd(const char *fname, | |
81 | Int_t& firstSensor, | |
82 | Int_t& lastSensor ){ | |
83 | // | |
84 | // read values from ascii file | |
85 | // | |
86 | TTree * tree = new TTree("asci","asci"); | |
87 | tree->ReadFile(fname,""); | |
88 | ||
89 | Int_t nentries = tree->GetEntries(); | |
90 | Int_t sensor=0; | |
91 | Int_t sector=0; | |
92 | char type[100]; | |
93 | char side[100]; | |
94 | Int_t num=0; | |
95 | Int_t echa=0; | |
96 | //Double_t x=0; | |
97 | //Double_t y=0; | |
98 | //Double_t z=0; | |
99 | //String_t namedtp[100]; | |
100 | ||
101 | tree->SetBranchAddress("Sensor",&sensor); | |
102 | tree->SetBranchAddress("Type",&type); | |
103 | tree->SetBranchAddress("Side",&side); | |
104 | tree->SetBranchAddress("Sec",§or); | |
105 | tree->SetBranchAddress("Num",&num); | |
106 | tree->SetBranchAddress("ECha",&echa); | |
107 | //tree->SetBranchAddress("X",&x); | |
108 | //tree->SetBranchAddress("Y",&y); | |
109 | //tree->SetBranchAddress("Z",&z); | |
110 | ||
111 | firstSensor = (Int_t)tree->GetMinimum("ECha"); | |
112 | lastSensor = (Int_t)tree->GetMaximum("ECha"); | |
113 | ||
114 | TClonesArray * array = new TClonesArray("AliTPCSensorTemp",nentries); | |
115 | ||
116 | for (Int_t isensor=0; isensor<nentries; isensor++){ | |
117 | AliTPCSensorTemp * temp = new ((*array)[isensor])AliTPCSensorTemp; | |
118 | tree->GetEntry(isensor); | |
119 | temp->SetId(sensor); | |
120 | temp->SetIdDCS(echa); | |
121 | if (side[0]=='C') temp->SetSide(1); | |
122 | temp->SetSector(sector); | |
123 | temp->SetNum(num); | |
124 | //temp->SetType(type); | |
125 | if (bcmp(type,"ROC",3)==0) temp->SetType(0); | |
126 | if (bcmp(type,"OFC",3)==0) temp->SetType(1); | |
127 | if (bcmp(type,"IFC",3)==0) temp->SetType(2); | |
128 | if (bcmp(type,"TPC",3)==0) temp->SetType(3); | |
129 | if (bcmp(type,"ELM",3)==0) temp->SetType(4); | |
130 | if (bcmp(type,"TS",2)==0) temp->SetType(5); | |
131 | if (bcmp(type,"COOL",3)==0)temp->SetType(6); | |
132 | //temp->SetX(x); | |
133 | ||
134 | if (temp->GetType()==0){ | |
135 | temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30)); | |
136 | } | |
137 | if ((temp->GetType()==1) || (temp->GetType()==4)){ | |
138 | temp->SetX(TMath::Cos((2*sector+1)*0.1745)*260); | |
139 | } | |
140 | if ((temp->GetType()==2) || (temp->GetType()==3)){ | |
141 | temp->SetX(TMath::Cos((2*sector+1)*0.1745)*83); | |
142 | } | |
143 | if ((temp->GetType()==5) || (temp->GetType()==6)){ | |
144 | temp->SetX(0); | |
145 | } | |
146 | ||
147 | //temp->SetY(y); | |
148 | if (temp->GetType()==0){ | |
149 | temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30)); | |
150 | } | |
151 | if ((temp->GetType()==1) || (temp->GetType()==4)){ | |
152 | temp->SetY(TMath::Sin((2*sector+1)*0.1745)*260); | |
153 | } | |
154 | if ((temp->GetType()==2) || (temp->GetType()==3)){ | |
155 | temp->SetY(TMath::Sin((2*sector+1)*0.1745)*83); | |
156 | } | |
157 | if ((temp->GetType()==5) || (temp->GetType()==6)){ | |
158 | temp->SetY(0); | |
159 | } | |
160 | //temp->SetZ(z); | |
161 | if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==0) { | |
162 | temp->SetZ(260); | |
163 | } | |
164 | if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){ | |
165 | temp->SetZ(-260); | |
166 | } | |
167 | if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) { | |
168 | temp->SetZ(250); | |
169 | } | |
170 | if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) { | |
171 | temp->SetZ(180); | |
172 | } | |
173 | if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) { | |
174 | temp->SetZ(60); | |
175 | } | |
176 | if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) { | |
177 | temp->SetZ(-60); | |
178 | } | |
179 | if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) { | |
180 | temp->SetZ(-180); | |
181 | } | |
182 | if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) { | |
183 | temp->SetZ(-250); | |
184 | } | |
185 | Char_t chname[1000]; | |
186 | sprintf(chname,"tpc_temp:PT_%i.Temperature",echa); | |
187 | temp->SetName(chname); | |
188 | } | |
189 | delete tree; | |
190 | return array; | |
191 | } |