Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
2ae205b
Added emulation for ZeroBias data, TandP data and MC, plus few useful…
davignon Oct 28, 2016
3efae1f
Added submitter for emulation of ZeroBias (no Reco)
davignon Oct 28, 2016
ef0d758
enable auto running of submitters
davignon Oct 28, 2016
48c7a52
A few useful flags
davignon Oct 31, 2016
3d28028
Few modifications for running on MC
davignon Oct 31, 2016
4e286cb
few fixes
davignon Nov 2, 2016
a196011
Changes for trigger studies
davignon Feb 1, 2017
1813bfe
Few changes for CMSSW 900pre2
davignon Feb 7, 2017
d5acad8
test build file
davignon May 16, 2017
16c60a7
Added jets to ntuples
davignon May 16, 2017
3a30cdf
Enable multiple taus for acceptance tests
davignon Jun 1, 2017
85ef1f8
First commit master_HLT
tstreble Jun 13, 2017
137b3b5
Various changes
tstreble Jun 14, 2017
afd35bf
Submission SingleMu296172-296174
tstreble Jun 14, 2017
e77e124
Various updatesÃ
tstreble Jun 22, 2017
e27673b
Added different tau IDs
tstreble Jun 26, 2017
cf5b0ae
Changed HLT paths
tstreble Jun 26, 2017
879f40f
Various updates for HLT
tstreble Jun 30, 2017
ea4fc9a
Delete test_customHLT.py
tstreble Jun 30, 2017
da81e85
Delete test_SingleMu296174.py
tstreble Jun 30, 2017
08529f7
Merge pull request #1 from tstreble/master_HLT
davignon Jun 30, 2017
e382e72
Implemented backward compatibility for test.py
tstreble Jul 1, 2017
ccde42c
Added L2CaloJet variables for HLT
tstreble Jul 1, 2017
9b944d2
Put back proper HLT filters
tstreble Jul 12, 2017
d186315
Added DM + antilep discriminants
tstreble Jul 17, 2017
f793097
Merge pull request #2 from tstreble/master_HLT
davignon Jul 18, 2017
cd32733
Update README.md
tstreble Aug 16, 2017
1d8b3db
Various updates
tstreble Aug 21, 2017
7c347f4
Merge branch 'master_HLT' of https://github.com/tstreble/TauTagAndPro…
tstreble Aug 21, 2017
a087d35
Update README.md
tstreble Aug 21, 2017
9a9cc83
Update README.md
tstreble Aug 21, 2017
ebf3a48
Update README.md
tstreble Aug 24, 2017
b7b1137
Merge pull request #3 from tstreble/master_HLT
davignon Aug 24, 2017
237e66b
Update README.md
davignon Aug 24, 2017
c6b783a
updates to CB function in fitter to take isolation into account
davignon Aug 28, 2017
5f260a0
Updated README
davignon Aug 30, 2017
5e5fb5e
Update README.md
davignon Aug 30, 2017
a05abc4
Minor updates, do not affect running
davignon Aug 30, 2017
dc1e6df
Merge branch 'master' of https://github.com/davignon/TauTagAndProbe
davignon Aug 30, 2017
8ab28b3
Update README.md
davignon Aug 30, 2017
02bbfa7
Added running-on-AOD feature, truth matching had to be updated as well
davignon Aug 31, 2017
ca84c64
Merge branch 'master' of https://github.com/davignon/TauTagAndProbe
davignon Aug 31, 2017
46749c7
Fix filling of L1 taus for multiple taus ntuples
davignon Sep 1, 2017
45989f5
Added L1EG+L1Mu objects for ZB
tstreble Sep 12, 2017
5facf9a
Added MC weight for efficiency
tstreble Sep 12, 2017
84b00b2
Merge branch 'master_HLT' of https://github.com/tstreble/TauTagAndPro…
tstreble Sep 12, 2017
2e9f6e5
Merge branch 'master' into master_HLT
tstreble Sep 12, 2017
20e43d3
Update README.md
tstreble-ATLAS Oct 9, 2017
c797fd1
Merge pull request #4 from tstreble/master_HLT
davignon Oct 9, 2017
8ee8f70
Added PS column
tstreble Oct 10, 2017
648ea0b
Merge branch 'master_HLT' of https://github.com/tstreble/TauTagAndPro…
tstreble Oct 10, 2017
bd44ce2
Merge pull request #5 from tstreble/master_HLT
davignon Oct 10, 2017
316721a
update of MC analyzers
davignon Oct 17, 2017
7944524
Merge branch 'master' of https://github.com/davignon/TauTagAndProbe
davignon Oct 17, 2017
dc932b5
Changes in HLT paths
tstreble Oct 24, 2017
5b83e40
Updated T&P selections
Nov 5, 2017
fc76e65
Update test_SingleMu297050_TandP.py
tstreble-ATLAS Nov 5, 2017
6fcc09a
Update MCanalysis_cff.py
tstreble-ATLAS Nov 6, 2017
7478394
Update MCanalysis_cff.py
tstreble-ATLAS Nov 6, 2017
b73fcc0
Added gen index for tau in MC
Nov 6, 2017
451a53d
Merge branch 'master' into master_HLT
tstreble-ATLAS Nov 6, 2017
f8dbe15
Merge branch 'master' into master_HLT
tstreble-ATLAS Nov 6, 2017
dcd8f55
Merge pull request #6 from tstreble/master_HLT
davignon Nov 7, 2017
b18956e
remove jet ID causing crashes in 92X
davignon Nov 9, 2017
8a9e06e
remove limit on max n events
davignon Nov 9, 2017
226d99a
Fix to run on several runs in same job
Nov 14, 2017
70df3bb
Update TauTagAndProbeFilter.cc
tstreble-ATLAS Nov 17, 2017
8dcd63f
Added L1 sums
davignon Nov 20, 2017
11da0de
mod to produce ntuples for efficiency evaluation on data
camendola Dec 5, 2017
624de80
Merge pull request #7 from camendola/chiara-modForVBFeff
davignon Dec 5, 2017
21c6554
fix for Chiara
davignon Dec 5, 2017
380a149
Merge pull request #8 from davignon/FixForChiara
davignon Dec 5, 2017
74f33f0
Added mT and mVis in Ntuplizer
Jan 9, 2018
542de94
Some changes made during sync: DR_btag, MuonID, TauIso. Used samples …
hsert Jan 10, 2018
3a3ee20
adding nTruePU variable to be used for PU reweighting
hsert Jan 11, 2018
0bb1aa5
Cleaning
Jan 12, 2018
8e724e4
Added missing met label
Jan 12, 2018
f5e1166
merge
hsert Jan 14, 2018
9c388fd
muonNumberFilter is added for MCAnalysis tAndP_config
hsert Jan 14, 2018
e32385d
correction to failed merge
hsert Jan 14, 2018
9f18631
The mass cuts, mt and mvis, is removed in this step: apply them later
hsert Jan 14, 2018
d11b77d
global tags are updated for CMSSW_9_4_X, required for 17Nov2017 Rerec…
hsert Jan 14, 2018
84352e8
Merge pull request #1 from hsert/master_HLT
tstreble-ATLAS Jan 17, 2018
0fe8c37
Fix for MuTau40 path + additional mu-tau paths for developments
Jan 20, 2018
322fa07
Merge branch 'master_HLT' of https://github.com/tstreble/TauTagAndPro…
Jan 20, 2018
1ac8cfd
Small fix for PU info
Jan 20, 2018
c679b8d
Merge pull request #9 from tstreble/master_HLT
davignon Feb 5, 2018
00c1a83
Update MCanalysis_cff.py
tstreble-ATLAS Feb 5, 2018
585b92e
Update MCanalysis_cff.py
tstreble-ATLAS Feb 5, 2018
9deec46
Update test_SingleMu297050_TandP.py
tstreble-ATLAS Feb 5, 2018
377def3
Merge pull request #10 from tstreble/master_HLT
davignon Feb 5, 2018
06fc625
Changed flag
davignon Feb 5, 2018
707999f
Merge branch 'master' of https://github.com/davignon/TauTagAndProbe i…
davignon Feb 5, 2018
1298e94
Changed flag 2
davignon Feb 5, 2018
cb9da0a
Merge pull request #11 from davignon/TauTagAndProbe_050218
davignon Feb 5, 2018
08b60de
Buildfile change and preparing for Run-3
davignon Sep 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
*.pdf
*.zip
fit.exe
*~
*#*
*.d
89 changes: 71 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,83 @@ Set of tools to evaluate tau trigger performance on T&P

