Projection on a axis from TH2D

I get many errors, so it seems to not be right:

/home/axel/Downloads/Jessica.PQ/test/test.C:60:12: error: expected unqualified-id
    double M_PI = TMath::Pi();
           ^
/usr/include/math.h:1070:16: note: expanded from macro 'M_PI'
# define M_PI           3.14159265358979323846  /* pi */
                        ^
In file included from input_line_11:1:
/home/axel/Downloads/Jessica.PQ/test/test.C:99:14: error: use of undeclared identifier 'h1x'
 int nbinx = h1x->GetNbinsX();
             ^
/home/axel/Downloads/Jessica.PQ/test/test.C:100:14: error: use of undeclared identifier 'h1y'
 int nbiny = h1y->GetNbinsX();
             ^
/home/axel/Downloads/Jessica.PQ/test/test.C:101:41: error: use of undeclared identifier 'h1y'
 TH1F* dcp = new TH1F("dcp", "", nbiny, h1y->GetBinCenter(1), h1y->GetBinCenter(nbiny));
                                        ^
/home/axel/Downloads/Jessica.PQ/test/test.C:101:63: error: use of undeclared identifier 'h1y'
 TH1F* dcp = new TH1F("dcp", "", nbiny, h1y->GetBinCenter(1), h1y->GetBinCenter(nbiny));
                                                              ^
/home/axel/Downloads/Jessica.PQ/test/test.C:118:12: error: redefinition of 'c1'
  TCanvas *c1 = new TCanvas();
           ^
/home/axel/Downloads/Jessica.PQ/test/test.C:86:14: note: previous definition is here
    TCanvas *c1 = new TCanvas();
             ^
/home/axel/Downloads/Jessica.PQ/test/test.C:127:5: error: use of undeclared identifier 'cpviolation'
    cpviolation->Write();
    ^

As I said, SA_th23dcp->ProjectionY() - that will give you a TH1 and should be what you’re after.

Cheers, Axel.