Error: Use of undeclared identifier

Hi, earlier I was using Root 5.34 but I didn’t receive any kind of error during executing this code, now I have upgraded my Root to 6.24, but I am getting these kind of errors. Can you please tell me, how to resolve this kind of errors.

In file included from input_line_8:1:
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:75:8: warning: '/*' within block comment [-Wcomment]
      //*****************************************AvgAnode****************************************************************************
       ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:99:8: warning: '/*' within block comment [-Wcomment]
      //************************************************Avg HV***************************************
       ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:124:8: warning: '/*' within block comment [-Wcomment]
      //************************************Avg PCR*****************************************
       ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:154:5: warning: '/*' within block comment [-Wcomment]
   //*************************************AvgModule CCR n PCR**********************************************************************************
    ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:183:8: warning: '/*' within block comment [-Wcomment]
      //******************************************************************************************************************************
       ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:233:9: error: use of undeclared identifier 'gr'
               gr = new TGraph();
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:234:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerStyle(2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:235:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerSize(0.2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:245:14: error: use of undeclared identifier 'gr'
                           gr->SetPoint(n,Temp,PixelAnode[Channel]);
                           ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:254:9: error: use of undeclared identifier 'gr'
               gr->SetTitle(TitleName);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:255:9: error: use of undeclared identifier 'gr'
               gr->Draw("AL*");
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:282:9: error: use of undeclared identifier 'gr'
               gr = new TGraph();
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:283:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerStyle(2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:284:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerSize(0.2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:294:14: error: use of undeclared identifier 'gr'
                           gr->SetPoint(n,Temp,PixelScr[Channel]);
                           ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:303:9: error: use of undeclared identifier 'gr'
               gr->SetTitle(TitleName);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:304:12: error: use of undeclared identifier 'gr'
           gr->Draw("AL*");
           ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:357:29: warning: format specifies type 'int *' but the argument has type 'unsigned short *' [-Wformat]
                           fscanf(hv,"%i",&PixelHv[j]);
                                      ~~  ^~~~~~~~~~~
                                      %hi
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:393:9: error: use of undeclared identifier 'gr'
               gr = new TGraph();
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:394:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerStyle(2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:395:9: error: use of undeclared identifier 'gr'
               gr->SetMarkerSize(0.2);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:402:9: error: use of undeclared identifier 'gr'
               gr->SetTitle(TitleName);
               ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:411:29: warning: format specifies type 'int *' but the argument has type 'unsigned short *' [-Wformat]
                           fscanf(DT,"%i",&PixelDt[j]);
                                      ~~  ^~~~~~~~~~~
                                      %hi
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:412:20: error: use of undeclared identifier 'gr'
                   gr->SetPoint(n,Temp,PixelDt[Channel]);
                   ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:415:12: error: use of undeclared identifier 'gr'
           gr->Draw("AL*");
           ^
/home/pratibha/sandeep/MACE/new/TeleAnaModule.cxx:442:6: error: use of undeclared identifier 'gr1'
                   gr1 = new TGraph();
                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]


My code is this:-

//#include "TCanvas.h"
//#include "TROOT.h"
//#include "TGraphErrors.h"
//#include "TGraph.h"
//#include "TF1.h"
//#include "TLegend.h"
//#include "TArrow.h"
//#include "iostream.h"
#include <fstream>
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
//#include "sys/types.h"
//#include "dirent.h"
//#include "unistd.h"
//#include "errno.h"
#define TOTALCIM 68
#define TOTALPIXEL 1088


void TeleAnaModule()
{
  
    FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6,*fp7,*fp8;
    FILE *hv,*DT;
    Int_t i,n,j,Channel,TotalChannel,ModuleChannel,Counter=1,count=0,CIM,cim,lmidcounter=0,lmid;
    Double_t Temp;
    float PixelAnode[TOTALCIM*16],AvgAnode,AVGANODEMAX=5;
    short PCR,PCR1,PCR2,PCR3,PCR4,PCR5,PCR6,PCR7;
    unsigned int PixelScr[TOTALCIM*16],AvgScr,AVGSCRMAX=1300000;
    unsigned short AvgCCR,AvgModulePCR;
    unsigned short PixelHv[TOTALCIM*16],PixelDt[TOTALCIM*16],AvgHv,AvgDt;
    unsigned int pcr[TOTALCIM],ccr[TOTALCIM];
    char pix[17][6]={"ch#01","ch#02","ch#03","ch#04","ch#05","ch#06","ch#07","ch#08","ch#09","ch#10","ch#11","ch#12","ch#13","ch#14","ch#15","ch#16"}; 
    char LMID[69][3]={"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32",
		"33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68"};	
    char TitleName[30];
    char OutputFile[80];
    unsigned int ch[TOTALPIXEL],module[TOTALPIXEL],SetHV[TOTALPIXEL],SetDT[TOTALPIXEL],SetROI[TOTALPIXEL];
    
    fp8=fopen("/home/pratibha/sandeep/MACE/dataout/CurrentexpParameter.dat","r");
    for(i=0;i<TOTALPIXEL;i++)
         fscanf(fp8,"%d %d %d %d %d",&ch[i],&module[i],&SetHV[i],&SetDT[i],&SetROI[i]);
    fclose(fp8);     	  
 //   char OutputFileScr[60];
//	int proAnode[TOTALCIM*16],proScr[TOTALCIM*16];
		
	 //*************************************************AvgSCR***************************************************************************
 /*    TCanvas *c3 = new TCanvas("c3","Average",200,10,700,500);
     c3->Divide(1,4);
     c3->cd(1);
      gr2 = new TGraph();
       
    //  gr2->GetYaxis()->SetRange(1000,10000);
      gr2->SetMaximum(AVGSCRMAX);
	  gr2->SetMarkerStyle(2);
	  gr2->SetMarkerSize(0.2);
	  strcpy(TitleName,"AvgSCR per Pixel");
	  gr2->SetTitle(TitleName);
	  gr2->GetXaxis()->SetTitle("Pixel No.");
      gr2->GetYaxis()->SetTitle("Rates (Hz)");
	 
	  fp4=fopen("/home/pratibha/sandeep/MACE/dataout/crilog.dat","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp4))
	           break;
	        fscanf(fp4,"%i %i %i %f %i %i %i",&lmid,&ModuleChannel,&Channel,&AvgAnode,&AvgScr,&AvgHv,&AvgDt);
	        gr2->SetPoint(n,Temp,AvgScr);
            
      }
      gr2->Draw("AP*");
      fclose(fp4);
      //*****************************************AvgAnode****************************************************************************
      c3->cd(2);
      gr2 = new TGraph();
       
    //  gr2->GetYaxis()->SetRange(1000,10000);
      gr2->SetMaximum(AVGANODEMAX);
	  gr2->SetMarkerStyle(2);
	  gr2->SetMarkerSize(0.2);
	  strcpy(TitleName,"AvgAnode per Pixel");
	  gr2->SetTitle(TitleName);
	  gr2->GetYaxis()->SetTitle("Current (uA)");
	  gr2->GetHistogram()->GetYaxis()->SetTitle("new Y axis title");
	  fp4=fopen("/home/pratibha/sandeep/MACE/dataout/crilog.dat","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp4))
	           break;
	        fscanf(fp4,"%i %i %i %f %i %i %i",&lmid,&ModuleChannel,&Channel,&AvgAnode,&AvgScr,&AvgHv,&AvgDt);
	        gr2->SetPoint(n,Temp,AvgAnode);
            
      }
      gr2->Draw("AP*");
      fclose(fp4); 
      //************************************************Avg HV***************************************
      c3->cd(3);
      gr2 = new TGraph();
       
    //  gr2->GetYaxis()->SetRange(1000,10000);
      gr2->SetMaximum(1300);
	  gr2->SetMarkerStyle(2);
	  gr2->SetMarkerSize(0.2);
	  strcpy(TitleName,"AvgHV per Pixel");
	  gr2->SetTitle(TitleName);
	  gr2->GetXaxis()->SetTitle("Pixel No.");
      gr2->GetYaxis()->SetTitle("HV (V)");
	  fp4=fopen("/home/pratibha/sandeep/MACE/dataout/crilog.dat","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp4))
	           break;
	        fscanf(fp4,"%i %i %i %f %i %i %i",&lmid,&ModuleChannel,&Channel,&AvgAnode,&AvgScr,&AvgHv,&AvgDt);
            gr2->SetPoint(n,Temp,AvgHv);
            
      }
      gr2->Draw("AP*");
      fclose(fp4); 
      
      //************************************Avg PCR*****************************************
      c3->cd(4);
      gr2 = new TGraph();
       
    //  gr2->GetYaxis()->SetRange(1000,10000);
      gr2->SetMaximum(1500);
	  gr2->SetMarkerStyle(2);
	  gr2->SetMarkerSize(0.2);
	  strcpy(TitleName,"System PCR Vs Events");
	  gr2->SetTitle(TitleName);
	  gr2->GetXaxis()->SetTitle("EventNo.");
      gr2->GetYaxis()->SetTitle("Rates (Hz)");
	  fp5=fopen("/home/pratibha/sandeep/MACE/dataout/scalarSLTG.txt","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp5))
	           break;
	        fscanf(fp5,"%i %i %i %i %i %i %i %i",&PCR,&PCR1,&PCR2,&PCR3,&PCR4,&PCR5,&PCR6,&PCR7);
            gr2->SetPoint(n,Temp,PCR);
            
      }
      gr2->Draw("AL*");
      strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/TelemetryReport/");
	  strcat(OutputFile,"AvgParameters");
	  strcat(OutputFile,".pdf");
	  c3->Print(OutputFile); 
	  c3->Update();
      c3->Modified();
      fclose(fp5); 
   //*************************************AvgModule CCR n PCR**********************************************************************************
      TCanvas *c4 = new TCanvas("c4","AvgModule",200,10,700,500);
      c4->Divide(1,2);
      c4->cd(1);
      gr3 = new TGraph();
      gr3->SetMarkerStyle(2);
	  gr3->SetMarkerSize(0.2);
	  gr3->SetMaximum(100000);
	  strcpy(TitleName,"AvgCCR per Module");
	  gr3->SetTitle(TitleName);
	  
	  fp6=fopen("/home/pratibha/sandeep/MACE/dataout/Avg_ccr_pcr.dat","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp6))
	           break;
	        fscanf(fp6,"%i %i",&AvgCCR,&AvgModulePCR);
	        if(AvgModulePCR>3000)
	           AvgModulePCR=0;
            gr3->SetPoint(n,Temp,AvgCCR);
         
      }
	  gr3->GetXaxis()->SetTitle("Module No.");
      gr3->GetYaxis()->SetTitle("Rates (Hz)");
      gr3->GetXaxis()->SetTitleSize(0.05);
      gr3->GetYaxis()->SetTitleSize(0.05);
      gr3->Draw("AL*");
      fclose(fp6);
      //******************************************************************************************************************************
      c4->cd(2);
      gr3 = new TGraph();
      gr3->SetMarkerStyle(3);
	  gr3->SetMarkerSize(0.2);
	  gr3->SetMaximum(100);
	  strcpy(TitleName,"AvgPCR per Module");
	  gr3->SetTitle(TitleName);
	  fp7=fopen("/home/pratibha/sandeep/MACE/dataout/Avg_ccr_pcr.dat","r");
	  for(n=0;;n++)
      {
	     	Temp=n;
	       	if(feof(fp7))
	           break;
	        fscanf(fp7,"%i %i",&AvgCCR,&AvgModulePCR);
            gr3->SetPoint(n,Temp,AvgModulePCR);
            
      }
      gr3->GetXaxis()->SetTitle("Module No.");
      gr3->GetYaxis()->SetTitle("Rates (Hz)");
      gr3->GetXaxis()->SetTitleSize(0.05);
      gr3->GetYaxis()->SetTitleSize(0.05);
      gr3->Draw("AL*");
      fclose(fp7);
      strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/TelemetryReport/");
	  strcat(OutputFile,"PCRnCCR");
	  strcat(OutputFile,".pdf");
	  c4->Print(OutputFile); 
	  c4->Update();
      c4->Modified();*/
   
   //*********************************************************************************************************************************	

 //  gr->SetLineColor(2);
 //  gr->SetLineWidth(4);
 //  gr->SetMarkerColor(4);
 //  gr->SetMarkerStyle(21);
 //  gr->SetTitle("a simple graph");
 //  gr->GetXaxis()->SetTitle("X title");
 //  gr->GetYaxis()->SetTitle("Y title");
 //  gr->SetLineColor(2);
//   gr->SetLineWidth(4);
    
     TCanvas *c1 = new TCanvas("c1","Telemetry",200,10,700,500);
     c1->Divide(4,4);
     	
     for(Channel=0;Channel<TOTALCIM*16;Channel++)
     {
		   
		   c1->cd(Counter);
	       gr = new TGraph();
	       gr->SetMarkerStyle(2);
	       gr->SetMarkerSize(0.2);
	       fp1=fopen("/home/pratibha/sandeep/MACE/dataout/panode.dat","r");
	       for (n=0;;n++)
           {
	        	Temp=n;
	        	if(feof(fp1))
		           break;
		        for(j=0;j<TOTALCIM*16;j++)
		        {   
		           fscanf(fp1,"%f",&PixelAnode[j]);
		           gr->SetPoint(n,Temp,PixelAnode[Channel]);
                }
           }
	       strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[lmidcounter]);
	   //    if((Channel-count*16)==15)
	   //       lmidcounter++;
	       strcat(TitleName,"   Anode  ");
	       strcat(TitleName,pix[Channel-count*16]);
	       gr->SetTitle(TitleName);
	       gr->Draw("AL*");
	       
             
    //*******************************************************************************************************************************************
           Counter++; 
           if((Channel-count*16)==15)
           {
		       strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/Anode/");
		       strcat(OutputFile,"Anode_LMID#");
		       strcat(OutputFile,LMID[lmidcounter]); 
			   strcat(OutputFile,".pdf");
		       c1->Print(OutputFile); 
		       count++;
		       Counter=1;
		       lmidcounter++;
		       c1->Update();
               c1->Modified();
               
            } 
            
		   fclose(fp1);
      }
     //*****************************************************SCR COMBINED**************************************************************************** 
      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
		   c1->cd(Counter);
	       gr = new TGraph();
	       gr->SetMarkerStyle(2);
	       gr->SetMarkerSize(0.2);
	       fp2=fopen("/home/pratibha/sandeep/MACE/dataout/criSCR.dat","r");	 
	       for ( n=0;;n++)
           {
	        	Temp=n;
	        	if(feof(fp2))
		        break;
		        for(j=0;j<TOTALCIM*16;j++)
		        {   
		           fscanf(fp2,"%i",&PixelScr[j]);
		           gr->SetPoint(n,Temp,PixelScr[Channel]);
                }
           }
           strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[lmidcounter]);
	   //    if((Channel-count*16)==15)
	    //      lmidcounter++;
	       strcat(TitleName,"   SCR  ");
	       strcat(TitleName,pix[Channel-count*16]);
	       gr->SetTitle(TitleName);
           gr->Draw("AL*");
    //**********************************************************************************************************************************************
          
           Counter++; 
           if((Channel-count*16)==15)
           {
		       strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/SCR/");
		       strcat(OutputFile,"SCR_LMID#");
		       strcat(OutputFile,LMID[lmidcounter]); 
			   strcat(OutputFile,".pdf");
		       c1->Print(OutputFile); 
		       count++;
		       lmidcounter++;
		       Counter=1;
		       c1->Update();
               c1->Modified();
               
            } 
		   fclose(fp2);
      }
   //******************************************************** HV COMBINED**************************************************************************
      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
		    c1->cd(Counter); 
		    auto mg = new TMultiGraph();
		    auto hr1 = new TGraph();
         //   hr1->SetName("hr1");
            hr1->SetMarkerStyle(2);
	        hr1->SetMarkerSize(0.2);
	        hr1->SetMarkerStyle(2);
            hr1->SetDrawOption("AL");
            hr1->SetLineColor(1);
            hr1->SetLineWidth(1);
       //     hr1->SetFillStyle(0);
 
            auto hr2 = new TGraph();
          //  hr2->SetName("hr2");
            hr2->SetMarkerStyle(1);
            hr2->SetMarkerSize(0.1);
            hr2->SetMarkerColor(2);
            hr2->SetDrawOption("L");
            hr2->SetLineColor(2);
            hr2->SetLineWidth(1);
         //   hr2->SetFillStyle(0);
            hv=fopen("/home/pratibha/sandeep/MACE/dataout/hv.dat","r");	 
	        for(n=0;;n++)
            {
	        	Temp=n;
	        	if(feof(hv))
		           break;
		        for(j=0;j<TOTALCIM*16;j++)
		        {   
		           fscanf(hv,"%i",&PixelHv[j]);
                   hr1->SetPoint(n,Temp,PixelHv[Channel]);
                }
           }
           for(i=0;i<n;i++)
              hr2->SetPoint(i,i,SetHV[Channel]);
           mg->Add( hr1 );
           mg->Add( hr2 );  
           strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[lmidcounter]);
	       strcat(TitleName,"   HV  ");
	       strcat(TitleName,pix[Channel-count*16]);
	       mg->SetTitle(TitleName);
           mg->Draw("AL*");  
           Counter++; 
           if((Channel-count*16)==15)
           {
		       strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/HV/");
		       strcat(OutputFile,"HV_LMID#");
		       strcat(OutputFile,LMID[lmidcounter]); 
			   strcat(OutputFile,".pdf");
		       c1->Print(OutputFile); 
		       count++;
		       lmidcounter++;
		       Counter=1;
		       c1->Update();
               c1->Modified();
           } 
		   fclose(hv);
      }   
	//******************************************************** DT COMBINED****************************************************************************
    
      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
		   c1->cd(Counter);
	       gr = new TGraph();
	       gr->SetMarkerStyle(2);
	       gr->SetMarkerSize(0.2);
	       strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[lmidcounter]);
	    //   if((Channel-count*16)==15)
	    //      lmidcounter++;
	       strcat(TitleName,"   DT  ");
	       strcat(TitleName,pix[Channel-count*16]);
	       gr->SetTitle(TitleName);
	       DT=fopen("/home/pratibha/sandeep/MACE/dataout/DT.dat","r");	 
	       for(n=0;;n++)
           {
	        	Temp=n;
	        	if(feof(DT))
		           break;
		        for(j=0;j<TOTALCIM*16;j++)
		        {   
		           fscanf(DT,"%i",&PixelDt[j]);
                   gr->SetPoint(n,Temp,PixelDt[Channel]);
                }
           }
           gr->Draw("AL*");
         
     
    //*********************************************************************************************************************************************
   
           Counter++; 
           if((Channel-count*16)==15)
           {
		       strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/DT/");
		       strcat(OutputFile,"DT_LMID#");
		       strcat(OutputFile,LMID[lmidcounter]); 
			   strcat(OutputFile,".pdf");
		       c1->Print(OutputFile); 
		       count++;
		       lmidcounter++;
		       Counter=1;
		       c1->Update();
               c1->Modified();
               
            } 
		   fclose(DT);
      }   
    //**************************************Module PCR*************************************************************************************************
   
      TCanvas *c2 = new TCanvas("c2","PCR",200,10,700,500);
      for(CIM=0;CIM<TOTALCIM;CIM++)
      {
		   gr1 = new TGraph();
		  // gr2->SetMaximum(500);
	       gr1->SetMarkerStyle(2);
	       gr1->SetMarkerSize(0.2);
	       strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[CIM]);
	       strcat(TitleName,"   PCR  ");
	       gr1->SetTitle(TitleName);
	       fp3=fopen("/home/pratibha/sandeep/MACE/dataout/pcr.dat","r");
	       for(n=0;;n++)
           {
	        	Temp=n;
	        	if(feof(fp3))
		           break;
		        for(j=0;j<TOTALCIM;j++)
		        {   
		           fscanf(fp3,"%d",&pcr[j]);
                   gr1->SetPoint(n,Temp,pcr[CIM]);
                }
           }
           gr1->Draw("AL*");
           strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/PCR/");
		   strcat(OutputFile,"PCR_LMID#");
		   strcat(OutputFile,LMID[CIM]); 
		   strcat(OutputFile,".pdf");
		   c2->Print(OutputFile); 
		   c2->Update();
           c2->Modified();
           fclose(fp3);
      }   
    //********************************************Module CCR*****************************************************************
      TCanvas *c3 = new TCanvas("c3","CCR",200,10,700,500);
      for(CIM=0;CIM<TOTALCIM;CIM++)
      {
		   gr2 = new TGraph();
		  // gr2->SetMaximum(500);
	       gr2->SetMarkerStyle(2);
	       gr2->SetMarkerSize(0.2);
	       strcpy(TitleName,"LMID#");
	       strcat(TitleName,LMID[CIM]);
	       strcat(TitleName,"   CCR  ");
	       gr2->SetTitle(TitleName);
	       fp4=fopen("/home/pratibha/sandeep/MACE/dataout/ccr.dat","r");
	       for(n=0;;n++)
           {
	        	Temp=n;
	        	if(feof(fp4))
		           break;
		        for(j=0;j<TOTALCIM;j++)
		        {   
		           fscanf(fp4,"%d",&ccr[j]);
                   gr2->SetPoint(n,Temp,ccr[CIM]);
                }
           }
           gr2->Draw("AL*");
           strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/CCR/");
		   strcat(OutputFile,"CCR_LMID#");
		   strcat(OutputFile,LMID[CIM]); 
		   strcat(OutputFile,".pdf");
		   c3->Print(OutputFile); 
		   c3->Update();
           c3->Modified();
           fclose(fp4);
      }   
    
    //***********************************************************************************************************************
}

 #ifndef __CINT__
 int main(){
     TeleAnaModule();
     }
     #endif 

