| 18,50 → 18,7 |
| |
| ClassImp (drs) |
| |
| drs::drs( const char *FileName, int nch, DrsChannel* d, int trgch, int nev, int updfrq) |
| { |
| int debug=0; |
| int i,ich,iev; |
| int stat; |
| char histname[128]; |
| // char FileName[300]="./data/n2.dat"; |
| FILE *fin; |
| |
| char recid[5]="SAMO"; |
| unsigned short *srecid = (unsigned short *) &recid[0]; |
| |
| struct evrec { |
| unsigned long evn; |
| unsigned short tYear,tMonth,tDay,tHour,tMin,tSec,tmSec,rc; |
| } evrec; |
| |
| float dtdata[NCH][DWIDTH]; |
| float tcdata[NCH][DWIDTH]; |
| float tccalib[NCH]; |
| float scaler[NCH]; |
| float *t; |
| float *y; |
| float *ay; |
| |
| short lwfm[NCH]; |
| int nwfm[NCH]; |
| int board; |
| int version; |
| |
| |
| unsigned short ichdat[NCH][DWIDTH]; |
| float chdat[NCH][DWIDTH]; |
| float achdat[NCH][DWIDTH]; |
| float chmax[NCH][2]; |
| float chmin[NCH][2]; |
| float letime[NCH],cftime[NCH],qdc[NCH]; |
| |
| |
| // gROOT->Reset(); |
| |
| gStyle->SetOptStat(1111111); |
| // gStyle->SetPalette(52); |
| |
| TH1F *h1_chmax[NCH]; |
| TH1F *h1_chmaxt[NCH]; |
| TH1F *h1_chmin[NCH]; |
| 75,15 → 32,15 |
| TH2F *h2_ctdcadc[NCH]; |
| TH2F *h2_ctalk; |
| TGraph *gr_wfm[NCH]; |
| TLegend *leg; |
| |
| 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); |
| c_wfm->cd(1); |
| TFile *froot; |
| |
| for (i=0; i<nch; i++) { |
| int drs::histoinit( int nch, DrsChannel* d, int trgch){ |
| char histname[128]; |
| leg = new TLegend(0.8, 0.8, 1, 1); |
| for (int i=0; i<nch; i++) { |
| sprintf(histname,"chmax_%02d",i); |
| h1_chmax[i]=new TH1F(histname,histname,1100,-0.88,0.88); |
| sprintf(histname,"chmaxt_%02d",i); |
| 117,9 → 74,67 |
| gr_wfm[i]->GetHistogram()->SetTitle("WaveForms"); |
| } |
| |
| leg->Draw(); |
| |
| h2_ctalk=new TH2F("ctalk","ctalk",250,0.,0.5,250,0.,0.5); |
| return 0; |
| } |
| |
| drs::drs( const char *FileName, int nch, DrsChannel* d, int trgch, int first, int neve, int updfrq) |
| { |
| int debug=0; |
| int i,ich,iev; |
| int stat; |
| int nev = first + neve; |
| // char FileName[300]="./data/n2.dat"; |
| FILE *fin; |
| |
| char recid[5]="SAMO"; |
| unsigned short *srecid = (unsigned short *) &recid[0]; |
| |
| struct evrec { |
| unsigned long evn; |
| unsigned short tYear,tMonth,tDay,tHour,tMin,tSec,tmSec,rc; |
| } evrec; |
| |
| float dtdata[NCH][DWIDTH]; |
| float tcdata[NCH][DWIDTH]; |
| float tccalib[NCH]; |
| float scaler[NCH]; |
| float *t; |
| float *y; |
| float *ay; |
| |
| short lwfm[NCH]; |
| int nwfm[NCH]; |
| int board; |
| int version; |
| |
| |
| unsigned short ichdat[NCH][DWIDTH]; |
| float chdat[NCH][DWIDTH]; |
| float achdat[NCH][DWIDTH]; |
| float chmax[NCH][2]; |
| float chmin[NCH][2]; |
| float letime[NCH],cftime[NCH],qdc[NCH]; |
| |
| |
| // gROOT->Reset(); |
| |
| gStyle->SetOptStat(1111111); |
| // gStyle->SetPalette(52); |
| |
| char rootname[0xFF]; |
| sprintf(rootname, "%s_x%d_y%d.root", FileName, 0,0); |
| TFile *froot = new TFile(rootname,"RECREATE"); |
| histoinit(nch, d, trgch); |
| leg->Draw(); |
| TCanvas *c_wfm= new TCanvas("c_wfm","WFM",50,50,700,700); |
| |
| c_wfm->Divide(1,1); |
| c_wfm->cd(1); |
| |
| |
| |
| fin=fopen(FileName,"rb"); |
| if (fin==NULL) { |
| printf("Error opening file %s\n",FileName); |
| 156,9 → 171,16 |
| stat=fread(&len,1,4,fin); |
| if (len>0 && len<37) { |
| stat=fread(posrec,1,len,fin); |
| if (recid[3]=='R') |
| if (recid[3]=='R'){ |
| if (iev>=first){ |
| froot->Write(); |
| froot->Close(); |
| sprintf(rootname, "%s_x%d_y%d.root", FileName, posrec[3], posrec[4]); |
| froot = new TFile(rootname,"RECREATE"); |
| histoinit(nch,d, trgch); |
| } |
| printf("Position len=%d x=%d y=%d ix=%d iy=%d\n", len, posrec[0], posrec[1], posrec[3], posrec[4]); |
| else |
| } else |
| printf("Position record buffer length %d\n", len); |
| } else { |
| printf("Wrong buffer length %d\n", len); |
| 204,8 → 226,8 |
| printf("Unknown header! %s\n", recid); |
| break; |
| } |
| if (iev<first) continue; |
| |
| |
| if (recid[0] == 'E') { |
| for ( i=0; i<nch; i++) { |
| if (!lwfm[i]) continue; |