Belle II Software development
CDCDedxBadWireAlgorithm.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 <string>
13#include <iostream>
14#include <fstream>
15
16#include <TCanvas.h>
17#include <TH2F.h>
18#include <TH1I.h>
19#include <TMath.h>
20#include <TLine.h>
21#include <TStyle.h>
22#include <TPaveText.h>
23#include <TText.h>
24#include <TLegend.h>
25
26#include <framework/database/DBObjPtr.h>
27#include <framework/database/IntervalOfValidity.h>
28
29#include <reconstruction/dbobjects/CDCDedxBadWires.h>
30#include <reconstruction/dbobjects/CDCDedxWireGain.h>
31
32#include <calibration/CalibrationAlgorithm.h>
33
34#include <cdc/dbobjects/CDCGeometry.h>
35#include <cdc/geometry/CDCGeometryPar.h>
36#include <cdc/geometry/CDCGeometryParConstants.h>
37
38
39namespace Belle2 {
50
51 public:
52
57
62
66 void setMonitoringPlots(bool value = false) {m_isMakePlots = value;}
67
71 void setHighFracThres(double value) {m_fracThres = value;}
72
76 void setRMSThres(double value) {m_rmsThres = value;}
77
81 void setMeanThres(double value) {m_meanThres = value;}
82
86 void setADC(bool value = false)
87 {
88 m_isADC = value;
89 if (m_isADC) m_varMax = 1000.0;
90 else m_varMax = 7.0;
91 }
92
96 void setHistPars(int nbin, double min, double max)
97 {
98 m_varBins = nbin;
99 m_varMin = min;
100 m_varMax = max;
101 }
102
106 void getExpRunInfo();
107
111 void plotWireDist(const std::vector<double>& inwires, std::map<int, std::vector<double>>& vhitvar);
112
116 void printCanvas(TList* list, TList* hflist, Color_t color);
117
121 void plotBadWireMap(const std::vector<double>& vbadwires, const std::vector<double>& vdeadwires);
122
126 TH2F* getHistoPattern(const std::vector<double>& inwires, const std::string& suffix, int& total);
127
131 void plotQaPars(std::map<int, std::vector<double>>& qapars);
132
136 void plotEventStats();
137
141 void setTextCosmetics(TPaveText* pt, double size)
142 {
143 pt->SetTextAlign(11);
144 pt->SetFillStyle(3001);
145 pt->SetLineColor(2);
146 pt->SetTextFont(82);
147 pt->SetTextSize(size);
148 }
149
153 void setHistCosmetics(TH2F* hist, Color_t color)
154 {
155 hist->SetMarkerStyle(20);
156 hist->SetMarkerSize(0.3);
157 hist->SetMarkerColor(color);
158 hist->SetFillColor(color);
159 hist->SetStats(0);
160 }
161
162 protected:
163
167 virtual EResult calibrate() override;
168
169 private:
170
171 unsigned int c_nwireCDC;
174 bool m_isADC;
177 double m_varMin;
178 double m_varMax;
179 double m_meanThres;
180 double m_rmsThres;
181 double m_fracThres;
182 double m_amean;
183 double m_arms;
185 std::string m_varName;
186 std::string m_suffix;
191 };
193} // namespace Belle2
A calibration algorithm for CDC dE/dx to find the bad wires.
virtual ~CDCDedxBadWireAlgorithm()
Destructor.
void setHistCosmetics(TH2F *hist, Color_t color)
function to change histogram styles
void plotBadWireMap(const std::vector< double > &vbadwires, const std::vector< double > &vdeadwires)
function to plot wire status map (all, bad and dead)
double m_varMax
max range for input variable
double m_rmsThres
rms Threshold accepted for good wire
double m_varMin
min range for input variable
std::string m_varName
std::string to set var name (adc or dedx)
void getExpRunInfo()
function to get extract calibration run/exp
unsigned int c_nwireCDC
number of wires in CDC
double m_arms
average rms of dedx for all wires
bool m_isMakePlots
produce plots for status
void setHighFracThres(double value)
function to set high dedx fraction threshold
DBObjPtr< CDCDedxBadWires > m_DBBadWires
Badwire DB object.
void setMeanThres(double value)
function to set Mean Threshold
std::string m_suffix
suffix std::string for naming plots
void setTextCosmetics(TPaveText *pt, double size)
function to change text styles
CDCDedxBadWireAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
DBObjPtr< CDCGeometry > m_cdcGeo
Geometry of CDC.
double m_meanThres
mean Threshold accepted for good wire
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wiregain DB object.
double m_fracThres
high-frac Threshold accepted for good wire
int m_varBins
number of bins for input variable
void printCanvas(TList *list, TList *hflist, Color_t color)
function to print canvas
void plotQaPars(std::map< int, std::vector< double > > &qapars)
function to plot the QA (decision) parameters
void plotEventStats()
function to draw the stats
void setRMSThres(double value)
function to set RMS Threshold
virtual EResult calibrate() override
cdcdedx badwire algorithm
void setADC(bool value=false)
function to choose adc or dedx as variable
void plotWireDist(const std::vector< double > &inwires, std::map< int, std::vector< double > > &vhitvar)
function to draw per wire plots
void setHistPars(int nbin, double min, double max)
function to set adc/dedx parameters
void setMonitoringPlots(bool value=false)
function to enable plotting
double m_amean
average mean of dedx for all wires
bool m_isADC
Use adc if(true) else dedx for calibration.
TH2F * getHistoPattern(const std::vector< double > &inwires, const std::string &suffix, int &total)
function to get wire map with input file (all, bad and dead)
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.