Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:42

0001 //____________________________________________________________________________..
0002 //
0003 // This is a template for a Fun4All SubsysReco module with all methods from the
0004 // $OFFLINE_MAIN/include/fun4all/SubsysReco.h baseclass
0005 // You do not have to implement all of them, you can just remove unused methods
0006 // here and in HerwigHepMCFilter.h.
0007 //
0008 // HerwigHepMCFilter(const std::string &name = "HerwigHepMCFilter")
0009 // everything is keyed to HerwigHepMCFilter, duplicate names do work but it makes
0010 // e.g. finding culprits in logs difficult or getting a pointer to the module
0011 // from the command line
0012 //
0013 // HerwigHepMCFilter::~HerwigHepMCFilter()
0014 // this is called when the Fun4AllServer is deleted at the end of running. Be
0015 // mindful what you delete - you do loose ownership of object you put on the node tree
0016 //
0017 // int HerwigHepMCFilter::Init(PHCompositeNode *topNode)
0018 // This method is called when the module is registered with the Fun4AllServer. You
0019 // can create historgrams here or put objects on the node tree but be aware that
0020 // modules which haven't been registered yet did not put antyhing on the node tree
0021 //
0022 // int HerwigHepMCFilter::InitRun(PHCompositeNode *topNode)
0023 // This method is called when the first event is read (or generated). At
0024 // this point the run number is known (which is mainly interesting for raw data
0025 // processing). Also all objects are on the node tree in case your module's action
0026 // depends on what else is around. Last chance to put nodes under the DST Node
0027 // We mix events during readback if branches are added after the first event
0028 //
0029 // int HerwigHepMCFilter::process_event(PHCompositeNode *topNode)
0030 // called for every event. Return codes trigger actions, you find them in
0031 // $OFFLINE_MAIN/include/fun4all/Fun4AllReturnCodes.h
0032 //   everything is good:
0033 //     return Fun4AllReturnCodes::EVENT_OK
0034 //   abort event reconstruction, clear everything and process next event:
0035 //     return Fun4AllReturnCodes::ABORT_EVENT; 
0036 //   proceed but do not save this event in output (needs output manager setting):
0037 //     return Fun4AllReturnCodes::DISCARD_EVENT; 
0038 //   abort processing:
0039 //     return Fun4AllReturnCodes::ABORT_RUN
0040 // all other integers will lead to an error and abort of processing
0041 //
0042 // int HerwigHepMCFilter::ResetEvent(PHCompositeNode *topNode)
0043 // If you have internal data structures (arrays, stl containers) which needs clearing
0044 // after each event, this is the place to do that. The nodes under the DST node are cleared
0045 // by the framework
0046 //
0047 // int HerwigHepMCFilter::EndRun(const int runnumber)
0048 // This method is called at the end of a run when an event from a new run is
0049 // encountered. Useful when analyzing multiple runs (raw data). Also called at
0050 // the end of processing (before the End() method)
0051 //
0052 // int HerwigHepMCFilter::End(PHCompositeNode *topNode)
0053 // This is called at the end of processing. It needs to be called by the macro
0054 // by Fun4AllServer::End(), so do not forget this in your macro
0055 //
0056 // int HerwigHepMCFilter::Reset(PHCompositeNode *topNode)
0057 // not really used - it is called before the dtor is called
0058 //
0059 // void HerwigHepMCFilter::Print(const std::string &what) const
0060 // Called from the command line - useful to print information when you need it
0061 //
0062 //____________________________________________________________________________..
0063 
0064 #include "HerwigHepMCFilter.h"
0065 
0066 #include <fun4all/Fun4AllReturnCodes.h>
0067 
0068 #include <phool/PHCompositeNode.h>
0069 
0070 //____________________________________________________________________________..
0071 HerwigHepMCFilter::HerwigHepMCFilter(int n_events, const std::string &name):
0072  SubsysReco(name)
0073 {
0074   this->goal_number=n_events;
0075   std::cout << "HerwigHepMCFilter::HerwigHepMCFilter(const std::string &name) Calling ctor" << std::endl;
0076 }
0077 
0078 //____________________________________________________________________________..
0079 HerwigHepMCFilter::~HerwigHepMCFilter()
0080 {
0081   std::cout << "HerwigHepMCFilter::~HerwigHepMCFilter() Calling dtor" << std::endl;
0082 }
0083 
0084 //____________________________________________________________________________..
0085 int HerwigHepMCFilter::Init(PHCompositeNode *topNode)
0086 {
0087   std::cout << "HerwigHepMCFilter::Init(PHCompositeNode *topNode) Initializing" << std::endl;
0088   return Fun4AllReturnCodes::EVENT_OK;
0089 }
0090 
0091 //____________________________________________________________________________..
0092 int HerwigHepMCFilter::InitRun(PHCompositeNode *topNode)
0093 {
0094   std::cout << "HerwigHepMCFilter::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
0095   return Fun4AllReturnCodes::EVENT_OK;
0096 }
0097 
0098 //____________________________________________________________________________..
0099 int HerwigHepMCFilter::process_event(PHCompositeNode *topNode)
0100 {
0101   std::cout << "HerwigHepMCFilter::process_event(PHCompositeNode *topNode) Processing Event" << std::endl;
0102   return Fun4AllReturnCodes::EVENT_OK;
0103 }
0104 
0105 //____________________________________________________________________________..
0106 int HerwigHepMCFilter::ResetEvent(PHCompositeNode *topNode)
0107 {
0108   std::cout << "HerwigHepMCFilter::ResetEvent(PHCompositeNode *topNode) Resetting internal structures, prepare for next event" << std::endl;
0109   return Fun4AllReturnCodes::EVENT_OK;
0110 }
0111 
0112 //____________________________________________________________________________..
0113 int HerwigHepMCFilter::EndRun(const int runnumber)
0114 {
0115   std::cout << "HerwigHepMCFilter::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
0116   return Fun4AllReturnCodes::EVENT_OK;
0117 }
0118 
0119 //____________________________________________________________________________..
0120 int HerwigHepMCFilter::End(PHCompositeNode *topNode)
0121 {
0122   std::cout << "HerwigHepMCFilter::End(PHCompositeNode *topNode) This is the End..." << std::endl;
0123   return Fun4AllReturnCodes::EVENT_OK;
0124 }
0125 
0126 //____________________________________________________________________________..
0127 int HerwigHepMCFilter::Reset(PHCompositeNode *topNode)
0128 {
0129  std::cout << "HerwigHepMCFilter::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
0130   return Fun4AllReturnCodes::EVENT_OK;
0131 }
0132 
0133 //____________________________________________________________________________..
0134 void HerwigHepMCFilter::Print(const std::string &what) const
0135 {
0136   std::cout << "HerwigHepMCFilter::Print(const std::string &what) const Printing info for " << what << std::endl;
0137 }