Belle II Software development
PhaseSpaceAnalysisModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9# pragma once
10
11// framework
12#include <framework/core/Module.h>
13#include <mdst/dataobjects/MCParticle.h>
14#include <framework/datastore/StoreArray.h>
15#include <genfit/TrackCand.h>
16#include <tracking/spacePointCreation/SpacePointTrackCand.h>
17
18// ROOT
19#include <TFile.h>
20#include <TTree.h>
21
22// other stuff
23#include <string>
24
25// boost
26#include <boost/any.hpp>
27
28namespace Belle2 {
39
40 public:
43 void initialize() override;
44 void event() override;
45 void terminate() override;
49 std::vector<double> MomX;
50 std::vector<double> MomY;
51 std::vector<double> MomZ;
54 std::vector<double> Eta;
56 std::vector<double> pT;
57
58 std::vector<double> VertX;
59 std::vector<double> VertY;
60 std::vector<double> VertZ;
62 std::vector<int> PDG;
63 std::vector<double> Charge;
65 std::vector<double> Energy;
66 std::vector<double> Mass;
68// std::vector<unsigned short int> RefereeStatus; /**< refereeStatus of a SPTC (if available) */
69 };
70
75 };
76
77 protected:
78
79 // ======================================== PARAMETERS ========================================================================
80 std::vector<std::string> m_PARAMcontainerNames;
82 std::vector<std::string> m_PARAMtrackCandTypes;
84 std::vector<std::string> m_PARAMrootFileName;
88
89 // ======================================== INTERNALLY USED MEMBERS ===========================================================
90 std::vector<std::pair<boost::any, e_trackCandType> > m_tcStoreArrays;
94 std::vector<TTree*> m_treePtrs;
98 std::vector<std::string> m_treeNames;
99 // ==================================================== COUNTERS ==============================================================
100 unsigned int m_noMcPartCtr;
102 unsigned int m_skippedTCsCtr;
104 std::vector<unsigned int> m_mcPartCtr;
107 void initializeCounters(size_t nContainers)
108 {
109 m_noMcPartCtr = 0;
110 m_skippedTCsCtr = 0;
111
112 m_mcPartCtr = std::vector<unsigned int>(nContainers, 0);
113 }
114
120 void initializeRootFile(std::string fileName, std::string writeOption, std::vector<std::string> treeNames);
121 void getValuesForRoot(Belle2::MCParticle* mcParticle, RootVariables& rootVariables);
124 template<typename TrackCandType>
125 std::vector<int> getMCParticleIDs(Belle2::StoreArray<TrackCandType> trackCands);
126
127// /** get all referee statuses from all SpacePointTrackCand */
128// std::vector<unsigned short int> getRefereeStatuses(Belle2::StoreArray<Belle2::SpacePointTrackCand> trackCands);
129
134 std::vector<std::vector<int> > getDiffIds(const std::vector<std::vector<int> >& allIDs);
135
140 };
142}
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Base class for Modules.
Definition: Module.h:72
Module for analysing the phase space of genfit::TrackCand(s) and SpacePointTrackCand(s) NOTE: this is...
void initializeRootFile(std::string fileName, std::string writeOption, std::vector< std::string > treeNames)
create a root file with file name
std::vector< std::string > m_PARAMtrackCandTypes
types of the track candidates in containerNames
std::vector< unsigned int > m_mcPartCtr
container wise coutner of TrackCands / MCParticles
StoreArray< SpacePointTrackCand > m_SpacePointTrackCands
SpacePointTrackCands StoreArray.
RootVariables m_rootVariables
root variables used for collecting data event-wise
bool m_PARAMdiffAnalysis
take containers pair-wise and only analize those particles that are found in one container but not in...
unsigned int m_noMcPartCtr
Counter for nullptr pointers to MC Particles (should always be zero.
std::vector< std::string > m_treeNames
names of the trees that are stored in the root file
StoreArray< genfit::TrackCand > m_GenfitTrackCands
Genfit::TrackCands StoreArray.
std::vector< std::string > m_PARAMrootFileName
name of the output root file name
unsigned int m_skippedTCsCtr
Counter for negative MC particle ids (should always be zero.
e_trackCandType
enum to differentiate between possible trackCandidate types
std::vector< TTree * > m_treePtrs
each container name gets its own tree in the root file
std::vector< std::string > m_PARAMcontainerNames
collection name of trackCands to be investigated
void initializeCounters(size_t nContainers)
initialize all counters to 0 to avoid undefined behavior
std::vector< std::vector< int > > getDiffIds(const std::vector< std::vector< int > > &allIDs)
the first vector in allIds is used as reference to which all other vectors of allIDs are compared.
void getValuesForRoot(Belle2::MCParticle *mcParticle, RootVariables &rootVariables)
collect the values for root output
std::vector< int > getMCParticleIDs(Belle2::StoreArray< TrackCandType > trackCands)
get all MCPartileIDs of tracks
TFile * m_rootFilePtr
Pointer to root file.
StoreArray< MCParticle > m_MCParticles
MCParticles StoreArray.
std::vector< std::pair< boost::any, e_trackCandType > > m_tcStoreArrays
StoreArrays of the containers.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.
helper class to have all RootVariables assembled in one container
std::vector< double > VertZ
z position of vertex
std::vector< int > PDG
mc particle pdg code
std::vector< double > VertY
y position of vertex
std::vector< double > VertX
x position of vertex
std::vector< double > Charge
mc particle charge
std::vector< double > pT
transverse momentum.
std::vector< double > Energy
mc particle energy