Skip to content

Commit a29bb29

Browse files
committed
Merge pull request #447 in B2/basf2 from bugfix/BII-8727-tracking-dqm-patch03 to release/06-00
* commit 'b7d479fca04744323c524b73447330e092571de2': bug-fix: you have to create a new histogram before filling it.. improvements after Thomas' comments + added th2f of n of events vs time after inj and time withing a beam cycle added 2D histogram with aborted events in (time after injection, time within beam cycle) for HER and LER removed unused data members add monitoring object only if the histogram esists, otherwise leave a hole in Mirabelle Tracking DQM: ER analysis module bug-fix: 1D and 2D residual plots are now filled removed strange characters + bug-fix on production of 1D/2D residuals correct title of 1D/2D unbiased residuals for each VXD sensor FATAL instead of WARNING if VXD geometry is missing
2 parents 496a86d + b7d479f commit a29bb29

File tree

11 files changed

+271
-47
lines changed

11 files changed

+271
-47
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 <dqm/analysis/modules/DQMHistAnalysis.h>
12+
13+
#include <TCanvas.h>
14+
15+
namespace Belle2 {
16+
17+
/** Analysis of ER Tracking DQM plots */
18+
class DQMHistAnalysisTrackingERModule : public DQMHistAnalysisModule {
19+
20+
// Public functions
21+
public:
22+
23+
/** Constructor */
24+
DQMHistAnalysisTrackingERModule();
25+
/**Destructor */
26+
~DQMHistAnalysisTrackingERModule() {};
27+
28+
/** Module function initialize */
29+
void initialize() override;
30+
/** Module function event */
31+
void event() override;
32+
33+
private:
34+
35+
float m_onTimeHalfWidth = 50; /**< [ns], cluster is on time if within ± onTimeHalfWidth */
36+
37+
/** Monitoring Object to be produced by this module, which contain defined canvases and monitoring variables */
38+
MonitoringObject* m_monObj = nullptr;
39+
40+
};
41+
} // end namespace Belle2
42+

dqm/analysis/modules/include/DQMHistAnalysisTrackingHLT.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ namespace Belle2 {
2929
void initialize() override;
3030
/** Module function event */
3131
void event() override;
32-
/** Module function terminate */
33-
void terminate() override;
3432

3533
// parameters
3634
bool m_printCanvas = false; /**< if true print the pdf of the canvases */
@@ -43,9 +41,6 @@ namespace Belle2 {
4341
/** Monitoring Object to be produced by this module, which contain defined canvases and monitoring variables */
4442
MonitoringObject* m_monObj = nullptr;
4543

46-
TH1* m_rtype = nullptr; /**< histogram from DQMInfo with runtype */
47-
TString m_runtype = ""; /**< string with runtype: physics or cosmic */
48-
4944
TCanvas* m_cAbortRate = nullptr; /**< canvas for the abort rate plot */
5045
};
5146
} // end namespace Belle2
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
#include <dqm/analysis/modules/DQMHistAnalysisTrackingER.h>
10+
11+
#include <TROOT.h>
12+
#include <TString.h>
13+
14+
#include <TMath.h>
15+
#include <iostream>
16+
17+
using namespace std;
18+
using namespace Belle2;
19+
20+
//-----------------------------------------------------------------
21+
// Register the Module
22+
//-----------------------------------------------------------------
23+
REG_MODULE(DQMHistAnalysisTrackingER)
24+
25+
//-----------------------------------------------------------------
26+
// Implementation
27+
//-----------------------------------------------------------------
28+
29+
DQMHistAnalysisTrackingERModule::DQMHistAnalysisTrackingERModule()
30+
: DQMHistAnalysisModule()
31+
{
32+
33+
setDescription("DQM Analysis Module of the Tracking ER Plots.");
34+
35+
addParam("onTimeHalfWidth", m_onTimeHalfWidth, "a cluster is on time if within ± onTimeHalfWidth [ns]", float(m_onTimeHalfWidth));
36+
37+
}
38+
39+
void DQMHistAnalysisTrackingERModule::initialize()
40+
{
41+
42+
gROOT->cd();
43+
44+
// add MonitoringObject
45+
m_monObj = getMonitoringObject("trackingER");
46+
47+
}
48+
49+
50+
void DQMHistAnalysisTrackingERModule::event()
51+
{
52+
53+
//compute fraction of tracks with no PXD hits
54+
55+
TH1* hNoPXDHits = findHist("TrackingERDQM/NoOfHitsInTrack_PXD");
56+
if (hNoPXDHits != nullptr) {
57+
58+
int nTracks = hNoPXDHits->GetEntries();
59+
int nTracksNoPXD = hNoPXDHits->GetBinContent(1);
60+
61+
if (nTracks > 0)
62+
m_monObj->setVariable("tracksNoPXDHit", (double)nTracksNoPXD / nTracks);
63+
}
64+
65+
//fraction of offtime SVD hits
66+
//considering L3V and L456V clusters (separately)
67+
68+
TH1* hSVDL3VTime = findHist("SVDClsTrk/SVDTRK_ClusterTimeV3");
69+
if (hSVDL3VTime != nullptr) {
70+
int all = hSVDL3VTime->GetEntries();
71+
if (all > 0) {
72+
int bin_min = hSVDL3VTime->GetXaxis()->FindBin(-m_onTimeHalfWidth);
73+
int bin_max = hSVDL3VTime->GetXaxis()->FindBin(+m_onTimeHalfWidth);
74+
int offtime = all - hSVDL3VTime->Integral(bin_min, bin_max);
75+
double offtimeL3Hits = (double)offtime / all;
76+
m_monObj->setVariable("offtimeL3Hits", offtimeL3Hits);
77+
}
78+
}
79+
80+
TH1* hSVDL456VTime = findHist("SVDClsTrk/SVDTRK_ClusterTimeV456");
81+
if (hSVDL456VTime != nullptr) {
82+
int all = hSVDL456VTime->GetEntries();
83+
if (all > 0) {
84+
int bin_min = hSVDL456VTime->GetXaxis()->FindBin(-m_onTimeHalfWidth);
85+
int bin_max = hSVDL456VTime->GetXaxis()->FindBin(+m_onTimeHalfWidth);
86+
int offtime = all - hSVDL456VTime->Integral(bin_min, bin_max);
87+
double offtimeL456Hits = (double)offtime / all;
88+
m_monObj->setVariable("offtimeL456Hits", offtimeL456Hits);
89+
}
90+
}
91+
}

