6 GlobalFunctions.hh
Renata Kopecná edited this page 2022-01-31 09:44:27 +01:00

Table of Contents

Global variables

Decay Options

  • const bool KshortChannel = GetKSfromExePath()
  • const bool SplitDDandLL = KshortChannel ? true : false //for pi0 SplitDDandLL is always false!
  • std::string TheDecay = (KshortChannel ? "KshortPiplus" : "KplusPi0Resolved")
  • const bool Kst2Kpluspi0Resolved = !KshortChannel
  • const bool Kst2Kpluspi0Merged = false //We do not use merged pi0, so set to false. This option is pretty much obsolete.
  • const bool Kst2Kspiplus = KshortChannel //David's option, no clue what it is good for

Paths

Hardcoded paths to the folders with data

  • const std::string path_to_data = "/auto/data/dgerick/B2Kstmumu"
  • const std::string path_to_output_KshortPiplus = "/auto/data/dgerick/B2Kstmumu"
  • const std::string path_to_output_KplusPizero = "/home/lhcb/kopecna/B2KstarMuMu/data"
  • const std::string thePath = Kst2Kspiplus ? path_to_output_KshortPiplus : path_to_output_KplusPizero

Basic options

  • const bool smallSample = false //option that used to be used in testing, somewhat obsolete but can be easily added
  • const bool UseDTF = KshortChannel ? true : true //use mass and momenta of particles obtained by DTF?
  • const bool UsePDGmIn4Dvectors = KshortChannel ? false : true //Use PDG values when calculating four-momenta or use the reconstructed mass?
  • const bool ReweightByRefChannel = KshortChannel ? true : true //Pretty much obsolete, always use reference channel to reweight
  • const bool AlwaysUseRefChannelData = KshortChannel ? true : true // same as above
  • const bool Use2017 = KshortChannel ? true : true //Relic from 2017, when we were adding new data
  • const bool Use2018 = KshortChannel ? true : true //Relic from 2018, when we were adding new data
  • const bool UsePIDgen = KshortChannel ? true : false //In KS, they used PID weights on top of the 2D weights in MC

Weighting options

  • const std::string firstMCweight = (KshortChannel ? "nLongTracks" : "nLongTracks") //Name of the branch of the first weight
  • const std::string seconMCweight = KshortChannel ? (UseDTF ? "B_plus_PT_DTF" : "B_plus_PT") : (UseDTF ? "B_plus_PT_DTF" : "B_plus_PT") //Name of the branch of the second weight
  • const UInt_t firstnBins = 75 //number of bins in the weighting histogram
  • const UInt_t secondnBins = 50 //number of bins in the weighting histogram
  • const double firstMCrange[2] = {-0.5, 149.5} //range of the weighting histogram
  • const double seconMCrange[2] = {TMath::Log(1500.), TMath::Log(50000.)} //range of the weighting histogram
  • const std::string firstMClatex = KshortChannel ? "N^{Long}{Tracks}" : "N^{Long}{Tracks}" //Latex names of the weight histogram
  • const std::string seconMClatex = KshortChannel ? "p_{T}(B^{+}) ( MeV/c )" : "p_{T}(B^{+}) ( MeV/c )" //Latex names of the weight histogram

Truth-matching options

  • const bool UseBKGCAT = KshortChannel ? true : false //Use background category from TupleToolMCBackgroundInfo
  • const bool pi0TM = true //Truth-match pi0?
  • const std::string TMtag = UseBKGCAT ? "" : "_TM" + std::string(pi0TM ? "" : "_noPi0TM")
  • const std::string TMbranch = "TMed" + std::string(UseBKGCAT ? "BKGCAT" : "") + std::string(pi0TM ? "" : "_noPi0")
  • const std::string gammaTMbranch = "TM_gammas" + std::string(pi0TM ? "" : "_noPi0") //name of the branch with pi0 truth-matching ID
  • const bool gammaTMdefault = false //Truth-match gammas?

