TCanvas::Print wont take a variable as an argument

I wanted to loop over a block of code that calls a function (Loop())to create a histogram and then save it as a .png. TCanvas::Print is giving me an argument error as it only accepts a string as an argument. Is there any other way to do this? Any help would be appreciated.

   for (int i=0;i<N;i++){ 
      TCanvas *canva = new TCanvas("canva","Pt vs v2 and v3 for Proton, Pion and Kaon",1000,1000); 
      this->Loop(i,canva);
      canva->Print("./Plot/g"+to_string(i)+".png");        
      };

Here is a link to the actual code.

_ROOT Version:6.26
_Platform: Windows
_Compiler: Clang

canva->Print(Form("./Plot/g%d.png",i));   
1 Like