Divide() canvas not working

I am trying to follow this worksheet from Hance and recreate the invariant mass plot below from his root file. I have attached my code and the root file can be downloaded from the website.

Anyway, when I try to run my code, I get the following error:HEP_practiceV5.C (20.6 KB) ___

In file included from input_line_13:1:
/home/nick/PHY496/mhance/HEP_practiceV5.C:658:3: error: use of undeclared identifier 'c19_1'
                c19_1->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:665:3: error: use of undeclared identifier 'c19_2'
                c19_2->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:672:3: error: use of undeclared identifier 'c19_3'
                c19_3->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:679:3: error: use of undeclared identifier 'c19_4'
                c19_4->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:696:3: error: use of undeclared identifier 'c20_1'
                c20_1->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:703:3: error: use of undeclared identifier 'c20_2'
                c20_2->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:710:3: error: use of undeclared identifier 'c20_3'
                c20_3->cd();
                ^
/home/nick/PHY496/mhance/HEP_practiceV5.C:717:3: error: use of undeclared identifier 'c20_4'
                c20_4->cd();

Could someone explain why ‘Divide()’ is not working here?
ROOT Version: 6.22
Platform: Linux Ubuntu 18.04

As the error messages tell you, c19_1, etc. don’t exist. Anyway, if your canvas is c19, and is divided in 2x2, you need to use

 c19->cd(1);  // and similar for 2, 3 and 4

Note also you have wrong definition of TH1F:

	TH1F *histTotPx = new TH1F("histTotPx", "TotpX hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
	TH1F *histTotPy = new TH1F("histTotPy", "TotpY hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
	TH1F *histTotPz = new TH1F("histTotPz", "TotpZ hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);
	TH1F *histTotE = new TH1F("histTotE", "TotE hist", xNChannels, xMin, xMax, yNChannels, yMin, yMax);

These are TH2F constructors, not TH1F.