Namespace: Trigger

namespace trigger

Functions

bool matchParticle(const ROOT::Math::PtEtaPhiMVector &particle, ROOT::RVec<float> &triggerobject_pts, ROOT::RVec<float> &triggerobject_etas, ROOT::RVec<float> &triggerobject_phis, ROOT::RVec<int> &triggerobject_ids, ROOT::RVec<int> &triggerobject_filterbits, const float &pt_threshold, const float &eta_threshold, const int &trigger_particle_id_value, const std::vector<int> &trigger_bit_values, const float &deltaR_threshold)

This function tries to match an object with a trigger object. An object is successfully matched, if they overlap within a given \(\Delta R\) cone and the \(p_T\) / \(|\eta|\) thresholds are met. Further, the trigger object ID and the trigger object filter bit are set to the correct value.

For the trigger objects, two additional quantities are stored, the ID of the particle and some further information on the trigger path encoded in a bitmap. The trigger object ID is encoded as follows:

1 = Jet
2 = MET
3 = HT
4 = MHT
6 = FatJet
11 = Electron (PixelMatched e/gamma)
22 = Photon (PixelMatch-vetoed e/gamma)
13 = Muon
15 = Tau

A more detailed description about the encoded additional trigger information can be found in the corresponding NanoAOD producer triggerObjects_cff.py It is recommended to look in the CMSSW branch that was used to produce the NanoAOD version you are working with and not the master branch. As an example, for Run2 (NanoAODv9) for electrons:

Electrons

Value

Bit (value used in the config)

ignore matching

-

-1

no match

0

-

CaloIdL_TrackIdL_IsoVL

1

0

1e (WPTight)

2

1

1e (WPLoose)

4

2

OverlapFilter PFTau

8

3

2e

16

4

1e-1mu

32

5

1e-1tau

64

6

3e

128

7

2e-1mu

256

8

1e-2mu

512

9

1e (32_L1DoubleEG_AND_L1SingleEGOr)

1024

10

Parameters:
  • particle – Lorentz vector of the object/particle that should be matched to a trigger object

  • triggerobject_pts – vector of trigger object \(p_T\) values

  • triggerobject_etas – vector of trigger object \(\eta\) values

  • triggerobject_phis – vector of trigger object \(\phi\) values

  • triggerobject_ids – vector of trigger object IDs

  • triggerobject_filterbits – vector of trigger object filter bits. Depending on the trigger object ID (e.g. electron, muon, …), this bitmap has a different meaning.

  • pt_threshold\(p_T\) threshold value the tested object has to exceed in order to be considered a match

  • eta_threshold\(\eta\) threshold value the tested object has to be below in order to be considered a match

  • trigger_particle_id_value – trigger object ID value that should be tested

  • trigger_bit_values – list of trigger object filter bit positions that should be tested. If no bit matching is desired, set this value to -1 or an empty vector.

  • deltaR_threshold – maximum \(\Delta R\) value between the trigger object and the tested object in order to be considered a match

Returns:

boolean value indicating whether a match was found

ROOT::RDF::RNode SingleObjectFlag(ROOT::RDF::RNode df, const std::string &outputname, const std::string &particle, const std::string &triggerobject_pt, const std::string &triggerobject_eta, const std::string &triggerobject_phi, const std::string &triggerobject_id, const std::string &triggerobject_filterbit, const std::string &hlt_path, const float &pt_threshold, const float &eta_threshold, const int &trigger_particle_id_value, const std::vector<int> &trigger_bit_values, const float &deltaR_threshold)

This function generates a trigger flag based on an HLT path and trigger object matching for a selected object. This relies on the trigger::matchParticle function which does the object to trigger object matching test.

Note

This function is defined for single object triggers only. For double object triggers be referred to the trigger::DoubleObjectFlag functions.

Note

If more than one matching HLT path is found, the function will throw an exception, if no matching HLT path is found, the function will return a dataframe with a flag with false for all entries.

Parameters:
  • df – input dataframe

  • outputname – name of the output flag

  • particle – name of the column containing the Lorentz vector of the object/particle that should be matched to a trigger object

  • triggerobject_pt – name of the column containing the trigger object \(p_T\) values

  • triggerobject_eta – name of the column containing the trigger object \(\eta\) values

  • triggerobject_phi – name of the column containing the trigger object \(\phi\) values

  • triggerobject_id – name of the column containing the trigger object IDs

  • triggerobject_filterbit – name of the column containing the trigger object filter bits. Depending on the trigger object ID (e.g. electron, muon, …), this bitmap has a different meaning.

  • hlt_path – name of the column containing the HLT path to be checked, this can be a valid regex.

  • pt_threshold\(p_T\) threshold value the tested object has to exceed in order to be considered a match

  • eta_threshold\(\eta\) threshold value the tested object has to be below in order to be considered a match

  • trigger_particle_id_value – trigger object ID value that should be tested

  • trigger_bit_values – list of trigger object filter bit positions that should be tested. If no bit matching is desired, set this value to -1 or an empty vector.

  • deltaR_threshold – maximum \(\Delta R\) value between the trigger object and the tested object in order to be considered a match

