/* include files */ #include #include #include #include #include #include #include using namespace std; // root include files #include "TApplication.h" // needed to display canvas #include "TSystem.h" #include "TCanvas.h" #include "TFile.h" #include "TH1.h" #include "TH1F.h" #include "TH2F.h" #include "TH3F.h" #include "TF1.h" #include "TMath.h" #include "TGraph.h" #include "TGraphErrors.h" int main(int argc, char **argv) { char CrateName[128] = "ROCFDC"; int version = 1; int ROC = 2; int SLOT = 3; int CHANNEL = 1; int DISPLAY = 1; char InputFile[128]; int ROCNum[10] = {2,3,5,6,7,8,9,10,11,12}; TApplication theApp("App", &argc, argv); if (argc>1){ for (int i=1;i>EVENT>>Sl>>ch; if ((Sl==Slot) && (ch+1 == CHANNEL)){ iss>>p>>dp; x[NCon] = (float)EVENT; y[NCon] = p; dx[NCon] = 0.; dy[NCon++] = dp; } } INF.close(); } TGraphErrors *graph; char t1[128]; char t2[128]; sprintf(t1,"graph%d_%d_%d",ROC,SLOT,CHANNEL); sprintf(t2,"Pedestals ROC %d SLOT %d CHANNEL %d",ROC,SLOT,CHANNEL); graph = new TGraphErrors(NCon,x,y,NULL,dy); graph->SetTitle(t2); graph->SetMarkerColor(4); graph->SetMarkerStyle(21); graph->GetYaxis()->SetTitle("Pedestal [ADC counts]"); if (DISPLAY){ TCanvas *myc1; char str1[128]; sprintf(str1,"Pedestals ROC %d ADC125 Samples in SLOT %d CHANNEL %d",ROC,SLOT,CHANNEL); myc1 = new TCanvas("myc1", str1, 800, 400); myc1->SetFillColor(42); gPad->SetGrid(); graph->Draw("AP"); myc1->Update(); cout<<"Continue: "; char inp[128]; cin>>inp; } TFile *fout; sprintf(fnam,"%s/PedestalsROC%dSLOT%dCHANNEL%d.root",DataDir,ROC,SLOT,CHANNEL); fout = new TFile(fnam,"RECREATE"); graph->Write(); fout->Close(); return 0; }