Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 326 | f9daq | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
||
| 3 | #include <TROOT.h> |
||
| 4 | #include <TF1.h> |
||
| 5 | #include <TH1F.h> |
||
| 6 | #include <TH1D.h> |
||
| 7 | #include <TH2D.h> |
||
| 8 | #include <TCanvas.h> |
||
| 9 | #include <TStyle.h> |
||
| 10 | #include <TSystem.h> |
||
| 11 | #include <TFile.h> |
||
| 12 | #include <TDirectory.h> |
||
| 13 | #include <TApplication.h> |
||
| 14 | #include <TPaveText.h> |
||
| 15 | |||
| 16 | |||
| 17 | void onBrowserClose() { |
||
| 18 | gApplication->Terminate(0); |
||
| 19 | } |
||
| 20 | |||
| 21 | int febreport(char *path, int run){ |
||
| 22 | |||
| 23 | char hname[0xFF]; |
||
| 24 | char name[0xFF]; |
||
| 25 | |||
| 26 | gROOT->SetMacroPath("../macros"); |
||
| 27 | gROOT->LoadMacro("slowcxml2root.cxx+"); |
||
| 28 | gROOT->LoadMacro("febana.cxx+"); |
||
| 29 | //gROOT->ProcessLine(".L H2Dload.cxx"); |
||
| 30 | sprintf(hname,"%s/febtest_%04d.root", path, run); |
||
| 31 | |||
| 32 | printf("File name =%s\n",hname); |
||
| 33 | TFile *file0 = new TFile(hname); |
||
| 34 | file0->ls(); |
||
| 35 | TCanvas *c[4]; |
||
| 36 | for (int k=0;k<4;k++){ |
||
| 37 | sprintf(name,"brd%d", k); |
||
| 38 | c[k]= new TCanvas( name, name, 900, 600); |
||
| 39 | c[k]->Divide(2,3); |
||
| 40 | } |
||
| 41 | |||
| 42 | sprintf(name,"slowcxml2root(\"%s/febslowc_%04d.xml\")",path, run); |
||
| 43 | printf("%s\n",name); |
||
| 44 | gROOT->ProcessLine(name); |
||
| 45 | TH2D *h2dp=(TH2D *) gDirectory->Get("h2d_0;1"); |
||
| 46 | for (int k=0;k<4;k++){ |
||
| 47 | sprintf(name,"vth1_%d_0",k); //you define histogram vth1_0_0;1 |
||
| 48 | TH2D * h0 = (TH2D *) gDirectory->Get(name); //this tell you directory to your histogram |
||
| 49 | int brd; |
||
| 50 | if (!h0) continue; |
||
| 51 | sscanf(h0->GetTitle(),"%*s%*s%*s%*s sn=%d",&brd); |
||
| 52 | // printf("sn = %d\n",brd); |
||
| 53 | c[k]->cd(1); |
||
| 54 | hpt(k); |
||
| 55 | c[k]->cd(2); |
||
| 56 | //sprintf(name,"title%d",k); |
||
| 57 | TPaveText *pt1 = new TPaveText(.2,.2,.7,.7); |
||
| 58 | |||
| 59 | if (pt1) pt1->Draw(); |
||
| 60 | sprintf(name,"RUN=febtest_%04d.root", run); |
||
| 61 | pt1->AddText(name); |
||
| 62 | sprintf(name,"Position= FEB %d", k); |
||
| 63 | pt1->AddText(name); |
||
| 64 | sprintf(name,"SN=%d", brd); |
||
| 65 | pt1->AddText(name); |
||
| 66 | |||
| 67 | |||
| 68 | c[k]->cd(3); |
||
| 69 | hplot(k); |
||
| 70 | c[k]->cd(4); |
||
| 71 | h0->Draw(); |
||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | if (h2dp) { |
||
| 76 | double max = h2dp->GetMaximum(); |
||
| 77 | sprintf(name,"board%d", brd); |
||
| 78 | TH2D *hth= new TH2D(name, "Threshold scan with Test Pulse;channel;VTH1",h2dp->GetNbinsX()/4, -0.5,143.5, h2dp->GetNbinsY() , h2dp->GetYaxis()->GetXmin(), h2dp->GetYaxis()->GetXmax() ); |
||
| 79 | sprintf(name,"fwhm%d", brd); |
||
| 80 | TH1D *hfwhm= new TH1D(name, "FWHM;channel",h2dp->GetNbinsX()/4, -0.5,143.5 ); |
||
| 81 | hth->SetStats(false); |
||
| 82 | for (int x=0;x<hth->GetNbinsX();x++){ |
||
| 83 | double fwhm=0; |
||
| 84 | for (int y=0;y<hth->GetNbinsY();y++){ |
||
| 85 | double val= h2dp->GetBinContent(k*144+x+1,y+1); |
||
| 86 | hth->SetBinContent(x+1, y+1, val); |
||
| 87 | if (val> max*0.5) fwhm+=1; |
||
| 88 | } |
||
| 89 | hfwhm->SetBinContent(x+1,fwhm); |
||
| 90 | } |
||
| 91 | hfwhm->SetMaximum(100); |
||
| 92 | hfwhm->SetMinimum(0); |
||
| 93 | |||
| 94 | c[k]->cd(5); |
||
| 95 | hth->Draw("colz"); |
||
| 96 | c[k]->cd(6); |
||
| 97 | hfwhm->Draw(); |
||
| 98 | } |
||
| 99 | |||
| 100 | sprintf(name,"pdf/board_%d_%04d.pdf(", brd, run); |
||
| 101 | printf("%s\n",name); |
||
| 102 | c[k]->Print(name,"pdf"); |
||
| 103 | } |
||
| 104 | |||
| 105 | //printf("name=%s\n",name); |
||
| 106 | |||
| 107 | febana(run); |
||
| 108 | |||
| 109 | // printf("arguments path=%s run=%d\n",path, run ); |
||
| 110 | return 0; |
||
| 111 | } |