Belle II Software  release-05-02-19
SegmentNetworkAnalyzerModule.h
1 /*************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2016 - Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Thomas Madlener *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #pragma once
12 
13 #include <tracking/trackFindingVXD/segmentNetwork/DirectedNodeNetworkContainer.h>
14 #include <tracking/trackFindingVXD/segmentNetwork/Segment.h>
15 #include <tracking/trackFindingVXD/segmentNetwork/TrackNode.h>
16 
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/datastore/StoreArray.h>
19 #include <mdst/dataobjects/MCParticle.h>
20 #include <framework/core/Module.h>
21 
22 #include <TFile.h>
23 #include <TTree.h>
24 
25 #include <string>
26 
27 namespace Belle2 {
33  class SegmentNetworkAnalyzerModule : public Module {
34 
35  public:
36 
38  struct RootVariables {
39  std::vector<double> phi{};
40  std::vector<double> theta{};
41  std::vector<double> pT{};
42  std::vector<int> signal{};
43  std::vector<int> passed{};
44  std::vector<int> pdg{};
45  std::vector<int> virtualIP{};
46  unsigned networkSize{};
47  unsigned networkConnections{};
48  };
49 
52 
54  void initialize() override;
55 
57  void event() override;
58 
60  void terminate() override;
61 
62  private:
63 
65  std::string m_PARAMnetworkName;
66 
68  std::string m_PARAMrootFileName;
69 
72 
75 
77  TFile* m_rFilePtr;
78 
80  TTree* m_treePtr;
81 
84 
86  void makeBranches();
87 
90  bool passed);
91 
93  template<typename EntryType, typename MetaInfoType>
95 
96  };
98 }
Belle2::SegmentNetworkAnalyzerModule::initialize
void initialize() override
set up root file and check required Store Arrays
Definition: SegmentNetworkAnalyzerModule.cc:36
Belle2::SegmentNetworkAnalyzerModule::RootVariables::phi
std::vector< double > phi
phi of the innermost hit (that is not the virtual IP)
Definition: SegmentNetworkAnalyzerModule.h:47
Belle2::SegmentNetworkAnalyzerModule::RootVariables::passed
std::vector< int > passed
did segment combination pass the three hit filters
Definition: SegmentNetworkAnalyzerModule.h:51
Belle2::SegmentNetworkAnalyzerModule::RootVariables::theta
std::vector< double > theta
theta of the innermost hit (that is not the virtual IP)
Definition: SegmentNetworkAnalyzerModule.h:48
Belle2::SegmentNetworkAnalyzerModule::RootVariables::networkConnections
unsigned networkConnections
number of connections in network
Definition: SegmentNetworkAnalyzerModule.h:55
Belle2::SegmentNetworkAnalyzerModule::event
void event() override
collect necessary data and put into TTree
Definition: SegmentNetworkAnalyzerModule.cc:49
Belle2::SegmentNetworkAnalyzerModule::RootVariables::pT
std::vector< double > pT
pT of the related MCParticle
Definition: SegmentNetworkAnalyzerModule.h:49
Belle2::SegmentNetworkAnalyzerModule::RootVariables::networkSize
unsigned networkSize
segmentNetwork size
Definition: SegmentNetworkAnalyzerModule.h:54
Belle2::Segment< Belle2::TrackNode >
Belle2::DirectedNodeNetwork
Network of directed nodes of the type EntryType.
Definition: DirectedNodeNetwork.h:38
Belle2::SegmentNetworkAnalyzerModule::m_rFilePtr
TFile * m_rFilePtr
ptr to root file
Definition: SegmentNetworkAnalyzerModule.h:85
Belle2::SegmentNetworkAnalyzerModule::m_network
Belle2::StoreObjPtr< Belle2::DirectedNodeNetworkContainer > m_network
StoreObjPtr to the SegmentNetwork and TrackNode Network container.
Definition: SegmentNetworkAnalyzerModule.h:79
Belle2::SegmentNetworkAnalyzerModule::SegmentNetworkAnalyzerModule
SegmentNetworkAnalyzerModule()
constructor
Definition: SegmentNetworkAnalyzerModule.cc:23
Belle2::SegmentNetworkAnalyzerModule::terminate
void terminate() override
write and close root file
Definition: SegmentNetworkAnalyzerModule.cc:90
Belle2::SegmentNetworkAnalyzerModule::m_PARAMrootFileName
std::string m_PARAMrootFileName
file name of the produced root file
Definition: SegmentNetworkAnalyzerModule.h:76
Belle2::SegmentNetworkAnalyzerModule::RootVariables::virtualIP
std::vector< int > virtualIP
did the segment contain the virtual IP
Definition: SegmentNetworkAnalyzerModule.h:53
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr< Belle2::DirectedNodeNetworkContainer >
Belle2::SegmentNetworkAnalyzerModule::m_treePtr
TTree * m_treePtr
ptr to TTree
Definition: SegmentNetworkAnalyzerModule.h:88
Belle2::SegmentNetworkAnalyzerModule::getNConnections
size_t getNConnections(Belle2::DirectedNodeNetwork< EntryType, MetaInfoType > &network) const
get the number of connections between the nodes of a network
Definition: SegmentNetworkAnalyzerModule.cc:159
Belle2::SegmentNetworkAnalyzerModule::RootVariables
keep all the variables for rootoutput in one struct
Definition: SegmentNetworkAnalyzerModule.h:46
Belle2::SegmentNetworkAnalyzerModule::makeBranches
void makeBranches()
setup the Branches in the output TTree
Definition: SegmentNetworkAnalyzerModule.cc:100
Belle2::SegmentNetworkAnalyzerModule::RootVariables::signal
std::vector< int > signal
was segment combination signal
Definition: SegmentNetworkAnalyzerModule.h:50
Belle2::SegmentNetworkAnalyzerModule::RootVariables::pdg
std::vector< int > pdg
pdg of the related MCParticle
Definition: SegmentNetworkAnalyzerModule.h:52
Belle2::SegmentNetworkAnalyzerModule::m_mcParticles
Belle2::StoreArray< Belle2::MCParticle > m_mcParticles
MCParticles StoreArray for obtaining MC Information.
Definition: SegmentNetworkAnalyzerModule.h:82
Belle2::SegmentNetworkAnalyzerModule::m_PARAMnetworkName
std::string m_PARAMnetworkName
StoreArray name of the DirectedNodeNetworkContainer.
Definition: SegmentNetworkAnalyzerModule.h:73
Belle2::StoreArray< Belle2::MCParticle >
Belle2::SegmentNetworkAnalyzerModule::m_rootVariables
RootVariables m_rootVariables
handle to collect all data for one event
Definition: SegmentNetworkAnalyzerModule.h:91
Belle2::SegmentNetworkAnalyzerModule::analyzeCombination
void analyzeCombination(const Belle2::Segment< Belle2::TrackNode > &outer, const Belle2::Segment< Belle2::TrackNode > &inner, bool passed)
get necessary data from three hit combination and put them into the root variables
Definition: SegmentNetworkAnalyzerModule.cc:113