Subversion Repositories f9daq

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 f9daq 1
/*
2
 
3
Skripta za kalibracijo visine fotovrhov
4
Vhod: histogrami ADC vs sum
5
 
6
Navodilo:
7
1.klikni na GCUT toolbar
8
2. poklikaj najvisji fotovrh v vsakem od histogramov . klikajh v vrstnem redu hoistogramov.
9
3. zakljuci na zadnjem vrhu tako, da se enkrat kliknes na isto tocko
10
4. ponovi vse za vse 4 fotopomnozevalke
11
 
12
Izhod: Datoteka z visinami fotovrhov po kanalih
13
 
14
 .x fotovrh.cxx("fmfpet.root")
15
 
16
*/
17
 
18
int fotovrh(char *fname, float max=100){
19
 
20
char cmd[256];
21
TFile *f= new TFile(fname);
22
 
23
FILE *fp= fopen("fotovrh.dat","w");
24
if (!fp) return 0;
25
for (int ipmt=0;ipmt<4;ipmt++){
26
  sprintf(cmd,"c%d",ipmt);
27
  TCanvas *c= new TCanvas(cmd,cmd,1500,1000);
28
 
29
  c->ToggleToolBar();
30
  c->Divide(4,4);
31
 
32
  for (int ch=0;ch<16;ch++){
33
    c->cd(ch+1);
34
    sprintf(cmd,"adcvssumch%d",ipmt*16+ch);
35
    TH2 *h = (TH2 *) f->Get(cmd);
36
    if (!h) {
37
     cout << "Histogram not found " << cmd << endl;
38
     continue;
39
    } else {
40
      if (max>0) h->SetMaximum(max);
41
      h->Draw("colz");
42
    }
43
  }
44
 
45
  c->WaitPrimitive("CUTG");
46
  TCutG *mycutg  = (TCutG*)gROOT->GetListOfSpecials()->FindObject("CUTG");
47
  if (mycutg) {
48
   sprintf(cmd,"cutg%d",ipmt);
49
   mycutg->SetName(cmd);
50
   mycutg->Print();
51
   int n= mycutg->GetN();
52
   double x,y;
53
   for (int k=0;k<n-1;k++){
54
     mycutg->GetPoint(k, x, y);
55
     printf("%d %f\n",k+ipmt*16,x);
56
     fprintf(fp,"%d %f\n",k+ipmt*16,x);
57
   }
58
  }
59
 
60
}
61
fclose(fp);
62
return 0;
63
}