I have been trying to write a small code in order to load a tree so I can create a for loop over a a branch. At first I thought It wasn´t going to be difficult until this error came up. I have been looking for different ways to solve it but I don’t know how still:
IncrementalExecutor::executeFunction: symbol ‘_ZN6TClass8GetClassISt6vectorIfSaIfEEEEPS_bb’ unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass<std::vector<float, std::allocator > >(bool, bool)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZN6TClass8GetClassISt6vectorIiSaIiEEEEPS_bb’ unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass<std::vector<int, std::allocator > >(bool, bool)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZN6TClass8GetClassIyEEPS_bb’ unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass(bool, bool)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZN6TClass8GetClassIiEEPS_bb’ unresolved while linking [cling interface function]!
You are probably missing the definition of TClass* TClass::GetClass(bool, bool)
Maybe you need to load the corresponding shared library?
I’m attaching the code too just in case:
//C and C++ Libraries
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <vector>
#include <algorithm> // for std::find
#include <iterator> // for std::begin, std::end
// ROOT libraries
#include <TROOT.h>
#include <TH1D.h>
#include <TH2D.h>
#include <TTree.h>
#include <TFile.h>
#include <TF1.h>
#include <TRandom3.h>
#include <TCanvas.h>
#include <TChain.h>
#include <TColor.h>
#include <TStyle.h>
#include <TCutG.h>
//#include <TClass.h>
using namespace std;
int main(){
cout<< "Program started at: "<<endl;
system("/bin/date");
cout << endl;
//Defining the histogram
TH2F *TBA_Dt= new TH2F("TBA_Dt", "Top Bottom Asymmetry; Charge (ADCc); TBA; Events", 500,0,1600000,500,-1,1);
//////////////////////////////////////////
// Declare TTree and Variables //
//////////////////////////////////////////
//Connect tree file
ifstream finp("inputlist.txt");
string fileinput;
TChain* dstree = new TChain("dstree");
while(finp>>fileinput){
dstree->Add(fileinput.c_str());
cout<<"Input file: "<<fileinput<<endl;
}
//Declaration of leaves types
Int_t ev;
Int_t run;
Int_t npeaks;
Int_t evt_num;
ULong64_t trig_cnt;
vector<int> *pk_t;
vector<float> *pk_p;
vector<float> *pk_k;
vector<int> *pk_ch;
vector<int> *pk_xy;
vector<int> *ch_id;
vector<float> *ch_bl;
vector<float> *ch_rms;
vector<float> *ch_roi;
vector<int> *ch_sat;
vector<float> *ch_osc;
vector<float> *ch_fprompt;
vector<float> *trig;
vector<float> *Dt;
vector<float> *Max;
vector<float> *MaxP;
vector<float> *Min;
vector<float> *qP0;
vector<float> *qP1;
// Set branch addresses and branch pointers
dstree->SetBranchAddress("ev", &ev);
dstree->SetBranchAddress("run", &run);
dstree->SetBranchAddress("npeaks", &npeaks);
dstree->SetBranchAddress("evt_num", &evt_num);
dstree->SetBranchAddress("trig_cnt", &trig_cnt);
dstree->SetBranchAddress("pk_t", &pk_t);
dstree->SetBranchAddress("pk_p", &pk_p);
dstree->SetBranchAddress("pk_k", &pk_k);
dstree->SetBranchAddress("pk_ch", &pk_ch);
dstree->SetBranchAddress("pk_xy", &pk_xy);
dstree->SetBranchAddress("ch_id", &ch_id);
dstree->SetBranchAddress("ch_bl", &ch_bl);
dstree->SetBranchAddress("ch_rms", &ch_rms);
dstree->SetBranchAddress("ch_roi", &ch_roi);
dstree->SetBranchAddress("ch_sat", &ch_sat);
dstree->SetBranchAddress("ch_osc", &ch_osc);
dstree->SetBranchAddress("ch_fprompt", &ch_fprompt);
dstree->SetBranchAddress("trig", &trig);
dstree->SetBranchAddress("Dt", &Dt);
dstree->SetBranchAddress("Max", &Max);
dstree->SetBranchAddress("MaxP", &MaxP);
dstree->SetBranchAddress("Min", &Min);
dstree->SetBranchAddress("qP0", &qP0);
dstree->SetBranchAddress("qP1", &qP1);
//////////////////////////////////////////////
// LOOP OVER OUR TTREE //
////////////////////////////////////////////
// First of all, we are going to set the total number of events we have to study
Long64_t nentries= dstree->GetEntries();
cout<<"Total events: "<<nentries/1e6<< "millions"<<endl;
Long64_t totalEvents=0;
Long64_t nbytes=0;
//dstree->Scan("ch_roi");
float tba[nentries]; //¿missed pointer? Code run until this line
int diff=0;
for (int i = 0; i < nentries; i++) {
nbytes=dstree->GetEntry(i);
tba[i] = (ch_roi[0][i]-0.741*ch_roi[1][i])/(ch_roi[0][i]+0.741*ch_roi[1][i]);
diff=tba[i]-tba[i-1];
if(diff<0.01){
TBA_Dt->Fill(tba[i],ch_roi[0][i]+0.741*ch_roi[1][i]);
}
}
///////////////////////////////////////////////
// Opening output file //
/////////////////////////////////////////////
cout<<"Opening output file"<<endl;
TFile *output_file=new TFile("results_run00508.root","recreate");//change the name if the run of the inputlist changes
TDirectory *TopBottomAsymmetry=output_file->mkdir("Top Bottom Asymmetry");
cout<<"Output file opened"<< endl;
//////////////////////////////////////////////
// Writing output file //
////////////////////////////////////////////
//TopBottomAsymmetry
TopBottomAsymmetry->cd();
TBA_Dt->Write();
return 0;
}
void analyze2(){
main();
}
_ROOT Version: 6.26/06
Platform: Ubuntu
Compiler: Not Provided