Belle II Software  release-05-02-19
BeamSpotMonitorModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Giulia Casarosa, Gaetano De Marino *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/Module.h>
14 #include <framework/database/DBObjPtr.h>
15 
16 #include <mdst/dbobjects/BeamSpot.h>
17 
18 #include <string>
19 #include <TFile.h>
20 #include <TTree.h>
21 #include <TBranch.h>
22 
23 namespace Belle2 {
31  class BeamSpotMonitorModule : public Module {
32 
33  public:
34 
39 
41  virtual void initialize() override;
42 
44  virtual void beginRun() override;
45 
47  virtual void event() override;
48 
50  virtual void terminate() override;
51 
52  private:
53 
54  /* user-defined parameters */
55  std::string m_rootFileName;
57  /* ROOT file related parameters */
58  TFile* m_rootFilePtr = nullptr;
59  TTree* m_tree = nullptr;
61  //branches
62  TBranch* b_exp = nullptr;
63  TBranch* b_run = nullptr;
64  TBranch* b_x = nullptr;
65  TBranch* b_y = nullptr;
66  TBranch* b_z = nullptr;
67  TBranch* b_xErr = nullptr;
68  TBranch* b_yErr = nullptr;
69  TBranch* b_zErr = nullptr;
70  TBranch* b_xSize = nullptr;
71  TBranch* b_ySize = nullptr;
72  TBranch* b_zSize = nullptr;
74  //branch variables
75  int m_run = -1;
76  int m_exp = -1;
77  double m_x = 0;
78  double m_y = 0;
79  double m_z = 0;
80  double m_xErr = 0;
81  double m_yErr = 0;
82  double m_zErr = 0;
83  double m_xSize = 0;
84  double m_ySize = 0;
85  double m_zSize = 0;
91  };
93 }
94 
Belle2::BeamSpotMonitorModule::b_z
TBranch * b_z
Z position of the beam spot.
Definition: BeamSpotMonitorModule.h:74
Belle2::BeamSpotMonitorModule::m_y
double m_y
Y position of the beam spot.
Definition: BeamSpotMonitorModule.h:86
Belle2::BeamSpotMonitorModule::m_xSize
double m_xSize
X position size of the beam spot.
Definition: BeamSpotMonitorModule.h:91
Belle2::BeamSpotMonitorModule::m_rootFilePtr
TFile * m_rootFilePtr
pointer at root file used for storing histograms
Definition: BeamSpotMonitorModule.h:66
Belle2::BeamSpotMonitorModule::m_ySize
double m_ySize
Y position size of the beam spot.
Definition: BeamSpotMonitorModule.h:92
Belle2::BeamSpotMonitorModule::m_zSize
double m_zSize
Z position size of the beam spot.
Definition: BeamSpotMonitorModule.h:93
Belle2::BeamSpotMonitorModule::b_zSize
TBranch * b_zSize
Z position size of the beam spot.
Definition: BeamSpotMonitorModule.h:80
Belle2::BeamSpotMonitorModule::terminate
virtual void terminate() override
print the payloads uniqueID and write tree to the rootfile
Definition: BeamSpotMonitorModule.cc:105
Belle2::BeamSpotMonitorModule::BeamSpotMonitorModule
BeamSpotMonitorModule()
Constructor: Sets the description, the properties and the parameters of the module.
Definition: BeamSpotMonitorModule.cc:30
Belle2::BeamSpotMonitorModule::b_ySize
TBranch * b_ySize
Y position size of the beam spot.
Definition: BeamSpotMonitorModule.h:79
Belle2::BeamSpotMonitorModule::b_xSize
TBranch * b_xSize
X position size of the beam spot.
Definition: BeamSpotMonitorModule.h:78
Belle2::BeamSpot
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition: BeamSpot.h:32
Belle2::BeamSpotMonitorModule::m_tree
TTree * m_tree
pointer to the tree
Definition: BeamSpotMonitorModule.h:67
Belle2::BeamSpotMonitorModule::initialize
virtual void initialize() override
initialize the TTree
Definition: BeamSpotMonitorModule.cc:39
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::BeamSpotMonitorModule::m_xErr
double m_xErr
X position error of the beam spot.
Definition: BeamSpotMonitorModule.h:88
Belle2::BeamSpotMonitorModule::m_rootFileName
std::string m_rootFileName
root file name
Definition: BeamSpotMonitorModule.h:63
Belle2::BeamSpotMonitorModule::beginRun
virtual void beginRun() override
check BeamSpot payload validity
Definition: BeamSpotMonitorModule.cc:63
Belle2::BeamSpotMonitorModule::b_yErr
TBranch * b_yErr
Y position error of the beam spot.
Definition: BeamSpotMonitorModule.h:76
Belle2::BeamSpotMonitorModule::m_BeamSpotDB
DBObjPtr< BeamSpot > m_BeamSpotDB
beam spot payload from the database
Definition: BeamSpotMonitorModule.h:96
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::BeamSpotMonitorModule::m_z
double m_z
Z position of the beam spot.
Definition: BeamSpotMonitorModule.h:87
Belle2::BeamSpotMonitorModule::m_x
double m_x
X position of the beam spot.
Definition: BeamSpotMonitorModule.h:85
Belle2::BeamSpotMonitorModule::b_x
TBranch * b_x
X position of the beam spot.
Definition: BeamSpotMonitorModule.h:72
Belle2::BeamSpotMonitorModule::m_exp
int m_exp
experiment number
Definition: BeamSpotMonitorModule.h:84
Belle2::BeamSpotMonitorModule::m_BeamSpot
BeamSpot m_BeamSpot
beam spot payload
Definition: BeamSpotMonitorModule.h:97
Belle2::BeamSpotMonitorModule::b_y
TBranch * b_y
Y position of the beam spot.
Definition: BeamSpotMonitorModule.h:73
Belle2::BeamSpotMonitorModule::m_run
int m_run
run number
Definition: BeamSpotMonitorModule.h:83
Belle2::BeamSpotMonitorModule::b_zErr
TBranch * b_zErr
Z position error of the beam spot.
Definition: BeamSpotMonitorModule.h:77
Belle2::BeamSpotMonitorModule::m_zErr
double m_zErr
Z position error of the beam spot.
Definition: BeamSpotMonitorModule.h:90
Belle2::BeamSpotMonitorModule::b_xErr
TBranch * b_xErr
X position error of the beam spot.
Definition: BeamSpotMonitorModule.h:75
Belle2::BeamSpotMonitorModule::b_exp
TBranch * b_exp
experiment number
Definition: BeamSpotMonitorModule.h:70
Belle2::BeamSpotMonitorModule::b_run
TBranch * b_run
run number
Definition: BeamSpotMonitorModule.h:71
Belle2::BeamSpotMonitorModule::m_yErr
double m_yErr
Y position error of the beam spot.
Definition: BeamSpotMonitorModule.h:89
Belle2::BeamSpotMonitorModule::event
virtual void event() override
fill trees
Definition: BeamSpotMonitorModule.cc:73