It will be great help for resolving these errors.
Thanks with regards,
Sandeep

Hello,

It might be just

auto gr = new TGraph();

instead of gr = new TGraph(). If it’s not that, could you attach your macro? The formatting of the inline version got a bit mixed up.

Cheers,
Jakob

I cleaned up your macro. It now compiles with ROOT 6. It does not run because the data file are missing but the compilation phase is ok.

//#include "TCanvas.h"
//#include "TROOT.h"
//#include "TGraphErrors.h"
//#include "TGraph.h"
//#include "TF1.h"
//#include "TLegend.h"
//#include "TArrow.h"
//#include "iostream.h"
#include <fstream>
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
//#include "sys/types.h"
//#include "dirent.h"
//#include "unistd.h"
//#include "errno.h"
#define TOTALCIM 68
#define TOTALPIXEL 1088


void TeleAnaModule()
{

    FILE *fp1,*fp2,*fp3,*fp4,*fp5,*fp6,*fp7,*fp8;
    FILE *hv,*DT;
    Int_t i,n,j,Channel,TotalChannel,ModuleChannel,Counter=1,count=0,CIM,cim,lmidcounter=0,lmid;
    Double_t Temp;
    float PixelAnode[TOTALCIM*16],AvgAnode,AVGANODEMAX=5;
    short PCR,PCR1,PCR2,PCR3,PCR4,PCR5,PCR6,PCR7;
    unsigned int PixelScr[TOTALCIM*16],AvgScr,AVGSCRMAX=1300000;
    unsigned short AvgCCR,AvgModulePCR;
    unsigned short PixelHv[TOTALCIM*16],PixelDt[TOTALCIM*16],AvgHv,AvgDt;
    unsigned int pcr[TOTALCIM],ccr[TOTALCIM];
    char pix[17][6]={"ch#01","ch#02","ch#03","ch#04","ch#05","ch#06","ch#07","ch#08","ch#09","ch#10","ch#11","ch#12","ch#13","ch#14","ch#15","ch#16"};
    char LMID[69][3]={"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32",
      "33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68"};
    char TitleName[30];
    char OutputFile[80];
    unsigned int ch[TOTALPIXEL],module[TOTALPIXEL],SetHV[TOTALPIXEL],SetDT[TOTALPIXEL],SetROI[TOTALPIXEL];

    fp8=fopen("/home/pratibha/sandeep/MACE/dataout/CurrentexpParameter.dat","r");
    for(i=0;i<TOTALPIXEL;i++)
         fscanf(fp8,"%d %d %d %d %d",&ch[i],&module[i],&SetHV[i],&SetDT[i],&SetROI[i]);
    fclose(fp8);



     TCanvas *c1 = new TCanvas("c1","Telemetry",200,10,700,500);
     c1->Divide(4,4);

     for(Channel=0;Channel<TOTALCIM*16;Channel++)
     {

         c1->cd(Counter);
          auto gr = new TGraph();
          gr->SetMarkerStyle(2);
          gr->SetMarkerSize(0.2);
          fp1=fopen("/home/pratibha/sandeep/MACE/dataout/panode.dat","r");
          for (n=0;;n++)
           {
              Temp=n;
              if(feof(fp1))
                 break;
              for(j=0;j<TOTALCIM*16;j++)
              {
                 fscanf(fp1,"%f",&PixelAnode[j]);
                 gr->SetPoint(n,Temp,PixelAnode[Channel]);
                }
           }
          strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[lmidcounter]);
      //    if((Channel-count*16)==15)
      //       lmidcounter++;
          strcat(TitleName,"   Anode  ");
          strcat(TitleName,pix[Channel-count*16]);
          gr->SetTitle(TitleName);
          gr->Draw("AL*");


/*******************************************************************************************************************************************/
           Counter++;
           if((Channel-count*16)==15)
           {
             strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/Anode/");
             strcat(OutputFile,"Anode_LMID#");
             strcat(OutputFile,LMID[lmidcounter]);
            strcat(OutputFile,".pdf");
             c1->Print(OutputFile);
             count++;
             Counter=1;
             lmidcounter++;
             c1->Update();
               c1->Modified();

            }

         fclose(fp1);
      }
