#include "TROOT.h" #include "TRint.h" #include "TH1F.h" #include "TH2F.h" #include "TF1.h" #include "TCanvas.h" #include "TChain.h" #include "TVector3.h" #include "TMath.h" #include "TFile.h" #include "TSystem.h" #include "TGStatusBar.h" #include "TSystem.h" #include "TXMLEngine.h" #include "TTree.h" #include "TLorentzVector.h" #include "TNtuple.h" #include "TStyle.h" #include "TGraphErrors.h" #include "TGraph.h" #include #include #include #include #include #include #include #include #include #include #include "g12_ecor.hpp" #include "g12_pcor.hpp" using namespace std; // "ROOT Script" entry point (the same name as the "filename's base"). int example_root(void) { clog << "This program compiled against CERN's root libraries.\n"; string parms_dir = "."; /// Initialization of Momentum Correction Parameters clog << "Reading in momentum correction parameters...\n"; clas::g12::MomentumCorrection pcor(parms_dir); /// loop over events { /// example event with typical numbers float run = 56363; float ebeam = 1.2; /// Beam energy correction ///////////////////////////////////// float new_ebeam = clas::g12::corrected_beam_energy(run, ebeam); /// //////////////////////////////////////////////////////////// float id = 14; // proton (geant 3 ID codes) TVector3 p; p.SetX(0.3); p.SetY(0.4); p.SetMag(1.1);// total momentum float pz = p.Z(); float phi = p.Phi(); float theta = p.Theta(); TVector3 new_p = p; /// Momentum correction //////////////////////////////////////// new_p.SetMag(p.Mag() + pcor.pcor(phi,id)); /// //////////////////////////////////////////////////////////// cout << "Measured:\n" << " run: " << run << endl << " ebeam: " << ebeam << endl << " p (px,py,pz): " << p.Mag() << ", (" << p.X() << "," << p.Y() << "," << p.Z() << ")\n" << " (theta,phi): (" << p.Theta() << "," << p.Phi() << ")\n" << "After Correction:\n" << " ebeam: " << new_ebeam << endl << " p (px,py,pz): " << new_p.Mag() << ", (" << new_p.X() << "," << new_p.Y() << "," << new_p.Z() << ")\n" << " (new_theta,new_phi): (" << new_p.Theta() << "," << new_p.Phi() << ")\n"; } return 0; } #if !defined(__CINT__) && !defined(__ACLIC__) // "Standalone Application" entry point ("main"). int main(int /*argc*/, char ** /*argv*/) { return example_root(); // just call the "ROOT Script" } #endif /* !defined(__CINT__) && !defined(__ACLIC__) */