### Install instructions
```
cmsrel CMSSW_8_0_5
cd CMSSW_8_0_5/src
cmsrel CMSSW_9_2_5_patch2
cd CMSSW_9_2_5_patch2/src
cmsenv
git clone https://github.com/l-cadamuro/TauTagAndProbe
git clone https://github.com/davignon/TauTagAndProbe
scram b -j4
```

### Tu run on MC (no t&P, select candidates by gen matching)
Run test.py to produce ntuples including offline taus + various online quantities

### Running on Monte Carlo for HLT
Simply switch the flag isMC accordingly in test.py
It is important to use T&P mu-tau selections as the efficiency is computed using the tau leg of the mu+tau paths.

### Running on Monte Carlo for L1
For Monte Carlo (MC), we implemented a truth matching rather than a Tag & Probe technique which would dramatically and artificially decrease the available statistics.
The MC-specific producers are in two parts:

1. To get the unpacked L1 quantities and the reco information, use:
```
cmsrel CMSSW_7_6_3
cd CMSSW_7_6_3/src
cmsenv
git clone https://github.com/l-cadamuro/TauTagAndProbe
scram b -j4
cmsRun test_noTagAndProbe_multipleTaus.py
```
then set isMC = True in test.py
This runs on MiniAOD and will write ntuples that are referred as "offline".
A wrapper for this is: ```submitOnTier3_multipleTaus.py```, where you can specify the name of the dataset to run on, the global tag, etc.

