 |
Belle II Software
release-05-02-19
|
12 #include <reconstruction/modules/PIDNtuple/PIDNtupleModule.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/StoreObjPtr.h>
19 #include <framework/gearbox/Const.h>
20 #include <framework/logging/Logger.h>
23 #include <framework/dataobjects/EventMetaData.h>
24 #include <mdst/dataobjects/Track.h>
25 #include <mdst/dataobjects/MCParticle.h>
26 #include <mdst/dataobjects/PIDLikelihood.h>
43 m_norm(0), m_value(0), m_file(0), m_tree(0)
47 setDescription(
"Writes a flat ntuple of PIDLikelihoods with track info into a root file");
48 setPropertyFlags(c_ParallelProcessingCertified);
51 addParam(
"outputFileName", m_outputFileName,
"Output file name",
52 std::string(
"PIDNtuple.root"));
53 addParam(
"makeFlat", m_makeFlat,
"make momentum distribution flat up to pMax",
false);
54 addParam(
"p1", m_p1,
"parameter of momentum distribution", 0.90311E-01);
55 addParam(
"p2", m_p2,
"parameter of momentum distribution", 0.56846);
56 addParam(
"pMax", m_pMax,
"make distribution flat up to this momentum", 3.0);
70 trackfitResults.isRequired();
71 PIDLikelihoods.isRequired();
75 mcparticles.isOptional();
76 tracks.optionalRelationTo(mcparticles);
80 m_tree =
new TTree(
"pid",
"PID tree");
99 m_tree->Branch(
"top", &
m_pid.
top,
"le/F:lmu:lpi:lk:lp:flag/S:seen/S");
101 m_tree->Branch(
"ecl", &
m_pid.
ecl,
"le/F:lmu:lpi:lk:lp:flag/S:seen/S");
102 m_tree->Branch(
"klm", &
m_pid.
klm,
"le/F:lmu:lpi:lk:lp:flag/S:seen/S");
121 for (
const auto& track : tracks) {
125 B2WARNING(
"No track fit result... Skipping.");
131 B2WARNING(
"No track fit result... Skipping.");
137 if (mcParticle) mother = mcParticle->
getMother();
140 m_pid.
evt = evtMetaData->getEvent();
Float_t le
log likelihood for electron
virtual void beginRun() override
Called when entering a new run.
LogLikelihoods klm
log likelihoods from KLM
LogLikelihoods cdcdedx
log likelihoods from CDC dE/dx
Float_t rhoDec
decay vertex (cylindrical coordinate r) of MCParticle
makes PID ntuple from mdst input
Short_t seen
is seen in this component (from related MCParticle)
std::string m_outputFileName
output file name
Float_t lmu
log likelihood for muon
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
PID::PIDTree m_pid
PID tree structure.
static const ChargedStable electron
electron particle
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
LogLikelihoods ecl
log likelihoods from ECL
Float_t lp
log likelihood for proton
void clear()
Clear the structure: set elements to zero.
Float_t rhoProd
production vertex (cylindrical coordinate r) of MCParticle
double getPValue() const
Getter for Chi2 Probability of the track fit.
Float_t zProd
production vertex (cylindrical coordinate z) of MCParticle
double m_value
distribution value at m_pMax
LogLikelihoods arich
log likelihoods from ARICH
bool hasSeenInDetector(Const::DetectorSet set) const
Return if the seen-in flag for a specific subdetector is set or not.
Float_t phiDec
decay vertex (cylindrical coordinate phi) of MCParticle
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Short_t primary
is a primary particle (from related MCParticle)
virtual ~PIDNtupleModule()
Destructor.
Float_t pValue
p-value of Track fit
Values of the result of a track fit with a given particle hypothesis.
Float_t phiProd
production vertex (cylindrical coordinate phi) of MCParticle
virtual void terminate() override
Termination action.
static const ChargedStable kaon
charged kaon particle
TVector3 getDecayVertex() const
Return decay vertex.
Int_t motherPDG
PDG code of related mother MCParticle.
static const ChargedStable pion
charged pion particle
unsigned int getStatus(unsigned short int bitmask=USHRT_MAX) const
Return status code of particle.
Short_t flag
flag: information is available (1) or not (0)
LogLikelihoods top
log likelihoods from TOP
Float_t lk
log likelihood for kaon
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
Float_t p
momentum magnitude of Track
double m_p2
parameter of momentum distribution
TVector3 getProductionVertex() const
Return production vertex position.
int getPDG() const
Return PDG code of particle.
double m_norm
distribution normalization
virtual void endRun() override
End-of-run action.
MCParticle * getMother() const
Returns a pointer to the mother particle.
double momDistribution(double p) const
parameterized momentum distribution
bool m_makeFlat
if true, make momentum distribution flat up to m_pMax
virtual void initialize() override
Initialize the Module.
static const ChargedStable proton
proton particle
void printModuleParams() const
Prints module parameters.
double m_p1
parameter of momentum distribution
Float_t phi
azimuthal angle of Track
Float_t lpi
log likelihood for pion
static const ChargedStable muon
muon particle
A Class to store the Monte Carlo particle information.
LogLikelihoods svddedx
log likelihoods from SVD dE/dx
Accessor to arrays stored in the data store.
TTree * m_tree
TTree with PIDTree structure.
Int_t PDG
PDG code of related MCParticle.
double m_pMax
flatten distribution up to this momentum
Float_t cth
cosine of polar angle of Track
Float_t zDec
decay vertex (cylindrical coordinate z) of MCParticle
@ c_PrimaryParticle
bit 0: Particle is primary particle.
virtual void event() override
Event processor.