Cuts

  • const double cut_DTF_status = 0.5
  • const double cut_DTF_chi2 = 200.0
  • const double K_star_plus_mass_difference = 100.0 //MeV //difference between K* mass and PDG K* mass
  • const double cut_B_plus_M_low_basic = 4900. //pre-DTF cut
  • const double cut_B_plus_M_low = KshortChannel ? 5150. : 5150. //MeV
  • const double cut_B_plus_M_high = KshortChannel ? 6000. : 5800. //MeV
  • const double B_plus_M_signal_window = KshortChannel ? 50. : 100 //MeV -- as PDGmass +/- the window
  • const double cut_kin_Theta_low = 0.0 //kinematic cut <=> pseudorapidity (for each particle, except for gammas)
  • const double cut_kin_Theta_up = 0.4 //kinematic cut <=> pseudorapidity (for each particle, except for gammas)
  • const double cut_K_star_plus_pT = 1350.0 //MeV
  • const double cut_B_plus_pT = 2000.0 //MeV
  • const double cut_pi_zero_PT = 800.0 //MeV
  • const double cut_B_plus_DIRA = 0.99996 //DIRA is nicely explained in my thesis, page 45
  • const double cut_muon_angle = 0.001 //cut on angles between particles
  • const double cut_B_plus_FDCHI2 = 121.0
  • const double cut_K_star_plus_FDCHI2 = 9.0
  • const double cut_B_plus_ConePTasym = -0.5 //conePT is explained in my thesis, page 47
  • const double cut_DiMuon_M = 7100.0 //MeV, dimuon mass cut
  • const double cut_muon_IPCHI2_OWNPV_low = 9.0
  • const double cut_IPCHI2_OWNPV_low = 0.0
  • const double cut_IPCHI2_OWNPV_high = 12.0
  • const double cut_muon_ProbNNmu = 0.25
  • const double cut_K_plus_ProbNNk = 0.25
  • const double cut_gamma_CL = 0.15 //gamma confidence level, explained in my thesis, page 48
  • const bool SplitInQ2 = KshortChannel ? false : false //rather obsolete, but still allows you to split the sample based on Q2 below and above J/psi
  • const float SignalRegionNsigma = 2.; //How many sigmas around the signal peak comprises the signal region

Constants

  • TString TMVAmethod = KshortChannel ? "BDTG" : "MLP" //used TMVA method
  • struct PDGMASS //PDG masses in MeV
    • const Double_t B_PLUS = 5279.29
    • const Double_t B_ZERO = 5279.61
    • const Double_t J_PSI = 3096.90
    • const Double_t PSI_2S = 3686.10
    • const Double_t K_STAR_PLUS = 891.66
    • const Double_t K_ONE_PLUS = 1272.0
    • const Double_t K_PLUS = 493.68
    • const Double_t K_SHORT = 497.61
    • const Double_t PI_PLUS = 139.57
    • const Double_t PI_ZERO = 134.98
    • const Double_t MU = 105.66
    • const Double_t GAMMA = 0
  • struct TRUEIDS //IDs of particles (see Monte Carlo numbering scheme
    • const Int_t B_PLUS = 521
    • const Int_t B_ZERO = 511
    • const Int_t K_STAR_PLUS = 323
    • const Int_t K_STAR_ZERO = 313
    • const Int_t K_ONE_PLUS = 10323 // K1(1270)+
    • const Int_t K_ONE_PLUS_1400 = 20323 // K1(1400)+
    • const Int_t K_ONE_PLUS_1410 = 100323 // K1(1410)+
    • const Int_t K_ONE_ZERO = 10313 // K0(1270)+
    • const Int_t K_PLUS = 321
    • const Int_t K_SHORT = 310
    • const Int_t PI_PLUS = 211
    • const Int_t PI_ZERO = 111
    • const Int_t RHO_ZERO = 113
    • const Int_t MU_MINUS = 13
    • const Int_t GAMMA = 22
    • const Int_t J_PSI = 443
    • const Int_t ELECTRON = 11
  • const double BR_sig = 8.668e-7;
  • const double BR_sig = 8.668e-7; //BR for B+ -> K*+ mu mu without resonances from flavio (09-05-19)
  • const double BR_ref = 1.43e-3 * 5.961e-2; //PDG value for B+ -> J/psi K*+ times J/psi -> mu mu
  • const double BR_ref2 = 6.7e-4 * 8.0e-3; //PDG value for B+ -> psi(2s) K*+ times psi(2s) -> mu mu

output levels

  • int verboseLevel = 2
    • verboseLevel 0: cout Tests, Debugs, Infos, Warnings and Errors
    • verboseLevel 1: cout Debugs, Infos, Warnings and Errors
    • verboseLevel 2: cout Infos, Warnings and Errors
    • verboseLevel 3: cout Warnings and Errors
    • verboseLevel 4: cout Errors (always cout errors)

colors

Colors are defined using #define as it is a constant everywhere

  • cBOLDWHITE // Bold White
  • cBOLDRED // Bold Red
  • cBOLDGREEN // Bold Green
  • cGREEN // Green
  • cBOLDCYAN // Bold Cyan
  • cCYAN // Cyan
  • cRED // Red
  • cBOLDRED // Bold red
  • cYELLOW // Yellow
  • cBOLDYELLOW // Bold Yellow
  • cRESET // Resets the colors

