# (analysis) note on filtering in the ttbar samples
## Heavy flavour filtering
ntuple generation **SOLARBv2**:
- the event overlap between the ttbar nonallhad samples (410470) and the HF enhanced samples is taken into account by removing the corresponding events in 410470
- this is done in at Level 2, by setting the flag in the config: `DoTTbarBfilter true`
- this feature was added to the `run_level2.py` script on March 15th, in this [commit](https://gitlab.cern.ch/ls2multib/ntupler/-/commit/c72411eaf6f383cb22f769482fc2a20261451ed5)
- **test this**:
Confirmed: when looking into the merged root files, the `ttbar_lep` sample only includes events that have the `TopHeavyFlavorFilterFlag == 0`

---
ntuple generation **SOLARB2121440-pc1**:
- here the event overlap removal is not applied
- **test this**:
Confirmed: the events in the `ttbar_lep` root file have event with different `TopHeavyFlavorFilterFlag`

## Dilepton filtering
- Dilepton filtering is not applied in either SOLARBv2 or SOLARB2121440-pc1.
- **test this** on SOLARBv2:
by checking the variable `truth_top_dilep_filter` on the `ttbar_dil` sample (some events do indeed have value 1):

## Notes on ntuple-generations (add to README):
### for SOLARBv3p1
- Event overlap removal is applied considering both HF filtering and dilep, i.e. to get a fully inclusive sample, all ttbar samples must be used (similar for 1l):
- ttbar_lep_mc16*_SOLARBv3p1_2l.root
- ttbar_dil_mc16*_SOLARBv3p1_2l.root
- ttbar_ljets_BBFilt_mc16*_SOLARBv3p1_2l.root
- ttbar_ljets_BFiltBBVeto_mc16*_SOLARBv3p1_2l.root
- ttbar_ljets_CFiltBVeto_mc16*_SOLARBv3p1_2l.root
- ttbar_dil_BBFilt_mc16*_SOLARBv3p1_2l.root
- ttbar_dil_BFiltBBVeto_mc16*_SOLARBv3p1_2l.root
- ttbar_dil_CFiltBVeto_mc16*_SOLARBv3p1_2l.root
### for SOLARBv2
- Event overlap removal is applied only considering HF filtering, i.e. the sample called "lep" includes both ljets+dil events (complement to the filtered events):
- do not use the `ttbar_dil` sample without manually removing the overlap (can be done with `truth_top_dilep_filter` flag)
- recommended set of samples (similar for 1l):
- ttbar_lep_mc16*_SOLARBv2.1_2l.root
- ttbar_ljets_BBFilt_mc16*_SOLARBv2.1_2l.root
- ttbar_ljets_BFiltBBVeto_mc16*_SOLARBv2.1_2l.root
- ttbar_ljets_CFiltBVeto_mc16*_SOLARBv2.1_2l.root
- ttbar_dil_BBFilt_mc16*_SOLARBv2.1_2l.root
- ttbar_dil_BFiltBBVeto_mc16*_SOLARBv2.1_2l.root
- ttbar_dil_CFiltBVeto_mc16*_SOLARBv2.1_2l.root
### for SOLARB2121440-pc1
- No event overlap removal is applied, i.e. the "lep" sample is a fully inclusive sample
- only use the other samples when manually removing the overlap
- recommended set of samples (similar for 1l):
- ttbar_lep_mc16*_SOLARB2121440-pc1_2l.root