dqm/analysis/modules/src/DQMHistAnalysisTrackingHLT.cc

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ void DQMHistAnalysisTrackingHLTModule::initialize()
4848
// add MonitoringObject
4949
m_monObj = getMonitoringObject("trackingHLT");
5050

51-
m_rtype = findHist("DQMInfo/rtype");
52-
m_runtype = m_rtype ? m_rtype->GetTitle() : "";
5351
}
5452

55-
5653
void DQMHistAnalysisTrackingHLTModule::event()
5754
{
5855

@@ -64,8 +61,7 @@ void DQMHistAnalysisTrackingHLTModule::event()
6461
bool hasError = false;
6562
int nEvents = hAbort->GetEntries();
6663
double abortRate = hAbort->GetMean();
67-
hAbort->SetTitle(Form("Fraction of Events in which Tracking aborts = %.6f ", abortRate));
68-
64+
hAbort->SetTitle(Form("Fraction of Events in which Tracking aborts = %.4f %%", abortRate * 100));
6965
m_monObj->setVariable("abortRate", abortRate);
7066
//check if number of errors is above the allowed limit
7167
if (abortRate > m_failureRateThreshold)
@@ -92,35 +88,28 @@ void DQMHistAnalysisTrackingHLTModule::event()
9288
m_cAbortRate->Print("c_AbortRate.pdf");
9389

9490
// add average number of tracks per event to Mirabelle
95-
double averageNTracks = -1;
9691
TH1* hnTracks = findHist("TrackingHLTDQM/NoOfTracks");
97-
if (hnTracks != NULL)
98-
averageNTracks = hnTracks->GetMean();
99-
double averageNVXDTracks = -1;
100-
TH1* hnVXDTracks = findHist("TrackingHLTDQM/NoOfTracksInVXDOnly");
101-
if (hnVXDTracks != NULL)
102-
averageNVXDTracks = hnVXDTracks->GetMean();
103-
double averageNCDCTracks = -1;
104-
TH1* hnCDCTracks = findHist("TrackingHLTDQM/NoOfTracksInCDCOnly");
105-
if (hnCDCTracks != NULL)
106-
averageNCDCTracks = hnCDCTracks->GetMean();
107-
double averageNVXDCDCTracks = -1;
108-
TH1* hnVXDCDCTracks = findHist("TrackingHLTDQM/NoOfTracksInVXDCDC");
109-
if (hnVXDCDCTracks != NULL)
110-
averageNVXDCDCTracks = hnVXDCDCTracks->GetMean();
111-
112-
m_monObj->setVariable("nTracksPerEvent", averageNTracks);
113-
m_monObj->setVariable("nVXDTracksPerEvent", averageNVXDTracks);
114-
m_monObj->setVariable("nCDCTracksPerEvent", averageNCDCTracks);
115-
m_monObj->setVariable("nVXDCDCTracksPerEvent", averageNVXDCDCTracks);
92+
if (hnTracks != NULL) {
93+
double averageNTracks = hnTracks->GetMean();
94+
m_monObj->setVariable("nTracksPerEvent", averageNTracks);
95+
}
11696

117-
}
97+
TH1* hnVXDTracks = findHist("TrackingHLTDQM/NoOfTracksInVXDOnly");
98+
if (hnVXDTracks != NULL) {
99+
double averageNVXDTracks = hnVXDTracks->GetMean();
100+
m_monObj->setVariable("nVXDTracksPerEvent", averageNVXDTracks);
101+
}
118102

