Belle II Software development
TrgEclTimingCalibration.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#ifndef TRGECLTCALIBRATION_h
9#define TRGECLTCALIBRATION_h
10
11
12#include <iostream>
13#include <fstream>
14#include <vector>
15
16#include "TMatrixD.h"
17#include "TVectorD.h"
18#include <Math/Vector3D.h>
19
20#include <framework/core/Module.h>
21#include <trg/ecl/TrgEclMapping.h>
22
23#include "trg/ecl/dataobjects/TRGECLHit.h"
24#include "trg/ecl/dataobjects/TRGECLTrg.h"
25#include "trg/ecl/dataobjects/TRGECLCluster.h"
26#include "trg/ecl/dataobjects/TRGECLUnpackerStore.h"
27#include "trg/ecl/dataobjects/TRGECLUnpackerEvtStore.h"
28
29#include <framework/datastore/StoreObjPtr.h>
30#include <framework/datastore/StoreArray.h>
31
32
33namespace Belle2 {
40
41 public:
45 virtual ~TRGECLTimingCalModule();
46
47 public:
49 virtual void initialize() override;
51 virtual void beginRun() override;
53 virtual void event() override;
55 virtual void endRun() override;
57 virtual void terminate() override;
58
60 void Set_TCposition();
61
63 int Solve_Matrix();
64
66 int ReadData();
67
69 int FillMatrix();
70
72 void InitParams();
73
75 void Save_Result();
76
78 void Calculate_Chisq();
79
82
84 void GetTimeOffset();
85 private:
86
87 /***** Calibration *****/
102
111
115 int nevt_read = 0;
119 double cut_chisq;
120
122 std::string str_default_name = "TCTimeOffset.root";
124 std::string str_ofilename;
127
130 std::vector<int> TCId;
132 std::vector<double> TCEnergy;
134 std::vector<double> TCTiming;
136 std::vector<ROOT::Math::XYZVector> TCPosition;
137
140 TMatrixDSym _Matrix;
142 std::vector<std::vector<double>> Chisq1;
144 std::vector<std::vector<double>> Chisq2;
146 std::vector<std::vector<double>> Chisq3;
147
149 std::vector<int> Nevent_TC;
151 std::vector<double> chisq_result;
153 TVectorD _Vector;
155 std::vector<bool> b_Inc_TC;
157 std::vector<bool> b_Exclude_TC;
159 std::vector<double> tcal_result;
161 std::vector<double> tcal_result_err;
162
165
168 std::vector<double> TimeOffset;
169
170 };
172}
173#endif
Base class for Modules.
Definition: Module.h:72
Class ECL Trigger Timiing Calibration Module.
int nevt_selected
The number of selected events.
std::vector< double > tcal_result_err
Time offset error.
std::vector< double > TCEnergy
TC energy.
void InitParams()
Parameters initialization.
void Save_Result()
Save time offset and chisq as a root file.
std::vector< std::vector< double > > Chisq1
chisq component1
TVectorD _Vector
Vector component.
std::vector< double > tcal_result
Time offset calibration result.
int fIteration
Flag iteration 0 : first calbiration 1 : iteration.
int fSimulation
Flag simulation 0 : real data 1 : simulation data.
virtual void initialize() override
initialize function
std::string str_timeoffset_fname
Input time offset file name (iteration mode)
std::vector< ROOT::Math::XYZVector > TCPosition
TC position from TRGECLMap (cosmic calibration)
int nevt_read
The number of read events.
virtual void event() override
Event function.
virtual void endRun() override
End Run function.
std::vector< bool > b_Exclude_TC
Flag TC excluded.
void Calculate_Chisq()
Calculate chisq based on time offset obtained from "Solve_Matrix" function.
void GetTimeOffset()
Get previous time offsets (iteration mode)
double TCEnergyCalibrationConstant
ADC to GeV energy conversion factor.
double cut_chisq
TC chisq cut (iteration mode)
void Set_TCposition()
Set TC position from TRGECLMap.
virtual void terminate() override
Terminate function.
double cut_high_energy
TC energy cut upper limit.
double cut_low_energy
TC energy cut lower limit.
std::vector< double > TCTiming
TC time.
std::string str_default_name
Default output root file name.
std::vector< int > Nevent_TC
The number of uesed TC hit (TC by TC)
virtual void beginRun() override
Begin Run function.
int fInclude_FWD
Flag include forward endcap 0 : exclude FWD 1 : include FWD.
std::vector< double > TimeOffset
Time offset Input time offset (iteration mode)
int fInclude_BWD
Flag include backward endcap 0 : exclude BWD 1 : include BWD.
int fInclude_BR
Flag include barrel 0 : exclude BR 1 : include BR.
int f3Dbhabha_veto
Flag 3D bhabha veto 0 : not use 1 : use.
int FillMatrix()
Fill matrix and vector components.
virtual ~TRGECLTimingCalModule()
Destructor.
void TRGECLTimingCalClear()
Clear vector every event.
std::vector< bool > b_Inc_TC
Flag TC included.
int TC_ref
Reference TC whose time offset set to be 0.
std::vector< std::vector< double > > Chisq3
chisq component3
std::vector< double > chisq_result
Chisq values based on time offset obtained from "Solve_Matrix" function.
int FlagMatrixSolved
Flag matrix solved (0 : not solved 1 : solved)
std::vector< std::vector< double > > Chisq2
chisq component2
std::vector< int > TCId
Trigger Cell TCID.
std::string str_ofilename
Output root file name.
TMatrixDSym _Matrix
Matrix Marix component.
int fCalType
Calibration type 0 : beam 1 : cosmic.
Abstract base class for different kinds of events.