9 MCtruthmatching.cpp
Renata Kopecná edited this page 2022-02-10 11:19:26 +01:00

In this script, the MC truthmatching is executed. The script can check both the background category of the decay or perform true-ID based truthmatching. Since this had to be heavily optimized for the K+pi0 channel, the KShort part is obsolete, but in principle it should work.

The corresponding classes are defined in TMsource.cpp.

Table of Contents

Global variables

I would say they are pretty self-explanatory :)

  • Double_t YieldBeforeTruthMatching
  • Double_t YieldAfterTruthMatching
  • Double_t YieldBeforeTruthMatchingErr
  • Double_t YieldAfterTruthMatchingErr

Functions

passGammas()

Checks the TRUEIDs of the gammas, including the (grand(grand))mother IDs.

  • Parameters
    • gamma1: gamma_IDs class of the first gamma
    • gamma2: gamma_IDs class of the second gamma
    • *counter: counter class to see the number of vetoed events
    • B_plus_TM: Check whether the gamma TRUEID chain originates from a B?
    • K_star_plus_TM: Check whether the gamma TRUEID chain originates from a Kstar?
    • pi_zero_TM: Check whether the gamma TRUEID chain originates from a pi0?
    • gamma_TM: Check gamma TRUEID?
    • gamma_TM_full: if true, don't check the gamma TRUEID chain, just return true
  • Result Returns a number from 1 to 6:
    • 1: Both gammas are actually gammas
    • 2: One gamma is gamma, one is converted
    • 3: Both are converted
    • 4: One gamma is real, one is random
    • 5: One gamma is converted, one is random
    • 6: Both gammas are random

passAllTM()

Checks the TRUEID decay chain, fills some mass histograms and returns whether the event is sucessfully truthmatched or not.

  • Parameters
    • B_plus: Bplus_IDs class of the Bplus
    • K_star: K_star_IDs class of the Kstar
    • J_psi: J_psi_IDs class of the J/psi
    • mu_plus: mu_IDs class of the mu+
    • mu_minus: mu_IDs class of the mu-
    • K_plus: K_plus_IDs class of the Kplus
    • pi_zero: pi_zero_IDs class of the pi0
    • K_short: K_short_IDs class of the Ks
    • pi_plus: pi_plus_IDs class of the pi+
    • Ks_pi_plus: Ks_pi_IDs class of the pi+ from Ks
    • Ks_pi_minus: Ks_pi_IDs class of the pi- from Ks
    • *counter: counter class to see the number of vetoed events
    • *h_pi0_mismatched_mass: histogram to be filled with the mass of mismatched pi0
    • *h_Bplus_M_pi0mismatched: histogram to be filled with the B+ mass for events with mismatched pi0
    • *h_Bplus_M_noPi0Constr:histogram to be filled with the B+ mass for events with any pi0
    • *h_pi0_resolved_mass: histogram to be filled with the pi0 mass
    • *h_Bplus_M_pi0random: histogram to be filled with the B+ mass for events with random
    • B_plus_TM: Check whether the TRUEID chain originates from a B?
    • K_star_plus_TM: Check whether the TRUEID chain originates from a Kstar?
    • K_plus_TM: Check whether the TRUEID chain originates from a Kplus?
    • pi_zero_TM: Check whether the TRUEID chain originates from a pi0?
    • pi_zero_full_TM: Check whether the TRUEID of pi0?
    • mu_TM: Check whether the TRUEID of muons is correct?
    • J_psi_TM: Check whether the TRUEID chain originates from a Jpsi?
  • Result
    Returns a boolean: passed (event is TMed) or not passed (event is not TMed)

Int_t MCtruth()

Reads a tree, performs the truthmatching based on the settings in GlobalFunctions.hpp, creates, fills and saves a lot of mass and TRUEID histograms. Saves the truthmatching branch in a new tuple. The old tuple is backed up and overwritten by the new tuple. The meaning of the parameters is in BDTSelection.cpp.

  • Parameters
    • year
    • magnet
    • ReferenceChnnel
    • PHSP
    • B0
    • K1
    • Inc
  • Result\
    • If everyhting is fine, returns 1, otherwise returns 0.

bool restore_from_backup

Restores the backup file created by Int_t MCtruth().

  • Parameters
    • string year = "2011"
    • string magnet = "down"
    • bool ReferenceChannel = false
    • bool PHSP = false
    • bool B0 = false
    • bool K1 = false
    • bool Inc = false
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.

bool restore_allyears_from_backup

Calls bool restore_from_backup for both polarities and years corresponding to the selected Run.

  • Parameters
    • int Run = 1
    • bool Reference = false
    • bool PHSP = false
    • bool B0 = false
    • bool K1 = false
    • bool Inc = false
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.

bool restore_all_from_backup

Calls bool restore_from_backup for both Runs, Sig, Ref and PHSP MC. Does not restore the bkg samples (aka B0 = K1 = Inc = false)!

  • Parameters
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.

Int_t TruthMatchAllBkg

Runs Int_t MCtruth() for all years. Runs the selected bkg sample (either B0, K1 or Inc).

  • Parameters
    • bool Reference = false
    • Int_t Run = 1
    • bool B0 = false
    • bool K1 = false
    • bool Inc = false
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.

Int_t TruthMatchAll

Runs Int_t MCtruth() for all years. Runs the selected MC sample (either signal, reference or PHSP).

  • Parameters
    • bool Reference = false
    • bool PHSP = false
    • Int_t Run = 1
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.

Int_t TruthMatchAllAll

Runs Int_t MCtruth() for all years. Runs over all MC samples for given Run.

  • Parameters
    • Int_t Run
  • Return
    • If everyhting is fine, returns 1, otherwise returns 0.