Belle II Software development
TrackDQMModule.cc
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 <tracking/modules/trackingDQM/TrackDQMModule.h>
10#include <tracking/modules/trackingDQM/TrackDQMEventProcessor.h>
11#include <tracking/dqmUtils/HistogramFactory.h>
12
13#include <TDirectory.h>
14
15using namespace Belle2;
16using namespace Belle2::HistogramFactory;
17using boost::format;
18
19//-----------------------------------------------------------------
20// Register the Module
21//-----------------------------------------------------------------
22
23REG_MODULE(TrackDQM);
24
25//-----------------------------------------------------------------
26// Implementation
27//-----------------------------------------------------------------
28
30{
31 setDescription("DQM of finding tracks, their momentum, "
32 "Number of hits in tracks, "
33 "Number of tracks. "
34 );
35}
36
37//------------------------------------------------------------------
38// Function to define histograms
39//-----------------------------------------------------------------
40
42{
44
45 // eventLevelTrackingInfo is currently only set by VXDTF2, if VXDTF2 is not in path the StoreObject is not there
46 m_eventLevelTrackingInfo.isOptional();
47}
48
50{
52
53 if (VXD::GeoCache::getInstance().getGeoTools()->getNumberOfLayers() == 0)
54 B2FATAL("Missing geometry for VXD.");
55
56 // Create a separate histogram directories and cd into it.
57 TDirectory* originalDirectory = gDirectory;
58
59 TDirectory* TracksDQM = originalDirectory->GetDirectory("TracksDQM");
60 if (!TracksDQM)
61 TracksDQM = originalDirectory->mkdir("TracksDQM");
62
63 TDirectory* TracksDQMAlignment = originalDirectory->GetDirectory("TracksDQMAlignment");
64 if (!TracksDQMAlignment)
65 TracksDQMAlignment = originalDirectory->mkdir("TracksDQMAlignment");
66
67 TracksDQM->cd();
69 DefineHits();
77
79
80 TracksDQMAlignment->cd();
83
84 originalDirectory->cd();
85
86 for (auto change : m_histogramParameterChanges)
87 ProcessHistogramParameterChange(std::get<0>(change), std::get<1>(change), std::get<2>(change));
88}
89
91{
94 return;
95
97
98 eventProcessor.Run();
99
100 if (m_eventLevelTrackingInfo.isValid())
101 m_trackingErrorFlags->Fill((double)m_eventLevelTrackingInfo->hasAnErrorFlag());
102 else
103 m_trackingErrorFlags->Fill(0.0);
104}
105
107{
108 // only monitor if any flag was set so only 2 bins needed
109 const char* flagTitle =
110 "Tracking error summary. Mean = errors/event (should be 0 or very close to 0); Error occured yes or no; Number of events";
111
112 m_trackingErrorFlags = Create("NumberTrackingErrorFlags", flagTitle, 2, -0.5, 1.5, "", "");
113
114 m_trackingErrorFlags->GetXaxis()->SetBinLabel(1, "No Error");
115 m_trackingErrorFlags->GetXaxis()->SetBinLabel(2, "Error occured");
116}
virtual void Run()
Call this to start processing the event data and filling histograms.
This class serves as a base for the TrackDQMModule and AlignDQMModule (and possibly other DQM histogr...
virtual void Define1DSensors()
Define 1D histograms with unbiased residuals for individual sensors.
bool histogramsDefined
True if the defineHisto() was called.
std::vector< std::tuple< std::string, std::string, std::string > > m_histogramParameterChanges
Used for changing parameters of histograms via the ProcessHistogramParameterChange function.
virtual void DefineHalfShellsVXD()
Define histograms with unbiased residuals for half-shells for PXD and SVD sensors.
virtual void initialize() override
Initializer.
virtual void DefineUBResidualsVXD()
Define histograms with unbiased residuals in PXD and SVD sensors.
virtual void DefineTRClusters()
Define histograms with correlations between neighbor layers and cluster hitmap in IP angle range.
void ProcessHistogramParameterChange(const std::string &name, const std::string &parameter, const std::string &value)
Process one change in histogram parameters.
virtual void event() override
This method is called for each event.
virtual void DefineTrackFitStatus()
Define histograms which require FitStatus.
std::string m_tracksStoreArrayName
StoreArray name where Tracks are written.
virtual TH1F * Create(std::string name, std::string title, int nbinsx, double xlow, double xup, std::string xTitle, std::string yTitle)
Function to create TH1F and add it to the vector of histograms (m_histograms).
virtual void DefineHits()
Define histograms with numbers of hits.
virtual void DefineMomentumCoordinates()
Define histograms with track momentum Pt.
virtual void DefineTracks()
All the following Define- functions should be used in the defineHisto() function to define histograms...
virtual void Define2DSensors()
Define 2D histograms with unbiased residuals for individual sensors.
virtual void DefineMomentumAngles()
Define histograms with track momentum Pt.
std::string m_recoTracksStoreArrayName
StoreArray name where RecoTracks are written.
virtual void DefineHelixParametersAndCorrelations()
Define histograms with helix parameters and their correlations.
virtual void defineHisto() override
Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
The purpose of this class is to process one event() in TrackDQMModule.
TrackDQMModule()
Constructor.
virtual void initialize() override
Module functions.
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Acccess to the EventLevelTrackingInfo object in the datastore.
virtual void event() override
This method is called for each event.
TH1F * m_trackingErrorFlags
Monitors the Error flags set by the tracking code.
virtual void DefineFlags()
All the following Define- functions should be used in the defineHisto() function to define histograms...
virtual void defineHisto() override
Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.