00001 class EEBlueLedBox;
00002 EEBlueLedBox *led;
00003 TFile *f;
00004 TCanvas *c;
00005
00006
00007
00008
00009 init() {
00010 gStyle->SetPalette(1,0);
00011 gSystem -> Load("../ezGames/EEBlueLedBox/libEEBlueLedBox.so");
00012 led= new EEBlueLedBox();
00013
00014 f=new TFile("smdCal-Xm1.hist.root");
00015 }
00016
00017
00018 plBlue(int iuv=0,int sect=1) {
00019 gStyle->SetOptStat(11);
00020 init();
00021
00022
00023
00024 }
00025
00026 plSmd() {
00027 int iuv,sec=8;
00028 for(sec=1;sec<=12;sec++)
00029 for(iuv=0;iuv<2;iuv++){
00030 plBlue1(iuv,sec);
00031 c->Print();
00032 }
00033 }
00034
00035
00036 plPre(float zMax=15.) {
00037 int sec=8;
00038 c=new TCanvas("xy","xy",590,600);
00039 for(sec=1;sec<=12;sec++) {
00040 TString opt="col z";
00041
00042 if(sec>1) opt="col same";
00043
00044 char txt[100];
00045 sprintf(txt,"xy%02d",sec);
00046 printf("=%s=%s\n",txt,opt.Data());
00047 TH2F *h=(TH2F *)f->Get(txt);
00048 assert(h);
00049 h->Draw(opt.Data());
00050 h->SetMaximum(zMax);
00051 if(sec==1) { h->SetStats(0); h->SetTitle("MIP position, UxV only");}
00052 }
00053 gPad->SetGrid();
00054 }
00055
00056
00057 plBlue1(int iuv=0,int sect=1) {
00058 char txt[100];
00059 sprintf(txt,"fr%02d%c",sect,iuv+'U');
00060 printf("=%s=\n",txt);
00061 TH1F *h0=f->Get(txt);
00062 assert(h0);
00063 c=new TCanvas(txt,txt,600,700);
00064 c->Divide(1,4);
00065
00066 h0->SetFillColor(kGreen);
00067 int i;
00068 for(i=1;i<=4;i++) {
00069 c->cd(i);
00070 h=(TH1F*) h0->Clone();
00071
00072 h->Draw("b");
00073 h0->Draw("same e");
00074 h->SetAxisRange((i-1)*80,i*80);
00075 float ym=h->GetMaximum();
00076 gPad->SetLogy();
00077
00078 plotLed(iuv,ym*.8);
00079 }
00080 TString Txt=txt;
00081
00082
00083 }
00084
00085
00086
00087
00088 plotLed(int iuv=0,float ym) {
00089 int colA[]={kBlack,kRed,kBlue,kMagenta};
00090
00091 Int_t board = 0;
00092
00093 Int_t iplane =iuv;
00094 int totStrip=0;
00095
00096 for ( Int_t board = 0; board < 8; board++ ) {
00097
00098 TObjArray fibers = led->getFibersToSmdPlane( board, iplane );
00099 std::cout << "Strips illuminated by LED board " << board+1 << std::endl;
00100
00101
00102 for ( Int_t ifiber = 0; ifiber < fibers.GetEntries(); ifiber++ ) {
00103
00104 EEBlueLedFiber *fiber = (EEBlueLedFiber *)fibers[ifiber];
00105 std::cout << "min strip = " << fiber->getMinStrip() << " "
00106 << "max strip = " << fiber->getMaxStrip() << " "
00107 << "led board = " << fiber->getLedBoard() << " "
00108 << "led fiber = " << fiber->getLedFiber() << " "
00109 <<std::endl;
00110
00111 totStrip+=1+fiber->getMaxStrip()-fiber->getMinStrip();
00112 float y1=0.1,y2=log(ym)/2.;
00113 float x1=fiber->getMinStrip()-0.4;
00114 float x2=fiber->getMaxStrip()+0.4;
00115
00116 TBox *box = new TBox(x1,y1,x2,y2);
00117 int col=colA[board%4];
00118 box -> SetLineColor(col);
00119 box -> SetFillStyle(0);
00120
00121
00122 box -> Draw();
00123 char txt[100];
00124 sprintf(txt,"br=%d fb=%d", fiber->getLedBoard(),fiber->getLedFiber() );
00125 tt=new TText(x1+1.,y2*1.01,txt);
00126
00127
00128 }
00129 }
00130 cout <<" totStrip="<<totStrip<<endl;
00131 }