6 Standalone Scripts
Renata Kopecná edited this page 2022-02-10 15:14:00 +01:00

Before using these scripts, please check the include paths: in order to organize the folder in a meaningful way, the location of the scripts changed!

Backgrounds

In this folder, scripts used for various background-related checks are saved.

BackgroundCheck.cc

Checks the mass and angle distribution in different mass regions.

CompareBackgroundSamples.cc

Takes the different samples used to check backgrounds (B0KstMuMu, B0KstJpsi, B0XJpsi, BK1Jpsi, BK1MuMu), scales them according to the size of available samples to match the signal sample, and plots the contributions of each sample to the B+ DTF mass.

DoubleMisIDtest.cc

Fakes the double-misID of pi+ and mu+. Checks how many of the fake double misIDed events would pass the double-misID filter in the preselection.

MisID.cc

Compares the double-missID distributions in Jpsi and B+ masses before and after MVA cut.

InclusiveCheck.cpp

Checks the Bplus and Kstar mass as well as the Q2 distributions from the inclusive sample.

IncSamplePlot.cpp

Checks the TRUEID of particles and plots possible sources of background in one plot. Selected data from the BtoXJpsi sample are used as input.

Data Manipulation

Scripts used to copy/move/restore tuples.

moveStuff.sh

Copies MC tuples from a folder to a different one.

restore_data_from_backup.sh

Chnages the name of the 201X_pi0Resolved_backup.root files to 201X_pi0Resolved.root. Useful when you need to revert some additional cut.

Multiple Candidates

testRunNumber.cpp

Check the number of double candidates using a pairing function from run and event number.

Selection

AddVariable.cpp

Adds TRUE (PX,PY,PZ,PT,ETA,PHI,M,E) pi0 resolved branches. Adds XMuMu mass. Applies veto on the KplusMuMu mass. Applies veto on the PizMuMu mass.

DTFcomparison.cc

Plots comparison plots of different particle masses, PT, ETA and angles using DTF (fixing the pi0 or Ks mass) and not using DTF.

compareVariables.cc

Compares sWeighted data to reference MC in the distributions used for MVA training. This was replaced by the more powerful python tool. However, this script can be quickly used to check the sWeights, so it is kept.

Efficiency.cpp

A backup of originally used Efficiency.cpp in the selection. This script includes calculation of

  • L0Muon efficiency
  • Overall TM efficiency using the B+ mass, TM variable can be chosen
  • TM efficiency from the B+ mass in bins of a desired variable
  • TM efficienc from the pi0 maass in bins of a desired variable
  • Multiple candiddates removal efficiency
  • Scan MVA efficiency (in steps fo the MVA response)
  • Plot the MVA efficiency at a certain TMVA cut in bins of a desired variable
  • Scan total efficiency
  • Read the efficiency from a given plot
  • Test how flat the TM efficiency is

EfficiencyClass.cpp

A backup of the EfficiencyClass.cpp used in the selection. Provides EffAndError class and helper functions for the Efficiency.cpp.

MakeNiceTMplots.cpp

Script used to check the possible methods of Truth Matching.

  • Compares what types of gammas are present in the sample.
  • Compares the contribution of different gamma types in the B+ mass.
  • Compares the contribution of different gamma types in the angles.
  • Creates comparison plots for different ways how to Truth Match the data in the angles.

TMefficiency.cpp

Makes very pretty plots of truthmatching efficiencies using the pi0 mass. The script can perform TM efficiency study with different combinations of properties below.

  • Different TM methods
  • Different fits of the pi0 mass
  • Different (re)weighting
  • Efficiency for signal and for background

PreselectionOptimizer.cpp

Quick short script that allows to add cuts on already preselected tuples.

q2_veto.cpp

Creates 1D and 2D (Bplus mass) plots of the Q2 distributions and the Q2 vetoes.

QuickChecker.cpp

Epicly flexible tool to quickly create basic plots for checking various features.

All definitions happen in the AllBranches constructor, where used branches are defined. Cuts are also defined in the constructor, the strings are transferred to CopyTree. This is the part where you need to add your cuts.

EpicOptimizer() doesn't need to be touched at all.

Options to create either standalone years plots (Run==0), plots per Run (Run==1 || Run ==2) or both runs combined (Run==12)

Possibility to run on stripped/preselected data/MC/PHSP/Ref. In the case of MC also possibility to run only on TruthMatched data.

Standard output in data/MC/PHSP/Ref folder, year/run and preselection option in the name.

Disclaimer: Probably leaky and not super-safe to you, so proceed with caution.

sWeightSelection.cc

Loops over all .root files created by the MVA selection and adds some more kinematic, PID and other cuts. The tuples are saved in a new tuple.

Resolution

PiZeroResolution.cpp

Checks the resolution of Bplus, Kstar, Kplus and pi0 in many kinematical variables and the angles. Also creates residual and pull plots.

Trigger checks

AALLSAMEBPVcheck.cc

Checks the MC samples for a possible bug in the Hlt2Topo2BodyBBDT trigger line.

LaTeX

GetTableOfMVASignificance.cc

Script used to create tables of the TMVA significance. Output is a LaTeX table.

GetTablesOfEventNumbers.cc

Outputs a LaTeX table with number of events at selection steps.

Putting plots into LaTeX slides

In order to quickly and easily include all the plots into slides, python script to put figures into slides is included. It is possible to set how many plots in how many rows are there. The corresponding files are Codes/Scripts/LaTeX/putIntoSlides.py and Codes/Scripts/LaTeX/putIntoSlides_Utils.py.