9#include <pxd/modules/pxdDQM/PXDDQMBowingModule.h>
11#include <alignment/dbobjects/VXDAlignment.h>
12#include <analysis/dataobjects/ParticleList.h>
13#include <framework/database/DBObjPtr.h>
14#include <genfit/Track.h>
15#include <mdst/dataobjects/Track.h>
16#include <pxd/reconstruction/PXDRecoHit.h>
17#include <tracking/dataobjects/RecoTrack.h>
18#include <tracking/trackFitting/fitter/base/TrackFitter.h>
19#include <vxd/geometry/GeoCache.h>
20#include "TDirectory.h"
30 setDescription(R
"DOC(Create basic histograms for PXD bowing monitoring)DOC");
38 std::string(
"PXDBow"));
41 addParam(
"cutP",
m_cutP,
"Cut on the track momentum (lower limit)", 1.0);
45 addParam(
"rangeV",
m_rangeV,
"Upper edge of the res v histogram symmetrical range", 0.1);
46 addParam(
"rangeS",
m_rangeS,
"Upper edge of the sagitta histogram symmetrical range", 0.1);
47 addParam(
"binsV",
m_binsV,
"Number of bins of the res v histogram", 100);
48 addParam(
"binsS",
m_binsS,
"Number of bins of the sagitta histogram", 100);
63 const std::vector<VxdID>& sensors =
geometry.getListOfSensors();
64 for (
const VxdID& aVxdID : sensors) {
67 const double sensor_length = info.getLength();
76 for (
auto& h :
m_hResV)
if (h.second) h.second->Reset();
77 for (
auto& h :
m_hSagitta)
if (h.second) h.second->Reset();
84 B2INFO(
"RecoTrack array is missing, no residuals");
88 B2INFO(
"Particle array is missing, no residuals");
94 for (
unsigned int iParticle = 0; iParticle < nParticles; ++iParticle) {
96 auto b2track = particle->getTrack();
98 B2WARNING(
"No Track for particle.");
104 const ROOT::Math::XYZVector& mom = fitResult->
getMomentum();
105 const auto p = mom.R();
108 const auto d0 = helix.getD0();
109 const auto z0 = helix.getZ0();
112 auto recoTrack = b2track->getRelatedTo<
RecoTrack>();
114 B2WARNING(
"No RecoTrack for Track");
120 if (!std::any_of(hits.begin(), hits.end(),
121 [](
const auto & hit) {
122 return hit->getSensorID().getSensorNumber() == 1;
126 auto noPXDTrack = recoTrack->getRelatedTo<
RecoTrack>(
"SVDCDCRecoTracks");
130 for (
unsigned int i = 0; i < track.getNumPoints() - 1; ++i) {
131 if (!track.getPoint(i)->hasRawMeasurements())
continue;
136 const auto fitterInfo = track.getPoint(i)->getFitterInfo();
138 const auto& vxdid =
VxdID(hit->getPlaneId());
139 if (vxdid.getSensorNumber() != 1)
continue;
140 const auto& plane = fitterInfo->getPlane();
142 const auto& state = fitterInfo->getFittedState(biased).getState();
143 const auto residual = fitterInfo->getResidual(0, biased).getState();
145 const double hitposU = state[3] + residual[0];
146 const double hitposV = state[4] + residual[1];
148 auto noPXDState = genfit::StateOnPlane(noPXDTrack->getMeasuredStateOnPlaneFromFirstHit());
149 noPXDState.extrapolateToPlane(plane);
151 const double noPXDhitPredU = noPXDState.getState()[3];
152 const double noPXDhitPredV = noPXDState.getState()[4];
154 const double noPXDhitPredVp = noPXDState.getState()[2];
156 const double residualU = hitposU - noPXDhitPredU;
158 if (std::abs(residualU) >
m_cutResU)
continue;
159 const double residualV = hitposV - noPXDhitPredV;
160 const double residualW = residualV / noPXDhitPredVp;
172 TDirectory* oldDir = gDirectory;
179 for (
VxdID& avxdid : sensors) {
182 || avxdid.getSensorNumber() != 1)
continue;
184 TString buff = (std::string)avxdid;
185 buff.ReplaceAll(
".",
"_");
static const ChargedStable pion
charged pion particle
Class for accessing objects in the database.
HistoModule()
Constructor.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
void initialize() override final
initializes the needed store arrays and histograms
int m_binsS
number of bins for the histograms of the sagitta
int m_binsV
number of bins for the histograms of the v residuals
std::string m_particleListName
Name of the particle list to which the module is applied.
std::map< VxdID, TH1F * > m_hResV
histos for the residual of the PXD hits' v component for each PXD module
void defineHisto() override final
actually defines the histograms
std::map< VxdID, Double_t > m_dwAlignment
Bowing amplitude of the PXD modules inside the alignment.
void event() override final
Refits tracks without PXD hits and calculate the residuals for the PXD layers.
Double_t m_cutZ0
value fot the cut on absolute value of the track parameter z0
std::map< VxdID, TH1F * > m_hSagitta
histos of the sagitta for each PXD module
Double_t m_rangeS
range for the histos of the sagitta
std::string m_histogramDirectoryName
Name of the directory where the histogram will be placed.
PXDDQMBowingModule()
Constructor: Sets the description, the properties and the parameters of the module.
Double_t m_cutResU
value fot the cut on absolute value of the u residuals
Double_t m_rangeV
range for the histos of the v residuls
StoreArray< RecoTrack > m_recoTracks
store array of the recoTracks related to the particles selected with m_ParticleList
void beginRun() override final
Resets the histograms for each run and print ROI size in v.
StoreObjPtr< ParticleList > m_ParticleList
particle list on which run the module (need to be charged particles to have some results)
Double_t m_cutP
value fot the cut on the momentum of the particle
Double_t m_cutD0
value fot the cut on absolute value of the track parameter d0
PXDRecoHit - an extended form of PXDCluster containing geometry information.
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
This is the Reconstruction Event-Data Model Track.
std::vector< Belle2::RecoTrack::UsedPXDHit * > getSortedPXDHitList() const
Return a sorted list of pxd hits. Sorted by the sortingParameter.
Values of the result of a track fit with a given particle hypothesis.
Helix getHelix() const
Conversion to framework Helix (without covariance).
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
static const baseType dAlpha
Sensor/layer/ladder alignment in local alpha.
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
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.
Common code concerning the geometry representation of the detector.
Abstract base class for different kinds of events.