// $Id$ // // File: DParticle_factory_HDParSim.cc // Created: Tue Feb 3 11:27:46 EST 2009 // Creator: davidl (on Darwin harriet.jlab.org 9.6.0 i386) // #include #include using namespace std; #include #include #include #include "DFactoryGeneratorHDParSim.h" #include "DTrackingResolutionGEANT.h" #include "DParticle_factory_HDParSim.h" using namespace jana; // Routine used If we're a plugin extern "C"{ void InitPlugin(JApplication *app){ InitJANAPlugin(app); app->AddFactoryGenerator(new DFactoryGeneratorHDParSim()); } } // "C" //------------------ // init //------------------ jerror_t DParticle_factory_HDParSim::init(void) { res = new DTrackingResolutionGEANT(); return NOERROR; } //------------------ // brun //------------------ jerror_t DParticle_factory_HDParSim::brun(jana::JEventLoop *eventLoop, int runnumber) { return NOERROR; } //------------------ // evnt //------------------ jerror_t DParticle_factory_HDParSim::evnt(JEventLoop *loop, int eventnumber) { // The simplest way to do this is to get the list of DParticle // objects made from the DParticle:THROWN factory and copy those // into our own DParticle objects, but with smeared values. vector particles_thrn; loop->Get(particles_thrn, "THROWN"); for(unsigned int i=0; i assoc_objs; particles_thrn[i]->GetT(assoc_objs); for(unsigned int j=0; jAddAssociatedObject(assoc_objs[j]); // Get the GEANT particle type. The DMCThrown object used to create // this DParticle contains this info and a pointer to it should // be kept as an associated object. vector throwns; part->Get(throwns); if(throwns.size()!=1){ _DBG_<<"No associated DMCThrown object with DParticle object obtained"<momentum(); if(res->Smear(thrown->type, mom)){ part->setMomentum(mom); _data.push_back(part); }else{ delete part; } } return NOERROR; } //------------------ // erun //------------------ jerror_t DParticle_factory_HDParSim::erun(void) { return NOERROR; } //------------------ // fini //------------------ jerror_t DParticle_factory_HDParSim::fini(void) { return NOERROR; }