# Viewpoints NASA

## Viewpoints

### What is it?

From the website: Viewpoints (vp) is a high-performance visualization and analysis tool for large, complex, multidimensional data sets. It allows interactive exploration of data in 100 or more dimensions with sample counts, or the number of points, exceeding 10^6 (up to 10^8 depending on available RAM). Viewpoints was originaly created for use with the extremely large data sets produced by current and future NASA space science missions, but it has been used for a wide variety of diverse applications ranging from aeronautical engineering, quantum chemistry, and computational fluid dynamics to virology, computational finance, and aviation safety.

## BaBar tutorial

• Download the viewpoints executable from here. Note that there is support for Windows, Mac and Linux.
• Start the program. You should get 4 empty windows and a control panel to the left of them.
• If the program crashes on startup, it may be that you have older graphics drivers. See this FAQ page for more help. For instance, I can run this on my laptop but not my desktop at SLAC.
• Try the sample data that comes with the program.
• From the control panel: File --> Open data file --> (select sampledata.txt)
• This is some biometric data that the authors provide, but it has a small bug in it. The header information is marked with a "#" sign in the beginning of the file. The "#" should also be in front of the variable names, which is the last line before the data starts. You may choose to edit this file yourself and add a "#" before the names, or download a corrected version from sampledata.txt here.
• Note that the sample graphs are all 2D, but you can choose to add a 3rd axis to plot.
• Click on any of the 4 plots to select it, or click on the desired tab at the top of the control file.
• You can go to the plot buttons and using the drop down menu, select any of the other variables in the file.
• At the lower section of the control panel are multi colored tabs. While the data points are red, you can select other parts of a graph and color them in some other hue. Viewpoints opens with the blue selected by default.
• Here is where the power of viewpoints lies: use your mouse to select a square region in one of the plots as you would in some graphics program.
• The data points in the square region should appear blue, but even better the variables in the other plots for those "events" have now also been colored blue.
• This is a simple and intuitive way to explore correlations amongst variables in a dataset.

### Try some BaBar data

#### Converted photons

• Open it in viewpoints.
• On a suggestion from Steve Sekula, I grabbed converted photons (gamma --> e+ e-) from generic MC and dumped the XYZ-position found by vertexing the e+e- pair.
• These conversions occur in material, so we can produce an image of the SVT, which surrounds the interaction region.
• Some things to try:
1. For the first plot, add the Z position. Using the rotate slider you can see the structure of the material around the interaction point.
2. In the upper part of the control panel adjust the lumin.
3. While you do this, select the red tab on on the lower part of the control panel. Adjust lum1 and lum2 to highlight different features of the SVT.
4. If you hold down the middle button on your mouse and move the cursor diagonally across the plot from lower left to upper right, you can zoom in. Moving from upper right to lower left will zoom out.
5. On my machine, holding down the Ctrl button on my keyboard and the left mouse button allows me to do the same thing.
6. Using the same combinations of mouse buttons/keyboard as above but moving the cursor across the plot vertically or horizonally will stretch or squash the plot.

#### B decaying to D pi ($B\rightarrow D \pi$)

• From some Monte Carlo, I dumped the XYZ momentum (lab frame) for the final state particles for the decay
• B^0 --> D- pi+
• D- --> K pi pi
• This is from a set of exercises for new students.
• Once the user has set up a particular set of views/plots, viewpoints can dump that configuration to an XML file.
• Open viewpoints and load up the configuration file: File --> Load configuration --> (select BtoDpi_configurationFile.xml)
• The upper left plot is the momentum space of the pi from the B decay.
• The upper right plot is the momentum space of the K from the D decay.
• The lower left plot is the momentum space of one of the pi's from the D decay.
• The lower right plot is the momentum space of one of the the pi's from the D decay.
• There is minimal PID on the kaon and none on the pions.
• Some things to try/note:
1. Set the pion from the B decay to spin. Note the acceptance of BaBar in this space. Why is it hollow?
2. Note the radial lines in the kaon plot in the X-Y projection.
3. Select the blue tab and the upper left plot. Select a small square in the upper left of the X-Y projection.
• You should see the opposite corner of the other particles highlighted.
• Hold the Shift button down and left click on the original highlighted region, but hold the mouse button down.
• You can now drag that window around and see how slices of phase space map onto each other.
• At any point you can go to the bottom of the control panel and click on clear sections to reset the highlighted region.
• You can also select multiple regions with the different colours.
• You can also cut out the section with kill sections, but I don't know how to bring the points back without reloading the file.

#### B --> rho pi