119-
void DQMHistAnalysisTrackingHLTModule::terminate()
120-
{
103+
TH1* hnCDCTracks = findHist("TrackingHLTDQM/NoOfTracksInCDCOnly");
104+
if (hnCDCTracks != NULL) {
105+
double averageNCDCTracks = hnCDCTracks->GetMean();
106+
m_monObj->setVariable("nCDCTracksPerEvent", averageNCDCTracks);
107+
}
121108

122-
delete m_rtype;
109+
TH1* hnVXDCDCTracks = findHist("TrackingHLTDQM/NoOfTracksInVXDCDC");
110+
if (hnVXDCDCTracks != NULL) {
111+
double averageNVXDCDCTracks = hnVXDCDCTracks->GetMean();
112+
m_monObj->setVariable("nVXDCDCTracksPerEvent", averageNVXDCDCTracks);
113+
}
123114

124115
}
125-
126-

tracking/dqmUtils/include/DQMEventProcessorBase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace Belle2 {
4646
/**Call this if you want to produce 1D Track Residual plots for each VXD sensor */
4747
void produce1Dres() {m_produce1Dres = true;};
4848
/**Call this if you want to produce 2D Track Residual plots for each VXD sensor */
49-
void produce2Dres() {m_produce1Dres = true;};
49+
void produce2Dres() {m_produce2Dres = true;};
5050

5151
protected:
5252
/** Find RecoTrack for given track. Calls ProcessSuccesfulFit if the RecoTrack has a successful fit. */
@@ -107,10 +107,10 @@ namespace Belle2 {
107107
/** true if the DQM is run on HLT */
108108
bool m_runningOnHLT;
109109

110-
/** if true, produce 1D Track residuals plots for each VXD sensor*/
110+
/** if true, produce 1D Track residuals plots for each VXD sensor */
111111
bool m_produce1Dres = false;
112112

113-
/** if true, produce 2D Track residuals plots for each VXD sensor*/
113+
/** if true, produce 2D Track residuals plots for each VXD sensor */
114114
bool m_produce2Dres = false;
115115

116116
/** index of track (with valid TrackFitResult and related RecoTrack) */

tracking/dqmUtils/src/DQMEventProcessorBase.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ void DQMEventProcessorBase::ProcessPXDRecoHit(RecoHitInformation* recoHitInfo)
167167
m_histoModule->FillUBResidualsPXD(m_residual_um);
168168
m_histoModule->FillHalfShellsPXD(m_globalResidual_um, IsNotYang(m_sensorID.getLadderNumber(), m_layerNumber));
169169

170+
if (m_produce1Dres)
171+
m_histoModule->FillUB1DResidualsSensor(m_residual_um, m_sensorIndex);
172+
if (m_produce2Dres)
173+
m_histoModule->FillUB2DResidualsSensor(m_residual_um, m_sensorIndex);
174+
170175
SetCommonPrevVariables();
171176
}
172177

@@ -189,6 +194,11 @@ void DQMEventProcessorBase::ProcessSVDRecoHit(RecoHitInformation* recoHitInfo)
189194

190195
m_histoModule->FillUBResidualsSVD(m_residual_um);
191196
m_histoModule->FillHalfShellsSVD(m_globalResidual_um, IsNotMat(m_sensorID.getLadderNumber(), m_layerNumber));
197+
198+
if (m_produce1Dres)
199+
m_histoModule->FillUB1DResidualsSensor(m_residual_um, m_sensorIndex);
200+
if (m_produce2Dres)
201+
m_histoModule->FillUB2DResidualsSensor(m_residual_um, m_sensorIndex);
192202
}
193203

194204
SetCommonPrevVariables();

tracking/dqmUtils/src/DQMHistoModuleBase.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ void DQMHistoModuleBase::Define1DSensors()
418418
factory.yTitleDefault("counts");
419419

420420
m_UBResidualsSensorU = factory.xAxis(residualU).CreateSensorsTH1F(format("UBResidualsU_%1%"),
421-
format("PXD Unbiased U Residuals for sensor %1%"));
421+
format("VXD Unbiased U Residuals for sensor %1%"));
422422
m_UBResidualsSensorV = factory.xAxis(residualV).CreateSensorsTH1F(format("UBResidualsV_%1%"),
423-
format("PXD Unbiased V Residuals for sensor %1%"));
423+
format("VXD Unbiased V Residuals for sensor %1%"));
424424

