11#include <tracking/modules/vxdtfRedesign/SegmentNetworkAnalyzerModule.h>
12#include <tracking/spacePointCreation/SpacePoint.h>
13#include <tracking/spacePointCreation/PurityCalculatorTools.h>
29 std::string(
"SegmentNetworkAnalyzer_output.root"));
35 B2INFO(
"SegmentNetworkAnalyzer::initialize() ------------------------------");
41 m_treePtr =
new TTree(
"SegmentNetworkAnalyzer",
"segment network analysis output");
55 for (
const auto&
outerHit : hitNetwork.getNodes()) {
56 for (
const auto& centerHit :
outerHit->getInnerNodes()) {
58 centerHit->getEntry().m_sector->getFullSecID(),
60 ¢erHit->getEntry());
62 for (
const auto& innerHit : centerHit->getInnerNodes()) {
64 innerHit->getEntry().m_sector->getFullSecID(),
65 ¢erHit->getEntry(),
66 &innerHit->getEntry());
70 if (
auto outerNode = segmentNetwork.getNode(outerSegment.
getID())) {
71 for (
const auto& connectedNode : outerNode->getInnerNodes()) {
72 if (connectedNode->getEntry() == innerSegment) {
116 std::vector<const Belle2::SpacePoint*> combinationSPs;
117 combinationSPs.push_back(outer.
getOuterHit()->m_spacePoint);
118 combinationSPs.push_back(outer.
getInnerHit()->m_spacePoint);
119 combinationSPs.push_back(inner.
getInnerHit()->m_spacePoint);
122 auto mcId = purityInfo[0].getPurity();
123 bool signal = mcId.first >= 0 && mcId.second == 1;
140 auto spacePoint = inner.
getInnerHit()->m_spacePoint;
147 auto position = spacePoint->getPosition();
151 B2DEBUG(22,
"Collected combination with: phi " << position.Phi() <<
", theta " << position.Theta() <<
152 ", pdg " << pdg <<
", pT " << pT <<
", signal " << signal <<
", passed " << passed <<
", mcId " << mcId.first);
155template<
typename EntryType,
typename MetaInfoType >
159 for (
const auto& outerNodes : network) {
160 nLinks += outerNodes->getInnerNodes().size();
DirectedNodeNetwork< Belle2::TrackNode, Belle2::VoidMetaInfo > & accessHitNetwork()
Returns reference to the HitNetwork stored in this container, intended for read and write access.
DirectedNodeNetwork< Belle2::Segment< Belle2::TrackNode >, Belle2::CACell > & accessSegmentNetwork()
Returns reference to the SegmentNetwork stored in this container, intended for read and write access.
Network of directed nodes of the type EntryType.
A Class to store the Monte Carlo particle information.
int getPDG() const
Return PDG code of particle.
ROOT::Math::XYZVector getMomentum() const
Return momentum.
void setDescription(const std::string &description)
Sets the description of the module.
TTree * m_treePtr
ptr to TTree
std::string m_PARAMrootFileName
file name of the produced root file
TFile * m_rFilePtr
ptr to root file
void initialize() override
set up root file and check required Store Arrays
SegmentNetworkAnalyzerModule()
constructor
Belle2::StoreObjPtr< Belle2::DirectedNodeNetworkContainer > m_network
StoreObjPtr to the SegmentNetwork and TrackNode Network container.
RootVariables m_rootVariables
handle to collect all data for one event
void event() override
collect necessary data and put into TTree
std::string m_PARAMnetworkName
StoreArray name of the DirectedNodeNetworkContainer.
size_t getNConnections(Belle2::DirectedNodeNetwork< EntryType, MetaInfoType > &network) const
get the number of connections between the nodes of a network
void terminate() override
write and close root file
Belle2::StoreArray< Belle2::MCParticle > m_mcParticles
MCParticles StoreArray for obtaining MC Information.
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
void makeBranches()
setup the Branches in the output TTree
The Segment class This class represents segments of track candidates needed for TrackFinderVXD-Module...
std::int64_t getID() const
************************* PUBLIC MEMBER FUNCTIONS *************************
const HitType * getOuterHit() const
returns outer hit of current Segment
const HitType * getInnerHit() const
returns inner hit of current Segment
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
@ VXD
Any type of VXD Sensor.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
static std::vector< Belle2::MCVXDPurityInfo > createPurityInfosVec(const std::vector< const Belle2::SpacePoint * > &spacePoints)
create a vector of MCVXDPurityInfos objects for a std::vector<Belle2::SpacePoints>.
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior
Abstract base class for different kinds of events.
keep all the variables for rootoutput in one struct
std::vector< double > phi
phi of the innermost hit (that is not the virtual IP)
std::vector< int > pdg
pdg of the related MCParticle
unsigned networkSize
segmentNetwork size
std::vector< int > virtualIP
did the segment contain the virtual IP
std::vector< double > theta
theta of the innermost hit (that is not the virtual IP)
unsigned networkConnections
number of connections in network
std::vector< int > passed
did segment combination pass the three hit filters
std::vector< int > signal
was segment combination signal
std::vector< double > pT
pT of the related MCParticle