Fork me on GitHub

Changeset 193c0693 in git for modules


Ignore:
Timestamp:
Feb 26, 2018, 12:59:36 PM (7 years ago)
Author:
GitHub <noreply@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
3e1fe17, e4cc3f7
Parents:
44dbbc1 (diff), 9c980d2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Michele Selvaggi <michele.selvaggi@…> (02/26/18 12:59:36)
git-committer:
GitHub <noreply@…> (02/26/18 12:59:36)
Message:

Merge pull request #48 from l-cadamuro/master

Including B hadrons in the Particles collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/StatusPidFilter.cc

    r44dbbc1 r193c0693  
    5050
    5151using namespace std;
     52
     53namespace {
     54  // integer power (faster than TMath::Pow() + cast to integer)
     55  int ipow(int base, int exp)
     56  {
     57      int result = 1;
     58      while (exp)
     59      {
     60          if (exp & 1)
     61              result *= base;
     62          exp >>= 1;
     63          base *= base;
     64      }
     65
     66      return result;
     67  }
     68
     69  // standalone function to extract the i-th digit from a number (counting from 0 = rightmost, etc..)
     70  int digit(int val, int i)
     71  {
     72      int y    = ipow(10,i);
     73      int z    = val/y;
     74      int val2 = val / (y * 10);
     75      return (z - val2*10);
     76  }
     77
     78  //  return the first two digits if this is a "fundamental" particle
     79  //  ID = 100 is a special case (internal generator ID's are 81-100)
     80  //  also, 101 and 102 are now used (by HepPID) for geantinos
     81  int fundamentalID(int pdgCode)
     82  {
     83      pdgCode = abs(pdgCode);
     84      if( ( digit(pdgCode, 9) == 1 ) && ( digit(pdgCode, 8) == 0 ) ) { return 0; }
     85      if( digit(pdgCode, 2) == 0 && digit(pdgCode, 3) == 0) {
     86          return pdgCode%10000;
     87      } else if( pdgCode <= 102 ) {
     88          return pdgCode;
     89      } else {
     90          return 0;
     91      }
     92  }
     93
     94  bool hasBottom(int pdgCode)
     95  {
     96      if ( (pdgCode/10000000) > 0)
     97        return false;
     98      if (pdgCode <= 100)
     99        return false;
     100      if (fundamentalID(pdgCode) <= 100 && fundamentalID(pdgCode) > 0)
     101        return false;
     102      if( digit(pdgCode, 3) == 5 || digit(pdgCode, 2) == 5 || digit(pdgCode, 1) == 5 )
     103        return true;     
     104      return false;
     105  }
     106}
     107
    52108
    53109//------------------------------------------------------------------------------
     
    117173    if(pdgCode > 22 && pdgCode < 43) pass = kTRUE;
    118174
    119     if(!pass || candidate->Momentum.Pt() < fPTMin) continue;
     175    // logic ported from HepPDF: http://lcgapp.cern.ch/project/simu/HepPDT/HepPDT.2.05.02/html/ParticleID_8cc-source.html#l00081
     176    bool is_b_hadron = hasBottom(pdgCode);
     177    bool is_b_quark  = (pdgCode == 5);
     178
     179    if (is_b_hadron)
     180      pass = kTRUE;
     181
     182    // fPTMin not applied to b_hadrons / b_quarks to allow for b-enriched sample stitching
     183    if(!pass || (candidate->Momentum.Pt() < fPTMin && !(is_b_hadron || is_b_quark)) ) continue;
    120184
    121185    fOutputArray->Add(candidate);
Note: See TracChangeset for help on using the changeset viewer.