Rev 1 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
Skripta za kalibracijo visine fotovrhov
Vhod: histogrami ADC vs sum
Navodilo:
1.klikni na GCUT toolbar
2. poklikaj najvisji fotovrh v vsakem od histogramov . klikajh v vrstnem redu hoistogramov.
3. zakljuci na zadnjem vrhu tako, da se enkrat kliknes na isto tocko
4. ponovi vse za vse 4 fotopomnozevalke
Izhod: Datoteka z visinami fotovrhov po kanalih
.x fotovrh.cxx("fmfpet.root")
*/
int fotovrh(char *fname, float max=100){
char cmd[256];
TFile *f= new TFile(fname);
FILE *fp= fopen("fotovrh.dat","w");
if (!fp) return 0;
for (int ipmt=0;ipmt<4;ipmt++){
sprintf(cmd,"c%d",ipmt);
TCanvas *c= new TCanvas(cmd,cmd,1500,1000);
c->ToggleToolBar();
c->Divide(4,4);
for (int ch=0;ch<16;ch++){
c->cd(ch+1);
sprintf(cmd,"adcvssumch%d",ipmt*16+ch);
TH2 *h = (TH2 *) f->Get(cmd);
if (!h) {
cout << "Histogram not found " << cmd << endl;
continue;
} else {
if (max>0) h->SetMaximum(max);
h->Draw("colz");
}
}
c->WaitPrimitive("CUTG");
TCutG *mycutg = (TCutG*)gROOT->GetListOfSpecials()->FindObject("CUTG");
if (mycutg) {
sprintf(cmd,"cutg%d",ipmt);
mycutg->SetName(cmd);
mycutg->Print();
int n= mycutg->GetN();
double x,y;
for (int k=0;k<n-1;k++){
mycutg->GetPoint(k, x, y);
printf("%d %f\n",k+ipmt*16,x);
fprintf(fp,"%d %f\n",k+ipmt*16,x);
}
}
}
fclose(fp);
return 0;
}