Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 203 → Rev 204

/drs/drs.C
4,6 → 4,7
#include "TCanvas.h"
#include "TStyle.h"
#include "TLegend.h"
#include "TFile.h"
//#include "TROOT.h"
 
#include <stdio.h>
74,6 → 75,9
TH2F *h2_ctdcadc[NCH];
TH2F *h2_ctalk;
TGraph *gr_wfm[NCH];
TFile *froot = new TFile(TString(FileName) + ".root","RECREATE");
TCanvas *c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700);
TLegend *leg = new TLegend(0.8, 0.8, 1, 1);
c_wfm->Divide(1,1);
81,13 → 85,13
 
for (i=0; i<nch; i++) {
sprintf(histname,"chmax_%02d",i);
h1_chmax[i]=new TH1F(histname,histname,1500,-0.88,0.88);
h1_chmax[i]=new TH1F(histname,histname,1100,-0.88,0.88);
sprintf(histname,"chmaxt_%02d",i);
h1_chmaxt[i]=new TH1F(histname,histname,DWIDTH,-0.1,204.7);
sprintf(histname,"chmin_%02d",i);
h1_chmin[i]=new TH1F(histname,histname,1500,-0.88,0.88);
h1_chmin[i]=new TH1F(histname,histname,1100,-0.55,0.55);
sprintf(histname,"chmint_%02d",i);
h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1,204.7);
h1_chmint[i]=new TH1F(histname,histname,DWIDTH,-0.1,504.7);
sprintf(histname,"letime_%02d",i);
h1_letime[i]=new TH1F(histname,histname,500,d[i].twin[0],d[i].twin[1]);
sprintf(histname,"cftime_%02d",i);
97,14 → 101,14
sprintf(histname,"qdc_%02d",i);
h1_qdc[i]=new TH1F(histname,histname,500,-0.5,4.5);
sprintf(histname,"dpo_%02d",i);
h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1,204.7,1500,-0.88,0.88);
h2_dpo[i]=new TH2F(histname,histname,DWIDTH,-0.1,200.7,3000,-0.9,0.9);
sprintf(histname,"tdcadc_%02d",i);
h2_tdcadc[i]=new TH2F(histname,histname,250,-0.1,0.5,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]);
sprintf(histname,"ctdcadc_%02d",i);
h2_ctdcadc[i]=new TH2F(histname,histname,250,-0.1,0.5,400,d[i].twin[0]-d[trgch].twin[0],d[i].twin[1]-d[trgch].twin[0]);
gr_wfm[i]=new TGraph(DWIDTH);
gr_wfm[i]->SetMinimum(-0.55);
gr_wfm[i]->SetMaximum(0.55);
gr_wfm[i]->SetMinimum(-0.9);
gr_wfm[i]->SetMaximum(0.9);
gr_wfm[i]->SetLineColor(i+1);
gr_wfm[i]->SetMarkerColor(i+1);
sprintf(histname,"ch %d",i);
115,7 → 119,7
 
leg->Draw();
h2_ctalk=new TH2F("ctalk","ctalk",250,0.,0.5,250,0.,0.5);
 
fin=fopen(FileName,"rb");
if (fin==NULL) {
printf("Error opening file %s\n",FileName);
288,13 → 292,16
letime[ich]=t0n+(t0-t0n)*(d[ich].threshold-y[i-1])/(y[i]-y[i-1]);
}
// constant fraction time in the range
if ( ( ((!d[ich].edge) && (chmin[ich][0]<d[ich].threshold)&&(y[i]<chmin[ich][0]*d[ich].cfrac)) ||
(( d[ich].edge) && (chmax[ich][0]>d[ich].threshold)&&(y[i]>chmax[ich][0]*d[ich].cfrac)) )
&&(cftime[ich]<0.)
 
) {
cftime[ich]=t0n+(t0-t0n)*(chmin[ich][0]*d[ich].cfrac-y[i-1])/(y[i]-y[i-1]);
}
if (cftime[ich]<0.){
// negative signals
if ((!d[ich].edge) && (chmin[ich][0]<d[ich].threshold)&&(y[i]<chmin[ich][0]*d[ich].cfrac )){
cftime[ich]=t0n+(t0-t0n)*(chmin[ich][0]*d[ich].cfrac-y[i-1])/(y[i]-y[i-1]);
}
// positive signals
if (( d[ich].edge) && (chmax[ich][0]>d[ich].threshold)&&(y[i]>chmax[ich][0]*d[ich].cfrac)){
cftime[ich]=t0n+(t0-t0n)*(chmax[ich][0]*d[ich].cfrac-y[i-1])/(y[i]-y[i-1]);
}
}
}
}
 
327,11 → 334,13
 
TCanvas* c_dpo= new TCanvas("c_dpo","DPO",750,50,700,700);
c_dpo->Divide(2,2);
for (i=0; i<nch; i++) {c_dpo->cd(i+1); h2_dpo[i]->Draw("colz");}
for (i=0; i<nch; i++) {c_dpo->cd(i+1); h2_dpo[i]->DrawCopy("colz");}
 
TCanvas* c_cftdif= new TCanvas("c_cftdif","DPO",750,50,700,700);
c_cftdif->Divide(2,2);
for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->Draw();}
for (i=0; i<nch; i++) {c_cftdif->cd(i+1); h1_cftdif[i]->DrawCopy();}
froot->Write();
froot->Close();
return;
}