Belle II Software  release-06-00-14
PIDNtupleModule.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 #include <framework/core/Module.h>
12 #include <string>
13 #include <reconstruction/modules/PIDNtuple/PIDTree.h>
14 #include "TFile.h"
15 
16 namespace Belle2 {
25  class PIDNtupleModule : public Module {
26 
27  public:
28 
33 
37  virtual ~PIDNtupleModule();
38 
43  virtual void initialize() override;
44 
49  virtual void beginRun() override;
50 
54  virtual void event() override;
55 
60  virtual void endRun() override;
61 
66  virtual void terminate() override;
67 
71  void printModuleParams() const;
72 
73  private:
74 
75  std::string m_outputFileName;
76  bool m_makeFlat;
77  double m_p1;
78  double m_p2;
79  double m_pMax;
81  double m_norm;
82  double m_value;
84  TFile* m_file;
85  TTree* m_tree;
94  double momDistribution(double p) const
95  {
96  double f = 1.0 - exp(-p / m_p1);
97  return m_norm * f * f * f * f * exp(-p / m_p2);
98  };
99 
100  };
101 
103 } // Belle2 namespace
Base class for Modules.
Definition: Module.h:72
makes PID ntuple from mdst input
TTree * m_tree
TTree with PIDTree structure.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
bool m_makeFlat
if true, make momentum distribution flat up to m_pMax
virtual void endRun() override
End-of-run action.
virtual void terminate() override
Termination action.
double m_p2
parameter of momentum distribution
PID::PIDTree m_pid
PID tree structure.
virtual void beginRun() override
Called when entering a new run.
PIDNtupleModule()
Constructor.
virtual ~PIDNtupleModule()
Destructor.
void printModuleParams() const
Prints module parameters.
double momDistribution(double p) const
parameterized momentum distribution
double m_pMax
flatten distribution up to this momentum
double m_p1
parameter of momentum distribution
double m_value
distribution value at m_pMax
double m_norm
distribution normalization
std::string m_outputFileName
output file name
Abstract base class for different kinds of events.
Structure for the output of PID log likelihoods + tracking info to a flat ntuple.
Definition: PIDTree.h:56