StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plBlue.C
1 class EEBlueLedBox;
2 EEBlueLedBox *led;
3 TFile *f;
4 TCanvas *c;
5 
6 //=============================================
7 //=============================================
8 
9 init() {
10  gStyle->SetPalette(1,0);
11  gSystem -> Load("../ezGames/EEBlueLedBox/libEEBlueLedBox.so");
12  led= new EEBlueLedBox();
13  // led->print();
14  f=new TFile("smdCal-Xm1.hist.root");
15 }
16 
17 //=============================================
18 plBlue(int iuv=0,int sect=1) {
19  gStyle->SetOptStat(11);
20  init();
21  //plBlue1(iuv, sect);
22  // plPre();
23 
24 }
25 //=============================================
26 plSmd() {
27  int iuv,sec=8;
28  for(sec=1;sec<=12;sec++)
29  for(iuv=0;iuv<2;iuv++){
30  plBlue1(iuv,sec);
31  c->Print();
32  }
33 }
34 
35 //=============================================
36 plPre(float zMax=15.) {
37  int sec=8;
38  c=new TCanvas("xy","xy",590,600);
39  for(sec=1;sec<=12;sec++) {
40  TString opt="col z";
41  // if(sec%2==0) opt="box";
42  if(sec>1) opt="col same";
43 
44  char txt[100];
45  sprintf(txt,"xy%02d",sec);
46  printf("=%s=%s\n",txt,opt.Data());
47  TH2F *h=(TH2F *)f->Get(txt);
48  assert(h);
49  h->Draw(opt.Data());
50  h->SetMaximum(zMax);
51  if(sec==1) { h->SetStats(0); h->SetTitle("MIP position, UxV only");}
52  }
53  gPad->SetGrid();
54 }
55 
56 //=============================================
57 plBlue1(int iuv=0,int sect=1) {
58  char txt[100];
59  sprintf(txt,"fr%02d%c",sect,iuv+'U');
60  printf("=%s=\n",txt);
61  TH1F *h0=f->Get(txt);
62  assert(h0);
63  c=new TCanvas(txt,txt,600,700);
64  c->Divide(1,4);
65 
66  h0->SetFillColor(kGreen);
67  int i;
68  for(i=1;i<=4;i++) {
69  c->cd(i);
70  h=(TH1F*) h0->Clone();
71  // h->SetMaximum(ym);
72  h->Draw("b");
73  h0->Draw("same e");
74  h->SetAxisRange((i-1)*80,i*80);
75  float ym=h->GetMaximum();
76  gPad->SetLogy();
77  // fr05U->Draw();
78  plotLed(iuv,ym*.8);
79  }
80  TString Txt=txt;
81  // c->Print(Txt+".gif");
82 
83 }
84 
85 //=============================================
86 //=============================================
87 
88 plotLed(int iuv=0,float ym) {
89  int colA[]={kBlack,kRed,kBlue,kMagenta};
90 
91  Int_t board = 0;
92 
93  Int_t iplane =iuv;
94  int totStrip=0;
95 
96  for ( Int_t board = 0; board < 8; board++ ) {
97 
98  TObjArray fibers = led->getFibersToSmdPlane( board, iplane );
99  std::cout << "Strips illuminated by LED board " << board+1 << std::endl;
100  // Loop over all fibers and draw a box where we "expect"
101  // a signal from the LED's.
102  for ( Int_t ifiber = 0; ifiber < fibers.GetEntries(); ifiber++ ) {
103 
104  EEBlueLedFiber *fiber = (EEBlueLedFiber *)fibers[ifiber];
105  std::cout << "min strip = " << fiber->getMinStrip() << " "
106  << "max strip = " << fiber->getMaxStrip() << " "
107  << "led board = " << fiber->getLedBoard() << " "
108  << "led fiber = " << fiber->getLedFiber() << " "
109  <<std::endl;
110 
111  totStrip+=1+fiber->getMaxStrip()-fiber->getMinStrip();
112  float y1=0.1,y2=log(ym)/2.;
113  float x1=fiber->getMinStrip()-0.4;
114  float x2=fiber->getMaxStrip()+0.4;
115 
116  TBox *box = new TBox(x1,y1,x2,y2);
117  int col=colA[board%4];
118  box -> SetLineColor(col);
119  box -> SetFillStyle(0); // 75% transparent
120  // box -> SetFillColor(2);
121 
122  box -> Draw();
123  char txt[100];
124  sprintf(txt,"br=%d fb=%d", fiber->getLedBoard(),fiber->getLedFiber() );
125  tt=new TText(x1+1.,y2*1.01,txt);
126  // tt->Draw();
127 
128  }// end of one beoard
129  }// endo fo loop over boards
130  cout <<" totStrip="<<totStrip<<endl;
131 }