Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:15:56

0001 #include <iostream>
0002 
0003 // --- header for this clase
0004 #include <TreeMaker.h>
0005 
0006 // --- basic sPhenix environment stuff
0007 #include <fun4all/Fun4AllServer.h>
0008 #include <phool/getClass.h>
0009 #include <phool/PHCompositeNode.h>
0010 
0011 using std::cout;
0012 using std::endl;
0013 
0014 
0015 
0016 TreeMaker::TreeMaker(const std::string &name) : SubsysReco("TREEMAKER")
0017 {
0018   cout << "TreeMaker::TreeMaker called" << endl;
0019   foutname = name;
0020 }
0021 
0022 
0023 TreeMaker::~TreeMaker()
0024 {
0025   cout << "TreeMaker::~TreeMaker called" << endl;
0026 }
0027 
0028 
0029 int TreeMaker::Init(PHCompositeNode *topNode)
0030 {
0031   cout << "TreeMaker::Init called" << endl;
0032   outfile = TFile::Open(foutname.c_str(),"RECREATE");
0033   InitializeTree();
0034   return 0;
0035 }
0036 
0037 
0038 int TreeMaker::InitRun(PHCompositeNode *topNode)
0039 {
0040   cout << "TreeMaker::InitRun called" << endl;
0041   int cn_status = CreateNode(topNode);
0042   cout << "TreeMaker::InitRun : CreateNode returned " << cn_status << endl;
0043   return 0;
0044 }
0045 
0046 
0047 
0048 int TreeMaker::process_event(PHCompositeNode *topNode)
0049 {
0050 
0051   // --- initialize the counters
0052   InitializeCounters();
0053 
0054   // --- copy the old jets/clusters and make a new container for modified jets/clusters
0055   CopyAndMakeJets(topNode);
0056   CopyAndMakeClusters(topNode);
0057 
0058   // --- get the jets and set the tree variables
0059   GetTruthJets(topNode);
0060   GetRecoJets(topNode);
0061 
0062   // --- get the clusters and do some analysis
0063   GetClusters(topNode);
0064 
0065   // --- do some stuff with fast jet
0066   UseFastJet(topNode);
0067 
0068   // --- fill the tree
0069   tree->Fill();
0070 
0071   // --- all done!
0072   return 0;
0073 
0074 }
0075 
0076 
0077 
0078 int TreeMaker::End(PHCompositeNode *topNode)
0079 {
0080   cout << "TreeMaker::End called" << endl;
0081   outfile->Write();
0082   outfile->Close();
0083   cout << "All done!  Have a nice day!" << endl;
0084   return 0;
0085 }
0086