| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GenPruneTool.cc

Go to the documentation of this file.
00001 #include "GenPruneTool.h"
00002 #include "Context/TimeStamp.h"
00003 #include "Event/GenHeader.h"
00004 
00005 using namespace DayaBay;
00006 
00007 GenPruneTool::GenPruneTool(const std::string& type,
00008                                          const std::string& name, 
00009                                          const IInterface* parent)
00010     : GaudiTool(type,name,parent)
00011 {
00012   declareInterface< IGenPruneTool >(this) ;
00013 
00014   declareProperty("MaxVertices", m_maxVertices = -1,
00015                   "Negative: no touch. Otherwise, the number of vertices must be <= the MaxVertices");
00016 }
00017 
00018 GenPruneTool::~GenPruneTool()
00019 {}
00020 
00021 StatusCode GenPruneTool::initialize()
00022 {
00023   return StatusCode::SUCCESS;
00024 }
00025 
00026 StatusCode GenPruneTool::finalize()
00027 {
00028   return StatusCode::SUCCESS;
00029 }
00030 
00031 
00032 StatusCode GenPruneTool::prune(DayaBay::GenHeader* genHeader)
00033 {
00034   if (m_maxVertices < 0) return StatusCode::SUCCESS;
00035 
00036   HepMC::GenEvent* event = genHeader->event();
00037   if (!event) {
00038     debug() << "GenHeader has null event, my work here is already done" << endreq;
00039     return StatusCode::SUCCESS;
00040   }
00041 
00042   int nverts = genHeader->event()->vertices_size();
00043   if (nverts <= m_maxVertices) {
00044     debug() << "GenHeader has " << nverts << " <= " << m_maxVertices
00045             << ", my work here is already done."
00046             << endreq;
00047     return StatusCode::SUCCESS;
00048   }
00049 
00050   genHeader->setEvent(0);
00051   debug() << "nullified GenHeader's event pointer" << endreq;
00052   return StatusCode::SUCCESS;
00053 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:37:24 2011 for DybTool by doxygen 1.4.7