/*****************************************************SCR COMBINED****************************************************************************/
      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
         c1->cd(Counter);
          auto gr = new TGraph();
          gr->SetMarkerStyle(2);
          gr->SetMarkerSize(0.2);
          fp2=fopen("/home/pratibha/sandeep/MACE/dataout/criSCR.dat","r");
          for ( n=0;;n++)
           {
              Temp=n;
              if(feof(fp2))
              break;
              for(j=0;j<TOTALCIM*16;j++)
              {
                 fscanf(fp2,"%i",&PixelScr[j]);
                 gr->SetPoint(n,Temp,PixelScr[Channel]);
                }
           }
           strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[lmidcounter]);
      //    if((Channel-count*16)==15)
       //      lmidcounter++;
          strcat(TitleName,"   SCR  ");
          strcat(TitleName,pix[Channel-count*16]);
          gr->SetTitle(TitleName);
           gr->Draw("AL*");
/**********************************************************************************************************************************************/

           Counter++;
           if((Channel-count*16)==15)
           {
             strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/SCR/");
             strcat(OutputFile,"SCR_LMID#");
             strcat(OutputFile,LMID[lmidcounter]);
            strcat(OutputFile,".pdf");
             c1->Print(OutputFile);
             count++;
             lmidcounter++;
             Counter=1;
             c1->Update();
               c1->Modified();

            }
         fclose(fp2);
      }
