Update 'Selection code'
parent
75dcaaeb37
commit
d4845eb143
@ -1,113 +1,182 @@
|
||||
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
|
||||
When re-running everything do the following
|
||||
When re-running everything, do the following
|
||||
|
||||
First, compile and run the preselection
|
||||
```
|
||||
.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
|
||||
```
|
||||
|
||||
Next step is to compile and perform the MC Truth-Matching
|
||||
```
|
||||
.L MCtruthmatching.cpp+
|
||||
|
||||
TruthMatchAllAll(1); TruthMatchAllAll(2);
|
||||
```
|
||||
|
||||
.L CodeForTests/AddVariable.cpp+
|
||||
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);
|
||||
```
|
||||
|
||||
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);
|
||||
```
|
||||
|
||||
*** now compare all the variables ***
|
||||
|
||||
.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);
|
||||
|
||||
Check the MVA variables are agreeing after weighting them with sWeights
|
||||
```
|
||||
.L CodeForTests/compareVariables.cc+
|
||||
compareAll(1); compareAll(2);
|
||||
```
|
||||
|
||||
.L MVA.cpp+
|
||||
Reweighted Data and Monte Carlo can be used for the MVA training
|
||||
```
|
||||
.L MVA.cpp+
|
||||
RunMVA(1); RunMVA(2);
|
||||
```
|
||||
|
||||
.L PlotMVA.cpp+
|
||||
SaveAllFromOneFile(2011,1,false,false,0,false,"",false);
|
||||
SaveAllFromOneFile(2016,2,false,false,0,false,"",false);
|
||||
testFunction(1); testFunction(2)
|
||||
|
||||
.L TMVAClassApp.cpp+
|
||||
Apply the MVA to all the MC and Data
|
||||
```
|
||||
.L TMVAClassApp.cpp+
|
||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||
```
|
||||
|
||||
python RemoveMultipleCandidates.py -all
|
||||
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+
|
||||
RunMVA(1); RunMVA(2);
|
||||
|
||||
.L PlotMVA.cpp+
|
||||
SaveAllFromOneFile(2011,1,false,false,0,false,"",false);
|
||||
SaveAllFromOneFile(2016,2,false,false,0,false,"",false);
|
||||
testFunction(1); testFunction(2)
|
||||
|
||||
.L TMVAClassApp.cpp+
|
||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||
|
||||
python RemoveMultipleCandidates.py -all
|
||||
```
|
||||
|
||||
Add variables to the MC samples **TODO**
|
||||
```
|
||||
.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 BDTcutScanner.cpp+
|
||||
ScanSignalAndBckgndEstimation("2012",1,0.01,false,false,false,true)
|
||||
ScanSignalAndBckgndEstimation("2016",2,0.01,false,false,false,true)
|
||||
getMaxBDTresponse("2012",1,true,true,0,false,false)
|
||||
getMaxBDTresponse("2016",2,true,false,0,false,false)
|
||||
Scan the significance in the MVA cut. Don't mind the 2012 and 2016 tags, they are just dummies
|
||||
```
|
||||
.L BDTcutScanner.cpp+
|
||||
ScanSignalAndBckgndEstimation("2012",1,0.01,false,false,false,true)
|
||||
ScanSignalAndBckgndEstimation("2016",2,0.01,false,false,false,true)
|
||||
getMaxBDTresponse("2012",1,true,true,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
|
||||
|
||||
.L SignalStudy.cpp+
|
||||
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));
|
||||
```
|
||||
|
||||
|
||||
## Mass Fit compilation
|
||||
Recompile mass fit
|
||||
|
||||
```
|
||||
.L BmassShape/SignalType.cpp+
|
||||
.L BmassShape/SignalPdf.cpp+
|
||||
.L BmassShape/BackgroundType.cpp+
|
||||
.L BmassShape/BackgroundPdf.cpp+
|
||||
.L BmassShape/ParamValues.cpp+
|
||||
.L MassFit.cpp+
|
||||
```
|
||||
|
||||
|
||||
Check the inclusive sample
|
||||
## Checking the inclusive sample
|
||||
```
|
||||
.L BDTSelection.cpp+
|
||||
runAllIncMC(1); runAllIncMC(2)
|
||||
```
|
||||
|
||||
lb-conda default python Rescale_pi0momentum.py (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||
|
||||
```
|
||||
.L MCtruthmatching.cpp+
|
||||
TruthMatchAllBkg(true,1,false,false,true); TruthMatchAllBkg(true,2,false,false,true);
|
||||
```
|
||||
|
||||
```
|
||||
.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,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+
|
||||
TMVAClassAppInc(1); TMVAClassAppInc(2);
|
||||
```
|
||||
|
||||
```
|
||||
python RemoveMultipleCandidates.py -all (CAREFUL, NEEDS TO BE SET BY HAND)
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
.L CodeForTests/InclusiveCheck.cpp+
|
||||
plotTM(1,true); plotTM(2,true)
|
||||
plotTM(1,false); plotTM(2,false)
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user