Fork me on GitHub

Opened 8 years ago

Closed 8 years ago

#997 closed How to (fixed)

cannot access subjets in code

Reported by: Nikolay Kolev Owned by:
Priority: minor Milestone:
Component: Delphes code Version: Delphes 3
Keywords: subjets Cc:

Description

I am using Delphes 3.3.2 and need subjet information, e.g.
Jet_TrimmedP4[5][kMaxJet]. If I open the root file in TBrowser,
I get the graph with 5 times as many entries as the number of
jets. In code, I get all zeroes, e.g.:

for (int i = 0; i < Jet_; i++)
{

cout << (Jet_TrimmedP4[0][i])[0] << endl;
.....

}

or:

cout << (Jet_TrimmedP4[0][i]).Pt() << endl;

Wht am I doing wrong?

Attachments (3)

delphes_card_CMS.tcl (18.9 KB ) - added by Nikolay Kolev 8 years ago.
mononew_zero_jet_left_subjet_1.h (58.4 KB ) - added by Nikolay Kolev 8 years ago.
mononew_zero_jet_left_subjet_1.C (2.4 KB ) - added by Nikolay Kolev 8 years ago.

Download all attachments as: .zip

Change History (8)

by Nikolay Kolev, 8 years ago

Attachment: delphes_card_CMS.tcl added

by Nikolay Kolev, 8 years ago

by Nikolay Kolev, 8 years ago

comment:1 by Michele Selvaggi, 8 years ago

Do the following:

for(i = 0; i < branchJet->GetEntriesFast(); ++i)
{
     jet = (Jet*) branchJet->At(i);
     TLorentzVector p[5];
 
     for( Int_t j = 0; j < 5; j++)
     {
        p[j] = jet->TrimmedP4[j];
        cout<<p[j].Pt()<<endl;
       ...   
      }
}


comment:2 by Nikolay Kolev, 8 years ago

Thank you for the quick reply. So I need access to the jets branch. I tried several things and can't get it right, e.g.:

TBranch *jet = fChain->GetBranch("Jet");
for (int i = 0; i < jet->GetEntriesFast(); i++)
{ ........

Error: Can't call TBranch::GetEntriesFast () in current scope.

So I guess my question is: what is branchJet in the context of the class that MakeClass makes?

comment:3 by Michele Selvaggi, 8 years ago

Have a look at examples/Example3.C

comment:4 by Nikolay Kolev, 8 years ago

Thanks.

I was trying to keep using MakeClass; so I rewrote the analysis code as the delphes examples suggest and everything is working now; I have access to the subjets. As a side effect since it is now a regular c++ program using root and delphes libraries and doesn't run under root, it is going orders of magnitude faster.

I guess it is always worth doing things properly.

Thank you for the help.

Nikolay

comment:5 by Michele Selvaggi, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.