Belle II Software  release-08-01-10
BeamSpotMonitorModule.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 <framework/database/DBObjPtr.h>
13 
14 #include <mdst/dbobjects/BeamSpot.h>
15 
16 #include <string>
17 #include <TFile.h>
18 #include <TTree.h>
19 #include <TBranch.h>
20 
21 namespace Belle2 {
29  class BeamSpotMonitorModule : public Module {
30 
31  public:
32 
37 
39  virtual void initialize() override;
40 
42  virtual void beginRun() override;
43 
45  virtual void event() override;
46 
48  virtual void terminate() override;
49 
50  private:
51 
52  /* user-defined parameters */
53  std::string m_rootFileName;
55  /* ROOT file related parameters */
56  TFile* m_rootFilePtr = nullptr;
57  TTree* m_tree = nullptr;
59  //branches
60  TBranch* b_exp = nullptr;
61  TBranch* b_run = nullptr;
62  TBranch* b_x = nullptr;
63  TBranch* b_y = nullptr;
64  TBranch* b_z = nullptr;
65  TBranch* b_xErr = nullptr;
66  TBranch* b_yErr = nullptr;
67  TBranch* b_zErr = nullptr;
68  TBranch* b_xSize = nullptr;
69  TBranch* b_ySize = nullptr;
70  TBranch* b_zSize = nullptr;
72  //branch variables
73  int m_run = -1;
74  int m_exp = -1;
75  double m_x = 0;
76  double m_y = 0;
77  double m_z = 0;
78  double m_xErr = 0;
79  double m_yErr = 0;
80  double m_zErr = 0;
81  double m_xSize = 0;
82  double m_ySize = 0;
83  double m_zSize = 0;
90  };
92 }
93 
Module for the monitoring of the BeamSpot position and size.
std::string m_rootFileName
root file name
TBranch * b_xErr
X position error of the beam spot.
TTree * m_tree
pointer to the tree
TBranch * b_xSize
X position size of the beam spot.
virtual void initialize() override
initialize the TTree
TBranch * b_zSize
Z position size of the beam spot.
double m_xSize
X position size of the beam spot.
TBranch * b_yErr
Y position error of the beam spot.
virtual void event() override
fill trees
double m_xErr
X position error of the beam spot.
TBranch * b_y
Y position of the beam spot.
TBranch * b_exp
experiment number
virtual void terminate() override
print the payloads uniqueID and write tree to the rootfile
TBranch * b_x
X position of the beam spot.
double m_x
X position of the beam spot.
double m_yErr
Y position error of the beam spot.
DBObjPtr< BeamSpot > m_BeamSpotDB
beam spot payload from the database
TBranch * b_ySize
Y position size of the beam spot.
virtual void beginRun() override
check BeamSpot payload validity
double m_zSize
Z position size of the beam spot.
double m_zErr
Z position error of the beam spot.
TBranch * b_z
Z position of the beam spot.
double m_z
Z position of the beam spot.
BeamSpot m_BeamSpot
beam spot payload
double m_y
Y position of the beam spot.
TFile * m_rootFilePtr
pointer at root file used for storing histograms
BeamSpotMonitorModule()
Constructor: Sets the description, the properties and the parameters of the module.
StoreObjPtr< EventMetaData > m_EventMetaData
EventMetaData.
TBranch * b_zErr
Z position error of the beam spot.
double m_ySize
Y position size of the beam spot.
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition: BeamSpot.h:22
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Base class for Modules.
Definition: Module.h:72
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.