Subversion Repositories f9daq

Rev

Rev 35 | Rev 38 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35 Rev 36
Line 14... Line 14...
14
 
14
 
15
#include "include/RTUtil.h"
15
#include "include/RTUtil.h"
16
 
16
 
17
double getNoise(TH2F*, int, int);
17
double getNoise(TH2F*, int, int);
18
 
18
 
19
int thresholdScan(char filename[256] = "test", char plopt[256]="th", int chXstart=0, int chXend=7, int chYstart=0, int chYend=7, bool debug = false)
19
int biasScan(char filename[256] = "test", char plopt[256]="th", int chXstart=0, int chXend=7, int chYstart=0, int chYend=7, bool debug = false)
20
{
20
{
21
  const int c_nChannels = 64;
21
  const int c_nChannels = 64;
22
  const double c_xOffset = 1; // mm
22
  const double c_xOffset = 1; // mm
23
  const double c_yOffset = 0.7;
23
  const double c_yOffset = 0.7;
24
 
24
 
Line 44... Line 44...
44
        if(rootfile==NULL) {
44
        if(rootfile==NULL) {
45
          printf("Cannot open root file %s!!!\n",fnameroot);
45
          printf("Cannot open root file %s!!!\n",fnameroot);
46
          return(0);
46
          return(0);
47
        }
47
        }
48
 
48
 
49
  if (strstr(plopt, "th") != NULL) {
-
 
50
   TCanvas* canvas1 = new TCanvas("canvas1","",800,800);
-
 
51
   canvas1->cd();
-
 
52
   //gPad->SetLogz();
-
 
53
   //canvas1->SetLogz();
-
 
54
   TH2F* h_threshold = (TH2F*) rootfile->Get("h_threshold");
-
 
55
   h_threshold->SetTitleOffset(1.5,"y");
-
 
56
   //h_threshold->GetZaxis()->SetRangeUser(0,1000);
-
 
57
   h_threshold->SetContour(20);
-
 
58
   
-
 
59
   h_threshold->Draw("colz");
-
 
60
   
-
 
61
   TCanvas* canvas2 = new TCanvas("canvas2","",1600,800);
-
 
62
   canvas2->Divide(2);
-
 
63
   TH1D* h_projection1 = h_threshold->ProjectionY("Ch 37",38,38);
-
 
64
   canvas2->cd(1);
-
 
65
   //h_projection1->GetYaxis()->SetRangeUser(0,1000);
-
 
66
   //gPad->SetLogy();
-
 
67
   h_projection1->Draw();
-
 
68
   
-
 
69
   TH1D* h_projection2 = h_threshold->ProjectionY("Ch 38",39,39);
-
 
70
   canvas2->cd(2);
-
 
71
   //gPad->SetLogy();
-
 
72
   h_projection2->Draw();
-
 
73
  }
-
 
74
 
-
 
75
  if(strstr(plopt, "tdc") != NULL) {
49
  if(strstr(plopt, "tdc") != NULL) {
76
    TCanvas *canvas21 = new TCanvas("canvas21","canvas21",1600,800);
50
    TCanvas *canvas21 = new TCanvas("canvas21","canvas21",1600,800);
77
    TH3F* h0 = (TH3F*) rootfile->Get("h_correctedTDC");
51
    TH3F* h0 = (TH3F*) rootfile->Get("h_correctedTDC");
78
          Int_t binsX = h0->GetXaxis()->GetNbins();
52
          Int_t binsX = h0->GetXaxis()->GetNbins();
79
    Int_t minX  = h0->GetXaxis()->GetFirst();
53
    Int_t minX  = h0->GetXaxis()->GetFirst();
Line 114... Line 88...
114
   
88
   
115
    TH2D* h_timeWalk = (TH2D*) h0->Project3D("zy");
89
    TH2D* h_timeWalk = (TH2D*) h0->Project3D("zy");
116
    canvas21->cd(2);
90
    canvas21->cd(2);
117
    h_timeWalk->SetTitle(";Threshold [V]; t [ns]");
91
    h_timeWalk->SetTitle(";Threshold [V]; t [ns]");
118
    h_timeWalk->Draw("colz");
92
    h_timeWalk->Draw("colz");
-
 
93
  }
-
 
94
 
-
 
95
  if (strstr(plopt, "bias") != NULL) {
-
 
96
    TCanvas* canvas01 = new TCanvas("canvas01","",800, 800);
-
 
97
    canvas01->cd();
-
 
98
    TH2F* h_bias = (TH2F*) rootfile->Get("h_bias");
-
 
99
    h_bias->Draw("colz");
-
 
100
  }
-
 
101
 
-
 
102
  if (strstr(plopt, "th") != NULL) {
-
 
103
   TCanvas* canvas1 = new TCanvas("canvas1","",800,800);
-
 
104
   canvas1->cd();
-
 
105
   //gPad->SetLogz();
-
 
106
   //canvas1->SetLogz();
-
 
107
   TH2F* h_threshold = (TH2F*) rootfile->Get("h_threshold");
-
 
108
   h_threshold->SetTitleOffset(1.5,"y");
-
 
109
   //h_threshold->GetZaxis()->SetRangeUser(0,1000);
-
 
110
   h_threshold->SetContour(20);
-
 
111
   
-
 
112
   h_threshold->Draw("colz");
-
 
113
   
-
 
114
   TCanvas* canvas2 = new TCanvas("canvas2","",1600,800);
-
 
115
   canvas2->Divide(2);
-
 
116
   TH1D* h_projection1 = h_threshold->ProjectionY("Ch 37",38,38);
-
 
117
   canvas2->cd(1);
-
 
118
   //h_projection1->GetYaxis()->SetRangeUser(0,1000);
-
 
119
   //gPad->SetLogy();
-
 
120
   h_projection1->Draw();
-
 
121
   
-
 
122
   TH1D* h_projection2 = h_threshold->ProjectionY("Ch 38",39,39);
-
 
123
   canvas2->cd(2);
-
 
124
   //gPad->SetLogy();
-
 
125
   h_projection2->Draw();
119
  }
126
  }
120
 
127
 
121
  if(strstr(plopt,"16") != NULL)
128
  if(strstr(plopt,"16") != NULL)
122
  {
129
  {
123
  TH2F* h_threshold = (TH2F*) rootfile->Get("h_threshold");
130
  TH2F* h_threshold = (TH2F*) rootfile->Get("h_bias");
124
  TCanvas* canvas = new TCanvas("canvas","",1600,1600);
131
  TCanvas* canvas = new TCanvas("canvas","",1600,1600);
125
  canvas->cd();
132
  canvas->cd();
126
  TVirtualPad *main = new TPad("main","main",0,0,1,1,10,1);
133
  TVirtualPad *main = new TPad("main","main",0,0,1,1,10,1);
127
  main->Draw();
134
  main->Draw();
128
  main->Divide(4,4);
135
  main->Divide(4,4);
Line 134... Line 141...
134
      printf(" %d ", canvasPosition);
141
      printf(" %d ", canvasPosition);
135
      main->cd(canvasPosition);
142
      main->cd(canvasPosition);
136
      char name[128];
143
      char name[128];
137
      sprintf(name,"Channel %d",channel);
144
      sprintf(name,"Channel %d",channel);
138
      h_projection->SetTitle(name);
145
      h_projection->SetTitle(name);
139
      h_projection->DrawCopy();
146
      h_projection->DrawCopy("ex0");
140
    }
147
    }
141
  }
148
  }
