Belle II Software development
CDCDedxWireGainAlgorithm.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 <algorithm>
12#include <iostream>
13#include <fstream>
14#include <string>
15#include <vector>
16
17#include <TH1D.h>
18#include <TCanvas.h>
19#include <TMath.h>
20#include <TLine.h>
21#include <TStyle.h>
22#include <TH1I.h>
23
24#include <reconstruction/dbobjects/CDCDedxWireGain.h>
25#include <reconstruction/dbobjects/CDCDedxBadWires.h>
26#include <cdc/dbobjects/CDCGeometry.h>
27#include <calibration/CalibrationAlgorithm.h>
28#include <framework/database/DBObjPtr.h>
29#include <framework/database/IntervalOfValidity.h>
30
31#include <cdc/geometry/CDCGeometryPar.h>
32#include <cdc/geometry/CDCGeometryParConstants.h>
33
34const unsigned int c_nwireCDC = c_nSenseWires;
35
36namespace Belle2 {
46
47 public:
48
53
58
62 void setMergePayload(bool value = true) {m_isMerge = value;}
63
67 void enableExtraPlots(bool value = false) {m_isMakePlots = value;}
68
72 void setWireBasedTruction(bool value = false) {m_isWireTruc = value;}
73
77 void getExpRunInfo();
78
82 void createPayload(const std::vector<double>& vdedx_tmeans);
83
87 void getTruncatedBins(TH1D* hdedxhit, unsigned int& binlow, unsigned int& binhigh);
88
92 double getTruncationMean(TH1D* hdedxhit, int binlow, int binhigh);
93
97 void plotLayerDist(std::array<TH1D*, 2> hdedxL);
98
102 void plotWireDist(const std::vector<TH1D*>& hist, const std::vector<double>& vrel_mean);
103
107 void plotWireGain(const std::vector<double>& vdedx_means, const std::vector<double>& vrel_mean, double layeravg);
108
112 void plotLayerGain(const std::vector<double>& layermean, double layeravg);
113
117 void plotWGPerLayer(const std::vector<double>& vdedx_means, const std::vector<double>& layermean, double layeravg);
118
122 void plotEventStats();
123
124 protected:
125
129 virtual EResult calibrate() override;
130
131
132 private:
133
146 double m_dedxMin;
147 double m_dedxMax;
148 double m_truncMin;
149 double m_truncMax;
151 std::string m_suffix;
156 };
158} // namespace Belle2
A calibration algorithm for CDC dE/dx wire gains.
void plotWGPerLayer(const std::vector< double > &vdedx_means, const std::vector< double > &layermean, double layeravg)
function to draw WG per layer
void plotLayerGain(const std::vector< double > &layermean, double layeravg)
function to draw layer gains
void plotLayerDist(std::array< TH1D *, 2 > hdedxL)
function to draw dE/dx for inner/outer layer
bool m_isMerge
merge payload at the time of calibration
double m_truncMax
max trunc range for mean
double m_truncMin
min trunc range for mean
void enableExtraPlots(bool value=false)
function to set flag active for plotting
void getTruncatedBins(TH1D *hdedxhit, unsigned int &binlow, unsigned int &binhigh)
function to get bins of truncation from histogram
void plotWireGain(const std::vector< double > &vdedx_means, const std::vector< double > &vrel_mean, double layeravg)
function to draw wire gains
void getExpRunInfo()
function to get extract calibration run/exp
void createPayload(const std::vector< double > &vdedx_tmeans)
function to finally store new payload after full calibration
void plotWireDist(const std::vector< TH1D * > &hist, const std::vector< double > &vrel_mean)
function to draw dE/dx histograms for each wire
bool m_isMakePlots
Save arithmetic and truncated mean for the 'dedx' values.
DBObjPtr< CDCDedxBadWires > m_DBBadWires
Bad wire DB object.
void setWireBasedTruction(bool value=false)
function to set truncation method (local vs global)
std::string m_suffix
suffix string to separate plots
double getTruncationMean(TH1D *hdedxhit, int binlow, int binhigh)
function to get mean of truncation from histogram
int m_dedxBins
number of bins for dedx histogram
DBObjPtr< CDCGeometry > m_cdcGeo
Geometry of CDC.
CDCDedxWireGainAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
void setMergePayload(bool value=true)
function to decide merge vs relative gains
void plotEventStats()
function to draw statstics
virtual EResult calibrate() override
Wire gain algorithm.
double m_dedxMax
max dedx range for wiregain cal
double m_dedxMin
min dedx range for wiregain cal
bool m_isWireTruc
method of trunc range for mean
Base class for calibration algorithms.
EResult
The result of calibration.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Abstract base class for different kinds of events.