/******************************************************** HV COMBINED**************************************************************************/
      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
          c1->cd(Counter);
          auto mg = new TMultiGraph();
          auto hr1 = new TGraph();
         //   hr1->SetName("hr1");
            hr1->SetMarkerStyle(2);
           hr1->SetMarkerSize(0.2);
           hr1->SetMarkerStyle(2);
            hr1->SetDrawOption("AL");
            hr1->SetLineColor(1);
            hr1->SetLineWidth(1);
       //     hr1->SetFillStyle(0);

            auto hr2 = new TGraph();
          //  hr2->SetName("hr2");
            hr2->SetMarkerStyle(1);
            hr2->SetMarkerSize(0.1);
            hr2->SetMarkerColor(2);
            hr2->SetDrawOption("L");
            hr2->SetLineColor(2);
            hr2->SetLineWidth(1);
         //   hr2->SetFillStyle(0);
            hv=fopen("/home/pratibha/sandeep/MACE/dataout/hv.dat","r");
           for(n=0;;n++)
            {
              Temp=n;
              if(feof(hv))
                 break;
              for(j=0;j<TOTALCIM*16;j++)
              {
                 fscanf(hv,"%hi",&PixelHv[j]);
                   hr1->SetPoint(n,Temp,PixelHv[Channel]);
                }
           }
           for(i=0;i<n;i++)
              hr2->SetPoint(i,i,SetHV[Channel]);
           mg->Add( hr1 );
           mg->Add( hr2 );
           strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[lmidcounter]);
          strcat(TitleName,"   HV  ");
          strcat(TitleName,pix[Channel-count*16]);
          mg->SetTitle(TitleName);
           mg->Draw("AL*");
           Counter++;
           if((Channel-count*16)==15)
           {
             strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/HV/");
             strcat(OutputFile,"HV_LMID#");
             strcat(OutputFile,LMID[lmidcounter]);
            strcat(OutputFile,".pdf");
             c1->Print(OutputFile);
             count++;
             lmidcounter++;
             Counter=1;
             c1->Update();
               c1->Modified();
           }
         fclose(hv);
      }