Returns:

a new dataframe containing the trigger flag column

ROOT::RDF::RNode SingleObjectFlag(ROOT::RDF::RNode df, const std::string &outputname, const std::string &particle, const std::string &triggerobject_pt, const std::string &triggerobject_eta, const std::string &triggerobject_phi, const std::string &triggerobject_id, const std::string &triggerobject_filterbit, const float &pt_threshold, const float &eta_threshold, const int &trigger_particle_id_value, const std::vector<int> &trigger_bit_values, const float &deltaR_threshold)

This function generates a trigger flag based on trigger object matching for a selected object. This relies on the trigger::matchParticle function which does the object to trigger object matching test.

Note

This function is defined for single object triggers only. For double object triggers be referred to the trigger::DoubleObjectFlag functions.

Parameters:
  • df – input dataframe

  • outputname – name of the output flag

  • particle – name of the column containing the Lorentz vector of the object/particle that should be matched to a trigger object

  • triggerobject_pt – name of the column containing the trigger object \(p_T\) values

  • triggerobject_eta – name of the column containing the trigger object \(\eta\) values

  • triggerobject_phi – name of the column containing the trigger object \(\phi\) values

  • triggerobject_id – name of the column containing the trigger object IDs

  • triggerobject_filterbit – name of the column containing the trigger object filter bits. Depending on the trigger object ID (e.g. electron, muon, …), this bitmap has a different meaning.

  • pt_threshold\(p_T\) threshold value the tested object has to exceed in order to be considered a match

  • eta_threshold\(\eta\) threshold value the tested object has to be below in order to be considered a match

  • trigger_particle_id_value – trigger object ID value that should be tested

  • trigger_bit_values – list of trigger object filter bit positions that should be tested. If no bit matching is desired, set this value to -1 or an empty vector.

  • deltaR_threshold – maximum \(\Delta R\) value between the trigger object and the tested object in order to be considered a match

Returns:

a new dataframe containing the trigger flag column

ROOT::RDF::RNode DoubleObjectFlag(ROOT::RDF::RNode df, const std::string &outputname, const std::string &particle_1, const std::string &particle_2, const std::string &triggerobject_pt, const std::string &triggerobject_eta, const std::string &triggerobject_phi, const std::string &triggerobject_id, const std::string &triggerobject_filterbit, const std::string &hlt_path, const float &pt_threshold_1, const float &pt_threshold_2, const float &eta_threshold_1, const float &eta_threshold_2, const int &trigger_particle_id_value_1, const int &trigger_particle_id_value_2, const std::vector<int> &trigger_bit_values_1, const std::vector<int> &trigger_bit_values_2, const float &deltaR_threshold)

This function generates a trigger flag based on an HLT path and trigger object matching for the selected objects. This relies on the trigger::matchParticle function which does the object to trigger object matching test.

Note

This function is defined for double object triggers only. For single object triggers be referred to the trigger::SingleObjectFlag functions.

Note

If more than one matching HLT path is found, the function will throw an exception, if no matching HLT path is found, the function will return a dataframe with a flag with false for all entries.

Parameters:
  • df – input dataframe

  • outputname – name of the output flag

  • particle_1 – name of the column containing the Lorentz vector of the first object/particle that should be matched to a trigger object

  • particle_2 – name of the column containing the Lorentz vector of the second object/particle that should be matched to a trigger object

  • triggerobject_pt – name of the column containing the trigger object \(p_T\) values

  • triggerobject_eta – name of the column containing the trigger object \(\eta\) values

  • triggerobject_phi – name of the column containing the trigger object \(\phi\) values

  • triggerobject_id – name of the column containing the trigger object IDs

  • triggerobject_filterbit – name of the column containing the trigger object filter bits. Depending on the trigger object ID (e.g. electron, muon, …), this bitmap has a different meaning.

  • hlt_path – name of the column containing the HLT path to be checked, this can be a valid regex.

  • pt_threshold_1\(p_T\) threshold value the first tested object has to exceed in order to be considered a match

  • pt_threshold_2\(p_T\) threshold value the second tested object has to exceed in order to be considered a match

  • eta_threshold_1\(\eta\) threshold value the first tested object has to be below in order to be considered a match

  • eta_threshold_2\(\eta\) threshold value the second tested object has to be below in order to be considered a match

  • trigger_particle_id_value_1 – trigger object ID value that should be tested for the first object

  • trigger_particle_id_value_2 – trigger object ID value that should be tested for the second object

  • trigger_bit_values_1 – list of trigger object filter bit positions that should be tested for the first object. If no bit matching is desired, set this value to -1 or an empty vector.

  • trigger_bit_values_2 – list of trigger object filter bit positions that should be tested for the second object. If no bit matching is desired, set this value to -1 or an empty vector.

  • deltaR_threshold – maximum \(\Delta R\) value between the trigger object and the tested object in order to be considered a match

