Update 'Selection code'
parent
2a8398c2a9
commit
8997566e9c
@ -10,10 +10,10 @@ The selection code is a set of C++ scripts. First, the running of the code is in
|
|||||||
## Setting up ROOT
|
## Setting up ROOT
|
||||||
**TODO**
|
**TODO**
|
||||||
|
|
||||||
In order to make pretty plots, dedicated code in [[Design.cpp|Design.cpp]] is always checked for compilation when starting ROOT. This is done by creating a `.rootrc` file in your home directory and telling ROOT to always compile the Design.cpp:
|
In order to make pretty plots, dedicated code in [[Design.cpp|Design.cpp]] is always checked for compilation when starting ROOT. This is done by creating a `.rootalias.C` file in your home directory and telling ROOT to always compile the Design.cpp:
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
gROOT->ProcessLine(".L path/to/your/folder/Design.cpp+");
|
gROOT->ProcessLine(".L path/to/your/folder/Code/Design.cpp+");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -55,18 +55,20 @@ There are 5 levels of verbosity: The level of verbosity is defined in [GlobalFun
|
|||||||
|
|
||||||
|
|
||||||
# Running the code
|
# Running the code
|
||||||
The code consists of several C++ scripts that are compiled and executed in ROOT. Before every step, it is worth closing and opening ROOT, as it is possible ROOT will complain about redefinition of functions.
|
The code consists of several C++ scripts that are compiled and executed in ROOT. **Before every step, it is worth closing and opening ROOT**, as it is possible ROOT will complain about redefinition of functions.
|
||||||
|
|
||||||
We used ROOT 6.06.02.
|
We used ROOT 6.06.02.
|
||||||
|
|
||||||
|
|
||||||
First, compile and run the preselection. It is defined in [[BDTSelection.cpp|BDTSelection]]. This reads the files with **stripped** data and creates new tuples with **preselected** data.
|
First, compile and run the preselection. It is defined in [[BDTSelection.cpp|BDTSelection]]. This reads the files with **stripped** data and creates new tuples with **preselected** data.
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, run a python script [[Rescale_pi0momentum.py|Rescale-pi0-momentum]] performing the Kstar MacGyver DTF
|
Then, run a python script [[Rescale_pi0momentum.py|Rescale-pi0-momentum]] performing the Kstar MacGyver DTF
|
||||||
@ -76,42 +78,54 @@ lb-conda default python Scripts/Rescale_pi0momentum.py
|
|||||||
|
|
||||||
Next step is to compile and perform the MC Truth-Matching, saved in [[MCtruthmatching.cpp|MCtruthmatching.cpp]]. The Truth-matching procedure is in detail described in [my thesis](http://www.physi.uni-heidelberg.de/Publications/thesis_Kopecna_final.pdf).
|
Next step is to compile and perform the MC Truth-Matching, saved in [[MCtruthmatching.cpp|MCtruthmatching.cpp]]. The Truth-matching procedure is in detail described in [my thesis](http://www.physi.uni-heidelberg.de/Publications/thesis_Kopecna_final.pdf).
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L MCtruthmatching.cpp+
|
.L MCtruthmatching.cpp+
|
||||||
TruthMatchAllAll(1); TruthMatchAllAll(2);
|
TruthMatchAllAll(1); TruthMatchAllAll(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, we need to add the XMuMu mass variable and apply the KplusMuMu veto ([[AddVariable.cpp|AddVariable.cpp]])
|
Then, we need to add the XMuMu mass variable and apply the KplusMuMu veto ([[AddVariable.cpp|AddVariable.cpp]])
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L AddVariable.cpp+
|
.L 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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
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|B-mass-model]].
|
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|B-mass-model]].
|
||||||
|
|
||||||
Now the peaking background is removed, we can proceed to reweighting via [[nTrackWeights.cpp|nTrackWeights.cpp]]. It takes the **preselected** tuples and create new **weighted** ones, with the tag BDT input.
|
Now the peaking background is removed, we can proceed to reweighting via [[nTrackWeights.cpp|nTrackWeights.cpp]]. It takes the **preselected** tuples and create new **weighted** ones, with the tag BDT input.
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Check the MVA variables are agreeing after weighting them with sWeights [[CompareVariables.cpp|CompareVariables.cpp]]. (Yes, there is a [[dedicated tool|Comparison-tool]], but this was intially working, and working well, so it was kept for checking the variables used in the MVA training.) **TODO**
|
Check the MVA variables are agreeing after weighting them with sWeights [[CompareVariables.cpp|CompareVariables.cpp]]. (Yes, there is a [[dedicated tool|Comparison-tool]], but this was intially working, and working well, so it was kept for checking the variables used in the MVA training.) **TODO**
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L Scripts/compareVariables.cc+
|
.L Scripts/compareVariables.cc+
|
||||||
compareAll(1); compareAll(2);
|
compareAll(1); compareAll(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Reweighted Data and Monte Carlo can be used for the [[MVA.cpp|MVA-Class]]
|
Reweighted Data and Monte Carlo can be used for the [[MVA.cpp|MVA-Class]]
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L MVA.cpp+
|
.L MVA.cpp+
|
||||||
RunMVA(1); RunMVA(2);
|
RunMVA(1); RunMVA(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Apply the MVA to all the MC and Data using [[TMVAClassApp.cpp|TMVA Class application]]. This also creates new tuples with the tag BDT output.
|
Apply the MVA to all the MC and Data using [[TMVAClassApp.cpp|TMVA Class application]]. This also creates new tuples with the tag BDT output.
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L TMVAClassApp.cpp+
|
.L TMVAClassApp.cpp+
|
||||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Remove all multiple candidates, defined in [[RemoveMultipleCandidates.py|RemoveMultipleCandidates.py]]
|
Remove all multiple candidates, defined in [[RemoveMultipleCandidates.py|RemoveMultipleCandidates.py]]
|
||||||
@ -121,20 +135,25 @@ 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.
|
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.
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Check the variables again
|
Check the variables again
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L Scripts/compareVariables.cc+
|
.L Scripts/compareVariables.cc+
|
||||||
compareAll(1); compareAll(2);
|
compareAll(1); compareAll(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the MVA training, [[make nice plots|PlotTMVA.cpp]], apply the MVA and remove multiple candidates
|
Run the MVA training, [[make nice plots|PlotTMVA.cpp]], apply the MVA and remove multiple candidates
|
||||||
|
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L MVA.cpp+
|
.L MVA.cpp+
|
||||||
RunMVA(1); RunMVA(2);
|
RunMVA(1); RunMVA(2);
|
||||||
|
|
||||||
@ -145,29 +164,36 @@ testFunction(1); testFunction(2)
|
|||||||
|
|
||||||
.L TMVAClassApp.cpp+
|
.L TMVAClassApp.cpp+
|
||||||
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
TMVAClassAppAll(1); TMVAClassAppAll(2);
|
||||||
|
.q
|
||||||
|
|
||||||
python RemoveMultipleCandidates.py -all
|
python RemoveMultipleCandidates.py -all
|
||||||
```
|
```
|
||||||
|
|
||||||
[[Add variables|AddVariable.cpp]] to the MC samples
|
[[Add variables|AddVariable.cpp]] to the MC samples
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L AddVariable.cpp+
|
.L AddVariable.cpp+
|
||||||
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
|
addAllVariablesAllMCSamples(1); addAllVariablesAllMCSamples(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Get the eficiencies needed for the estimation of the best MVA response cut, defined in [[Efficiency.cpp|Efficiency.cpp]]
|
Get the eficiencies needed for the estimation of the best MVA response cut, defined in [[Efficiency.cpp|Efficiency.cpp]]
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L Efficiency.cpp+
|
.L Efficiency.cpp+
|
||||||
runAllEff();
|
runAllEff();
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Scan the significance in the MVA cut using the code in [[BDTcutScanner.cpp|BDTcutScanner.cpp]]. Don't mind the 2012 and 2016 tags, they are just dummies
|
Scan the significance in the MVA cut using the code in [[BDTcutScanner.cpp|BDTcutScanner.cpp]]. Don't mind the 2012 and 2016 tags, they are just dummies
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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)
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
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|ReorganizeTGraph.py]] just takes it and makes a pretty clean plot.
|
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|ReorganizeTGraph.py]] just takes it and makes a pretty clean plot.
|
||||||
@ -177,33 +203,41 @@ python ReorganizeTGraph.py
|
|||||||
|
|
||||||
Use the MVA scan to plot the signal yields, apply the MVA cut and compare the yields to the CMS results (see [[SignalStudy.cpp|Signal Study]]). It also creates the tuples used by the [[FCNC fitter|FCNC fitter]] tagged as BDT output selection.
|
Use the MVA scan to plot the signal yields, apply the MVA cut and compare the yields to the CMS results (see [[SignalStudy.cpp|Signal Study]]). It also creates the tuples used by the [[FCNC fitter|FCNC fitter]] tagged as BDT output selection.
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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));
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Checking the inclusive sample
|
## Checking the inclusive sample
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L BDTSelection.cpp+
|
.L BDTSelection.cpp+
|
||||||
runAllIncMC(1); runAllIncMC(2)
|
runAllIncMC(1); runAllIncMC(2)
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
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**)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, we need to add the variables to the inclusive sample. This HAS TO BE SET BY HAND in [[AddVariable.cpp|AddVariable.cpp]] before compilation!
|
Then, we need to add the variables to the inclusive sample. **This HAS TO BE SET BY HAND** in [[AddVariable.cpp|AddVariable.cpp]] before compilation!
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L AddVariable.cpp+
|
.L AddVariable.cpp+
|
||||||
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);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
Similarly, before applying the MacGyver DTF, the paths in [[Rescale_pi0momentum.py|Rescale-pi0-momentum]] have to be set by hand!
|
Similarly, before applying the MacGyver DTF, the paths in [[Rescale_pi0momentum.py|Rescale-pi0-momentum]] have to be set by hand!
|
||||||
```
|
```
|
||||||
@ -211,8 +245,10 @@ lb-conda default python Rescale_pi0momentum.py
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L TMVAClassApp.cpp+
|
.L TMVAClassApp.cpp+
|
||||||
TMVAClassAppInc(1); TMVAClassAppInc(2);
|
TMVAClassAppInc(1); TMVAClassAppInc(2);
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
Also the paths in [[RemoveMultipleCandidates.py|RemoveMultipleCandidates.py]] have to be set by hand!
|
Also the paths in [[RemoveMultipleCandidates.py|RemoveMultipleCandidates.py]] have to be set by hand!
|
||||||
```
|
```
|
||||||
@ -220,8 +256,10 @@ python RemoveMultipleCandidates.py -all
|
|||||||
```
|
```
|
||||||
Lastly, make the truth-matching plots using [[InclusiveCheck.cpp||InclusiveCheck.cpp]].
|
Lastly, make the truth-matching plots using [[InclusiveCheck.cpp||InclusiveCheck.cpp]].
|
||||||
```
|
```
|
||||||
|
root
|
||||||
.L Scripts/InclusiveCheck.cpp+
|
.L Scripts/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)
|
||||||
|
.q
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user