Fork me on GitHub

Changeset 975405a in git for examples


Ignore:
Timestamp:
Jul 2, 2013, 5:45:31 PM (11 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
d4ad7b3
Parents:
6c565cc
Message:

fix daughters indices in DelphesCMSFWLite

Location:
examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • examples/DelphesCMSFWLite.cpp

    r6c565cc r975405a  
     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);
  • examples/DelphesCMSFWLite.sh

    r6c565cc r975405a  
    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.