Project

General

Profile

order.patch

Patch used - Alec Habig, 09/30/2014 10:35 AM

View differences:

../EventGenerator/SupernovaGen_module.cc.fixed 2014-09-29 07:36:55.866438000 -0500
53 53

  
54 54
  private:
55 55

  
56
    void Sample(simb::MCTruth &truth);
56
    void Sample(std::unique_ptr< std::vector<simb::MCTruth> > &truthcol);
57 57

  
58 58
    /// Depending on configuration of fPMeaning
59 59
    /// calculate the momentum of the particle
......
190 190
    //unique_ptr allows ownership to be transferred to the art::Event after the out statement
191 191
    std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
192 192
  
193
    simb::MCTruth truth;
194
    truth.SetOrigin(simb::kSingleParticle);
195
    Sample(truth);
196
  
197
    //     std::cout << "put mctruth into the vector" << std::endl;
198
    truthcol->push_back(truth);
193
    Sample(truthcol);
199 194
  
200 195
    //     std::cout << "add vector to the event " << truthcol->size() << std::endl;
201 196
    evt.put(std::move(truthcol));
......
204 199
  }
205 200

  
206 201
  //----------------------------------------------------------------------------
207
  void SupernovaGen::Sample(simb::MCTruth& mct) 
202
  void SupernovaGen::Sample(std::unique_ptr< std::vector<simb::MCTruth> > &truthcol) 
208 203
  {
209 204
    std::cout << "--- SupernovaGen::Sample, time index: " << fTimeIndex << std::endl;
210 205
    // get the random number generator service and make some CLHEP generators
......
239 234
                << " positrons "    << std::endl; 
240 235
      for (int i_positron=0; i_positron<nPositrons; ++i_positron) {
241 236
          generatedPositrons++;
237
	  simb::MCTruth mct;
238
	  mct.SetOrigin(simb::kSingleParticle);
242 239
          // std::cout << "picking a " << fPDG << std::endl
243 240
          //    << fP0 << " " << fSigmaP << " (" << fX0
244 241
          //    << "/" << fSigmaX << ", " << fY0 
......
326 323
          part.AddTrajectoryPoint(pos, pvec);
327 324
        
328 325
          mct.Add(part);
326
	  truthcol->push_back(mct);
329 327
      } //end of loop over positrons
330 328
    } //end loop over energy bins particles
331 329
    std::cout << "Generated a total of " << generatedPositrons << " positrons" << std::endl;