-- DanielScheirich - 2009-10-04

VP1BPhysSystem for VP1


Virtual Point 1 (VP1) is a visualization tool for ATLAS experiment, that allows to display content of AOD/ESD files (tracks, calo clusters, muons, missing ET, hits, etc.) together with the ATLAS geometry. Each type of objects is displayed via different VP1 systems (e.g. VP1TrackSystem, VP1VertexSystem, et.c) which are accesed by plugins providing channels (e.g. VP13DCoctailChannel). For more information on VP1 go to the webpage http://atlas-vp1.web.cern.ch/atlas-vp1/.

System VP1BPhysSystem was created to help visualize and validate results of B-physics analyzes. At present time it offers the following features:

  • Display all the inner detector tracks (TrackParticleCandidates collection form AOD)
  • Display and highlight selected signal tracks
  • Display neutral tracks from vertex fits
  • Display refitted charged tracks from vertex fits
  • Display secondary vertices from vertex fits

Since AOD/ESD files don't contain output of the physics analysis (refitted tracks, vertices, neutral tracks) those must be stored in an external file (VP1BPhys Display File). VP1BPhys Display File is a ROOT file containing a plain ROOT tree. Each entry in the tree corresponds to one vertex and contains a list of charged and neutral tracks coming from/to that vertex. Entries are synchronized with the AOD events using run and event numebrs. In order to use VP1BPhysSystem you must create VP1BPhys Display File from whatever ntuple you get from your analysis. More information on how to create VP1BPhys Display File is given in the following section of this wiki.

Please note, that this document as well as the VP1BPhysSystem itself are relatively new and are still under development. If you have any comments or sugestions don't hasitate to contact me (daniel.scheirich@cernSPAMNOTNOSPAMPLEASE.ch)

Getting started with VP1

First you need to set up Athena in the usual way using a devval nightly build. Detailed instructions on how to do that can be found here Workbook. The following way works for me:

  • in your CMT home create the requirements file such as mine:
    set SITEROOT /afs/cern.ch
    macro ATLAS_DIST_AREA ${SITEROOT}/atlas/software/dist
    macro ATLAS_TEST_AREA /afs/cern.ch/user/s/scheiric/home/workdir
    use AtlasLogin AtlasLogin-* $(ATLAS_DIST_AREA)
    Use correct ATLAS_TEST_AREA path to your test area folder.
  • source /afs/cern.ch/sw/contrib/CMT/v1r20p20090520/mgr/setup.sh
  • configure CMT: cmt config
  • run setup.sh script: source setup.sh -tag=rel_4,32,devval,slc4,gcc34,setup
  • if your test area directory doesn't exist yet, create it mkdir $TestArea
  • and change to it cd $TestArea

NOTE You don't need to neccessary work in nightly release rel_4. It's important that you use nightly build that was made after Oct 1, 2009.

VP1 is a part of the Athena release so after setting up Athena enviroment you should be able to run it just by typing

vp1 aod.pool.root

where aod.pool.root is the input AOD file you want to display. If everything is setup correctly after a while VP1 window will come out. At this point you have access to the full functionality of the standard VP1, however VP1BPhysSystem won't be loaded (however, this might change with time). Detailed description of the VP1 functions can be found on the webpage http://atlas-vp1.web.cern.ch/atlas-vp1/doc/

NOTE You can exclude parts of the detector by running VP1 with some additional parameters. I have encountered some problems with calorimeter (segmentation fault), so if you have the same problem consider exluding the calorimeter from the display:

vp1 -nocalo aod.pool.root

Compiling the VP1BphysSystem

In order to use VP1BPhysSystem you have to check out and compile two packages from the svn. The first one is VP1BPhysSystem itself, the second one is VP13DCocktailPlugin which provides access to all the VP1 systems:

cd $TestArea
cmt co -r VP13DCocktailPlugin-00-06-02 graphics/VP1/VP1Plugins/VP13DCocktailPlugin
cmt co graphics/VP1/VP1Systems/VP1BPhysSystems
cd graphics/VP1/VP1Systems/VP1BPhysSystems/cmt
cmt config
source setup.sh
cd $TestArea/graphics/VP1/VP1Plugins/VP13DCocktailPlugin/cmt
cmt config
source setup.sh

