7.11 Particle Flow Tutorial: The PFRootEvent ROOT interface

Complete: 5


Detailed Review status

Overview

This page will teach you how to use the PFRootEvent ROOT interface for particle flow to:

  • do an event display of the objects relevant to particle flow
  • redo clustering and/or particle flow using the same algorithm libraries as in the full CMSSW

Introduction

The ROOT interface is located in src/RecoParticleFlow/CMS.PFRootEvent. It is able to read the CMSSW output tree, which may contain collections of PFRecHits, PFClusters, CMS.PFRecTracks, PFCandidates, PFSimParticles, jets, etc.

It has the advantage of being very fast. The main reason for it is that the geometry of the CMS detector does not have to be initialized, since it is hardwired in the various objects that are considered. For example, PFRecHits carry the position and axis direction of the corresponding calorimeter cell.

Example control files

The ROOT interface makes use of an homemade option file parsing system instead of the official configuration system (.cfg files), which is too rigid for us. particleFlow.opt is an example of option file, and is documented.

The option file is used in root macros located in CMS.PFRootEvent/test/Macros:

Software architecture

CMS.PFRootEvent is based on two classes:

  • PFRootEventManager, which handles event processing:
    • read data from the CMSSW Events TTree.
    • perform clustering
    • perform particle flow
    • hold the various collections of data:
      • read from the CMSSW Events Tree
      • obtained after clustering (clusters) or particle flow (blocks, candidates)
    • various printouts
  • DisplayManager, which is resonsible for the display of the PFRootEventManager.

The PFRootEventManager and the DisplayManager can be manipulated directly from the ROOT command line. In section Getting started with the display, we will see how to display an event using the member function display of the DisplayManager.

Getting started with the display (Fast Sim case)

Tip, idea To get the input file for PFRootEvent, please complete WorkBookParticleFlow#ParticleFlowHowtoFastSim

cd RecoParticleFlow/CMS.PFRootEvent/test
root
.x Macros/tauBenchmarkDisplay_famos.C
Several windows should open, showing different views of the first event: eta/phi view of the ECAL surface, eta/phi view of the HCAL surface, XY (the CMS detector is viewed along the z axis and appears as concentric circles), RZ (the CMS detector is viewed from the side, with the z axis horizontal).

To display the next event, simply do:

dm.display(i++); dm.lookForGenParticle(1)

Try to click on the various objects on the displays, and to zoom on the support axes.

Legend

  • legend for CMS.PFRootEvent display, XY view:
    legendXY.jpg

  • legend for CMS.PFRootEvent display, eta/phi view of ECAL surface:
    legendEPE.jpg

  • legend for CMS.PFRootEvent display, second eta/phi view of ECAL surface:
    legendEPE_2.jpg

Display Controls

Direct control

CMS.PFRootEvent is based on two classes:

  • PFRootEventManager, which handles event processing:
    • read data from the CMSSW Events TTree.
    • perform clustering
    • perform particle flow
    • hold the various collections of data:
      • read from the CMSSW Events Tree
      • obtained after clustering (clusters) or particle flow (blocks, candidates)
    • various printouts
  • DisplayManager, which is resonsible for the display of the PFRootEventManager.

The PFRootEventManager and the DisplayManager can be manipulated directly from the ROOT command line. In section Getting started with the display, we have already seen how to display an event using the member function display of the DisplayManager.

Most functions can be used in the same way, and most data members can be modified to fit your needs.

For example, here is how the default printout is performed:

em.print()

To modify the printout:

em.printMCtruth_ = true
em.printPFCandidates_ = false
em.printCluster_ = false
em.print()

Control through the option file

A good way to control PFRootEventManager and DisplayManager is to edit the option file, and to reload it.

Assuming particleFlow.opt is in use (this depends on the macro that you have called), you could edit this file and leave it opened in the backround.

For example, modify the following lines as you wish, and save the option file.

// print rechits yes/no
print rechits  0
// print clusters yes/no
print clusters 0
// print particle flow blocks yes/no
print PFBlocks     0
// print true particles yes/no
print true_particles 1
// print MC Truth
print MC_truth 0
// print reconstructed particles yes/no
print PFCandidates  1

Reload the file in the PFRootEventManager, and see the effect:

em.readOptions( "particleFlow.opt" )
dm.display( em.iEvent_ ); 

In case display options are modified, you need to reload the file into the DisplayManager:

dm.readOptions( "particleFlow.opt" )
dm.display( em.iEvent_ ); 

Graphical User Interface (GUI)

Finally, it now possible to manipulate some of the display options from an experimental GUI. To start the GUI:

DialogFrame *win = new DialogFrame(&em,&dm,gClient->GetRoot(), 200,220);

FAQ

How to print some information ?

To do a printout:

em.print()

The following options control the printout:

// print rechits yes/no
print rechits  0
// print clusters yes/no
print clusters 0
// print particle flow blocks yes/no
print PFBlocks     0
// print true particles yes/no
print true_particles 1
// print MC Truth
print MC_truth 0
// print reconstructed particles yes/no
print PFCandidates  1

IMPORTANT NOTE: "true particles" should in fact be called "simulated particles", while MC truth should be called "generated particles". The current names are misleading, and will be modified soon.

To print the first 30 generated particles in the GenEvent to std::cout:

em.printMCTruth( cout, 30 ) 

To print all particles to a file:

ostream out("out.txt")
em.printMCTruth( out ) 

How to center the view on a given GenParticle ?

First print the GenEvent (see How to print some information ?).

To center the eta/phi view on the 10th particle in the GenEvent:

dm.lookForGenParticle(10);

How to save the results ?

To save all the displays and the printout, in a directory MyDir_ (automatically created):

dm.printDisplay("MyDir_");

How to redo clustering and particle flow ?

As an example, let's redo clustering with different parameters.

  • edit particleFlow.opt to increase the seed threshold for ECAL barrel rechits. Set the following parameter to 1 GeV:
// seed threshold for ECAL barrel rechits
clustering thresh_Seed_Ecal_Barrel      0.15

  • read the option file from the ROOT interface:
em.readOptions("particleFlow.opt")

  • redo clustering, particle flow and display for the same event; center on most energetic rechit in ECAL:
dm.display( em.iEvent_ ); dm.lookForGenParticle(1)

Do not hesitate to play around with the various parameters driving clustering and particle flow, and watch the results on the display.

Review status

Responsible: Colin Bernet

Reviewer/Editor and Date (copy from screen) Comments
Last reviewed by: Colin - 27 Jul 2009 Created the page: moved the content from WorkBookParticleFlow

-- ColinBernet - 27 Jul 2009

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg legendEPE.jpg r1 manage 248.9 K 2007-11-09 - 13:29 ColinBernet legend for PFRootEvent display, eta/phi view of ECAL surface
JPEGjpg legendEPE_2.jpg r1 manage 195.1 K 2007-11-09 - 13:29 ColinBernet legend for PFRootEvent display, second eta/phi view of ECAL surface
JPEGjpg legendXY.jpg r1 manage 235.0 K 2007-11-09 - 13:28 ColinBernet legend for PFRootEvent display, XY view
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2009-12-07 - ColinBernet
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback