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