Hepevent common block and root

I found a problem which could affect many peple in the HEP community and I wonder if there is already a solution provided by someone.

That’s the problem: if I run pythia (or many other generator) the standard output comes in a ntupla which follow the hepevent standard common block. For each event there is a list of particles generated and indexed from 1 to the total number of particles generated in the event. This index (which identify the particle) is then used to refer to the mother and/or daughters of the given particles… this allows to find out decay chains for each given particle in the event.

Now if you want to use root to analyze this Hepevent you normally get the ntupla and using h2root transform it in a rootupla. And you are in a mess because the index for the particles in each event is changed from 1->Nparticles to 0->Nparticles-1 but the relative index of the mother and daughters stored in the common block is not and everything is shifted by 1. I hope to have been clear enough but I guess that people who have runned pythia know what I’m speaking about.

I tried to find out if there is any fix for this problem but seems that at least is not public available and discussing with few other peple in the CMS collaboration seems that the right way to go is getting the source code for h2root and change it a little bit to change also the value for mothers and daughters stored in the common block. We can name this new program something like hepevent2root and use it instead of the standard h2root…

Before to go on with this solution I’d like to get some comments and/or suggestions (or maybe someone has already solved this annoying problem and provide to me and to the CMS community a solution…)

Sorry for the long mail but I hope to get as much suggestions as I can on this item…

Thank you

Attilio

Attilio,

The solution to this problem is certainly not with a special version
of h2root. h2root cannot make any assumption of the type of data in the ntuple. Instead I would recommend
-to use the classes THbookFile, THbookTree to read the hbook data
-loop on all entries in the THbookTree
-Modify the data in memory for each event
-write this data to a normal TTree.

Rene

OK, I see what you mean, of course the solution is to read the content of the ntupla and correct all the values to deal with the index changes.

Now I was proposing to write an external program following the h2root strategy while you suggest to write a macro to be runned within root… well I’m not so sure what is the advanteges of the first method wrt to the second… the final goal is still to have a root file with a tree and the corrected values for mother and daughter infos…

Probably I’m a little bit naive but to me seems pretty equivalent…

Actually in CMS we have a standard package that all the users can use to produce the standard hepevent ntuplas starting from different generators… the ouput of the package (I’m talking about CMKIN for the people interested) is standard and there is also included an example of code to start a simple user analysis… my idea was to add to this package a script (or program) which allows everyone to trasform the ntupla in the correct rootupla… If you really think that the best way is to write a macro I’ll trust you but I’d really like to now the reasons…

Thank you for you valuable help and opinion…

Cheers

Attilio

Attilio,

I am not necessarily proposing a macro. You can implement a short program with the same interface as h2root, but using THbookFile/THbookTree and TTree.

If you have difficulties in implementing this small program, send me one of your hbook files and I will implement it (not before next week)

Rene

I spent the last weekend trying to write a macro that solve the problem quoted… at last.

The program works and the tree is now the correct one but at the end (when I quit root with the command .q) I got some error that I don’t understand.
I’m using the last 4.01 dev version on winXP:

WindowsXP/NT/w2000 with VC++ 7.1 (runs with VC++6), version 4.01/04 (good old tar file) WIN32GDK

This is the output:


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 4.01/02 24 September 2004 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

Compiled for win32.

CINT/ROOT C/C++ Interpreter version 5.15.152, Sep 13 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L makeHepEventRoot.C
root [1] doTransform()
This is a UnPacked CMKIN ntupla
This ntupla has 10 events
Processed 0 Events
root [2] .q
Warning in TStreamerInfo::Build:: TStreamerBase: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerBasicType: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerObject: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerObjectPointer: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerObjectAny: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerString: base class TStreamerElement has no streamer or dictionary it will not be saved
Warning in TStreamerInfo::Build:: TStreamerBasicPointer: base class TStreamerElement has no streamer or dictionary it will not be saved

What am I doing wrong?
I also attach the script code and a 10 events example ntupla.

Thank you

Attilio
makeRootpla.zip (220 KB)

no hint?

I cannot reproduce your prolem.
Could you move to 4.02 and try again?

Rene

Thank so for answearing… same here: with the new version no more problem.

Merry Christmas everybody!

Attilio