Returns:

a new dataframe containing the trigger flag column

ROOT::RDF::RNode DoubleObjectFlag(ROOT::RDF::RNode df, const std::string &outputname, const std::string &particle_1, const std::string &particle_2, const std::string &triggerobject_pt, const std::string &triggerobject_eta, const std::string &triggerobject_phi, const std::string &triggerobject_id, const std::string &triggerobject_filterbit, const float &pt_threshold_1, const float &pt_threshold_2, const float &eta_threshold_1, const float &eta_threshold_2, const int &trigger_particle_id_value_1, const int &trigger_particle_id_value_2, const std::vector<int> &trigger_bit_values_1, const std::vector<int> &trigger_bit_values_2, const float &deltaR_threshold)

This function generates a trigger flag based on the trigger object matching for the selected objects. This relies on the trigger::matchParticle function which does the object to trigger object matching test.

Note

This function is defined for double object triggers only. For single object triggers be referred to the trigger::SingleObjectFlag functions.

Note

this function is used for embedding samples

Parameters:
  • df – input dataframe

  • outputname – name of the output flag

  • particle_1 – name of the column containing the Lorentz vector of the first object/particle that should be matched to a trigger object

  • particle_2 – name of the column containing the Lorentz vector of the second object/particle that should be matched to a trigger object

  • triggerobject_pt – name of the column containing the trigger object \(p_T\) values

  • triggerobject_eta – name of the column containing the trigger object \(\eta\) values

  • triggerobject_phi – name of the column containing the trigger object \(\phi\) values

  • triggerobject_id – name of the column containing the trigger object IDs

  • triggerobject_filterbit – name of the column containing the trigger object filter bits. Depending on the trigger object ID (e.g. electron, muon, …), this bitmap has a different meaning.

  • pt_threshold_1\(p_T\) threshold value the first tested object has to exceed in order to be considered a match

  • pt_threshold_2\(p_T\) threshold value the second tested object has to exceed in order to be considered a match

  • eta_threshold_1\(\eta\) threshold value the first tested object has to be below in order to be considered a match

  • eta_threshold_2\(\eta\) threshold value the second tested object has to be below in order to be considered a match

  • trigger_particle_id_value_1 – trigger object ID value that should be tested for the first object

  • trigger_particle_id_value_2 – trigger object ID value that should be tested for the second object

  • trigger_bit_values_1 – list of trigger object filter bit positions that should be tested for the first object. If no bit matching is desired, set this value to -1 or an empty vector.

  • trigger_bit_values_2 – list of trigger object filter bit positions that should be tested for the second object. If no bit matching is desired, set this value to -1 or an empty vector.

  • deltaR_threshold – maximum \(\Delta R\) value between the trigger object and the tested object in order to be considered a match

Returns:

a new dataframe containing the trigger flag column

ROOT::RDF::RNode GetPrescaleValues(ROOT::RDF::RNode df, correctionManager::CorrectionManager &correction_manager, const std::string &outputname, const std::string &hlt_path, const std::string &run, const std::string &lumiblock, const std::string &prescale_file)

This function generates a new column containing the prescale value for a trigger given run and lumiblock. It is read from an external JSON file containing prescale values for a specific trigger.

Note

The JSON files can be produced with the brilcalc tool from LUM POG which needs to be run on lxplus. More details can be found here in the documentation of brilcalc.

Parameters:
  • df – input dataframe

  • correction_manager – correction manager responsible for loading the prescale trigger values

  • outputname – name of the output column containing the prescale value

  • hlt_path – name of the column containing the HLT path

  • run – name of the column containing the run number

  • lumiblock – name of the column containing the event lumiblock

  • prescale_file – relative path to the JSON containing the prescale values

Returns:

a new dataframe containing the prescale value column