Problem compiling macro with real data

Hey,

i’m trying to run the following code:

void example_01()
{
    TFile *fin = new TFile( "jpsi.root" );
    
    TTree *T;
    fin->GetObject("T",T);
    
    BEvent* Event = new BEvent();
    T->SetBranchAddress("BEvent",&Event);
    
    TH1F *h_jpsi = new TH1F ( "h_jpsi", "Invariant Mass of #mu^{+}#mu^{-}", 140, 2.7, 3.4 );
    
    int NEvents = (int)T->GetEntries();
    for (int idx=0;idx<NEvents;idx++) {
        
        if ((idx % 1000) == 0) printf ( "At Event: %d/%d.\n",idx,NEvents);
        T->GetEntry(idx);
        
        int NParticles = Event->NParticles();
        TClonesArray& Plist = *(Event->GetParticleList());
        
        for (int i=0;i<NParticles;i++) {
            for (int j=0;j<NParticles;j++) {
                
                BParticle* P1 = (BParticle*)Plist[i];
                BParticle* P2 = (BParticle*)Plist[j];
                
                if (P1->pid()!=MUON  || P2->pid()!=MUON ) continue;
                if (P1->charge()!=+1 || P2->charge()!=-1) continue;
                
                float Px = P1->px() + P2->px();
                float Py = P1->py() + P2->py();
                float Pz = P1->pz() + P2->pz();
                float E  = P1->e()  + P2->e();
                float P  = sqrt(Px*Px + Py*Py + Pz*Pz);
                float Mass = sqrt(E*E - P*P);
                
                h_jpsi->Fill(Mass);
            }
        }
    }
    
    TCanvas* c1 = new TCanvas("c1","c1",600,400);
    h_jpsi->SetFillColor(622);
    h_jpsi->Draw();
}

First, i use .L peaks.C (name of the file). Then i do: example_01() and i get this:

" IncrementalExecutor::executeFunction: symbol ‘_ZN6BEvent15GetParticleListEv’ unresolved while linking [cling interface function]!
You are probably missing the definition of BEvent::GetParticleList()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZN6BEventC1Ev’ unresolved while linking [cling interface function]!
You are probably missing the definition of BEvent::BEvent()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZTI6BEvent’ unresolved while linking [cling interface function]!
You are probably missing the definition of typeinfo for BEvent
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘_ZN6BEvent10NParticlesEv’ unresolved while linking [cling interface function]!
You are probably missing the definition of BEvent::NParticles()
Maybe you need to load the corresponding shared library? "

I really don’t know what’s going on, cause i have been running several similar codes perfectly.

Thanks!

As the error message says, did you load the library containing the definition of BEvent::GetParticleList(), BEvent::BEvent(), and BEvent::NParticles()?

Hey, bellenot. I tried, but i got the message:

Info in TUnixSystem::ACLiC: creating shared library /home/mapse/VisualS/Aulas 10 e 11 - ADFAE/Onze/./BEvent_cc.so
sh: 1: Syntax error: Unterminated quoted string
Error in : Compilation failed!
BParticle.cc/BEvent.cc loaded.

thanks.

Could you try in a location without the Aulas 10 e 11 - ADFAE subdirectory? (this is maybe confusing ACLiC)

BTW, you can also try to load the macro without compiling it (if it’s only one file…)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.