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

**URL:** <https://root-forum.cern.ch/t/how-do-i-switch-from-the-laboratory-reference-frame-to-the-center-of-mass-system/57558>\
**Category:** Newbie\
**Tags:** root\
**Created:** [December 15, 2023, 7:08am UTC](https://root-forum.cern.ch/t/how-do-i-switch-from-the-laboratory-reference-frame-to-the-center-of-mass-system/57558 "2023-12-15T07:08:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![filveronika](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/filveronika/32/35297_2.png) [@filveronika](https://root-forum.cern.ch/u/filveronika)\
**Post date:** [December 15, 2023, 7:08am UTC](https://root-forum.cern.ch/t/how-do-i-switch-from-the-laboratory-reference-frame-to-the-center-of-mass-system/57558/1 "2023-12-15T07:08:58Z")

</div>

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.

```auto
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, °");
  
    pad1->cd();
    hist1->Draw();
  
    pad2->cd();
    hist2->Draw();
  
    pad3->cd();
    hist3->Draw();
  
    canvas->SaveAs("pionCM.png");*/
    
    }

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [December 15, 2023, 7:53am UTC](https://root-forum.cern.ch/t/how-do-i-switch-from-the-laboratory-reference-frame-to-the-center-of-mass-system/57558/2 "2023-12-15T07:53:11Z")

</div>

Welcome to the ROOT foum.

May be @moneta or @Danilo know ?
