Void error


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


i have an error of this

<<< cling interactive line includer >>>:1:1: error: expected ‘}’
/home/muhammad/Desktop/dark rate data_3inches/DR.C:6:10: note: to match this ‘{’
void DR(){

, i am plotting five histograms, can you help me here

thanks

void DR(){




   const int dim = 5;
   TCanvas *tc3 = new TCanvas("ta3","tb3", 800, 700);  

   TF1 *fgaus2 = new TF1 ("fgaus2","gaus",-50,50);  
              
   fgaus2->SetParName(0,"Const_p");                                             
   fgaus2->SetParName(1,"#mu_p");
   fgaus2->SetParName(2,"#sigma_p");
             
  // Open the CSV file
   FILE *fr1; 
   ifstream myReadFile;

    tc3->Divide(3,3);
    TH1D * histo3[dim];
   // cout<<"histo3"<<endl;

 
   for(int fileIndex=0; fileIndex<dim; fileIndex++){

    tc3->cd(fileIndex+1);
  
  if (fileIndex==0) {
   fr1 = fopen ("31jan_2s_40th_3inches_1301V_2023_01_31-21_58_56.csv", "r");   
  }
  if (fileIndex==1) {
   fr1 = fopen ("2_feb_50th_1301V_3inches_2023_02_02-23_01_43.csv", "rt");
  }
  if (fileIndex==2) {
   fr1 = fopen ( "2_feb_60th_1301V_3inches_2023_02_02-23_01_43.csv", "rt");
  }
  if (fileIndex==3) {
   fr1 = fopen ( "2_feb_70th_1301V_3inches_2023_02_02-21_54_10.csv", "rt");
  } 
  if (fileIndex==4) {
   fr1 = fopen ( "2-feb-1301V-3inches-80th_2023_02_02-23_38_51.csv", "rt");
  }
/*  if (fileIndex==5) {
    fr1 = fopen ( "F2_1850V_T6100000.txt", "rt");
  }

  if (fileIndex==6) {
    fr1 = fopen ( "Data/F3_6x1_2,26V_00000.txt", "rt");
  }
  if (fileIndex==7) {
    fr1 = fopen ( "Data/F3_6x2_2,26V_00000.txt", "rt");
  }
  if (fileIndex==8) {
    fr1 = fopen ( "Data/F3_6x3_2,26V_00000.txt", "rt");
  }  */
  
 //  FILE* file = fopen("pedestal-16-01.csv", "r");
 //  fr1 = fopen("2023_01_26-17_00_43_data.csv", "rt");
 //fr1 = fopen("2023_01_26-17_11_49_data.csv", "rt");
 //fr1 = fopen("2_feb_70th_1301V_3inches_2023_02_02-21_54_10.csv", "rt");
 //  cout <<"file opened"<<endl;
   char line1[170];
   // Skip the first line (header)
   //for(int j=0; j<1; j++)
   fgets(line1, 170, fr1);
   
   int x;
   int t;
   int y;
   string  m;
   string  q;
   double sum=0;
   double sumw=0;     
   
   // Read the data from the CSV file
   vector<double> tot,Freq_CH1;
   double xmax;  ; //= -1e9;
   double xmin;  ;  //=  1e9;

   while (fgets(line1, 170, fr1)) {  
    sscanf(line1, "%*s ,%*d ,%d ,%*d ,%*s", &y);
//cout <<line1<<endl;
//cout <<x<<" "<<y<<" "<<t<<endl;

     Freq_CH1.push_back(y);
     if(y<xmin) xmin = y;
     if(y>xmax) xmax = y;
    }
   // fclose(file);
   myReadFile.close(); 
   
   double nbin = Freq_CH1.size();
  // cout <<nbin<<"nbin"<<endl;

 //  TH1D *histo = new TH1D("histo","histo",nbin,xmin,xmax);
     histo3[fileIndex] = new TH1D("histo3","histo3",nbin,xmin,xmax);
   for(double i=0;i<nbin;i++)
     histo3[fileIndex]->Fill(Freq_CH1[i]);
   if(fileIndex==0 || fileIndex==4) histo3[fileIndex]->Fit("G","SWW","");//,-76,-72); 
     else histo3[fileIndex]->Fit("G","SWW","",xmin,xmax);
     gStyle->SetOptFit(1);
     histo3[fileIndex]->Draw();
   // Freq_CH1_u[fileIndex] = fgaus2->GetParameter(1); 
 // double Freq_CH1_u;
   // tc->SetLogx();
  //tc->SetLogy();
     histo3[fileIndex]->SetTitle("Dark rate R14374");
     histo3[fileIndex]->GetXaxis()->SetTitle("ADC Count");
     histo3[fileIndex]->GetYaxis()->SetTitle("number of events");
   //   histo->Rebin(5);
//   TFitResultPtr r1 = histo->Fit("gaus","S","", 50,200);

 
  /*  fgaus2->SetParameter(0,r1->Parameter(0));
    fgaus2->SetParameter(1,r1->Parameter(1));
    fgaus2->SetParameter(2,r1->Parameter(2)); */
// histo->Fit("fgaus2","SWW","",50,200); 
 // fgaus2->DrawCopy("Same");
   
 //  histo->Draw("");
   // TImage *img = TImage::Create();

//   img->FromPad(tc);
//   img->WriteImage("Results/42th_3inches_30-01_1301V.png");
/*TCanvas *tcDR = new TCanvas("taDR","tbDR",700,700); 

 double xx[2] = {0,o};
 double yy[2] = {0, 250} ;
 TGraph *gscale = new TGraph(2,xx,yy); 
   
 gscale->SetTitle("Dark Rate 70_threshold R14374");
 gscale->GetXaxis()->SetTitle("Time");
 gscale->GetYaxis()->SetTitle("Dark Rate (Hz)");
 gscale->Draw("AP");
TGraph* DRplot = new TGraph(Time.size(),&Time[0],&Freq_CH1[0]);// 3inches 70th
 DRplot->SetMarkerStyle(20);
 DRplot->SetMarkerSize(1);
 DRplot->SetMarkerColor(4);
 DRplot->Draw("P");
*/


}

Hi Muhammad,

you have an opening curly brace here:

but you seem to have forgotten the respective closing brace…