Fork me on GitHub

Opened 11 years ago

Last modified 11 years ago

#260 new How to

Having Difficulty reaching the weight of events.

Reported by: ahmadborzou Owned by: borzou
Priority: major Milestone:
Component: Delphes code Version: Delphes 3
Keywords: Weight Cc:

Description

I want to have the weight of each event in my sample. Using TBrowser I can see the branch "Event". And, under that I see Event.Weight which shows 1 for most of the events. Now I want to access this Event.Weight in a macro. But I don't know how to do so.
I have done the following but it doesn't work

.
.
.
TClonesArray *branchEvent = treeReader->UseBranch("Event");
/ Loop over all events
treeReader->ReadEntry(entry);
event = (Event*) branchEvent->At(0);
cout << "weight : " << event->Weight << endl;

but I get the following error:
Error: Symbol event is not defined in current scope main.C:100:
Error: Failed to evaluate event->Weight

Change History (1)

comment:1 by Michele Selvaggi, 11 years ago

Hi,

please try this instead

LHEFEvent *event = (LHEFEvent*) branchEvent -> At(0);

or, if you are using HepMC format do:

HepMCEvent *event = (HepMCEvent*) branchEvent -> At(0);

Michele

Note: See TracTickets for help on using tickets.