Fork me on GitHub

Opened 6 years ago

Closed 6 years ago

#341 closed How to (fixed)

Limit in turth information written

Reported by: jaraque Owned by:
Priority: minor Milestone:
Component: Delphes code Version: Delphes 3
Keywords: Cc:

Description

Hi,

I am using some truth information which is written in the Delphes TTree with the Particle branch but for the information I am using I don't all the particle level information with all hadronisation, with the 40 or 50 first particles would be enough. The problem (or feature) is that since I have to read a huge number of variables per event my analysis takes some time to run. Is it possible to store particle level information only up toa given number of particles? So, limiting the size of the Particle branch not to include all particle generated by hadronisation?

Thanks a lot in advance,
Juanpe.

Change History (5)

comment:1 Changed 6 years ago by mselvaggi

Hi Juanpe,

the quick and dirty way would be to simply add a break statement in the loop.
If you have a disk space issue, then you have to apply a filter at the time of running delphes.

For instance you could have a look at modules/StatusPidFilter, but you will have to modify it to your own needs.
(as of now, it keeps only particles with status 3, with hard coded pdg codes).

https://cp3.irmp.ucl.ac.be/projects/delphes/browser/trunk/modules/StatusPidFilter.cc

After you have modfied it (and recompiled ..), you can call it in the following way in your data card:

set ExecutionPath {
  MyFilter
  …
}

module StatusPidFilter MyFilter {
set InputArray Delphes/allParticles
set OutputArray filteredParticles
}

…


module TreeWriter TreeWriter {
# add Branch InputArray BranchName BranchClass
  add Branch MyFilter/filteredParticles Particle GenParticle
  ...
}


Hope this helps,
Michele


Last edited 6 years ago by mselvaggi (previous) (diff)

comment:2 Changed 6 years ago by jaraque

Hi Michele,

thanks a lot! I think it might help indeed. Just a question, since I would like to save the first 50 or so particles, would be enough to exit the while loop in StatusPidFilter?.cc::85 after 50 particles have written?

I think so but it is better to check.

Thanks a lot!
Juanpe.

comment:3 Changed 6 years ago by jaraque

Also, another small question, when you say

module StatusPidFilter MyFilter {
add InputArray Delphes/allParticles
add OutputArray filteredParticles
}

you mean set instead of add right? I have never added a new module to a Delphes so I am not sure if that is the correct syntax.

Thanks,
juanpe.

Last edited 6 years ago by jaraque (previous) (diff)

comment:4 Changed 6 years ago by mselvaggi

Hi,

yes I meant "set" not "add" (edited).
If you are analysing stdhep files generated with MG5+Pythia6 you can simply set status = 3, which will keep all particles involved in the hard scattering.
If you are using herwig then the conventions for status is a bit different and you might wanna print it out for some events to see what is the best criterium for filtering according to your needs.
This said, probably keeping the first 50 particles should do it for most cases, but better check first.

Michele

comment:5 Changed 6 years ago by pavel

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.