Belle II Software  release-08-01-10
RootTracer.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * Forked from https://github.com/iLCSoft/MarlinKinfit *
6  * *
7  * Further information about the fit engine and the user interface *
8  * provided in MarlinKinfit can be found at *
9  * https://www.desy.de/~blist/kinfit/doc/html/ *
10  * and in the LCNotes LC-TOOL-2009-001 and LC-TOOL-2009-004 available *
11  * from http://www-flc.desy.de/lcnotes/ *
12  * *
13  * See git log for contributors and copyright holders. *
14  * This file is licensed under LGPL-3.0, see LICENSE.md. *
15  **************************************************************************/
16 
17 #ifdef MARLIN_USE_ROOT
18 
19 #ifndef __ROOTTRACER_H
20 #define __ROOTTRACER_H
21 
22 #include <iostream>
23 #include "analysis/OrcaKinFit/BaseTracer.h"
24 
25 class BaseFitter;
26 class TFile;
27 
28 #include <TROOT.h>
29 #include <TChain.h>
30 #include <TFile.h>
31 
32 // Class RootTracer:
34 
42 namespace Belle2 {
48  namespace OrcaKinFit {
49  class BaseFitter;
50 
51 
52 
53  class RootTracer: public BaseTracer {
54  public:
55  RootTracer(const char* filename = "trace.root", const char* option = "RECREATE");
56  virtual ~RootTracer();
57 
59  RootTracer(const RootTracer&) = delete;
60  RootTracer& operator=(const RootTracer&) = delete;
61 
62 
64  virtual void initialize(BaseFitter& fitter) override;
66  virtual void step(BaseFitter& fitter) override;
68  virtual void substep(BaseFitter& fitter,
69  int flag
70  ) override;
72  virtual void finish(BaseFitter& fitter) override;
73 
74  void printFitObjects(BaseFitter& fitter);
75  void printConstraints(BaseFitter& fitter);
76 
77  protected:
78  void SetBranchAddresses();
79  void CreateBranches();
80  void CreateEventBranches(BaseFitter& fitter);
81  void FillParameterValues(BaseFitter& fitter);
82 
83  TFile* file;
84  TTree* tree;
85  TTree* eventtree;
86 
87  int istep;
88  int isubstep;
89 
90  Int_t eventnumber;
91  Int_t stepnumber;
92  Int_t substepnumber;
93  Double_t chi2;
94 
95  enum {NPARMAX = 100};
96  Double_t parvalue[NPARMAX];
97 
98  };
99 
100  }// end OrcaKinFit namespace
102 } // end Belle2 namespace
103 
104 #endif // __ROOTTRACER_H
105 
106 #endif // MARLIN_USE_ROOT
Abstract base class for different kinds of events.