HeavyIonsAnalysis/JetAnalysis/src/HiJPTJetAnalyzer.cc
void
HiJPTJetAnalyzer::saveDaughters(const reco::Candidate &gen){

  for(unsigned i=0;i<gen.numberOfDaughters();i++){
    const reco::Candidate & daughter = *gen.daughter(i);
    double daughterPt = daughter.pt();
    if(daughterPt<1.) continue;
    double daughterEta = daughter.eta();
    if(fabs(daughterEta)>3.) continue;
    int daughterPdgId = daughter.pdgId();
    int daughterStatus = daughter.status();
    // Special case when b->b+string, both b and string contain all daughters, so only take the string
    if(gen.pdgId()==daughterPdgId && gen.status()==3 && daughterStatus==2) continue;

    // cheesy way of finding strings which were already used
    if(daughter.pdgId()==92){
      for(unsigned ist=0;ist<usedStringPts.size();ist++){
	if(fabs(daughter.pt() - usedStringPts[ist]) < 0.0001) return;
      }
      usedStringPts.push_back(daughter.pt());
    }

    jets_.bJetIndex[jets_.bMult] = jets_.nref;
    jets_.bStatus[jets_.bMult] = daughterStatus;
    jets_.bVx[jets_.bMult] = daughter.vx();
    jets_.bVy[jets_.bMult] = daughter.vy();
    jets_.bVz[jets_.bMult] = daughter.vz();
    jets_.bPt[jets_.bMult] = daughterPt;
    jets_.bEta[jets_.bMult] = daughterEta;
    jets_.bPhi[jets_.bMult] = daughter.phi();
    jets_.bPdg[jets_.bMult] = daughterPdgId;
    jets_.bChg[jets_.bMult] = daughter.charge();
    jets_.bMult++;
    saveDaughters(daughter);
  }
}
// This version called for all subsequent calls
This version called for all subsequent calls
This version called for all subsequent calls
void
HiJPTJetAnalyzer::saveDaughters(const reco::Candidate &gen){
  for(unsigned i=0;i<gen.numberOfDaughters();i++){
    const reco::Candidate & daughter = *gen.daughter(i);
    double daughterPt = daughter.pt();
    if(daughterPt<1.) continue;
    double daughterEta = daughter.eta();
    if(fabs(daughterEta)>3.) continue;
    int daughterPdgId = daughter.pdgId();
    int daughterStatus = daughter.status();
    if(gen.pdgId()==daughterPdgId && gen.status()==3 && daughterStatus==2) continue;
    if(daughter.pdgId()==92){
      for(unsigned ist=0;ist<usedStringPts.size();ist++){
	if(fabs(daughter.pt() - usedStringPts[ist]) < 0.0001) return;
      }
      usedStringPts.push_back(daughter.pt());
    }
    jets_.bJetIndex[jets_.bMult] = jets_.nref;
    jets_.bStatus[jets_.bMult] = daughterStatus;
    jets_.bVx[jets_.bMult] = daughter.vx();
    jets_.bVy[jets_.bMult] = daughter.vy();
    jets_.bVz[jets_.bMult] = daughter.vz();
    jets_.bPt[jets_.bMult] = daughterPt;
    jets_.bEta[jets_.bMult] = daughterEta;
    jets_.bPhi[jets_.bMult] = daughter.phi();
    jets_.bPdg[jets_.bMult] = daughterPdgId;
    jets_.bChg[jets_.bMult] = daughter.charge();
    jets_.bMult++;
    saveDaughters(daughter);
  }
}
void HiJPTJetAnalyzer :: saveDaughters ( const reco :: Candidate & gen ) { for ( unsigned i = 0 ; i < gen . numberOfDaughters ( ) ; i ++ ) { const reco :: Candidate & daughter = * gen . daughter ( i ) ; double daughterPt = daughter . pt ( ) ; if ( daughterPt < 1. ) continue ; double daughterEta = daughter . eta ( ) ; if ( fabs ( daughterEta ) > 3. ) continue ; int daughterPdgId = daughter . pdgId ( ) ; int daughterStatus = daughter . status ( ) ; if ( gen . pdgId ( ) == daughterPdgId && gen . status ( ) == 3 && daughterStatus == 2 ) continue ; if ( daughter . pdgId ( ) == 92 ) { for ( unsigned ist = 0 ; ist < usedStringPts . size ( ) ; ist ++ ) { if ( fabs ( daughter . pt ( ) - usedStringPts [ ist ] ) < 0.0001 ) return ; } usedStringPts . push_back ( daughter . pt ( ) ) ; } jets_ . bJetIndex [ jets_ . bMult ] = jets_ . nref ; jets_ . bStatus [ jets_ . bMult ] = daughterStatus ; jets_ . bVx [ jets_ . bMult ] = daughter . vx ( ) ; jets_ . bVy [ jets_ . bMult ] = daughter . vy ( ) ; jets_ . bVz [ jets_ . bMult ] = daughter . vz ( ) ; jets_ . bPt [ jets_ . bMult ] = daughterPt ; jets_ . bEta [ jets_ . bMult ] = daughterEta ; jets_ . bPhi [ jets_ . bMult ] = daughter . phi ( ) ; jets_ . bPdg [ jets_ . bMult ] = daughterPdgId ; jets_ . bChg [ jets_ . bMult ] = daughter . charge ( ) ; jets_ . bMult ++ ; saveDaughters ( daughter ) ; } }
This version called for all subsequent calls
This version called for all subsequent calls
// Special case when b->b+string, both b and string contain all daughters, so only take the string // cheesy way of finding strings which were already used