Fork me on GitHub

Changes in / [7dbc149:4564cba] in git


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cards/delphes_card_CMS.tcl

    r7dbc149 r4564cba  
    585585module PdgCodeFilter NeutrinoFilter {
    586586
    587   set InputArray Delphes/stableParticles
     587  #set InputArray Delphes/stableParticles
     588  set InputArray Delphes/allParticles
    588589  set OutputArray filteredParticles
    589590
    590591  set PTMin 0.0
     592  set RequireStatus true
     593  set RequireKeepGhostBHadron true
    591594
    592595  add PdgCode {12}
  • modules/PdgCodeFilter.cc

    r7dbc149 r4564cba  
    8585  fCharge = GetInt("Charge", 1);
    8686
     87  // keep bhadron
     88  fRequireKeepGhostBHadron = GetBool("RequireKeepGhostBHadron", false);
     89
    8790  // import input array
    8891  fInputArray = ImportArray(GetString("InputArray", "Delphes/allParticles"));
     
    124127  {
    125128    pdgCode = candidate->PID;
     129
     130    if (fRequireKeepGhostBHadron) {
     131      if (isBHadron(abs(pdgCode)) ){
     132        candidate->PT = candidate->PT * 1e-18;
     133        if (candidate->PT ==0) candidate->PT = 1e-18;
     134        candidate->Momentum.SetPtEtaPhiM(candidate->PT, candidate->Momentum.Eta(), candidate->Momentum.Phi(), candidate->Momentum.M());
     135        fOutputArray->Add(candidate);
     136        continue;
     137      }
     138    }
     139
    126140    const TLorentzVector &candidateMomentum = candidate->Momentum;
    127141    pt = candidateMomentum.Pt();
     
    139153  }
    140154}
     155
     156Bool_t PdgCodeFilter::isBHadron(const unsigned int absPdgId) {
     157  if (absPdgId <= 100)
     158    return false;  // Fundamental particles and MC internals
     159  if (absPdgId >= 1000000000)
     160    return false;  // Nuclei, +-10LZZZAAAI
     161
     162  // General form of PDG ID is 7 digit form
     163  // +- n nr nL nq1 nq2 nq3 nJ
     164  //const int nJ = absPdgId % 10; // Spin
     165  const int nq3 = (absPdgId / 10) % 10;
     166  const int nq2 = (absPdgId / 100) % 10;
     167  const int nq1 = (absPdgId / 1000) % 10;
     168
     169  if (nq3 == 0)
     170    return false;  // Diquarks
     171  if (nq1 == 0 and nq2 == 5)
     172    return true;  // B mesons
     173  if (nq1 == 5)
     174    return true;  // B baryons
     175
     176  return false;
     177}
     178
  • modules/PdgCodeFilter.h

    r7dbc149 r4564cba  
    5555  Bool_t fRequireNotPileup; //!
    5656
     57  Bool_t fRequireKeepGhostBHadron; //!
     58
    5759  std::vector<Int_t> fPdgCodes;
     60
     61  Bool_t isBHadron(const unsigned int absPdgId); //!
    5862
    5963  TIterator *fItInputArray; //!
Note: See TracChangeset for help on using the changeset viewer.