9#include <pxd/modules/pxdDQM/PXDDQMEfficiencyNtupleModule.h>
10#include <tracking/dataobjects/ROIid.h>
12#include <pxd/reconstruction/PXDPixelMasker.h>
13#include <mdst/dataobjects/Track.h>
14#include <framework/gearbox/Const.h>
16#include "TMatrixDSym.h"
40 addParam(
"ROIsName",
m_ROIsName,
"name of the list of HLT ROIs, if available in output", std::string(
""));
43 addParam(
"pCut",
m_pcut,
"Set a cut on the track fit p-value (0=no cut)",
double(0));
44 addParam(
"minSVDHits",
m_minSVDHits,
"Number of SVD hits required in a track to be considered", 0u);
45 addParam(
"momCut",
m_momCut,
"Set a cut on the track momentum in GeV/c, 0 disables",
double(0));
46 addParam(
"pTCut",
m_pTCut,
"Set a cut on the track pT in GeV/c, 0 disables",
double(0));
47 addParam(
"maskedDistance",
m_maskedDistance,
"Distance inside which no masked pixel or sensor border is allowed",
int(10));
53 auto dir = gDirectory;
76 m_tuple =
new TNtuple(
"effcontrol",
"effcontrol",
77 "vxdid:u:v:p:pt:distu:distv:sigu:sigv:dist:inroi:clborder:cldead:matched:z0:d0:svdhits:charge:phi:costheta");
92 B2INFO(
"PXDClusters array is missing, no efficiencies");
96 B2INFO(
"RecoTrack array is missing, no efficiencies");
100 B2INFO(
"Track array is missing, no efficiencies");
104 B2INFO(
"Intercept array is missing, no efficiencies");
110 if (!recoTrack.
size())
continue;
112 auto a_track = recoTrack[0];
114 if (!a_track->wasFitSuccessful())
continue;
116 if (a_track->getNumberOfSVDHits() <
m_minSVDHits)
continue;
119 if (!interceptList.
size())
continue;
121 const genfit::FitStatus* fitstatus = a_track->getTrackFitStatus();
122 if (fitstatus->getPVal() <
m_pcut)
continue;
124 genfit::MeasuredStateOnPlane trackstate;
125 trackstate = a_track->getMeasuredStateOnPlaneFromFirstHit();
126 if (trackstate.getMom().Mag() <
m_momCut)
continue;
127 if (trackstate.getMom().Pt() <
m_pTCut)
continue;
131 B2ERROR(
"expect a track fit result for mass");
137 for (
auto intercept : interceptList) {
138 auto aVxdID = intercept.getSensorID();
144 double sigu = intercept.getSigmaU();
145 double sigv = intercept.getSigmaV();
147 double u_fit = intercept.getCoorU();
148 double v_fit = intercept.getCoorV();
150 int ucell_fit = info.getUCellID(u_fit);
151 int vcell_fit = info.getVCellID(v_fit);
153 bool closeToBoarder =
false;
155 closeToBoarder =
true;
158 bool closeToDead =
false;
163 bool fitInsideROI =
false;
167 for (
auto& roit :
m_ROIs) {
168 if (aVxdID != (roit.getSensorID()).getID()) {
172 if (ucell_fit < roit.getMaxUid()
173 && ucell_fit > roit.getMinUid()
174 && vcell_fit < roit.getMaxVid()
175 && vcell_fit > roit.getMinVid()) {
188 bool matched =
false;
189 if (bestcluster >= 0) {
194 ROOT::Math::XYZVector dist_clus(u_fit - u_clus, v_fit - v_clus, 0);
195 du_clus = u_fit - u_clus;
196 dv_clus = v_fit - v_clus;
197 d_clus = dist_clus.R();
201 float fill[22] = {float((
int)aVxdID), float(u_fit), float(v_fit), float(trackstate.getMom().Mag()), float(trackstate.getMom().Pt()),
202 float(du_clus), float(dv_clus), float(sigu), float(sigv), float(d_clus),
203 float(fitInsideROI), float(closeToBoarder), float(closeToDead), float(matched),
204 float(ptr2->
getZ0()), float(ptr2->
getD0()), float(a_track->getNumberOfSVDHits()),
205 charge, float(trackstate.getMom().Phi()), float(trackstate.getMom().CosTheta())
216 double mindist = 999999999999;
234 ROOT::Math::XYZVector current(u, v, 0);
237 double dist = (intersection - current).
R();
238 if (dist < mindist) {
251 if (u - checkDistance < 0 || u + checkDistance >= 250 ||
252 v - checkDistance < 0 || v + checkDistance >= 768) {
262 for (
int u_iter = u - checkDistance; u_iter <= u + checkDistance ; ++u_iter) {
263 for (
int v_iter = v - checkDistance; v_iter <= v + checkDistance ; ++v_iter) {
static const ChargedStable pion
charged pion particle
void setDescription(const std::string &description)
Sets the description of the module.
void initialize() override final
initializes the need store arrays, trees and histograms
bool isCloseToBorder(int u, int v, int checkDistance)
is it close to the border
unsigned int m_minSVDHits
Required hits in SVD strips for tracks.
StoreArray< PXDCluster > m_pxdclusters
store array of pxd clusters
std::string m_PXDInterceptListName
intercept list name
double m_momCut
Cut on fitted track momentum.
int findClosestCluster(const VxdID &vxdid, ROOT::Math::XYZVector intersection)
find the closest cluster
bool isDeadPixelClose(int u, int v, int checkDistance, const VxdID &moduleID)
is a dead pixel close
double m_pcut
pValue-Cut for tracks
void terminate() override final
terminate , save tuple to file if needed
void event() override final
main function which fills trees and histograms
std::string m_pxdClustersName
name of the store array of pxd clusters
StoreArray< Track > m_tracks
store array of tracks
std::string m_recoTracksName
name of the store array of recotracks
TFile * m_file
pointer to opened file
int m_maskedDistance
Distance inside which no dead pixel or module border is allowed.
double m_pTCut
Cut on fitted track pT.
StoreArray< PXDIntercept > m_intercepts
store array of PXD Intercepts
std::string m_ROIsName
name of the store array of ROIs
StoreArray< RecoTrack > m_recoTracks
store array of reco tracks
bool m_useAlignment
if true alignment will be used!
VXD::GeoCache & m_vxdGeometry
the geometry
TNtuple * m_tuple
pointer to opened tuple
std::string m_ntupleName
name output file
PXDDQMEfficiencyNtupleModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_tracksName
name of the store array of tracks
StoreArray< ROIid > m_ROIs
store array of ROIs
PXDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an PXD ...
static PXDPixelMasker & getInstance()
Main (and only) way to access the PXDPixelMasker.
This is the Reconstruction Event-Data Model Track.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
bool isValid() const
Check wether the array was registered.
int getEntries() const
Get the number of objects in the array.
Values of the result of a track fit with a given particle hypothesis.
double getD0() const
Getter for d0.
double getZ0() const
Getter for z0.
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getSensorNumber() const
Get the sensor id.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.