File indexing completed on 2025-08-03 08:14:01
0001
0002 #include "WaveFormNtuple.h"
0003
0004 #include <calobase/TowerInfo.h>
0005 #include <calobase/TowerInfoContainer.h>
0006
0007 #include <fun4all/Fun4AllReturnCodes.h>
0008
0009 #include <phool/PHCompositeNode.h>
0010 #include <phool/getClass.h>
0011
0012 #include <TFile.h>
0013 #include <TNtuple.h>
0014
0015
0016 WaveFormNtuple::WaveFormNtuple(const std::string &name):
0017 SubsysReco(name)
0018 {
0019 }
0020
0021
0022 int WaveFormNtuple::InitRun(PHCompositeNode * )
0023 {
0024 outfile = TFile::Open("ntuple.root","RECREATE");
0025 ntup = new TNtuple("ntup","waveform analysis","e:t:chi2:ped:status:s5:s6:s7");
0026 return Fun4AllReturnCodes::EVENT_OK;
0027 }
0028
0029
0030 int WaveFormNtuple::process_event(PHCompositeNode *topNode)
0031 {
0032 TowerInfoContainer *towerinfocontainer = findNode::getClass<TowerInfoContainer>(topNode,"TOWERS_HCALOUT");
0033 if (towerinfocontainer)
0034 {
0035 unsigned int nchannels = towerinfocontainer->size();
0036 for (unsigned int channel = 0; channel < nchannels; channel++)
0037 {
0038 TowerInfo *rawtwr = towerinfocontainer->get_tower_at_channel(channel);
0039
0040
0041
0042
0043
0044
0045
0046 ntup->Fill(rawtwr->get_energy(), rawtwr->get_time_float(),rawtwr->get_chi2(), rawtwr->get_pedestal(),rawtwr->get_status(), rawtwr->get_waveform_value(5), rawtwr->get_waveform_value(6), rawtwr->get_waveform_value(7));
0047 }
0048 }
0049 return Fun4AllReturnCodes::EVENT_OK;
0050 }
0051
0052
0053 int WaveFormNtuple::End(PHCompositeNode * )
0054 {
0055 std::cout << "WaveFormNtuple::End(PHCompositeNode *topNode) This is the End..." << std::endl;
0056
0057 outfile->cd();
0058 ntup->Write();
0059 outfile->Close();
0060 return Fun4AllReturnCodes::EVENT_OK;
0061 }