### For L1 reemulation after T&P selections
2. To re-emulate the L1 objects with a specific config, you have to run on RAW, and use:
```
cmsrel CMSSW_8_0_21
cd cmsrel CMSSW_8_0_5/src
cmsenv
git cms-addpkg L1Trigger/L1TCalorimeter # only if you want to edit smt in the emulator
git clone https://github.com/l-cadamuro/TauTagAndProbe
scram b -j4
cmsRun reEmulL1_MC_L1Only.py
```
The correspond wrapper is: ```submitOnTier3_reEmulL1_MC.py```, where you can specify the name of the dataset to run on, the global tag, etc. Also be mindful that you can specify the emulator version to be run in reEmulL1_MC_L1Only.py by specifying the correct:
```
process.load("L1Trigger.L1TCalorimeter.caloStage2Params_2017_vX_X_XXX_cfi")
```

### Ntuples content
The Ntuple produced that way contain basic tau offline quantities (kinematics, DM, various discriminators) + bits corresponding to various HLT triggers (tauTriggerBits variable) + L1-HLT specific variables (for expert user).

The events stored pass basic mu+tauh T&P selections (OS requirement not applied for filter! isOS variable stored in Ntuple).

The tree triggerNames has the name of all the HLT paths included in the tauTriggerBits variable.

This can be checked for instance with
```
and use reEmulL1.py
triggerNames->Scan("triggerNames","","colsize=100")
*******************************************************************************************************************
* Row * triggerNames *
*******************************************************************************************************************
* 0 * HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_SingleL1_v *
* 1 * HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_TightID_SingleL1_v *
* 2 * HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_SingleL1_v *
* 3 * HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_TightID_SingleL1_v *
* 4 * HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_SingleL1_v *
* 5 * HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_TightID_SingleL1_v *
...
```
The Row of the path correspond to the bit number in the tauTriggerBits variable.

In the example presented here, the decision of the MediumChargedIsoPFTau20 leg can be checked for instance by requiring (tauTriggerBits>>2)&1 (matching with tag muon + offline tau of 0.5 included).


### Plotting: mostly turn-ons
Any basic check can be performed using those Ntuples (efficiency vs pT, eta-phi...) using custom code developed by the user.

A more fancy package is available to produce turn-on plots with CB fits.

For this, the Ntuples must first be converted using the script test/convertTreeForFitting.py (blame RooFit for not being able to deal with custom boolean cuts).

The package for plotting is available in test/fitter/ (to be compiled with make).

The CB fit can be run using a as an example test/fitter/hlt_turnOn_fitter.par (includes example for L1 and HLT turnons w/ subtraction of SS mu+tauh events to take into account contamination from fake taus using bkgSubW weight).

To be launched with
```
./fit.exe run/hlt_turnOn_fitter.par
```
The "Michelangelo" turn-on plot can then be produced adapting the script test/fitter/results/plot_turnOn_Data_vs_MC.py