425425
}
426426

@@ -435,7 +435,7 @@ void DQMHistoModuleBase::Define2DSensors()
435435
auto factory = Factory(this);
436436

437437
m_UBResidualsSensor = factory.xAxis(residualU).yAxis(residualV).zTitle("counts").CreateSensorsTH2F(format("UBResiduals_%1%"),
438-
format("PXD Unbiased Residuals for sensor %1%"));
438+
format("VXD Unbiased Residuals for sensor %1%"));
439439
}
440440

441441
void DQMHistoModuleBase::FillTrackIndexes(int iTrack, int iTrackVXD, int iTrackCDC, int iTrackVXDCDC)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Import('env')
22

3-
env['LIBS'] = ['vxd', 'tracking_dqmUtils', 'framework', 'mdst_dataobjects']
3+
env['LIBS'] = ['vxd', 'tracking_dqmUtils', 'framework', 'mdst_dataobjects', 'rawdata_dataobjects']
44

55
Return('env')

tracking/modules/trackingDQM/include/TrackingHLTDQMModule.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <tracking/dqmUtils/DQMHistoModuleBase.h>
1212
#include <framework/datastore/StoreObjPtr.h>
1313
#include <mdst/dataobjects/EventLevelTrackingInfo.h>
14+
#include <framework/datastore/StoreArray.h>
15+
#include <rawdata/dataobjects/RawFTSW.h>
1416
#include <TH1.h>
1517

1618
namespace Belle2 {
@@ -39,6 +41,9 @@ namespace Belle2 {
3941
* For the creation of histograms the THFFactory or the Create- functions should be used. */
4042
virtual void DefineFlags();
4143

44+
/** Input array for DAQ Status. */
45+
StoreArray<RawFTSW> m_rawTTD;
46+
4247
/** Acccess to the EventLevelTrackingInfo object in the datastore. */
4348
StoreObjPtr<EventLevelTrackingInfo> m_eventLevelTrackingInfo;
4449

@@ -47,5 +52,44 @@ namespace Belle2 {
4752
* and UnspecifiedTrackFindingFailure.
4853
* The histogram records if any flag was set. */
4954
TH1F* m_trackingErrorFlags = nullptr;
55+
56+
/** abort rate as a function of time after injection and time within a beam cycle - HER*/
57+
TH2F* m_abortVStimeHER = nullptr;
58+
59+
/** number of events as a function of time after injection and time within a beam cycle - HER*/
60+
TH2F* m_allVStimeHER = nullptr;
61+
62+
/** abort rate as a function of time after injection and time within a beam cycle - LER*/
63+
TH2F* m_abortVStimeLER = nullptr;
64+
65+
/** number of events as a function of time after injection and time within a beam cycle - LER*/
66+
TH2F* m_allVStimeLER = nullptr;
67+
68+
/** Beam revolution time in microseconds (approximated).
69+
*
70+
* The exact time could be obtained as
71+
* `5120 / HardwareClockSettings::getAcceleratorRF() * 1e3`
72+
* but this would run after defineHisto() if used in initialize().
73+
* Since defineHisto() uses this value, using a run-independent
74+
* approximated constant value is the only way.
75+
*/
76+
static constexpr double c_revolutionTime = 5120.0 / 508.0;
77+
78+
/** Defines the range of the x axis of the 2D time histogram */
79+
static constexpr double c_noInjectionTime = 30e3;
80+
81+
/** Approximated global clock frequency in MHz.
82+
*
83+
* Used to convert TTD timing to us.
84+
*
85+
* The exact frequency could be obtained as
86+
* `HardwareClockSettings::getGlobalClockFrequency() * 1e3`
87+
* but this would produce inconsistent histograms since I am
88+
* forced to use an approximated accelerator RF (508 MHz) for the
89+
* beam revolution period.
90+
*
91+
* @sa c_revolutionTime
92+
*/
93+
static constexpr double c_globalClock = 127.0;
5094
};
5195
}

tracking/modules/trackingDQM/src/TrackingExpressRecoDQMModule.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void TrackingExpressRecoDQMModule::defineHisto()
5353
DQMHistoModuleBase::defineHisto();
5454

5555
if (VXD::GeoCache::getInstance().getGeoTools()->getNumberOfLayers() == 0)
56-
B2WARNING("Missing geometry for VXD.");
56+
B2FATAL("Missing geometry for VXD.");
5757

5858
// Create a separate histogram directories and cd into it.
5959
TDirectory* originalDirectory = gDirectory;

0 commit comments

Comments
 (0)