9#include <pxd/modules/pxdDQM/PXDDQMEfficiencyNtupleModule.h>
10#include <pxd/dataobjects/PXDCluster.h>
11#include <tracking/dataobjects/ROIid.h>
12#include <tracking/dataobjects/RecoTrack.h>
13#include <tracking/dataobjects/PXDIntercept.h>
15#include <pxd/reconstruction/PXDPixelMasker.h>
16#include <mdst/dataobjects/Track.h>
17#include <framework/gearbox/Const.h>
19#include "TMatrixDSym.h"
20#include <Math/Vector3D.h>
45 addParam(
"ROIsName",
m_ROIsName,
"name of the list of HLT ROIs, if available in output", std::string(
""));
48 addParam(
"pCut",
m_pcut,
"Set a cut on the track fit p-value (0=no cut)",
double(0));
49 addParam(
"minSVDHits",
m_minSVDHits,
"Number of SVD hits required in a track to be considered", 0u);
50 addParam(
"momCut",
m_momCut,
"Set a cut on the track momentum in GeV/c, 0 disables",
double(0));
51 addParam(
"pTCut",
m_pTCut,
"Set a cut on the track pT in GeV/c, 0 disables",
double(0));
52 addParam(
"maskedDistance",
m_maskedDistance,
"Distance inside which no masked pixel or sensor border is allowed",
int(10));
58 auto dir = gDirectory;
81 m_tuple =
new TNtuple(
"effcontrol",
"effcontrol",
82 "vxdid:u:v:p:pt:distu:distv:sigu:sigv:dist:inroi:clborder:cldead:matched:z0:d0:svdhits:charge:phi:costheta");
97 B2INFO(
"PXDClusters array is missing, no efficiencies");
101 B2INFO(
"RecoTrack array is missing, no efficiencies");
105 B2INFO(
"Track array is missing, no efficiencies");
109 B2INFO(
"Intercept array is missing, no efficiencies");
115 if (!recoTrack.
size())
continue;
117 auto a_track = recoTrack[0];
119 if (!a_track->wasFitSuccessful())
continue;
121 if (a_track->getNumberOfSVDHits() <
m_minSVDHits)
continue;
124 if (!interceptList.
size())
continue;
126 const genfit::FitStatus* fitstatus = a_track->getTrackFitStatus();
127 if (fitstatus->getPVal() <
m_pcut)
continue;
129 genfit::MeasuredStateOnPlane trackstate;
130 trackstate = a_track->getMeasuredStateOnPlaneFromFirstHit();
131 if (trackstate.getMom().Mag() <
m_momCut)
continue;
132 if (trackstate.getMom().Pt() <
m_pTCut)
continue;
136 B2ERROR(
"expect a track fit result for mass");
141 std::vector<VxdID> sensors =
m_vxdGeometry.getListOfSensors();
142 for (
auto intercept : interceptList) {
143 auto aVxdID = intercept.getSensorID();
149 double sigu = intercept.getSigmaU();
150 double sigv = intercept.getSigmaV();
152 double u_fit = intercept.getCoorU();
153 double v_fit = intercept.getCoorV();
155 int ucell_fit = info.getUCellID(u_fit);
156 int vcell_fit = info.getVCellID(v_fit);
158 bool closeToBoarder =
false;
160 closeToBoarder =
true;
163 bool closeToDead =
false;
168 bool fitInsideROI =
false;
172 for (
auto& roit :
m_ROIs) {
173 if (aVxdID != (roit.getSensorID()).getID()) {
177 if (ucell_fit < roit.getMaxUid()
178 && ucell_fit > roit.getMinUid()
179 && vcell_fit < roit.getMaxVid()
180 && vcell_fit > roit.getMinVid()) {
193 bool matched =
false;
194 if (bestcluster >= 0) {
199 ROOT::Math::XYZVector dist_clus(u_fit - u_clus, v_fit - v_clus, 0);
200 du_clus = u_fit - u_clus;
201 dv_clus = v_fit - v_clus;
202 d_clus = dist_clus.R();
206 float fill[22] = {float((
int)aVxdID), float(u_fit), float(v_fit), float(trackstate.getMom().Mag()), float(trackstate.getMom().Pt()),
207 float(du_clus), float(dv_clus), float(sigu), float(sigv), float(d_clus),
208 float(fitInsideROI), float(closeToBoarder), float(closeToDead), float(matched),
209 float(ptr2->
getZ0()), float(ptr2->
getD0()), float(a_track->getNumberOfSVDHits()),
210 charge, float(trackstate.getMom().Phi()), float(trackstate.getMom().CosTheta())
221 double mindist = 999999999999;
226 for (
int iclus = 0; iclus <
m_pxdclusters.getEntries(); iclus++) {
239 ROOT::Math::XYZVector current(u, v, 0);
242 double dist = (intersection - current).
R();
243 if (dist < mindist) {
256 if (u - checkDistance < 0 || u + checkDistance >= 250 ||
257 v - checkDistance < 0 || v + checkDistance >= 768) {
267 for (
int u_iter = u - checkDistance; u_iter <= u + checkDistance ; ++u_iter) {
268 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.
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.
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.
Namespace to provide code needed by both Vertex Detectors, PXD and SVD, and also testbeam telescopes.
Abstract base class for different kinds of events.