/******************************************************** DT COMBINED****************************************************************************/

      count=0;lmidcounter=0;Counter=1;
      for(Channel=0;Channel<TOTALCIM*16;Channel++)
      {
         c1->cd(Counter);
          auto gr = new TGraph();
          gr->SetMarkerStyle(2);
          gr->SetMarkerSize(0.2);
          strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[lmidcounter]);
       //   if((Channel-count*16)==15)
       //      lmidcounter++;
          strcat(TitleName,"   DT  ");
          strcat(TitleName,pix[Channel-count*16]);
          gr->SetTitle(TitleName);
          DT=fopen("/home/pratibha/sandeep/MACE/dataout/DT.dat","r");
          for(n=0;;n++)
           {
              Temp=n;
              if(feof(DT))
                 break;
              for(j=0;j<TOTALCIM*16;j++)
              {
                 fscanf(DT,"%hi",&PixelDt[j]);
                   gr->SetPoint(n,Temp,PixelDt[Channel]);
                }
           }
           gr->Draw("AL*");


/*********************************************************************************************************************************************/

           Counter++;
           if((Channel-count*16)==15)
           {
             strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/DT/");
             strcat(OutputFile,"DT_LMID#");
             strcat(OutputFile,LMID[lmidcounter]);
            strcat(OutputFile,".pdf");
             c1->Print(OutputFile);
             count++;
             lmidcounter++;
             Counter=1;
             c1->Update();
               c1->Modified();

            }
         fclose(DT);
      }