• Taken from Tomo Miyashita's analysis.
• B0 --> rho pi
• rho --> pi pi
• Following examples are Monte Carlo run through the detector simulation.
• Open viewpoints and load up the flat phase space configuration file: File --> Load configuration --> (select Bto3pi_flatPhaseSpace.xml)
• The upper left plot is the Dalitz plot for m^2(pi+pi0) vs. m^2(pi+pi-)
• The upper right plot is cos(B-Sphericity) vs. cos(B-Sphericity). Hence the straight line.
• The lower left plot is the B-Sphericity vs. m^2(pi-pi0).
• The lower right plot is B-Thrust vs. B-Sphericity.
• Some things to try/note:
1. Go to the upper left plot an in the upper half of the control panel, select histog under the X axis.
• Select marginal and selection. You should have a histogram on the X-axis.
• You can play around with the N bins and bin ht to adjust it to your liking.
• This is a projection of the 2D plot. Since we have plotted the same variable on each axis, it's an easy way to plot a single variable.
2. Using the blue highlighting, select a region on this cos(B-Sphericity) line.
• By moving the box around, you should see the selected region sweep along the 1D projection as well.
• Note that the selected regions in the 1st plot (Dalitz plot) move around uniformly in the phase space.
• This is a good indication that cos(B-Sphericity) is not correlated with position in the Dalitz plot.
3. For the lower left plot, make the 1D projections for B-Thrust and B-Sphericity.
• Using the blue highlighter, select a vertical band (B-Sphericity) in this plane. Note how this maps on to the Dalitz plot.
• Using the yellow highlighter select a horizontal band (B-Thrust) in this plane. Note how this maps on to the Dalitz plot.
• This also looks kind of cool in the B-Sphericity vs. m^2(pi-pi0) (lower left) plot.
4. The Dalitz plot has the 3rd 2-body mass squared (m^2(pi-pi0)) on the Z-axis.
• Spin the Dalitz plot to see how the full 3D phase space looks.
• To appreciate the correlation amongst the variables, change the Z-axis of the Dalitz plot to be B-Sphericity and rotate the plot.

#### B --> Lambda0 e

• Taken from a current analysis of Matt Bellis and Elliott Jin.
• B- --> Lambda0 mu
• Lambda0 --> p pi-
• This analysis is ongoing and this summer we found viewpoints to be extremely useful in preliminary studies as we understand the data.
• This file is sideband data.
• We were finding that the data had much more background under the Lambda0 candidate than in the generic MC.
• Our selection of the generics did not include Bhabha events.
• e+ e- --> e+ e- gamma
• gamma --> e+ e-
• We realized that the extra background (non-Lambda0 events) could be coming from these radiative Bhabha events.
• For the creation of the ntuple, the charge of the pion from the Lambda0 was constrained to be the same charge as the electron.
• We wanted to learn if the background was correlated with:
1. Charge of the pion.
2. Tightness of PID of the pion.
3. Momentum distribution of the pion.
4. Number of tracks in the event.
• Open viewpoints and load up the flat phase space configuration file: File --> Load configuration --> (select BtoL0e_BhabhaStudy.xml)
• The upper left plot is M(Lambda0 candidate) vs. Flight len for Lambda0
• The upper right plot is momentum for the pion from the Lambda0 decay: |p| vs. cos(theta)
• The lower left plot is charge of the pion vs. whether the pion passed the tightest PID selector.
• The lower right plot is # of tracks (nTRKS) vs. # of tracks (nTRKS)
• I leave it to the reader to explore these questions with the data file.
• Of particular interest is the 1D projection of M(Lambda0 candidate) in the upper right plot. Project this onto the Y-axis to see the effect of your selections in the other variables.

• If you would like to try this program with your own ntuples, the easiest thing to do is to dump your data to a well-formatted text file.
• To start you off, here's a PyRoot script that can dump out selected variables. This is what I used for the B-->3pi data, so you'll want to edit this yourself.
• At SLAC, I can only run this on yakut10 or yakut11 because of ROOT/Python build compatibility issues.
• If you are having trouble running PyRoot scripts at SLAC, you may need to add the following line to your .cshrc
setenv PYTHONPATH ${ROOTSYS}/lib • If you want to learn more about PyRoot, here's some links.$ROOTSYS/tutorials/pyroot

## To do list

• I've tried modifying the source code to read in ROOT files.
• Not swinging, possibly because of namespace issues.
• We plan on contacting the authors of viewpoints to let them know that we are using their code.
• If there is enough interest, perhaps the next version may interface with ROOT files naturally.
• If we do contact the authors, are there any other suggestions we have?
• Circular selection regions (as opposed to the square regions)?
• Larger axis labels?
• After image rotation, can the selected regions map onto the rotation?
• Set up Hypernews forum.

## Our viewpoints successes!

• This tool becomes much more powerful as more of us use it and learn how to analyze our data with viewpoints.
• This Wiki is in a state of flux, but I urge you to post your viewpoints success stories!
• Viewpoints success stories
• Upload 1-3 images of your work and some details of what you are plotting and how it helped.
• You can also provide links to the .txt/.xml files if you like.
• If you're having problems getting to the Wiki, email me your work and I'll post it for you.