# How do I switch from the laboratory reference frame to the center of mass system?

Hello! Dear users, could you tell me what the problem is? I need to switch from the laboratory reference frame to the center of mass system of the virtual photon-proton system. I read the particle data from the file, then calculate their four-vector and with Boost everything should work. But for some reason the angle between the final proton and the photon does not turn out to be 180 degrees.

``````else if (lineCount % 4 == 3)
{
iss.clear();
iss.seekg(0);
for (int i = 0; i < 3; i++)
{
iss >> dummy;
}
double ID;
iss >> ID;
//std::cout << ID << std::endl;

iss.clear();
iss.seekg(0);
for (int i =0; i < 6; i++)
{

iss >> dummy;
}
iss >> px >> py >> pz;
//std::cout << "px " <<px << "py " << py << "pz " << pz <<std::endl;
iss.clear();
iss.seekg(0);
for (int i =0; i < 9; i++)
{
iss>> dummy;
}

double energy;
iss >> energy;
Ppi.SetPxPyPzE(px, py, pz, energy);
Ppi.Boost(-Pcm.BoostVector());

double theta = TMath::RadToDeg() * Ppi.Theta();
double phi = TMath::RadToDeg() * Ppi.Phi();
energy = Ppi.E();
/*hist1->Fill(energy, phi);
hist2->Fill(energy, theta);
hist3->Fill(theta,phi);*/

}

else if (lineCount % 4 == 0)
{
iss.clear();
iss.seekg(0);
for (int i = 0; i < 3; i++)
{
iss >> dummy;
}
double ID;
iss >> ID;
//std::cout << ID << std::endl;

iss.clear();
iss.seekg(0);
for (int i =0; i < 6; i++)
{

iss >> dummy;
}
iss >> px >> py >> pz;
//std::cout << "px " <<px << "py " << py << "pz " << pz <<std::endl;
iss.clear();
iss.seekg(0);
for (int i =0; i < 9; i++)
{
iss>> dummy;
}

double energy;
iss >> energy;
Pterm.SetPxPyPzE(px, py, pz, energy);
Pterm.Boost(-Pcm.BoostVector());

}

}

file.close();

/*hist1->GetXaxis()->SetTitle("E, GeV");
hist1->GetYaxis()->SetTitle("Phi, °");
hist2->GetXaxis()->SetTitle("E, GeV");
hist2->GetYaxis()->SetTitle("Theta, °");
hist3->GetYaxis()->SetTitle("Phi");
hist3->GetXaxis()->SetTitle("Theta, °");

hist1->Draw();