 |
Belle II Software
release-05-01-25
|
11 #include <pxd/modules/pxdDQM/PXDDQMEfficiencyModule.h>
12 #include <tracking/dataobjects/ROIid.h>
14 #include <pxd/reconstruction/PXDPixelMasker.h>
15 #include <mdst/dataobjects/Track.h>
16 #include <framework/gearbox/Const.h>
18 #include "TDirectory.h"
19 #include "TMatrixDSym.h"
34 setDescription(
"Create basic histograms for PXD efficiency");
37 setPropertyFlags(c_ParallelProcessingCertified);
40 addParam(
"pxdClustersName", m_pxdClustersName,
"name of StoreArray with PXD cluster", std::string(
""));
41 addParam(
"tracksName", m_tracksName,
"name of StoreArray with RecoTracks", std::string(
""));
42 addParam(
"ROIsName", m_ROIsName,
"name of the list of HLT ROIs, if available in output", std::string(
""));
43 addParam(
"PXDInterceptListName", m_PXDInterceptListName,
"name of the list of interceptions", std::string(
""));
44 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed",
45 std::string(
"PXDEFF"));
46 addParam(
"binsU", m_u_bins,
"histogram bins in u direction",
int(4));
47 addParam(
"binsV", m_v_bins,
"histogram bins in v direction",
int(6));
48 addParam(
"distCut", m_distcut,
"max distance in [cm] for cluster to be counted to a track",
double(0.0500));
49 addParam(
"pCut", m_pcut,
"Set a cut on the track p-value",
double(1e-20));
50 addParam(
"requireROIs", m_requireROIs,
"require tracks to lie inside a ROI",
bool(
false));
51 addParam(
"useAlignment", m_useAlignment,
"if true the alignment will be used",
bool(
true));
52 addParam(
"maskDeadPixels", m_maskDeadPixels,
"Do not consider tracks going through known dead or hot pixels for the efficiency",
54 addParam(
"minSVDHits", m_minSVDHits,
"Number of SVD hits required in a track to be considered", 0u);
55 addParam(
"momCut", m_momCut,
"Set a cut on the track momentum in GeV/c, 0 disables",
double(0));
56 addParam(
"pTCut", m_pTCut,
"Set a cut on the track pT in GeV/c, 0 disables",
double(1));
57 addParam(
"cutBorders", m_cutBorders,
"Do not use tracks near the borders of the sensor",
bool(
true));
58 addParam(
"maskedDistance", m_maskedDistance,
"Distance inside which no masked pixel or sensor border is allowed",
int(10));
59 addParam(
"trackUFactorDistCut", m_uFactor,
"Set a cut on u error of track (factor*err<dist), 0 disables",
double(2.0));
60 addParam(
"trackVFactorDistCut", m_vFactor,
"Set a cut on v error of track (factor*err<dist), 0 disables",
double(2.0));
61 addParam(
"z0minCut", m_z0minCut,
"Set a cut z0 minimum in cm (large negativ value eg -9999 disables)",
double(-1));
62 addParam(
"z0maxCut", m_z0maxCut,
"Set a cut z0 maximum in cm (large positiv value eg 9999 disables)",
double(1));
63 addParam(
"d0Cut", m_d0Cut,
"Set a cut abs(d0) in cm (and negativ value eg -9999 disables)",
double(0.5));
64 addParam(
"verboseHistos", m_verboseHistos,
"Add more verbose histograms for cuts (not for ereoc)",
bool(
false));
85 for (
auto& h :
m_h_p)
if (h.second) h.second->Reset();
86 for (
auto& h :
m_h_pt)
if (h.second) h.second->Reset();
87 for (
auto& h :
m_h_su)
if (h.second) h.second->Reset();
88 for (
auto& h :
m_h_sv)
if (h.second) h.second->Reset();
89 for (
auto& h :
m_h_p2)
if (h.second) h.second->Reset();
90 for (
auto& h :
m_h_pt2)
if (h.second) h.second->Reset();
91 for (
auto& h :
m_h_su2)
if (h.second) h.second->Reset();
92 for (
auto& h :
m_h_sv2)
if (h.second) h.second->Reset();
98 B2INFO(
"PXDClusters array is missing, no efficiencies");
102 B2INFO(
"RecoTrack array is missing, no efficiencies");
106 B2INFO(
"ROI array is missing but required hits in ROIs, aborting");
110 B2INFO(
"Intercept array is missing, no efficiencies");
118 if (!a_track.wasFitSuccessful())
continue;
120 if (a_track.getNumberOfSVDHits() <
m_minSVDHits)
continue;
123 if (!interceptList.
size())
continue;
129 trackstate = a_track.getMeasuredStateOnPlaneFromFirstHit();
130 if (trackstate.getMom().Mag() <
m_momCut)
continue;
131 if (trackstate.getMom().Pt() <
m_pTCut)
continue;
133 auto ptr = a_track.getRelated<
Track>(
"Tracks");
136 B2ERROR(
"expect a track for fitted recotracks");
139 auto ptr2 = ptr->getTrackFitResultWithClosestMass(
Const::pion);
141 B2ERROR(
"expect a track fit result for mass");
150 for (
auto intercept : interceptList) {
151 auto const aVxdID = intercept.getSensorID();
162 if (
m_h_p[aVxdID])
m_h_p[aVxdID]->Fill(trackstate.getMom().Mag());
163 if (
m_h_pt[aVxdID])
m_h_pt[aVxdID]->Fill(trackstate.getMom().Pt());
170 double u_fit = intercept.getCoorU();
171 double v_fit = intercept.getCoorV();
173 int ucell_fit = info.getUCellID(u_fit);
174 int vcell_fit = info.getVCellID(v_fit);
187 bool fitInsideROI =
false;
188 for (
auto& roit :
m_ROIs) {
189 if (aVxdID != roit.getSensorID()) {
193 if (ucell_fit < roit.getMaxUid()
194 && ucell_fit > roit.getMinUid()
195 && vcell_fit < roit.getMaxVid()
196 && vcell_fit > roit.getMinVid()) {
211 if (bestcluster >= 0) {
216 TVector3 dist_clus(u_fit - u_clus, v_fit - v_clus, 0);
220 if (
m_h_p2[aVxdID])
m_h_p2[aVxdID]->Fill(trackstate.getMom().Mag());
221 if (
m_h_pt2[aVxdID])
m_h_pt2[aVxdID]->Fill(trackstate.getMom().Pt());
235 TDirectory* oldDir = gDirectory;
242 for (
VxdID& avxdid : sensors) {
247 TString buff = (std::string)avxdid;
248 buff.ReplaceAll(
".",
"_");
250 int nu = info.getUCells();
251 int nv = info.getVCells();
254 m_h_track_hits[avxdid] =
new TH2F(
"track_hits_" + buff,
"tracks through sensor " + buff,
256 m_h_matched_cluster[avxdid] =
new TH2F(
"matched_cluster_" + buff,
"clusters matched to track intersections " + buff,
260 m_h_p[avxdid] =
new TH1F(
"p_" + buff,
"p " + buff, 100, 0, 10);
261 m_h_pt[avxdid] =
new TH1F(
"pt_" + buff,
"pt " + buff, 100, 0, 10);
262 m_h_su[avxdid] =
new TH1F(
"su_" + buff,
"su " + buff, 1000, 0, 1);
263 m_h_sv[avxdid] =
new TH1F(
"sv_" + buff,
"sv " + buff, 1000, 0, 1);
264 m_h_p2[avxdid] =
new TH1F(
"p2_" + buff,
"p2 " + buff, 100, 0, 10);
265 m_h_pt2[avxdid] =
new TH1F(
"pt2_" + buff,
"pt2 " + buff, 100, 0, 10);
266 m_h_su2[avxdid] =
new TH1F(
"su2_" + buff,
"su2 " + buff, 1000, 0, 1);
267 m_h_sv2[avxdid] =
new TH1F(
"sv2_" + buff,
"sv2 " + buff, 1000, 0, 1);
279 double mindist = 999999999999;
297 TVector3 current(u, v, 0);
300 double dist = (intersection - current).Mag();
301 if (dist < mindist) {
314 if (u - checkDistance < 0 || u + checkDistance >= 250 ||
315 v - checkDistance < 0 || v + checkDistance >= 768) {
325 for (
int u_iter = u - checkDistance; u_iter <= u + checkDistance ; ++u_iter) {
326 for (
int v_iter = v - checkDistance; v_iter <= v + checkDistance ; ++v_iter) {
size_t size() const
Get number of relations.
void event() override final
main function which fills trees and histograms
VXD::GeoCache & m_vxdGeometry
the geometry
std::map< VxdID, TH2F * > m_h_matched_cluster
histograms of matched clusters
bool isCloseToBorder(int u, int v, int checkDistance)
is it close to the border
double m_z0maxCut
cut z0 maximum in cm (large positiv value eg 9999 disables)
Class to uniquely identify a any structure of the PXD and SVD.
std::string m_histogramDirectoryName
Where to save the histograms too.
#StateOnPlane with additional covariance matrix.
std::map< VxdID, TH1F * > m_h_pt2
histograms of pt2
bool m_maskDeadPixels
mask dead pixels
double m_momCut
Cut on fitted track momentum.
std::string m_PXDInterceptListName
intercept list name
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
bool m_requireROIs
Require tracks going through ROIs.
double m_z0minCut
cut z0 minimum in cm (large negativ value eg -9999 disables)
baseType getLadderNumber() const
Get the ladder id.
Base class to provide Sensor Information for PXD and SVD.
void beginRun() override final
begin run function which resets histograms
StoreArray< RecoTrack > m_tracks
store array of tracks
std::map< VxdID, TH1F * > m_h_sv
histograms of sv
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
double m_distcut
distance cut in cm!
std::map< VxdID, TH2F * > m_h_track_hits
histograms of track hits
bool m_verboseHistos
add some verbose histograms for cuts
std::string m_tracksName
name of the store array of tracks
double m_pcut
pValue-Cut for tracks
StoreArray< ROIid > m_ROIs
store array of ROIs
static const ChargedStable pion
charged pion particle
virtual double getPVal() const
Get the p value of the fit.
std::map< VxdID, TH1F * > m_h_pt
histograms of transverse momenta
Class for type safe access to objects that are referred to in relations.
std::string m_ROIsName
name of the store array of ROIs
std::map< VxdID, TH1F * > m_h_p
histograms of momenta
Abstract base class for different kinds of events.
StoreArray< PXDCluster > m_pxdclusters
store array of pxd clusters
bool m_cutBorders
cut borders
std::map< VxdID, TH1F * > m_h_p2
histograms of p2
double m_vFactor
factor for track-error on distcut comparison
bool isDeadPixelClose(int u, int v, int checkDistance, const VxdID &moduleID)
is a dead pixel close
double m_uFactor
factor for track-error on distcut comparison
int findClosestCluster(const VxdID &vxdid, TVector3 intersection)
find the closest cluster
std::string m_pxdClustersName
name of the store array of pxd clusters
StoreArray< PXDIntercept > m_intercepts
store array of PXD Intercepts
void initialize() override final
initializes the need store arrays, trees and histograms
bool isValid() const
Check wether the array was registered.
baseType getSensorNumber() const
Get the sensor id.
double m_d0Cut
cut abs(d0) in cm (and negativ value eg -9999 disables)
std::map< VxdID, TH1F * > m_h_sv2
histrograms of sv2
void defineHisto() override final
actually defines the trees and histograms
std::map< VxdID, TH1F * > m_h_su
histograms of su
double m_pTCut
Cut on fitted track pT.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Class that bundles various TrackFitResults.
baseType getLayerNumber() const
Get the layer id.
Creates the basic histograms for PXD Efficiency DQM Simplified and adopted version of the testbeam px...
Class where important numbers and properties of a fit can be stored.
PXDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an PXD ...
int m_maskedDistance
Distance inside which no dead pixel or module border is allowed.
std::map< VxdID, TH1F * > m_h_su2
histrograms of su2
int getEntries() const
Get the number of objects in the array.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
static PXDPixelMasker & getInstance()
Main (and only) way to access the PXDPixelMasker.
unsigned int m_minSVDHits
Required hits in SVD strips for tracks.