Class Reference for E1039 Core & Analysis Software
GenEmbeddingData.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <TFile.h>
3 #include <TTree.h>
4 #include <phool/getClass.h>
11 #include "GenEmbeddingData.h"
12 using namespace std;
13 
14 GenEmbeddingData::GenEmbeddingData(const std::string name)
15  : SubsysReco(name)
16  , m_name_file("embedding_data.root")
17  , m_name_tree("tree")
18 {
19  ;
20 }
21 
23 {
25 }
26 
28 {
29  mi_evt = findNode::getClass<SQEvent >(topNode, "SQEvent");
30  mi_vec_hit = findNode::getClass<SQHitVector >(topNode, "SQHitVector");
31  if (!mi_evt || !mi_vec_hit) {
32  cout << PHWHERE << ": Cannot find SQEvent and/or SQHitVector." << endl;
34  }
35  mi_sim_evt = findNode::getClass<SQMCEvent >(topNode, "SQMCEvent");
36  mi_sim_vec_trk = findNode::getClass<SQTrackVector >(topNode, "SQTruthTrackVector");
37  mi_sim_vec_dim = findNode::getClass<SQDimuonVector>(topNode, "SQTruthDimuonVector");
38 
39  mo_file = new TFile(m_name_file.c_str(), "RECREATE");
40  mo_tree = new TTree(m_name_tree.c_str(), "Created by GenEmbeddingData");
41  mo_tree->Branch("SQEvent" , &mi_evt);
42  mo_tree->Branch("SQHitVector", &mi_vec_hit);
43  if (mi_sim_evt ) mo_tree->Branch("SQMCEvent" , &mi_sim_evt);
44  if (mi_sim_vec_trk) mo_tree->Branch("SQTruthTrackVector" , &mi_sim_vec_trk);
45  if (mi_sim_vec_dim) mo_tree->Branch("SQTruthDimuonVector", &mi_sim_vec_dim);
46 
48 }
49 
51 {
52  mo_tree->Fill();
54 }
55 
57 {
58  mo_file->cd();
59  mo_file->Write();
60  mo_file->Close();
62 }
int Init(PHCompositeNode *topNode)
int process_event(PHCompositeNode *topNode)
int End(PHCompositeNode *topNode)
Called at the end of all processing.
GenEmbeddingData(const std::string name="GenEmbeddingData")
int InitRun(PHCompositeNode *topNode)
#define PHWHERE
Definition: phool.h:23