CMS 3D CMS Logo

PassThroughEvtVtxGenerator.cc
Go to the documentation of this file.
1 
2 /*
3 */
4 
6 
9 
12 
15 
17 
20 
21 //#include "HepMC/GenEvent.h"
22 // #include "CLHEP/Vector/ThreeVector.h"
23 // #include "HepMC/SimpleVector.h"
24 
25 using namespace edm;
26 using namespace CLHEP;
27 //using namespace HepMC;
28 
29 
31  : BaseEvtVtxGenerator(pset)
32 {
34  if ( ! rng.isAvailable()) {
35  throw cms::Exception("Configuration")
36  << "The PassThroughEvtVtxGenerator requires the RandomNumberGeneratorService\n"
37  "which is not present in the configuration file. \n"
38  "You must add the service\n"
39  "in the configuration file or remove the modules that require it.";
40  }
41  sourceToken=consumes<edm::HepMCProduct>(pset.getParameter<edm::InputTag>("src"));
42 }
43 
45 {
46 }
47 
48 HepMC::FourVector PassThroughEvtVtxGenerator::newVertex(CLHEP::HepRandomEngine*) const {
49  return HepMC::FourVector(0.,0.,0.,0);
50 }
51 
53 {
55 
56  Handle<HepMCProduct> HepUnsmearedMCEvt ;
57 
58  evt.getByToken( sourceToken, HepUnsmearedMCEvt ) ;
59 
60  // Copy the HepMC::GenEvent
61  HepMC::GenEvent* genevt = new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent());
62  std::unique_ptr<edm::HepMCProduct> HepMCEvt(new edm::HepMCProduct(genevt));
63 
64  evt.put(std::move(HepMCEvt)) ;
65 
66  return ;
67 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void produce(edm::Event &, const edm::EventSetup &) override
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
return((rh^lh)&mask)
PassThroughEvtVtxGenerator(const edm::ParameterSet &)
bool isAvailable() const
Definition: Service.h:40
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
HLT enums.
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
def move(src, dest)
Definition: eostools.py:511