/**************************************Module PCR*************************************************************************************************/

      TCanvas *c2 = new TCanvas("c2","PCR",200,10,700,500);
      for(CIM=0;CIM<TOTALCIM;CIM++)
      {
         auto gr1 = new TGraph();
        // gr2->SetMaximum(500);
          gr1->SetMarkerStyle(2);
          gr1->SetMarkerSize(0.2);
          strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[CIM]);
          strcat(TitleName,"   PCR  ");
          gr1->SetTitle(TitleName);
          fp3=fopen("/home/pratibha/sandeep/MACE/dataout/pcr.dat","r");
          for(n=0;;n++)
           {
              Temp=n;
              if(feof(fp3))
                 break;
              for(j=0;j<TOTALCIM;j++)
              {
                 fscanf(fp3,"%d",&pcr[j]);
                   gr1->SetPoint(n,Temp,pcr[CIM]);
                }
           }
           gr1->Draw("AL*");
           strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/PCR/");
         strcat(OutputFile,"PCR_LMID#");
         strcat(OutputFile,LMID[CIM]);
         strcat(OutputFile,".pdf");
         c2->Print(OutputFile);
         c2->Update();
           c2->Modified();
           fclose(fp3);
      }
/********************************************Module CCR*****************************************************************/
      TCanvas *c3 = new TCanvas("c3","CCR",200,10,700,500);
      for(CIM=0;CIM<TOTALCIM;CIM++)
      {
         auto gr2 = new TGraph();
        // gr2->SetMaximum(500);
          gr2->SetMarkerStyle(2);
          gr2->SetMarkerSize(0.2);
          strcpy(TitleName,"LMID#");
          strcat(TitleName,LMID[CIM]);
          strcat(TitleName,"   CCR  ");
          gr2->SetTitle(TitleName);
          fp4=fopen("/home/pratibha/sandeep/MACE/dataout/ccr.dat","r");
          for(n=0;;n++)
           {
              Temp=n;
              if(feof(fp4))
                 break;
              for(j=0;j<TOTALCIM;j++)
              {
                 fscanf(fp4,"%d",&ccr[j]);
                   gr2->SetPoint(n,Temp,ccr[CIM]);
                }
           }
           gr2->Draw("AL*");
           strcpy(OutputFile, "/home/pratibha/sandeep/MACE/dataout/Modulewise/CCR/");
         strcat(OutputFile,"CCR_LMID#");
         strcat(OutputFile,LMID[CIM]);
         strcat(OutputFile,".pdf");
         c3->Print(OutputFile);
         c3->Update();
           c3->Modified();
           fclose(fp4);
      }

/***********************************************************************************************************************/
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.