Update 'Selection code'
parent
75dcaaeb37
commit
d4845eb143
@ -1,46 +1,83 @@
|
|||||||
The selection code is a set of C++ scripts.
|
The selection code is a set of C++ scripts. First, the running of the code is introduced. Then, each part of the code is explained.
|
||||||
|
|
||||||
# Running the code
|
# Running the code
|
||||||
When re-running everything do the following
|
When re-running everything, do the following
|
||||||
|
|
||||||
|
First, compile and run the preselection
|
||||||
|
```
|
||||||
.L BDTSelection.cpp+
|
.L BDTSelection.cpp+
|
||||||
runAllSignalData(1); runAllSignalData(2);
|
runAllSignalData(1); runAllSignalData(2);
|
||||||
runAllSignalMC(1); runAllSignalMC(2);
|
runAllSignalMC(1); runAllSignalMC(2);
|
||||||
runAllRefMC(1); runAllRefMC(2);
|
runAllRefMC(1); runAllRefMC(2);
|
||||||
runAllPHSPMC(1); runAllPHSPMC(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+
|
.L MCtruthmatching.cpp+
|
||||||
|
|
||||||
TruthMatchAllAll(1); TruthMatchAllAll(2);
|
TruthMatchAllAll(1); TruthMatchAllAll(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, we need to add the XMuMu mass variable and apply the KplusMuMu veto
|
||||||
|
```
|
||||||
.L CodeForTests/AddVariable.cpp+
|
.L CodeForTests/AddVariable.cpp+
|
||||||
addAllXMuMuMass(true,true,1); addAllXMuMuMass(false,true,1); applyAllVetoKplusMuMuMass(1);
|
addAllXMuMuMass(true,true,1); addAllXMuMuMass(false,true,1); applyAllVetoKplusMuMuMass(1);
|
||||||
addAllXMuMuMass(true,true,2); addAllXMuMuMass(false,true,2); applyAllVetoKplusMuMuMass(2);
|
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+
|
.L nTrackWeights.cpp+
|
||||||
WeightAll(true,1,true); ReweightReferenceMC(true,1,true); ReweightPHSPMC(true,1,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);
|
WeightAll(true,2,true); ReweightReferenceMC(true,2,true); ReweightPHSPMC(true,2,true);
|
||||||
|
```
|
||||||
|
|
||||||
*** now compare all the variables ***
|
Check the MVA variables are agreeing after weighting them with sWeights
|
||||||
|
```
|
||||||
.L MVA.cpp+
|
|
||||||
RunMVA(1); RunMVA(2);
|
|
||||||
|
|
||||||
.L TMVAClassApp.cpp+
|
|
||||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
|
||||||
|
|
||||||
python RemoveMultipleCandidates.py -all
|
|
||||||
|
|
||||||
*** Now rerunning the weights as they are fixed to 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);
|
|
||||||
|
|
||||||
.L CodeForTests/compareVariables.cc+
|
.L CodeForTests/compareVariables.cc+
|
||||||
compareAll(1); compareAll(2);
|
compareAll(1); compareAll(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Reweighted Data and Monte Carlo can be used for the MVA training
|
||||||
|
```
|
||||||
|
.L MVA.cpp+
|
||||||
|
RunMVA(1); RunMVA(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply the MVA to all the MC and Data
|
||||||
|
```
|
||||||
|
.L TMVAClassApp.cpp+
|
||||||
|
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove all multiple candidates
|
||||||
|
```
|
||||||
|
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);
|
||||||
|
```
|
||||||
|
|
||||||
|
Check the variables again
|
||||||
|
```
|
||||||
|
.L CodeForTests/compareVariables.cc+
|
||||||
|
compareAll(1); compareAll(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the MVA training, make nice plots, apply the MVA and remove multiple candidates
|
||||||
|
|
||||||
|
```
|
||||||
.L MVA.cpp+
|
.L MVA.cpp+
|
||||||
RunMVA(1); RunMVA(2);
|
RunMVA(1); RunMVA(2);
|
||||||
|
|
||||||
@ -53,61 +90,93 @@ When re-running everything do the following
|
|||||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||||
|
|
||||||
python RemoveMultipleCandidates.py -all
|
python RemoveMultipleCandidates.py -all
|
||||||
|
```
|
||||||
|
|
||||||
|
Add variables to the MC samples **TODO**
|
||||||
|
```
|
||||||
.L CodeForTests/AddVariable.cpp+
|
.L CodeForTests/AddVariable.cpp+
|
||||||
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
|
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
Get the eficiencies needed for the estimation of the best MVA response cut
|
||||||
|
```
|
||||||
.L Efficiency.cpp+
|
.L Efficiency.cpp+
|
||||||
runAllEff();
|
runAllEff();
|
||||||
|
```
|
||||||
|
|
||||||
|
Scan the significance in the MVA cut. Don't mind the 2012 and 2016 tags, they are just dummies
|
||||||
|
```
|
||||||
.L BDTcutScanner.cpp+
|
.L BDTcutScanner.cpp+
|
||||||
ScanSignalAndBckgndEstimation("2012",1,0.01,false,false,false,true)
|
ScanSignalAndBckgndEstimation("2012",1,0.01,false,false,false,true)
|
||||||
ScanSignalAndBckgndEstimation("2016",2,0.01,false,false,false,true)
|
ScanSignalAndBckgndEstimation("2016",2,0.01,false,false,false,true)
|
||||||
getMaxBDTresponse("2012",1,true,true,0,false,false)
|
getMaxBDTresponse("2012",1,true,true,0,false,false)
|
||||||
getMaxBDTresponse("2016",2,true,false,0,false,false)
|
getMaxBDTresponse("2016",2,true,false,0,false,false)
|
||||||
|
```
|
||||||
|
|
||||||
|
Make a nice TGraph from the scan; when creating the scan, it can happen that eg an estimation at cut at 0.95 happens before a cut at 0.92. This script just takes it and makes a pretty clean plot.
|
||||||
|
```
|
||||||
python ReorganizeTGraph.py
|
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+
|
.L SignalStudy.cpp+
|
||||||
plotYieldInQ2(true); plotYieldInQ2(false);
|
plotYieldInQ2(true); plotYieldInQ2(false);
|
||||||
ApplyCutPerYearAll(1); ApplyCutPerYearAll(2);
|
ApplyCutPerYearAll(1); ApplyCutPerYearAll(2);
|
||||||
printYileds(false); printYileds(true)
|
printYileds(false); printYileds(true)
|
||||||
yieldComparison(1,getTMVAcut(1));
|
yieldComparison(1,getTMVAcut(1));
|
||||||
yieldComparison(2,getTMVAcut(2));
|
yieldComparison(2,getTMVAcut(2));
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Mass Fit compilation
|
||||||
Recompile mass fit
|
Recompile mass fit
|
||||||
|
|
||||||
|
```
|
||||||
.L BmassShape/SignalType.cpp+
|
.L BmassShape/SignalType.cpp+
|
||||||
.L BmassShape/SignalPdf.cpp+
|
.L BmassShape/SignalPdf.cpp+
|
||||||
.L BmassShape/BackgroundType.cpp+
|
.L BmassShape/BackgroundType.cpp+
|
||||||
.L BmassShape/BackgroundPdf.cpp+
|
.L BmassShape/BackgroundPdf.cpp+
|
||||||
.L BmassShape/ParamValues.cpp+
|
.L BmassShape/ParamValues.cpp+
|
||||||
.L MassFit.cpp+
|
.L MassFit.cpp+
|
||||||
|
```
|
||||||
|
|
||||||
|
## Checking the inclusive sample
|
||||||
Check the inclusive sample
|
```
|
||||||
.L BDTSelection.cpp+
|
.L BDTSelection.cpp+
|
||||||
runAllIncMC(1); runAllIncMC(2)
|
runAllIncMC(1); runAllIncMC(2)
|
||||||
|
```
|
||||||
|
|
||||||
lb-conda default python Rescale_pi0momentum.py (CAREFUL, NEEDS TO BE SET BY HAND)
|
lb-conda default python Rescale_pi0momentum.py (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||||
|
|
||||||
|
```
|
||||||
.L MCtruthmatching.cpp+
|
.L MCtruthmatching.cpp+
|
||||||
TruthMatchAllBkg(true,1,false,false,true); TruthMatchAllBkg(true,2,false,false,true);
|
TruthMatchAllBkg(true,1,false,false,true); TruthMatchAllBkg(true,2,false,false,true);
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
.L CodeForTests/AddVariable.cpp+ (CAREFUL, NEEDS TO BE SET BY HAND)
|
.L CodeForTests/AddVariable.cpp+ (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||||
addAllXMuMuMass(true,true,1,true,true,false); addAllXMuMuMass(false,true,1,true,true,false); applyAllVetoKplusMuMuMass(1,true,true,false);
|
addAllXMuMuMass(true,true,1,true,true,false); addAllXMuMuMass(false,true,1,true,true,false); applyAllVetoKplusMuMuMass(1,true,true,false);
|
||||||
addAllXMuMuMass(true,true,2,true,true,false); addAllXMuMuMass(false,true,2,true,true,false); applyAllVetoKplusMuMuMass(2,true,true,false);
|
addAllXMuMuMass(true,true,2,true,true,false); addAllXMuMuMass(false,true,2,true,true,false); applyAllVetoKplusMuMuMass(2,true,true,false);
|
||||||
|
```
|
||||||
|
```
|
||||||
lb-conda default python Rescale_pi0momentum.py (CAREFUL, NEEDS TO BE SET BY HAND)
|
lb-conda default python Rescale_pi0momentum.py (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
.L TMVAClassApp.cpp+
|
.L TMVAClassApp.cpp+
|
||||||
TMVAClassAppInc(1); TMVAClassAppInc(2);
|
TMVAClassAppInc(1); TMVAClassAppInc(2);
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
python RemoveMultipleCandidates.py -all (CAREFUL, NEEDS TO BE SET BY HAND)
|
python RemoveMultipleCandidates.py -all (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
.L CodeForTests/InclusiveCheck.cpp+
|
.L CodeForTests/InclusiveCheck.cpp+
|
||||||
plotTM(1,true); plotTM(2,true)
|
plotTM(1,true); plotTM(2,true)
|
||||||
plotTM(1,false); plotTM(2,false)
|
plotTM(1,false); plotTM(2,false)
|
||||||
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user