Fork me on GitHub

Changeset 1157 in svn


Ignore:
Timestamp:
Jul 2, 2013, 5:45:31 PM (11 years ago)
Author:
Pavel Demin
Message:

fix daughters indices in DelphesCMSFWLite

Location:
trunk/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/DelphesCMSFWLite.cpp

    r1147 r1157  
     1#include <algorithm>
    12#include <stdexcept>
    23#include <iostream>
     
    56
    67#include <map>
     8#include <vector>
    79
    810#include <stdlib.h>
     
    4143void ConvertInput(fwlite::Event &event, DelphesFactory *factory, TObjArray *allParticleOutputArray, TObjArray *stableParticleOutputArray, TObjArray *partonOutputArray)
    4244{
    43   size_t i;
    4445  fwlite::Handle< vector< reco::GenParticle > > handleParticle;
     46  vector< reco::GenParticle >::const_iterator itParticle;
     47
     48  vector< const reco::Candidate * > vectorCandidate;
     49  vector< const reco::Candidate * >::iterator itCandidate;
     50
    4551  handleParticle.getByLabel(event, "genParticles");
    4652
     
    5662  pdg = TDatabasePDG::Instance();
    5763
    58   for(i = 0; i < handleParticle->size(); ++i)
    59   {
    60     const reco::GenParticle &particle = (*handleParticle)[i];
     64  for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle)
     65  {
     66    vectorCandidate.push_back(&*itParticle);
     67  }
     68
     69  for(itParticle = handleParticle->begin(); itParticle != handleParticle->end(); ++itParticle)
     70  {
     71    const reco::GenParticle &particle = *itParticle;
    6172
    6273    pid = particle.pdgId();
     
    7182
    7283    candidate->Status = status;
     84
     85    itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(0));
     86    if(itCandidate != vectorCandidate.end()) candidate->D1 = distance(vectorCandidate.begin(), itCandidate);
     87
     88    itCandidate = find(vectorCandidate.begin(), vectorCandidate.end(), particle.daughter(particle.numberOfDaughters() - 1));
     89    if(itCandidate != vectorCandidate.end()) candidate->D2 = distance(vectorCandidate.begin(), itCandidate);
    7390
    7491    pdgParticle = pdg->GetParticle(pid);
  • trunk/examples/DelphesCMSFWLite.sh

    r1131 r1157  
    1 
     1echo ">> Building DelphesCMSFWLite"
     2 
    23INC="`echo -I$CMSSW_FWLITE_INCLUDE_PATH | sed 's/:/ -I/g'` -I$CMSSW_RELEASE_BASE/src"
    34
Note: See TracChangeset for help on using the changeset viewer.