AliPhysics  5eaf189 (5eaf189)
scanTemp.C
Go to the documentation of this file.
1 void scanTemp(const char *fn = "2015/Run235840_235840_v1_s0.root",
2  const int kNumSens = 160, // active number of sensors
3  const int kNSM = 20)
4 {
5  TFile *file0 = TFile::Open(fn);
6  file0->ls();
7  AliCDBEntry->Print();
8  AliEMCALSensorTempArray *arr = AliCDBEntry->GetObject();
9  // arr->Print();
10  cout << " NumSensors " << arr->NumSensors()
11  << " GetFirstIdDCS() " << arr->GetFirstIdDCS()
12  << " GetLastIdDCS() " << arr->GetLastIdDCS()
13  << endl;
14  file0->Close();
15 
16  // info for each sensor
17  int np[kNumSens] = {0};
18  double min[kNumSens] = {0};
19  double max[kNumSens] = {0};
20  int id = 0;
21 
22  for (int isensor=0; isensor<kNumSens; isensor++) {
23  AliEMCALSensorTemp *o = arr->GetSensor(isensor);
24  if (o) {
25  id = o->GetIdDCS();
26  o->Print();
27  cout << " side " << o->GetSide()
28  << " sector " << o->GetSector()
29  << " num " << o->GetNum()
30  << " id " << id
31  << " startTime " << o->GetStartTime()
32  << " endTime " << o->GetEndTime()
33  << endl;
34  if (id >= kNumSens) {
35  cout << " exiting - invalid id " << id << endl;
36  exit();
37  }
38 
39  AliSplineFit *f = o->GetFit();
40  np[id] = 0;
41  min[id] = 100;
42  max[id] = 0;
43 
44  if (f) {
45  np[id] = f->GetKnots();
46  cout << " np " << np[id] << endl;
47  Double_t *x = f->GetX();
48  Double_t *y0 = f->GetY0();
49  Double_t *y1 = f->GetY1();
50  for (int i=0; i<np[id]; i++) {
51  cout << " i " << i
52  << " x " << x[i]
53  << " y0 " << y0[i]
54  << " y1 " << y1[i]
55  << endl;
56 
57  if (min[id]>y0[i]) min[id]=y0[i];
58  if (max[id]<y0[i]) max[id]=y0[i];
59  }
60  }
61  }
62  }
63 
64  for (int iSM=0; iSM<kNSM; iSM++) {
65  cout << " iSM " << iSM << endl;
66  double aveMin = 0;
67  double aveMax = 0;
68  int nOK = 0;
69  for (int is=0; is<8; is++) {
70  id = is + iSM*8;
71  printf("id %d np %d min %3.2f max %3.2f diff %3.2f\n",
72  id, np[id], min[id], max[id],
73  max[id] - min[id]);
74 
75  if (max[id] > 1) {
76  aveMin += min[id];
77  aveMax += max[id];
78  nOK++;
79  }
80  }
81 
82  if (nOK > 0) {
83  aveMin /= nOK;
84  aveMax /= nOK;
85  }
86  printf("iSM %d nOK %d average min %3.2f max %3.2f (max+min)/2 %3.2f\n",
87  iSM, nOK, aveMin, aveMax, (aveMin + aveMax)/2.);
88  }
89 
90 }
91 
double Double_t
Definition: External.C:58
const int kNumSens
Definition: scanAll.C:2
const int kNSM
Definition: plot.C:1
void scanTemp(const char *fn="2015/Run235840_235840_v1_s0.root", const int kNumSens=160, const int kNSM=20)
Definition: scanTemp.C:1