Update 'Selection code'

Renata Kopecná 2022-01-24 11:18:25 +01:00
parent df84a3f137
commit 500049b7ec

@ -3,46 +3,46 @@ The selection code is a set of C++ scripts. First, the running of the code is in
# Running the code
When re-running everything, do the following
First, compile and run the preselection
First, compile and run the preselection. It is defined in [[BDTSelection.cpp|BDTSelection]] .
```
.L BDTSelection.cpp+
runAllSignalData(1); runAllSignalData(2);
runAllSignalMC(1); runAllSignalMC(2);
runAllRefMC(1); runAllRefMC(2);
runAllPHSPMC(1); runAllPHSPMC(2);
.L BDTSelection.cpp+
runAllSignalData(1); runAllSignalData(2);
runAllSignalMC(1); runAllSignalMC(2);
runAllRefMC(1); runAllRefMC(2);
runAllPHSPMC(1); runAllPHSPMC(2);
```
Then,run a python script performing the Kstar MacGyver DTF
```
lb-conda default python Rescale_pi0momentum.py
lb-conda default python Rescale_pi0momentum.py
```
Next step is to compile and perform the MC Truth-Matching
```
.L MCtruthmatching.cpp+
TruthMatchAllAll(1); TruthMatchAllAll(2);
.L MCtruthmatching.cpp+
TruthMatchAllAll(1); TruthMatchAllAll(2);
```
Then, we need to add the XMuMu mass variable and apply the KplusMuMu veto
```
.L CodeForTests/AddVariable.cpp+
addAllXMuMuMass(true,true,1); addAllXMuMuMass(false,true,1); applyAllVetoKplusMuMuMass(1);
addAllXMuMuMass(true,true,2); addAllXMuMuMass(false,true,2); applyAllVetoKplusMuMuMass(2);
addAllXMuMuMass(true,true,1); addAllXMuMuMass(false,true,1); applyAllVetoKplusMuMuMass(1);
addAllXMuMuMass(true,true,2); addAllXMuMuMass(false,true,2); applyAllVetoKplusMuMuMass(2);
```
We have all the preselection finished. Now we will need to fit the reconstructed B mass peak. For the instructions how to compile the code and make RooFit use double-sided Crystal Ball or ExpGauss, see [B mass model section](https://git.physi.uni-heidelberg.de/kopecna/EWP-BplusToKstMuMu-AngAna/wiki/B-mass-model).
Now the peaking background is removed, we can proceed to reweighting
```
.L nTrackWeights.cpp+
WeightAll(true,1,true); ReweightReferenceMC(true,1,true); ReweightPHSPMC(true,1,true);
WeightAll(true,2,true); ReweightReferenceMC(true,2,true); ReweightPHSPMC(true,2,true);
.L nTrackWeights.cpp+
WeightAll(true,1,true); ReweightReferenceMC(true,1,true); ReweightPHSPMC(true,1,true);
WeightAll(true,2,true); ReweightReferenceMC(true,2,true); ReweightPHSPMC(true,2,true);
```
Check the MVA variables are agreeing after weighting them with sWeights
```
.L CodeForTests/compareVariables.cc+
compareAll(1); compareAll(2);
.L CodeForTests/compareVariables.cc+
compareAll(1); compareAll(2);
```
Reweighted Data and Monte Carlo can be used for the MVA training
@ -54,7 +54,7 @@ Reweighted Data and Monte Carlo can be used for the MVA training
Apply the MVA to all the MC and Data
```
.L TMVAClassApp.cpp+
TMVAClassAppAll(1); TMVAClassAppAll(2);
TMVAClassAppAll(1); TMVAClassAppAll(2);
```
Remove all multiple candidates
@ -65,8 +65,8 @@ python RemoveMultipleCandidates.py -all
We have to rerun the weights and therefore also the MVA: the shape of the B mass peak is fixed to the one after MVA.
```
.L nTrackWeights.cpp+
WeightAll(true,1,true); ReweightReferenceMC(true,1,true); ReweightPHSPMC(true,1,true);
WeightAll(true,2,true); ReweightReferenceMC(true,2,true); ReweightPHSPMC(true,2,true);
WeightAll(true,1,true); ReweightReferenceMC(true,1,true); ReweightPHSPMC(true,1,true);
WeightAll(true,2,true); ReweightReferenceMC(true,2,true); ReweightPHSPMC(true,2,true);
```
Check the variables again
@ -94,14 +94,14 @@ python RemoveMultipleCandidates.py -all
Add variables to the MC samples **TODO**
```
.L CodeForTests/AddVariable.cpp+
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
.L CodeForTests/AddVariable.cpp+
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
```
Get the eficiencies needed for the estimation of the best MVA response cut
```
.L Efficiency.cpp+
runAllEff();
.L Efficiency.cpp+
runAllEff();
```
Scan the significance in the MVA cut. Don't mind the 2012 and 2016 tags, they are just dummies
@ -121,11 +121,11 @@ python ReorganizeTGraph.py
Use the MVA scan to plot the signal yields, apply the MVA cut and compare the yields to the CMS results.
```
.L SignalStudy.cpp+
plotYieldInQ2(true); plotYieldInQ2(false);
ApplyCutPerYearAll(1); ApplyCutPerYearAll(2);
printYileds(false); printYileds(true)
yieldComparison(1,getTMVAcut(1));
yieldComparison(2,getTMVAcut(2));
plotYieldInQ2(true); plotYieldInQ2(false);
ApplyCutPerYearAll(1); ApplyCutPerYearAll(2);
printYileds(false); printYileds(true)
yieldComparison(1,getTMVAcut(1));
yieldComparison(2,getTMVAcut(2));
```