Structs

  • struct SignalFitParameters //Obsolete, used to be the starting parameters in the B mass fit
  • struct FixedParameters //Obsolete, used to be the fixed parameters in the B mass fit

Global functions

for_indexed(...)

Loops over the vector while having access to the index of the vector. The index is stored as i.

  • Parameters
    • std::vector

for_indexed_v()

Loops over the vector while having access to the index of the vector. The index is stored in my_counter.

  • Parameters
    • int my_counter
    • std::vector

Functions

bool GetKSfromExePath()

  • Return
    • Returns 1 if the current directory is in davids folder, else returns 0

bool isTM()

Takes the truth-matching response and checks whether the event passes the selection. It is useful as there are different ways how to truth-match, so this returns the truth-matching response based on the inputs.

  • Parameters
    • std::string customTMbranch
    • bool TM
    • bool gammaTM
    • int gTM
  • Return
    • 1 if event passes truthmatching, 0 if not

double getTMVAcut(int Run)

  • Parameters
    • int Run
  • Return
    • Returns the TMVA cut for given Run.

inline bool exists_test()

  • Parameters
    • const std::string& name
  • Return
    • True if the name exists, false otherwise.

void setVerboseLevel()

Changes the verbosity level.

  • Parameters
    • int level

bool set_gErrorIgnoreLevel()

  • Parameters
  • Return
    • Always true

bool get_gErrorIgnoreLevel = set_gErrorIgnoreLevel()

I am also confused what would be this good for. Take if for obsoletel.

void coutTest()

Prints a test message.

  • Parameters
    • string message

void coutDebug()

Prints a debug message.

  • Parameters
    • string message

void coutInfo()

Prints an info message.

  • Parameters
    • string message

void coutWarning()

Prints a warning message.

  • Parameters
    • string message

void coutERROR()

Prints an error message.

  • Parameters
    • string message

double get_cut_B_plus_M_low()

We have tested different lower B plus cuts for different Run. Now it is obsolete.

  • Parameters
    • int Run = 2 //setting lower B mass cut for different run/years
  • Return
    • Lower B plus mass cut for given Run.

double get_cut_B_plus_M_low()

We have tested different lower B plus cuts for different years. Now it is obsolete.

  • Parameters
    • std::string year = "2015"
  • Return
    • Lower B plus mass cut for given year.

bool IsDST()

  • Parameters
    • std::string year
    • bool MC
    • bool ReferenceChannel
    • bool PHSP
  • Return
    • True if the given sample is DST, False if it is mDST

void addLHCbtag()

Creates and draws the LHCb + suffix tag.

  • Parameters
    • Float_t x = 0.6
    • Float_t y = 0.85
    • std::string suffix = ""
    • Int_t color = 1
    • Float_t Scaling = 1.0

std::string Float2Comma()

Takes float and the precision and converts the float to a string.

  • Parameters
    • Float_t f
    • Int_t d
  • Return
    • String made of floats.

bool replace()

Takes a string with a substring from and replaces it to to.

  • Parameters
    • std::string& str
    • const std::string& from
    • const std::string& to
  • Return
    • False is the from string doesn't exist, otherwise true.

void printVector ()

Overloaded function, takes an int, double or a string vector and prints it as a single string, separated by a space.

  • Parameters
    • std::vector<int, double, string> vector

std::vector<string> yearsMC ()

  • Parameters
    • bool Reference = false
    • bool PHSP = false
    • int Run = 1
  • Return
    • A vector of strings containing all available years for the given MC sample.

std::vector<string> yearsData ()

  • Parameters
    • int Run = 1
  • Return
    • A vector of strings containing the years corresponding to the given Run.

std::vector<string> yearsVector ()

  • Parameters
    • bool MC = false
    • bool Reference = false
    • bool PHSP = false
    • int Run = 1
  • Return
    • A vector of strings containing the years corresponding to the given sample and Run.

std::vector<int> yearsVectorInt()

  • Parameters
    • bool MC = false
    • bool Reference = false
    • bool PHSP = false
    • int Run = 1
  • Return
    • A vector of integers containing the years corresponding to the given sample and Run.

std::vector<string> yearsInc()

  • Parameters
    • int Run
  • Return
    • A vector of strings containing all available years for the inclusive MC sample.

std::vector<string> yearsBkgMC()

  • Parameters
    • bool Reference
    • bool B0
    • bool K1
    • bool Inc
    • int Run
  • Return
    • A vector of strings containing all available years for the given background MC sample.

int getRunID()

  • Parameters
    • string year
  • Return
    • Run number for the given run (eg 2017 will return 2, 2011 will return 1)