If compilation finished successfully you can execute VP1:

cd $TestArea
vp1 -nocalo aod.pool.root

NOTE If you want to work with the fixed release (e.g. 15.5.1) you will have to download and recompile entire VP1 from the HEAD version. Go to http://atlas-vp1.web.cern.ch/atlas-vp1/vp1patches.php webpage, download the script vp1patch_cvshead_checkoutandbuildall.x and follow the instruction. The compilation will take quite some time.

Creating the VP1BPhys Display File

VP1BPhys Display File is a ROOT file that contains a single Tree named vp1bphys. Each entry in the tree correspond to one vertex. The tree has the following branches:

Branch Description
int evtNum Event number
int runNum Run number
double vtx_x Vertex position
double vtx_y  
double vtx_z  
double vtx_xx Vertex covariance matrix
double vtx_yy  
double vtx_zz  
double vtx_xy  
double vtx_xz  
double vtx_yz  
int vtx_mother Index of the mother vtx.
unsigned long vtx_color Color used for drawing
std::vector<int>* vtx_daughters Indices of daughter vertices
Charged tracks  
std::vector<double>* track_pt Charged track parameters
std::vector<double>* track_eta  
std::vector<double>* track_phi  
std::vector<double>* track_d0  
std::vector<double>* track_z0  
std::vector<double>* track_charge  
std::vector<double>* track_refitted_px Refitted momentum
std::vector<double>* track_refitted_py  
std::vector<double>* track_refitted_pz  
std::vector<unsigned long>* track_color Track color
std::vector<unsigned long>* track_refitted_color Refitted track color
Neutral tracks  
std::vector<double>* neutral_refitted_px Neutral track momentum
std::vector<double>* neutral_refitted_py  
std::vector<double>* neutral_refitted_pz  
std::vector<double>* neutral_length Length of the track
std::vector<int>* neutral_decay Decay vertex
std::vector<unsigned long>* neutral_color Track color

In principle you can create the vp1bphys tree by yourself just by filling all the branches. To make the job easier the convertor class is available in rootScripts folder of the VP1BPhysSystem package. To use it just copy files VP1BPhysConvertor.h and VP1BPhysConvertor.cxx to your ROOT working directory and include file VP1BPhysConvertor.cxx into your ROOT macro. You will gain access to two classes:

  • VertexNode
  • VP1BPhysConvertor
VertexNode class is used to define the topology of the decay you want to display, VP1BPhysConvertor then creates the vp1bphys tree and saves it to the specified output file.

The vp1bphys tree can be made in the following steps:

1. define the decay topology using the following syntax:
VertexNode* primaryVertex = new VertexNode();
VertexNode* bParticleVtx = primaryVertex->addDaughter();
VertexNode* secondaryVtx1 = bParticleVtx->addDaughter();
VertexNode* secondaryVtx2 = bParticleVtx->addDaughter();

This will create a tree-like structure, where we have a primary vertex which is a mother to the B particle vertex. The B particle vertex is the mother to the secondary vertices 1 and 2 (where secondary unstable particles decayed.) Note that only vertices are added to the topology tree. In a lot of cases there can be more unstable secondary particles but the final statetracks are fitted to a single vertex. Such a case is for instance decay Bs -> J/psi(mm)+phi(KK). Life-times of J/psi and phi are so short that they decay almost instantly and therefore muon and kaon tracks are coming from a single vertex. On the other hand, in case of the LambdaB -> J/psi(mm) + Lambda0(p pi) decay Lambda0 will create a well separated secondary vertex and thus both LambdaB and Lambda0 vertices must be created.

2. create instance of the convertor class
VP1BPhysConvertor convertor(primaryVertex, "vp1bphys.root");

The convertor class will create a ROOT tree. The first parameter of the constructor is pointer to the first vertex in the decay topology which is a primary vertex in our example. The second parameter specify the output file name, which must have an extension .root.

