Belle II Software  release-05-02-19
CDCDedxWireGainAlgorithm.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: jvbennett *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <reconstruction/dbobjects/CDCDedxWireGain.h>
14 #include <reconstruction/dbobjects/CDCDedxBadWires.h>
15 #include <calibration/CalibrationAlgorithm.h>
16 #include <framework/database/DBObjPtr.h>
17 #include <string>
18 #include <vector>
19 #include "TH1D.h"
20 #include "TH2F.h"
21 
22 namespace Belle2 {
31  class CDCDedxWireGainAlgorithm : public CalibrationAlgorithm {
32 
33  public:
34 
39 
43  virtual ~CDCDedxWireGainAlgorithm() {}
44 
48  void setMergePayload(bool value = true) {isMergePayload = value;}
49 
53  void setMonitoringPlots(bool value = false) {isMakePlots = value;}
54 
58  void setLocalTrucation(bool value = false) {isLTruc = value;}
59 
63  void setLayerScaling(bool value = false) {isLayerScale = value;}
64 
68  void generateNewPayloads(std::vector<double> dedxTruncmean);
69 
73  void getTrucationBins(TH1D* htemp, int& binlow, int& binhigh);
74 
78  void plotBadWires(int nDeadwires, int oDeadwires, int Badwires);
79 
83  TH2F* getHistoPattern(TString badFileName, TString suffix);
84 
88  double getIndexVal(int iWire, TString what);
89 
93  double getLayerAverage(std::vector<double> tempWire);
94 
95  protected:
96 
100  virtual EResult calibrate() override;
101 
102 
103  private:
104 
111  std::string m_badWireFPath;
112  std::string m_badWireFName;
113  bool isMakePlots;
114  bool isMergePayload;
115  bool isLTruc;
116  bool isLayerScale;
117  int fdEdxBins;
118  double fdEdxMin;
119  double fdEdxMax;
120  double fTrucMin;
121  double fTrucMax;
122  int fStartRun;
123  std::vector<double> flayerAvg;
127  };
129 } // namespace Belle2
Belle2::CDCDedxWireGainAlgorithm::getTrucationBins
void getTrucationBins(TH1D *htemp, int &binlow, int &binhigh)
function to get bins of trunction from histogram
Definition: CDCDedxWireGainAlgorithm.cc:438
Belle2::CDCDedxWireGainAlgorithm::fTrucMin
double fTrucMin
min trunc range for mean
Definition: CDCDedxWireGainAlgorithm.h:128
Belle2::CDCDedxWireGainAlgorithm::setMonitoringPlots
void setMonitoringPlots(bool value=false)
funtion to set flag active for plotting
Definition: CDCDedxWireGainAlgorithm.h:61
Belle2::CDCDedxWireGainAlgorithm::plotBadWires
void plotBadWires(int nDeadwires, int oDeadwires, int Badwires)
function to plot bad wire status (then and now)
Definition: CDCDedxWireGainAlgorithm.cc:534
Belle2::CDCDedxWireGainAlgorithm::isMergePayload
bool isMergePayload
merge payload at the of calibration
Definition: CDCDedxWireGainAlgorithm.h:122
Belle2::CDCDedxWireGainAlgorithm::m_DBBadWires
DBObjPtr< CDCDedxBadWires > m_DBBadWires
Bad wire DB object.
Definition: CDCDedxWireGainAlgorithm.h:134
Belle2::CDCDedxWireGainAlgorithm::getIndexVal
double getIndexVal(int iWire, TString what)
function to return various CDC indexing for given wire
Definition: CDCDedxWireGainAlgorithm.cc:638
Belle2::CDCDedxWireGainAlgorithm::isLTruc
bool isLTruc
method of trunc range for mean
Definition: CDCDedxWireGainAlgorithm.h:123
Belle2::CDCDedxWireGainAlgorithm::fdEdxMax
double fdEdxMax
max dedx range for wiregain cal
Definition: CDCDedxWireGainAlgorithm.h:127
Belle2::CDCDedxWireGainAlgorithm::CDCDedxWireGainAlgorithm
CDCDedxWireGainAlgorithm()
Constructor: Sets the description, the properties and the parameters of the algorithm.
Definition: CDCDedxWireGainAlgorithm.cc:28
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::CDCDedxWireGainAlgorithm::calibrate
virtual EResult calibrate() override
Wire gain algorithm.
Definition: CDCDedxWireGainAlgorithm.cc:51
Belle2::CDCDedxWireGainAlgorithm::m_badWireFName
std::string m_badWireFName
name of bad wire file
Definition: CDCDedxWireGainAlgorithm.h:120
Belle2::CDCDedxWireGainAlgorithm::m_badWireFPath
std::string m_badWireFPath
Save arithmetic and truncated mean for the 'dedx' values.
Definition: CDCDedxWireGainAlgorithm.h:119
Belle2::CDCDedxWireGainAlgorithm::fTrucMax
double fTrucMax
max trunc range for mean
Definition: CDCDedxWireGainAlgorithm.h:129
Belle2::CDCDedxWireGainAlgorithm::~CDCDedxWireGainAlgorithm
virtual ~CDCDedxWireGainAlgorithm()
Destructor.
Definition: CDCDedxWireGainAlgorithm.h:51
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCDedxWireGainAlgorithm::generateNewPayloads
void generateNewPayloads(std::vector< double > dedxTruncmean)
function to finally store new payload after full calibration
Definition: CDCDedxWireGainAlgorithm.cc:245
Belle2::CDCDedxWireGainAlgorithm::fdEdxMin
double fdEdxMin
min dedx range for wiregain cal
Definition: CDCDedxWireGainAlgorithm.h:126
Belle2::CDCDedxWireGainAlgorithm::setLayerScaling
void setLayerScaling(bool value=false)
funtion to set layer scaling
Definition: CDCDedxWireGainAlgorithm.h:71
Belle2::CDCDedxWireGainAlgorithm::getLayerAverage
double getLayerAverage(std::vector< double > tempWire)
function to get layer avg from outer layers
Definition: CDCDedxWireGainAlgorithm.cc:463
Belle2::CalibrationAlgorithm::EResult
EResult
The result of calibration.
Definition: CalibrationAlgorithm.h:50
Belle2::CDCDedxWireGainAlgorithm::fdEdxBins
int fdEdxBins
number of bins for dedx histogram
Definition: CDCDedxWireGainAlgorithm.h:125
Belle2::CDCDedxWireGainAlgorithm::setMergePayload
void setMergePayload(bool value=true)
function to decide merge vs relative gains
Definition: CDCDedxWireGainAlgorithm.h:56
Belle2::CDCDedxWireGainAlgorithm::fStartRun
int fStartRun
boundary start at this run
Definition: CDCDedxWireGainAlgorithm.h:130
Belle2::CDCDedxWireGainAlgorithm::setLocalTrucation
void setLocalTrucation(bool value=false)
funtion to set trucation method (local vs global)
Definition: CDCDedxWireGainAlgorithm.h:66
Belle2::CDCDedxWireGainAlgorithm::getHistoPattern
TH2F * getHistoPattern(TString badFileName, TString suffix)
function to plot wires in hist with input file
Definition: CDCDedxWireGainAlgorithm.cc:600
Belle2::CDCDedxWireGainAlgorithm::flayerAvg
std::vector< double > flayerAvg
layer wire avg of trun mean
Definition: CDCDedxWireGainAlgorithm.h:131
Belle2::CDCDedxWireGainAlgorithm::m_DBWireGains
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
Definition: CDCDedxWireGainAlgorithm.h:133
Belle2::CDCDedxWireGainAlgorithm::isMakePlots
bool isMakePlots
produce plots for status
Definition: CDCDedxWireGainAlgorithm.h:121
Belle2::CDCDedxWireGainAlgorithm::isLayerScale
bool isLayerScale
method of scaling layer avg
Definition: CDCDedxWireGainAlgorithm.h:124