11 #include <pxd/modules/pxdDQM/PXDDQMEfficiencyNtupleModule.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 "TMatrixDSym.h"
33 setDescription(
"Create basic histograms for PXD efficiency");
38 addParam(
"ntupleName", m_ntupleName,
"name of ntuple file", std::string(
"test.root"));
39 addParam(
"pxdClustersName", m_pxdClustersName,
"name of StoreArray with PXD cluster", std::string(
""));
40 addParam(
"recoTracksName", m_recoTracksName,
"name of StoreArray with RecoTracks", std::string(
""));
41 addParam(
"tracksName", m_tracksName,
"name of StoreArray with Tracks", 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(
"useAlignment", m_useAlignment,
"if true the alignment will be used",
true);
45 addParam(
"pCut", m_pcut,
"Set a cut on the track fit p-value (0=no cut)",
double(0));
46 addParam(
"minSVDHits", m_minSVDHits,
"Number of SVD hits required in a track to be considered", 0u);
47 addParam(
"momCut", m_momCut,
"Set a cut on the track momentum in GeV/c, 0 disables",
double(0));
48 addParam(
"pTCut", m_pTCut,
"Set a cut on the track pT in GeV/c, 0 disables",
double(0));
49 addParam(
"maskedDistance", m_maskedDistance,
"Distance inside which no masked pixel or sensor border is allowed",
int(10));
55 auto dir = gDirectory;
78 m_tuple =
new TNtuple(
"effcontrol",
"effcontrol",
79 "vxdid:u:v:p:pt:distu:distv:sigu:sigv:dist:inroi:clborder:cldead:matched:z0:d0:svdhits:charge:phi:costheta");
94 B2INFO(
"PXDClusters array is missing, no efficiencies");
98 B2INFO(
"RecoTrack array is missing, no efficiencies");
102 B2INFO(
"Track array is missing, no efficiencies");
106 B2INFO(
"Intercept array is missing, no efficiencies");
112 if (!recoTrack.
size())
continue;
114 auto a_track = recoTrack[0];
116 if (!a_track->wasFitSuccessful())
continue;
118 if (a_track->getNumberOfSVDHits() <
m_minSVDHits)
continue;
121 if (!interceptList.
size())
continue;
127 trackstate = a_track->getMeasuredStateOnPlaneFromFirstHit();
128 if (trackstate.getMom().Mag() <
m_momCut)
continue;
129 if (trackstate.getMom().Pt() <
m_pTCut)
continue;
133 B2ERROR(
"expect a track fit result for mass");
139 for (
auto intercept : interceptList) {
140 auto aVxdID = intercept.getSensorID();
146 double sigu = intercept.getSigmaU();
147 double sigv = intercept.getSigmaV();
149 double u_fit = intercept.getCoorU();
150 double v_fit = intercept.getCoorV();
152 int ucell_fit = info.getUCellID(u_fit);
153 int vcell_fit = info.getVCellID(v_fit);
155 bool closeToBoarder =
false;
157 closeToBoarder =
true;
160 bool closeToDead =
false;
165 bool fitInsideROI =
false;
169 for (
auto& roit :
m_ROIs) {
170 if (aVxdID != roit.getSensorID()) {
174 if (ucell_fit < roit.getMaxUid()
175 && ucell_fit > roit.getMinUid()
176 && vcell_fit < roit.getMaxVid()
177 && vcell_fit > roit.getMinVid()) {
190 bool matched =
false;
191 if (bestcluster >= 0) {
196 TVector3 dist_clus(u_fit - u_clus, v_fit - v_clus, 0);
197 du_clus = u_fit - u_clus;
198 dv_clus = v_fit - v_clus;
199 d_clus = dist_clus.Mag();
203 float fill[22] = {float((
int)aVxdID), float(u_fit), float(v_fit), float(trackstate.getMom().Mag()), float(trackstate.getMom().Pt()),
204 float(du_clus), float(dv_clus), float(sigu), float(sigv), float(d_clus),
205 float(fitInsideROI), float(closeToBoarder), float(closeToDead), float(matched),
206 float(ptr2->
getZ0()), float(ptr2->
getD0()), float(a_track->getNumberOfSVDHits()),
207 charge, float(trackstate.getMom().Phi()), float(trackstate.getMom().CosTheta())
218 double mindist = 999999999999;
236 TVector3 current(u, v, 0);
239 double dist = (intersection - current).Mag();
240 if (dist < mindist) {
253 if (u - checkDistance < 0 || u + checkDistance >= 250 ||
254 v - checkDistance < 0 || v + checkDistance >= 768) {
264 for (
int u_iter = u - checkDistance; u_iter <= u + checkDistance ; ++u_iter) {
265 for (
int v_iter = v - checkDistance; v_iter <= v + checkDistance ; ++v_iter) {