3. loop over the decay candidates. You have to open whatever ntuple you get from your physics analysis and access the parameters of the original charged tracks, their refitted parameters, vertex positions and error matrices, and neutral tracks. Then you will add them to the decay topology tree using methods of the VertexNode class:

VertexNode::setVtxPosition(double x, double y, double z) sets vertex position to (x,y,z)

VertexNode::setVtxError(double xx, double xy, double xz, double yy, double yz, double zz) sets vertex covariance matrix

VertexNode::setVtxColor(unsigned long color) sets vertex color. To define color use function getColor(int red, int green, int blue) where red, green, blue goes from 0 to 255.

VertexNode::addTrack(double px, double py, double pz, double d0, double z0, double charge, unsigned long color, double refPx, double refPy, double refPz, unsigned long refColor) adds a charged track to the vertex. Triplet px,py,pz defines the original track's momentum, d0 and z0 are its impact parameters (at the moment those are not important, you can set them to 0), charge is +1/-1, color specify which color should be used to draw the track (again ise function getColor) and triplet refPx, refPy, refPz is refitted momentum at vertex.

VertexNode::addNeutralTrack(double px, double py, double pz, unsigned long color) adds a neutral track to the vertex.

Once all the tracks and verices are added to the decay topology tree, method convertor.fill(runNumber, eventNumbr) must be called to copy all the values into the ROOT tree. Variables runNumber and eventNumbr must be specified so that VP1BPhysSystem is able to match the events with the ones in the AOD file.

4. save the ROOT tree by calling convertor.save().

Read the section Examples to get more familiar with VP1BPhysConvertot.

Using VP1BPhys

Before you start VP1, you need to have an AOD file and VP1BPhys Display File created from the analysis that was ran on that AOD. Read the previous section and examples to learn how to create VP1BPhys Display File. You also need to compile the latest version of VP1BphysSystems and VP13DCocktailPlugin as it is described in section Compiling the VP1BphysSystem.

Once you have all of that you can start VP1:

vp1 aod.pool.root (or vp1 -nocalo aod.pool.root if you don't want to use calorimeter).

If everything was setup correctly the window like this will pop up:


Click on All studies and you will gain access to all the 3D systems in VP1. If the the latest version of VP1BPhysSystems and VP13DCocktailPlugin is compiled successfully, there will be a checkbox BPhys in the left panel of the VP1 window:


By clicking on BPhys you gain access to VP1BPhysSystem. The new tab BPhys will appear at the top of the panel and you click on that tab to see display options of VP1Bphys.


Note that there are no tracks displayed in the mind frame of the VP1. This is because you haven't loaded any VP1BPhys Display File yet. To do that, click on Load file button in the left panel and choose appropriete root file. If your file was created correctly you should get something like this:


Note the message in left part of the window saying "No event to display". This means that the Display File doesn't contain the event that is being displayed from AOD. This doesn't neccessary mean that there is an error. It happens quite often that some events won't pass our physics analysis selection and therefore won't be included into the display file. So let's move forward and try to find some events that passed the selection. You do that by clicking at blue arrow button in left-bottom corner of the VP1 window. This will load the next event.


This snapshot shows an example of simulated LambdaB->J/psi(mm) + Lambda0(p pi) event. Note two highlited red tracks belonging to muons. The green and cyan tracks belong to proton and pion. The color of the tracks is not specified in VP1 but in the display file and can't be changed through VP1 gui. If you want to change the color of some tracks you have to generate a new display file.

There is no point in going to great detains and explaining all the functions of VP1BPhys here. Just try to chnage different checkboxes in the Bphys tab and see what'll happen, it's quite intuitive.


To be done...

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng fig1.png r1 manage 63.7 K 2009-10-06 - 17:30 DanielScheirich  
PNGpng fig1_2.png r1 manage 80.4 K 2009-10-06 - 17:35 DanielScheirich  
PNGpng fig2.png r1 manage 79.6 K 2009-10-06 - 17:30 DanielScheirich  
PNGpng fig3.png r1 manage 94.4 K 2009-10-06 - 17:31 DanielScheirich  
PNGpng fig4.png r1 manage 96.1 K 2009-10-06 - 17:31 DanielScheirich  
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2009-10-06 - DanielScheirich
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

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