AliPhysics  a6017e1 (a6017e1)
TInfo.cxx
Go to the documentation of this file.
1 #include "TInfo.h"
2 #include <TDatime.h>
3 #include <TFile.h>
4 #include <TFile.h>
5 #include <TGrid.h>
6 #include <TH2F.h>
7 #include <TMap.h>
8 #include <TNtuple.h>
9 
11 {
12  Float_t min=1e9;
13  for (Int_t i=0;i<NSensors();++i) {
14  if (!IsValid(i))
15  continue;
16  Float_t val = T(i,type);
17  if (val<min)
18  min = val;
19  }
20  return min;
21 }
22 
24 {
25  Float_t max=-1e9;
26  for (Int_t i=0;i<NSensors();++i) {
27  if (!IsValid(i))
28  continue;
29  Float_t val = T(i,type);
30  if (val>max)
31  max = val;
32  }
33  return max;
34 }
35 
37 {
38  Int_t nActiveSensors = 8;
39  Double_t temp = 0;
40  for (Int_t i=sm*8;i<(sm+1)*8;++i) {
41  if (T(i,type) <= 15 || T(i,type) > 27 ) // take out sensors which are nonesense
42  nActiveSensors--;
43  else
44  temp += T(i,3);
45  }
46  if (nActiveSensors != 0)
47  temp /= nActiveSensors;
48  return temp;
49 }
50 
51 TH2 *TInfo::GetHist(Int_t type) const
52 {
53  TH2F *h = new TH2F(Form("h%dT%d_%s",fRunNo,type,Type(type)),";col;rows",8,-0.5,7.5,20,-0.5,19.5);
54  h->SetTitle(Form("%s for run %d (frac=%.1f%%, length=%.1fh)",Type(type),fRunNo,Fraction()*100,(fLastTime-fFirstTime)/3600.));
55  h->SetDirectory(0);
56  h->SetStats(0);
57  Double_t min=AbsMinT(type);
58  Double_t max=AbsMaxT(type);
59  h->SetMinimum(min);
60  h->SetMaximum(max);
61  for (Int_t i=0;i<NSensors();++i) {
62  if (!IsValid(i))
63  continue;
64  Double_t val = T(i,type);
65  Double_t bin = GetBin(i);
66  h->SetBinContent(bin,val);
67  }
68  return h;
69 }
70 
71 void TInfo::Print(Option_t *option) const
72 {
73  cout << "Runno: " << fRunNo << " with average time " << fAvTime << " and " << Nvalid() << " entries" << endl;
74  for (Int_t i=0;i<NSensors();++i) {
75  if (IsValid(i))
76  cout << " " << i << " avgT=" << fAvgT.At(i) << ", rmsT=" << fRmsT.At(i) << ", minT=" << fMinT.At(i) << ", maxT=" << fMaxT.At(i) << ", diff=" << Diff(i) << endl;
77  }
78 }
79 
80 Float_t TInfo::T(Int_t ns, Int_t type) const
81 {
82  Double_t val = 0;
83  if (type==1)
84  val = MinT(ns);
85  else if (type==2)
86  val = MaxT(ns);
87  else if (type==3)
88  val = AvgT(ns);
89  else if (type==4)
90  val = RmsT(ns);
91  else if (type==5)
92  val = (MinT(ns)+MaxT(ns))/2;
93  else
94  val = Diff(ns);
95  return val;
96 }
97 
98 /*static*/
100 {
101  static TH2F *h=0;
102  if (h==0) {
103  h = new TH2F("hdummy",";col;rows",8,-0.5,7.5,20,-0.5,19.5);
104  h->SetDirectory(0);
105  }
106 
107  switch (ns) {
108  case 0: return h->GetBin(1,19); break;
109  case 1: return h->GetBin(1,20); break;
110  case 2: return h->GetBin(2,19); break;
111  case 3: return h->GetBin(2,20); break;
112  case 4: return h->GetBin(3,19); break;
113  case 5: return h->GetBin(3,20); break;
114  case 6: return h->GetBin(4,19); break;
115  case 7: return h->GetBin(4,20); break;
116  case 8: return h->GetBin(8,20); break;
117  case 9: return h->GetBin(8,19); break;
118  case 10: return h->GetBin(7,20); break;
119  case 11: return h->GetBin(7,19); break;
120  case 12: return h->GetBin(6,20); break;
121  case 13: return h->GetBin(6,19); break;
122  case 14: return h->GetBin(5,20); break;
123  case 15: return h->GetBin(5,19); break;
124 
125  case 16: return h->GetBin(1,17); break;
126  case 17: return h->GetBin(1,18); break;
127  case 18: return h->GetBin(2,17); break;
128  case 19: return h->GetBin(2,18); break;
129  case 20: return h->GetBin(3,17); break;
130  case 21: return h->GetBin(3,18); break;
131  case 22: return h->GetBin(4,17); break;
132  case 23: return h->GetBin(4,18); break;
133  case 24: return h->GetBin(8,18); break;
134  case 25: return h->GetBin(8,17); break;
135  case 26: return h->GetBin(7,18); break;
136  case 27: return h->GetBin(7,17); break;
137  case 28: return h->GetBin(6,18); break;
138  case 29: return h->GetBin(6,17); break;
139  case 30: return h->GetBin(5,18); break;
140  case 31: return h->GetBin(5,17); break;
141 
142  case 32: return h->GetBin(1,15); break;
143  case 33: return h->GetBin(1,16); break;
144  case 34: return h->GetBin(2,15); break;
145  case 35: return h->GetBin(2,16); break;
146  case 36: return h->GetBin(3,15); break;
147  case 37: return h->GetBin(3,16); break;
148  case 38: return h->GetBin(4,15); break;
149  case 39: return h->GetBin(4,16); break;
150  case 40: return h->GetBin(8,16); break;
151  case 41: return h->GetBin(8,15); break;
152  case 42: return h->GetBin(7,16); break;
153  case 43: return h->GetBin(7,15); break;
154  case 44: return h->GetBin(6,16); break;
155  case 45: return h->GetBin(6,15); break;
156  case 46: return h->GetBin(5,16); break;
157  case 47: return h->GetBin(5,15); break;
158 
159  case 48: return h->GetBin(1,13); break;
160  case 49: return h->GetBin(1,14); break;
161  case 50: return h->GetBin(2,13); break;
162  case 51: return h->GetBin(2,14); break;
163  case 52: return h->GetBin(3,13); break;
164  case 53: return h->GetBin(3,14); break;
165  case 54: return h->GetBin(4,13); break;
166  case 55: return h->GetBin(4,14); break;
167  case 56: return h->GetBin(8,14); break;
168  case 57: return h->GetBin(8,13); break;
169  case 58: return h->GetBin(7,14); break;
170  case 59: return h->GetBin(7,13); break;
171  case 60: return h->GetBin(6,14); break;
172  case 61: return h->GetBin(6,13); break;
173  case 62: return h->GetBin(5,14); break;
174  case 63: return h->GetBin(5,13); break;
175 
176  case 64: return h->GetBin(1,11); break;
177  case 65: return h->GetBin(1,12); break;
178  case 66: return h->GetBin(2,11); break;
179  case 67: return h->GetBin(2,12); break;
180  case 68: return h->GetBin(3,11); break;
181  case 69: return h->GetBin(3,12); break;
182  case 70: return h->GetBin(4,11); break;
183  case 71: return h->GetBin(4,12); break;
184  case 72: return h->GetBin(8,12); break;
185  case 73: return h->GetBin(8,11); break;
186  case 74: return h->GetBin(7,12); break;
187  case 75: return h->GetBin(7,11); break;
188  case 76: return h->GetBin(6,12); break;
189  case 77: return h->GetBin(6,11); break;
190  case 78: return h->GetBin(5,12); break;
191  case 79: return h->GetBin(5,11); break;
192 
193  case 80: return h->GetBin(1,9); break;
194  case 81: return h->GetBin(1,10); break;
195  case 82: return h->GetBin(2,9); break;
196  case 83: return h->GetBin(2,10); break;
197  case 84: return h->GetBin(3,9); break;
198  case 85: return h->GetBin(3,10); break;
199  case 86: return h->GetBin(4,9); break;
200  case 87: return h->GetBin(4,10); break;
201  case 88: return h->GetBin(8,10); break;
202  case 89: return h->GetBin(8,9); break;
203  case 90: return h->GetBin(7,10); break;
204  case 91: return h->GetBin(7,9); break;
205  case 92: return h->GetBin(6,10); break;
206  case 93: return h->GetBin(6,9); break;
207  case 94: return h->GetBin(5,10); break;
208  case 95: return h->GetBin(5,9); break;
209 
210  case 96: return h->GetBin(1,7); break;
211  case 97: return h->GetBin(1,8); break;
212  case 98: return h->GetBin(2,7); break;
213  case 99: return h->GetBin(2,8); break;
214  case 100: return h->GetBin(3,7); break;
215  case 101: return h->GetBin(3,8); break;
216  case 102: return h->GetBin(4,7); break;
217  case 103: return h->GetBin(4,8); break;
218  case 104: return h->GetBin(8,8); break;
219  case 105: return h->GetBin(8,7); break;
220  case 106: return h->GetBin(7,8); break;
221  case 107: return h->GetBin(7,7); break;
222  case 108: return h->GetBin(6,8); break;
223  case 109: return h->GetBin(6,7); break;
224  case 110: return h->GetBin(5,8); break;
225  case 111: return h->GetBin(5,7); break;
226 
227  case 112: return h->GetBin(1,5); break;
228  case 113: return h->GetBin(1,6); break;
229  case 114: return h->GetBin(2,5); break;
230  case 115: return h->GetBin(2,6); break;
231  case 116: return h->GetBin(3,5); break;
232  case 117: return h->GetBin(3,6); break;
233  case 118: return h->GetBin(4,5); break;
234  case 119: return h->GetBin(4,6); break;
235  case 120: return h->GetBin(8,6); break;
236  case 121: return h->GetBin(8,5); break;
237  case 122: return h->GetBin(7,6); break;
238  case 123: return h->GetBin(7,5); break;
239  case 124: return h->GetBin(6,6); break;
240  case 125: return h->GetBin(6,5); break;
241  case 126: return h->GetBin(5,6); break;
242  case 127: return h->GetBin(5,5); break;
243 
244  case 128: return h->GetBin(1,3); break;
245  case 129: return h->GetBin(1,4); break;
246  case 130: return h->GetBin(2,3); break;
247  case 131: return h->GetBin(2,4); break;
248  case 132: return h->GetBin(3,3); break;
249  case 133: return h->GetBin(3,4); break;
250  case 134: return h->GetBin(4,3); break;
251  case 135: return h->GetBin(4,4); break;
252  case 136: return h->GetBin(8,4); break;
253  case 137: return h->GetBin(8,3); break;
254  case 138: return h->GetBin(7,4); break;
255  case 139: return h->GetBin(7,3); break;
256  case 140: return h->GetBin(6,4); break;
257  case 141: return h->GetBin(6,3); break;
258  case 142: return h->GetBin(5,4); break;
259  case 143: return h->GetBin(5,3); break;
260 
261  case 144: return h->GetBin(1,1); break;
262  case 145: return h->GetBin(1,2); break;
263  case 146: return h->GetBin(2,1); break;
264  case 147: return h->GetBin(2,2); break;
265  case 148: return h->GetBin(3,1); break;
266  case 149: return h->GetBin(3,2); break;
267  case 150: return h->GetBin(4,1); break;
268  case 151: return h->GetBin(4,2); break;
269  case 152: return h->GetBin(8,2); break;
270  case 153: return h->GetBin(8,1); break;
271  case 154: return h->GetBin(7,2); break;
272  case 155: return h->GetBin(7,1); break;
273  case 156: return h->GetBin(6,2); break;
274  case 157: return h->GetBin(6,1); break;
275  case 158: return h->GetBin(5,2); break;
276  case 159: return h->GetBin(5,1); break;
277  }
278  return 0;
279 }
280 
282 {
283  Int_t ret = 0;
284 
285  Int_t nrows=12;
286  Int_t ncols=12;
287  if (sm>11 && sm<18){
288  ncols=16;
289  }
290  if (sm==10||sm==11||sm==18||sm==19) {
291  ncols=24;
292  nrows=4;
293  }
294 
295  Bool_t oddsm = sm%2;
296  if (sm==11) {
297  ret = 91;
298  } else if (sm==19) {
299  ret = 155;
300  } else if (!oddsm) {
301  ret = sm*8;
302  } else {
303  ret = (sm+1)*8-1;
304  }
305 
306  if (!oddsm) {
307  Int_t x = col/ncols;
308  Int_t b = 0;
309  if (row<nrows)
310  b = 1;
311  ret += 2*x + b;
312  } else {
313  Int_t x = col/ncols;
314  Int_t b = 0;
315  if (row<nrows)
316  b = 1;
317  ret -= 2*x + b;
318  }
319 
320  return ret;
321 }
322 
323 const char *TInfo::Type(Int_t type)
324 {
325  TString title("MaxT-MinT");
326  if (type==1)
327  title="MinT";
328  else if (type==2)
329  title="MaxT";
330  else if (type==3)
331  title="AvgT";
332  else if (type==4)
333  title="RmsT";
334  else if (type==5)
335  title="AvgMinMaxT";
336  return Form("%s",title.Data());
337 }
Float_t Diff(Int_t ns) const
Definition: TInfo.h:20
TArrayF & MaxT()
Definition: TInfo.h:37
TArrayF fRmsT
Definition: TInfo.h:55
double Double_t
Definition: External.C:58
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
UInt_t fAvTime
Definition: TInfo.h:58
static Int_t NSensors()
Definition: TInfo.h:49
TArrayF fAvgT
Definition: TInfo.h:54
Float_t AbsMaxT(Int_t t=2) const
Definition: TInfo.cxx:23
static Int_t GetBin(Int_t ns)
Definition: TInfo.cxx:99
TArrayF & RmsT()
Definition: TInfo.h:40
Int_t fRunNo
Definition: TInfo.h:53
Int_t Nvalid() const
Definition: TInfo.h:38
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Bool_t IsValid(Int_t ns) const
Definition: TInfo.h:31
TArrayF fMaxT
Definition: TInfo.h:57
Float_t AvgTempSM(Int_t sm, Int_t type=3) const
Definition: TInfo.cxx:36
TH2 * GetHist(Int_t type=1) const
Definition: TInfo.cxx:51
void Print(Option_t *option="") const
Definition: TInfo.cxx:71
static Int_t SensId(Int_t sm, Int_t row, Int_t col)
Definition: TInfo.cxx:281
TArrayF & MinT()
Definition: TInfo.h:36
Definition: External.C:220
Float_t T(Int_t ns, Int_t t) const
Definition: TInfo.cxx:80
TArrayF fMinT
Definition: TInfo.h:56
UInt_t fFirstTime
Definition: TInfo.h:59
const char Option_t
Definition: External.C:48
Float_t AbsMinT(Int_t t=1) const
Definition: TInfo.cxx:10
Double_t Fraction() const
Definition: TInfo.h:29
bool Bool_t
Definition: External.C:53
static const char * Type(Int_t t)
Definition: TInfo.cxx:323
UInt_t fLastTime
Definition: TInfo.h:60
TArrayF & AvgT()
Definition: TInfo.h:16