### Resolutions:
UNDER DEVELOPMENT


10 changes: 10 additions & 0 deletions TauTagAndProbe/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<use name="root"/>
<use name="CLHEP"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/Candidate"/>

<Flags CPPDEFINES="CMSSW_VERSION=1102"/>

<export>
<lib name="1"/>
</export>
70 changes: 70 additions & 0 deletions TauTagAndProbe/interface/GenHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
**
** Helpers for gen info
**
**
** \date: 13 May 2015
** \author: L. Cadamuro (LLR)
*/

#ifndef GenHelper_h
#define GenHelper_h

#include "TVector3.h"
#include "TLorentzVector.h"

#include <DataFormats/HepMCCandidate/interface/GenParticle.h>
#include <vector>

namespace genhelper {

enum HZDecay {
MuHad = 0,
EHad = 1,
HadHad = 2,
MuMu = 3,
EE = 4,
EMu = 5,
EEPrompt = 6, // prompt Z->ee/mumu decays
MuMuPrompt = 7,
Other = 8 // for e.g. h->bb
};

enum WDecay {
Had = 0, // W->qqbar
MuPrompt = 1,
EPrompt = 2,
TauMu = 3, // W->tau->mu
TauE = 4, // W->tau->e
TauHad = 5, // W->tau->tauh
other = 6
};

bool IsLastCopy (const reco::GenParticle& part); // return true if particle has no sons with its same pdgId to reject showering clones
bool IsFirstCopy (const reco::GenParticle& part, const bool checkAbsPdg = false); // return true if particle has no mothers with its same pdgId to handle showering clones

int GetTauDecay (const reco::GenParticle& part); // 0: tau->mu; 1: tau->ele; 2: tau->had
int GetTauDecay (const reco::Candidate* part); // 0: tau->mu; 1: tau->ele; 2: tau->had

const reco::Candidate* GetFirstCopy (const reco::Candidate* part); // follow all the replicated particle chain until the first clone
const reco::Candidate* GetLastCopy (const reco::Candidate* part); // follow all the replicated particle chain until the last clone
HZDecay GetHZDecay (const reco::Candidate* part); // return final state for H/Z -> see enum for code
WDecay GetWDecay (const reco::Candidate* part); // return final state for W -> see enum for code
WDecay GetTopDecay (const reco::Candidate* part); // return final state for top (= final state for W) -> see enum for code

reco::GenParticle GetTauHad (const reco::Candidate* part); // build had tau by summing sons without nu
reco::GenParticle GetTauHadNeutrals (const reco::Candidate* part); // build neutral component of had tau by summing sons without nu

const reco::Candidate* IsFromID (const reco::Candidate* part, int targetPDGId); // find if is son of a certain particle (select by targetPDGId); if not found, return NULL, else return its pointer
int GetIndexInOutput (const reco::Candidate* part, std::vector<const reco::Candidate *> cands);

typedef reco::GenParticleCollection::const_iterator IG;
typedef reco::GenParticleRefVector::const_iterator IGR;
TVector3 ImpactParameter(const TVector3& pv, const TVector3& sv, const TLorentzVector& p4);//Calculate generator level impact parameter
void GetTausDaughters(const reco::GenParticle& tau, reco::GenParticleRefVector& products, bool ignoreNus, bool direct);
void FindDescendents(const reco::GenParticle& base, reco::GenParticleRefVector& descendents, int status, int pdgId=0, bool skipPhotonsPi0AndFSR=false);
const reco::GenParticleRef GetLeadChParticle(const reco::GenParticleRefVector& products);
int getDetailedTauDecayMode(const reco::GenParticleRefVector& products);

}
#endif
2 changes: 2 additions & 0 deletions TauTagAndProbe/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/MessageLogger"/>
<use name="JetMETCorrections/Modules"/>
<use name="FWCore/Utilities"/>
<use name="DataFormats/PatCandidates"/>
<use name="CommonTools/Utils"/>
<use name="CommonTools/UtilAlgos"/>
<use name="FWCore/ServiceRegistry"/>
<use name="HLTrigger/HLTcore"/>
<use name="TauTagAndProbe/TauTagAndProbe"/>

<flags EDM_PLUGIN="1"/>

Expand Down
Loading