Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:43

0001 
0002 #include "SimDataFormats/HiGenData/interface/GenHIEvent.h"
0003 using namespace edm;
0004 
0005 void GenHIEvent::setGenParticles(const reco::GenParticleCollection* input) {
0006   subevents_.reserve(nhard_);
0007   for (int i = 0; i < nhard_; ++i) {
0008     std::vector<reco::GenParticleRef> refs;
0009     subevents_.push_back(refs);
0010   }
0011 
0012   for (unsigned int i = 0; i < input->size(); ++i) {
0013     reco::GenParticleRef ref(input, i);
0014     subevents_[ref->collisionId()].push_back(ref);
0015   }
0016 }
0017 
0018 const std::vector<reco::GenParticleRef> GenHIEvent::getSubEvent(unsigned int sub_id) const {
0019   if (sub_id > subevents_.size()) {  // sub_id >= 0, since sub_id is unsigned
0020   }
0021 
0022   return subevents_[sub_id];
0023 }