142
  printf("\n");
149
  printf("\n");
-
 
150
  }
-
 
151
 
-
 
152
  if(strstr(plopt, "1ch") != NULL)
-
 
153
  {
-
 
154
    TH2F* h_bias = (TH2F*) rootfile->Get("h_bias");
-
 
155
    TCanvas* canvas = new TCanvas("canvas","",1600,1600);
-
 
156
    canvas->cd();
-
 
157
    int channel = map[chXstart][chXend];
-
 
158
    TH1D* h_projection = h_bias->ProjectionY("",channel+1,channel+1);
-
 
159
    char name[128];
-
 
160
    sprintf(name,"Channel %d",channel);
-
 
161
    h_projection->SetTitle(name);
-
 
162
    h_projection->DrawCopy("ex0");
143
  }
163
  }
144
 
164
 
145
  if( strstr(plopt, "all") != NULL ) {
165
  if( strstr(plopt, "all") != NULL ) {
146
    TCanvas *canvas2 = new TCanvas("canvas2","Hits x;;",2000,2000);
166
    TCanvas *canvas2 = new TCanvas("canvas2","Hits x;;",2000,2000);
147
    TCanvas *canvas3 = new TCanvas("canvas3","Hits y;;",2000,2000);
167
    TCanvas *canvas3 = new TCanvas("canvas3","Hits y;;",2000,2000);