Fill histogram with cosine of random distribution of other histogram

I am trying to fill a histogram with the cosine of a random distribution of a previously created histogram:

[code]TCanvas* c=new TCanvas(“c”, “Cosine Coeff”, 200,10,600,400);
TProfile* pcos=new TProfile(“pcos”,“Cosine Coeff Avg”, 100,-4,4,0,20);

for( int j=0; j<1000; j++){
g1->GetRandom();
c1=cos(2*g1);
pcos->Fill(c1);
}

pcos->Draw();[/code]

I get this error:

it says the error is in the line where I attempt to fill pcos

ROOT User’s Guide -> Histograms -> Profile Histograms
TProfile::Fill