Dear friends,
I hope you are well
I want to calculate invariant mass of two opposite charge muons, my code is:
#include "TFile.h"
#include "TTree.h"
#include "TCanvas.h"
#include"TVector3.h"
#include"TH1F.h"
#include <TLatex.h>
#include<iostream>
using namespace std;
//task1
void readEvents(){
TFile * f = new TFile("data.root");
TTree * tree=(TTree *)f->Get("events");
Int_t nEntries=tree->GetEntries();
cout<<"There are"<<nEntries<<"entries in your ntuple"<<endl;
//task2
Int_t NMuon;
Int_t Muon_Charge[5];
Float_t Muon_Px[5];
Float_t Muon_Py[5];
Float_t Muon_Pz[5];
Float_t Muon_E[5];
//task3
tree->SetBranchAddress("NMuon",&NMuon);
tree->SetBranchAddress("Muon_Charge",&Muon_Charge);
tree->SetBranchAddress("Muon_Px", &Muon_Px);
tree->SetBranchAddress("Muon_Py", &Muon_Py);
tree->SetBranchAddress("Muon_Pz", &Muon_Pz);
tree->SetBranchAddress("Muon_E", &Muon_E);
//task4
for(Int_t entry=0;entry<nEntries; entry++){
TLorentzVector masspositive;
TLorentzVector massnegative;
TLorentzVector Mass;
if(NMuon==2)
if(Muon_Charge[1]!=Muon_Charge[2])
masspositive.SetPxPyPzE(Muon_Px[1],Muon_Py[1],Muon_Pz[1],Muon_E[1]);
massnegative.SetPxPyPzE(Muon_Px[2],Muon_Py[2],Muon_Pz[2],Muon_E[2]);
Mass=masspositive+massnegative;
Double_t invariantmass=Mass.Dot(Mass);
cout<<invariantmass<<endl;
}
}
and I get this error:
cling::DynamicLibraryManager::loadLibrary(): /home/zahra/root/macros/HEPTutorial_0/HEPTutorial/files/example.x: cannot dynamically load position-independent executable
Error in <TCling__LazyFunctionCreatorAutoloadForModule>: Failed to load library /home/zahra/root/macros/HEPTutorial_0/HEPTutorial/files/example.x
cling::DynamicLibraryManager::loadLibrary(): /home/zahra/root/macros/HEPTutorial_0/HEPTutorial/files/example.x: cannot dynamically load position-independent executable
Error in <TCling__LazyFunctionCreatorAutoloadForModule>: Failed to load library /home/zahra/root/macros/HEPTutorial_0/HEPTutorial/files/example.x
IncrementalExecutor::executeFunction: symbol '_ZN6TClass8GetClassIiEEPS_bb' unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass<int>(bool, bool)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN6TClass8GetClassIA5_iEEPS_bb' unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass<int [5]>(bool, bool)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN6TClass8GetClassIA5_fEEPS_bb' unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass<float [5]>(bool, bool)
Maybe you need to load the corresponding shared library?
Can anybody help me?
Thanks a lot
_ROOT Version: 6.22/06
_Platform:Ubuntu 20
_Compiler: Linux terminal