Pass fifo to Delphes

Asked by Michael Russell

Hello,

I have some LHE events from MG5 I’m passing through Pythia8/Delphes. Since I need a huge event sample, I end up with a very large intermediate HepMC file to give to Delphes and then delete. Is it possible to pipe the pythia HepMC output directly into Delphes without writing it to disk? I see it is possible to write out HepMC to a named pipe (fifo) for use with MadAnalysis. The same thing does not seem to work for Delphes, it doesn’t read from the fifo and I just end up with an empty root file. Is there a way of doing this?

Best,
Michael

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Michael Russell
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi Michael,

I do not think that Delphes is supporting fifo file as input. But please contact them to check.
In any case, we do not support the automatic linking of the fifo (like for MA5) but you can still create the fifo via our method, and then just run Delphes on that fifo and it should work (if this possible for the Delphes code obviously).

Cheers,

Olivier

> On 18 Jan 2018, at 14:17, Michael Russell <email address hidden> wrote:
>
> New question #663227 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/663227
>
> Hello,
>
> I have some LHE events from MG5 I’m passing through Pythia8/Delphes. Since I need a huge event sample, I end up with a very large intermediate HepMC file to give to Delphes and then delete. Is it possible to pipe the pythia HepMC output directly into Delphes without writing it to disk? I see it is possible to write out HepMC to a named pipe (fifo) for use with MadAnalysis. The same thing does not seem to work for Delphes, it doesn’t read from the fifo and I just end up with an empty root file. Is there a way of doing this?
>
> Best,
> Michael
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
Michael Russell (michael768) said :
#2

Hi Olivier,

Thanks for the quick reply, I'll check with the Delphes people.

Michael

Revision history for this message
Fabrizio Nesti (fnesti) said (last edit ):
#3

Dear Michael (and Olivier)
did you then manage to integrate the pipe for delphes in the MG flow?

It seems to work by hand, if tag_1_pythia8.cmd contains

     HEPMCoutput:file = myfifo

and then you run things manually:

   mkfifo myfifo
   HEPTools/MG5aMC_PY8_interface/MG5aMC_PY8_interface tag_1_pythia8.cmd &
   cat myfifo | Delphes/DelphesHepMC delphes_card.dat events.root

But I wonder if/how to make this work with PY8 splitting etc....

Any clue? Needless to say this would be often of major help.
Thanks in advance!

Revision history for this message
Fabrizio Nesti (fnesti) said (last edit ):
#4

Ok, meanwhile, I made it work, from madevent.

Because it could be useful to somebody, I post below the two minimal changes one needs to apply. Then this is the usage:

In madevent:
1- run pythia8 (and setup "HEPMCoutput:file = fifo" in the pythia card)
2- let it go (it spawns the pythia8 interface script)
3- run delphes

Hope this helps. Maybe it could be a useful addition to the standard MG5 tree.
Best whishes,
Fabrizio

============Here the changes ======================================

1- In Template/LO/bin/internal/run_delphes3, replace some lines as follows

# else
# if [ ${file: -4} == ".hep" ]
# then
# $delphesdir/DelphesSTDHEP ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
# else
# $delphesdir/DelphesHepMC2 ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
# fi
# fi
elif [ ${file: -4} == ".hep" ]
  then
    $delphesdir/DelphesSTDHEP ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
elif [ ${file: -5} == ".fifo" ]
  then
    echo "INFO: Delphes3 running on FIFO file: $file"
      cat $file | $delphesdir/DelphesHepMC2 ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root
else
    $delphesdir/DelphesHepMC2 ../Cards/delphes_card.dat ${run}/${tag}_delphes_events.root $file
fi

2- in madgraph/interface/common_run_interface.py just add pjoin(self.me_dir,'Events',self.run_name, 'PY8.hepmc.fifo') to the list of searched files.

E.g. in MG 3.3.2, it goes at line364, the section reads as follows:

 paths = [pjoin(self.me_dir,'Events',self.run_name, '%(tag)s_pythia_events.hep.gz'),
                     pjoin(self.me_dir,'Events',self.run_name, '%(tag)s_pythia8_events.hepmc.gz'),
                     pjoin(self.me_dir,'Events',self.run_name, '%(tag)s_pythia_events.hep'),
                     pjoin(self.me_dir,'Events',self.run_name, '%(tag)s_pythia8_events.hepmc'),
                     pjoin(self.me_dir,'Events','pythia_events.hep'),
                     pjoin(self.me_dir,'Events','pythia_events.hepmc'),
                     pjoin(self.me_dir,'Events','pythia8_events.hep.gz'),
                     pjoin(self.me_dir,'Events','pythia8_events.hepmc.gz'),
                     pjoin(self.me_dir,'Events',self.run_name, 'PY8.hepmc.fifo')
                     ]