Fork me on GitHub

Changeset 2c8865f in git


Ignore:
Timestamp:
Feb 24, 2022, 6:01:00 AM (3 years ago)
Author:
youngkwon jo <cccpy98@…>
Children:
46b3e01
Parents:
dd263e4
Message:

add code for keeping the BHadrons

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cards/delphes_card_CMS.tcl

    rdd263e4 r2c8865f  
    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}
     
    783786# add Branch InputArray BranchName BranchClass
    784787  add Branch Delphes/allParticles Particle GenParticle
     788#  add Branch NeutrinoFilter/filteredParticles Particle2 GenParticle
    785789
    786790  add Branch TrackMerger/tracks Track Track
  • modules/PdgCodeFilter.cc

    rdd263e4 r2c8865f  
    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    //std::cout << "--" << pdgCode << std::endl;
     130
     131    if (fRequireKeepGhostBHadron) {
     132      if (isBHadron(abs(pdgCode)) ){
     133        candidate->PT = candidate->PT * 1e-18;
     134        if (candidate->PT ==0) candidate->PT = 1e-18;
     135        candidate->Momentum.SetPtEtaPhiM(candidate->PT, candidate->Momentum.Eta(), candidate->Phi, candidate->Momentum.M());
     136        fOutputArray->Add(candidate);
     137        continue;
     138      }
     139    }
     140
    126141    const TLorentzVector &candidateMomentum = candidate->Momentum;
    127142    pt = candidateMomentum.Pt();
     
    139154  }
    140155}
     156
     157Bool_t PdgCodeFilter::isBHadron(const unsigned int absPdgId) {
     158  if (absPdgId <= 100)
     159    return false;  // Fundamental particles and MC internals
     160  if (absPdgId >= 1000000000)
     161    return false;  // Nuclei, +-10LZZZAAAI
     162
     163  // General form of PDG ID is 7 digit form
     164  // +- n nr nL nq1 nq2 nq3 nJ
     165  //const int nJ = absPdgId % 10; // Spin
     166  const int nq3 = (absPdgId / 10) % 10;
     167  const int nq2 = (absPdgId / 100) % 10;
     168  const int nq1 = (absPdgId / 1000) % 10;
     169
     170  if (nq3 == 0)
     171    return false;  // Diquarks
     172  if (nq1 == 0 and nq2 == 5)
     173    return true;  // B mesons
     174  if (nq1 == 5)
     175    return true;  // B baryons
     176
     177  return false;
     178}
     179
  • modules/PdgCodeFilter.h

    rdd263e4 r2c8865f  
    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.