![]() |
|
|||
File indexing completed on 2025-08-03 08:14:01
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 WaveForm.h. 0007 // 0008 // WaveForm(const std::string &name = "WaveForm") 0009 // everything is keyed to WaveForm, 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 // WaveForm::~WaveForm() 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 WaveForm::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 WaveForm::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 WaveForm::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 WaveForm::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 WaveForm::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 WaveForm::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 WaveForm::Reset(PHCompositeNode *topNode) 0057 // not really used - it is called before the dtor is called 0058 // 0059 // void WaveForm::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 "WaveForm.h" 0065 0066 #include <calobase/TowerInfo.h> 0067 #include <calobase/TowerInfoContainer.h> 0068 0069 #include <fun4all/Fun4AllReturnCodes.h> 0070 0071 #include <phool/PHCompositeNode.h> 0072 #include <phool/getClass.h> 0073 0074 //____________________________________________________________________________.. 0075 WaveForm::WaveForm(const std::string &name): 0076 SubsysReco(name) 0077 { 0078 outfile.open("data.txt",std::fstream::out); 0079 std::cout << "WaveForm::WaveForm(const std::string &name) Calling ctor" << std::endl; 0080 } 0081 0082 //____________________________________________________________________________.. 0083 WaveForm::~WaveForm() 0084 { 0085 std::cout << "WaveForm::~WaveForm() Calling dtor" << std::endl; 0086 } 0087 0088 //____________________________________________________________________________.. 0089 int WaveForm::Init(PHCompositeNode * /*topNode*/) 0090 { 0091 std::cout << "WaveForm::Init(PHCompositeNode *topNode) Initializing" << std::endl; 0092 return Fun4AllReturnCodes::EVENT_OK; 0093 } 0094 0095 //____________________________________________________________________________.. 0096 int WaveForm::InitRun(PHCompositeNode * /*topNode*/) 0097 { 0098 std::cout << "WaveForm::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl; 0099 return Fun4AllReturnCodes::EVENT_OK; 0100 } 0101 0102 //____________________________________________________________________________.. 0103 int WaveForm::process_event(PHCompositeNode *topNode) 0104 { 0105 TowerInfoContainer *towerinfocontainer = findNode::getClass<TowerInfoContainer>(topNode,"TOWERS_HCALOUT"); 0106 if (towerinfocontainer) 0107 { 0108 unsigned int nchannels = towerinfocontainer->size(); 0109 for (unsigned int channel = 0; channel < nchannels; channel++) 0110 { 0111 TowerInfo *rawtwr = towerinfocontainer->get_tower_at_channel(channel); 0112 std::cout << "energy: " << rawtwr->get_energy() << std::endl; 0113 std::cout << "time: " << rawtwr->get_time_float() << std::endl; 0114 for (int j = 0; j < 12; j++) 0115 { 0116 std::cout << "waveform_value[" << j << "]: " << rawtwr->get_waveform_value(j) << std::endl; 0117 } 0118 } 0119 } 0120 return Fun4AllReturnCodes::EVENT_OK; 0121 } 0122 0123 //____________________________________________________________________________.. 0124 int WaveForm::ResetEvent(PHCompositeNode * /*topNode*/) 0125 { 0126 std::cout << "WaveForm::ResetEvent(PHCompositeNode *topNode) Resetting internal structures, prepare for next event" << std::endl; 0127 return Fun4AllReturnCodes::EVENT_OK; 0128 } 0129 0130 //____________________________________________________________________________.. 0131 int WaveForm::EndRun(const int runnumber) 0132 { 0133 std::cout << "WaveForm::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl; 0134 return Fun4AllReturnCodes::EVENT_OK; 0135 } 0136 0137 //____________________________________________________________________________.. 0138 int WaveForm::End(PHCompositeNode * /*topNode*/) 0139 { 0140 std::cout << "WaveForm::End(PHCompositeNode *topNode) This is the End..." << std::endl; 0141 outfile.close(); 0142 return Fun4AllReturnCodes::EVENT_OK; 0143 } 0144 0145 //____________________________________________________________________________.. 0146 int WaveForm::Reset(PHCompositeNode * /*topNode*/) 0147 { 0148 std::cout << "WaveForm::Reset(PHCompositeNode *topNode) being Reset" << std::endl; 0149 return Fun4AllReturnCodes::EVENT_OK; 0150 } 0151 0152 //____________________________________________________________________________.. 0153 void WaveForm::Print(const std::string &what) const 0154 { 0155 std::cout << "WaveForm::Print(const std::string &what) const Printing info for " << what << std::endl; 0156 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |