CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
BiasedTauDecayer Class Reference

#include <BiasedTauDecayer.h>

Inheritance diagram for BiasedTauDecayer:

Public Member Functions

 BiasedTauDecayer (Pythia8::Info *infoPtr, Pythia8::Settings *settingsPtr)
 
bool decay (std::vector< int > &idProd, std::vector< double > &mProd, std::vector< Pythia8::Vec4 > &pProd, int iDec, const Pythia8::Event &event) override
 

Private Attributes

Pythia8::TauDecays decayer
 
bool eDecays_
 
bool filter_
 
std::vector< int > idProdSave
 
std::vector< double > mProdSave
 
bool muDecays_
 
std::vector< Pythia8::Vec4pProdSave
 

Detailed Description

Definition at line 9 of file BiasedTauDecayer.h.

Constructor & Destructor Documentation

◆ BiasedTauDecayer()

BiasedTauDecayer::BiasedTauDecayer ( Pythia8::Info *  infoPtr,
Pythia8::Settings *  settingsPtr 
)

Definition at line 11 of file BiasedTauDecayer.cc.

11  {
12  decayer = TauDecays();
13  decayer.initInfoPtr(*infoPtr);
14  decayer.init();
15  filter_ = settingsPtr->flag("BiasedTauDecayer:filter");
16  eDecays_ = settingsPtr->flag("BiasedTauDecayer:eDecays");
17  muDecays_ = settingsPtr->flag("BiasedTauDecayer:muDecays");
18 }
Pythia8::TauDecays decayer

Member Function Documentation

◆ decay()

bool BiasedTauDecayer::decay ( std::vector< int > &  idProd,
std::vector< double > &  mProd,
std::vector< Pythia8::Vec4 > &  pProd,
int  iDec,
const Pythia8::Event &  event 
)
override

Definition at line 20 of file BiasedTauDecayer.cc.

References funct::abs(), PA_ZEESkim_cff::decay, edmPickEvents::event, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, reco::isLepton(), visualization-live-secondInstance_cfg::m, AlCaHLTBitMon_ParallelJobs::p, and funct::true.

21  {
22  if (!filter_)
23  return false;
24  if (idProd[0] != 15 && idProd[0] != -15)
25  return false;
26  int iStart = event[iDec].iTopCopyId();
27  int iMom = event[iStart].mother1();
28  int idMom = event[iMom].idAbs();
29  if (idMom != 23 && idMom != 24 && idMom != 25)
30  return false;
31  int iDau1 = event[iMom].daughter1();
32  int iDau2 = event[iMom].daughter2();
33  int iBot1 = event[iDau1].iBotCopyId();
34  int iBot2 = event[iDau2].iBotCopyId();
35  int iDecSis = (iDec == iBot1) ? iBot2 : iBot1;
36  // Check if sister has been decayed
37  // Since taus decays are correlated, use one decay, store the other
38  bool notDecayed = event[iDecSis].status() > 0 ? true : false;
39  if (notDecayed) {
40  // bias for leptonic decays
41  bool hasLepton = (eDecays_ || muDecays_) ? false : true;
42  Event decay;
43  int i1 = -1;
44  int i2 = -1;
45  while (!hasLepton) {
46  decay = event;
47  decayer.decay(iDec, decay);
48  // check for lepton in first decay
49  i1 = decay[iDec].daughter1();
50  i2 = decay[iDec].daughter2();
51  for (int i = i1; i < i2 + 1; ++i) {
52  if (decay[i].isLepton() && decay[i].isCharged()) {
53  if ((eDecays_ && abs(decay[i].id()) == 11) || (muDecays_ && abs(decay[i].id()) == 13)) {
54  hasLepton = true;
55  break;
56  }
57  }
58  }
59  if (hasLepton)
60  break;
61  // check for lepton in second decay
62  i1 = decay[iDecSis].daughter1();
63  i2 = decay[iDecSis].daughter2();
64  for (int i = i1; i < i2 + 1; ++i) {
65  if (decay[i].isLepton() && decay[i].isCharged()) {
66  if ((eDecays_ && abs(decay[i].id()) == 11) || (muDecays_ && abs(decay[i].id()) == 13)) {
67  hasLepton = true;
68  break;
69  }
70  }
71  }
72  }
73  // Return decay products
74  i1 = decay[iDec].daughter1();
75  i2 = decay[iDec].daughter2();
76  for (int i = i1; i < i2 + 1; ++i) {
77  idProd.push_back(decay[i].id());
78  mProd.push_back(decay[i].m());
79  pProd.push_back(decay[i].p());
80  }
81  // Store correlated decay products
82  i1 = decay[iDecSis].daughter1();
83  i2 = decay[iDecSis].daughter2();
84  idProdSave.clear();
85  mProdSave.clear();
86  pProdSave.clear();
87  for (int i = i1; i < i2 + 1; ++i) {
88  idProdSave.push_back(decay[i].id());
89  mProdSave.push_back(decay[i].m());
90  pProdSave.push_back(decay[i].p());
91  }
92  } else {
93  // Return stored decay products
94  for (size_t i = 0; i < idProdSave.size(); ++i) {
95  idProd.push_back(idProdSave[i]);
96  mProd.push_back(mProdSave[i]);
97  pProd.push_back(pProdSave[i]);
98  }
99  }
100 
101  return true;
102 }
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:13
std::vector< Pythia8::Vec4 > pProdSave
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > idProdSave
std::vector< double > mProdSave
bool decay(std::vector< int > &idProd, std::vector< double > &mProd, std::vector< Pythia8::Vec4 > &pProd, int iDec, const Pythia8::Event &event) override
Pythia8::TauDecays decayer

Member Data Documentation

◆ decayer

Pythia8::TauDecays BiasedTauDecayer::decayer
private

Definition at line 20 of file BiasedTauDecayer.h.

◆ eDecays_

bool BiasedTauDecayer::eDecays_
private

Definition at line 22 of file BiasedTauDecayer.h.

◆ filter_

bool BiasedTauDecayer::filter_
private

Definition at line 21 of file BiasedTauDecayer.h.

◆ idProdSave

std::vector<int> BiasedTauDecayer::idProdSave
private

Definition at line 24 of file BiasedTauDecayer.h.

◆ mProdSave

std::vector<double> BiasedTauDecayer::mProdSave
private

Definition at line 25 of file BiasedTauDecayer.h.

◆ muDecays_

bool BiasedTauDecayer::muDecays_
private

Definition at line 23 of file BiasedTauDecayer.h.

◆ pProdSave

std::vector<Pythia8::Vec4> BiasedTauDecayer::pProdSave
private

Definition at line 26 of file BiasedTauDecayer.h.