Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

PisaSimpleGenerator.C

Go to the documentation of this file.
00001 #include "PisaSimpleGenerator.h"
00002 
00003 #include <cassert>
00004 
00005 #include "PHCompositeNode.h"
00006 #include "phool.h"
00007 #include "PisaHelper.h"
00008 #include "PisaStack.h"
00009 
00010 #include "TVirtualMCStack.h"
00011 
00012 //_____________________________________________________________________________
00013 PisaSimpleGenerator::PisaSimpleGenerator()
00014   : SubsysReco("PisaSimpleGenerator")
00015 {
00016 }
00017 
00018 //_____________________________________________________________________________
00019 PisaSimpleGenerator::~PisaSimpleGenerator()
00020 {
00021 }
00022 
00023 //_____________________________________________________________________________
00024 int
00025 PisaSimpleGenerator::process_event(PHCompositeNode* topnode)
00026 {
00027   PisaStack* stack = PisaHelper::getClass<PisaStack>(topnode,"Stack");
00028   assert(stack!=0);
00029 
00030   TVirtualMCStack* fStack = stack->stack();
00031   assert(fStack!=0);
00032 
00033   // Track ID (filled by stack)
00034   Int_t ntr;
00035   
00036   // Option: to be tracked
00037   Int_t toBeDone = 1; 
00038   
00039   // Geantino
00040   Int_t pdg  = 0;
00041   
00042   // Polarization
00043   Double_t polx = 0.; 
00044   Double_t poly = 0.; 
00045   Double_t polz = 0.; 
00046   
00047   // Position
00048   Double_t vx  = -200.; 
00049   Double_t vy  = 0.; 
00050   Double_t vz  = 0.; 
00051   Double_t tof = 0.;
00052 
00053   // Momentum 
00054   Double_t px, py, pz, e;
00055   px = 0.2; 
00056   py = 0.2; 
00057   pz = 1.0; 
00058   e  = sqrt(px*px+py*py+pz*pz);
00059   
00060   // Add particle to stack 
00061   fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx, poly, polz, 
00062                     kPPrimary, ntr, 1., 0);
00063   
00064   return 0;
00065 }
00066 
00067 //_____________________________________________________________________________
00068 int
00069 PisaSimpleGenerator::ResetEvent(PHCompositeNode* topnode)
00070 {
00071   PisaStack* stack = PisaHelper::getClass<PisaStack>(topnode,"Stack");
00072   assert(stack!=0);
00073   stack->Reset();
00074   return 0;
00075 }