9 #include <tracking/dqmUtils/DQMEventProcessorBase.h>
10 #include <tracking/dqmUtils/DQMHistoModuleBase.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <vxd/geometry/GeoTools.h>
14 #include <vxd/geometry/SensorInfoBase.h>
19 void DQMEventProcessorBase::Run()
23 B2DEBUG(22,
"Missing recoTracks array in event() for " + m_histoModule->getName() +
" module.");
27 if (!tracks.isOptional()) {
28 B2DEBUG(22,
"Missing recoTracks array in event() for " + m_histoModule->getName() +
" module.");
38 for (
const Track& track : tracks) {
42 m_histoModule->FillTrackIndexes(m_iTrack, m_iTrackVXD, m_iTrackCDC, m_iTrackVXDCDC);
43 }
catch (
const std::exception& e) {
44 B2WARNING(
"Exception " + std::string(e.what()) +
" in " + m_histoModule->getName() +
" module!");
46 B2WARNING(
"Unhandled exception in " + m_histoModule->getName() +
" module!");
50 void DQMEventProcessorBase::ProcessTrack(
const Track& track)
52 auto recoTracksVector = track.getRelationsTo<
RecoTrack>(m_recoTracksStoreArrayName);
53 if (!recoTracksVector.size())
56 m_recoTrack = recoTracksVector[0];
59 if (!m_runningOnHLT) {
61 nPXDClusters = (int)pxdClusters.
size();
64 int nSVDClusters = (int)svdClusters.
size();
66 int nCDCHits = (int)cdcHits.
size();
69 auto trackFitResult = track.getTrackFitResultWithClosestMass(Const::pion);
71 TString message = ConstructMessage(trackFitResult, nPXDClusters, nSVDClusters, nCDCHits);
72 B2DEBUG(20, message.Data());
74 FillTrackFitResult(trackFitResult);
75 m_histoModule->FillHitNumbers(nPXDClusters, nSVDClusters, nCDCHits);
77 if (m_recoTrack->wasFitSuccessful())
78 ProcessSuccessfulFit();
81 if (((nPXDClusters > 0) || (nSVDClusters > 0)) && (nCDCHits == 0))
83 if (((nPXDClusters == 0) && (nSVDClusters == 0)) && (nCDCHits > 0))
85 if (((nPXDClusters > 0) || (nSVDClusters > 0)) && (nCDCHits > 0))
89 TString DQMEventProcessorBase::ConstructMessage(
const TrackFitResult* trackFitResult,
int nPXDClusters,
int nSVDClusters,
92 return Form(
"%s: track %3i, Mom: %f, %f, %f, Pt: %f, Mag: %f, Hits: PXD %i SVD %i CDC %i Suma %i\n",
93 m_histoModule->getName().c_str(),
100 nPXDClusters, nSVDClusters, nCDCHits, nPXDClusters + nSVDClusters + nCDCHits
104 void DQMEventProcessorBase::FillTrackFitResult(
const TrackFitResult* trackFitResult)
106 if (m_runningOnHLT) {
107 m_histoModule->FillMomentumAngles(trackFitResult);
108 m_histoModule->FillMomentumCoordinates(trackFitResult);
110 m_histoModule->FillHelixParametersAndCorrelations(trackFitResult);
113 void DQMEventProcessorBase::ProcessSuccessfulFit()
116 m_histoModule->FillTrackFitStatus(m_recoTrack->getTrackFitStatus());
118 m_isNotFirstHit =
false;
120 for (
auto recoHitInfo : m_recoTrack->getRecoHitInformations(
true)) {
121 ProcessRecoHit(recoHitInfo);
128 B2DEBUG(20,
"Missing genfit::pxd recoHitInfo in event() for " + m_histoModule->getName() +
" module.");
137 if (!isPXD && !isSVD)
140 auto fitterInfo = m_recoTrack->getCreatedTrackPoint(recoHitInfo)->getFitterInfo();
144 m_rawSensorResidual =
new TVectorT<double>(fitterInfo->getResidual(0,
false).getState());
146 if (isPXD && ! m_runningOnHLT) {
147 ProcessPXDRecoHit(recoHitInfo);
149 ProcessSVDRecoHit(recoHitInfo);
152 delete m_rawSensorResidual;
159 m_residual_um.SetX(m_rawSensorResidual->GetMatrixArray()[0] / Unit::um);
160 m_residual_um.SetY(m_rawSensorResidual->GetMatrixArray()[1] / Unit::um);
163 ComputeCommonVariables();
165 FillCommonHistograms();
167 m_histoModule->FillUBResidualsPXD(m_residual_um);
168 m_histoModule->FillHalfShellsPXD(m_globalResidual_um, IsNotYang(m_sensorID.getLadderNumber(), m_layerNumber));
171 m_histoModule->FillUB1DResidualsSensor(m_residual_um, m_sensorIndex);
173 m_histoModule->FillUB2DResidualsSensor(m_residual_um, m_sensorIndex);
175 SetCommonPrevVariables();
182 m_residual_um.SetX(m_rawSensorResidual->GetMatrixArray()[0] / Unit::um);
185 m_residual_um.SetY(m_rawSensorResidual->GetMatrixArray()[0] / Unit::um);
189 if (m_sensorIDPrev == m_sensorID) {
190 ComputeCommonVariables();
192 if (! m_runningOnHLT) {
193 FillCommonHistograms();
195 m_histoModule->FillUBResidualsSVD(m_residual_um);
196 m_histoModule->FillHalfShellsSVD(m_globalResidual_um, IsNotMat(m_sensorID.getLadderNumber(), m_layerNumber));
199 m_histoModule->FillUB1DResidualsSensor(m_residual_um, m_sensorIndex);
201 m_histoModule->FillUB2DResidualsSensor(m_residual_um, m_sensorIndex);
204 SetCommonPrevVariables();
207 m_sensorIDPrev = m_sensorID;
210 void DQMEventProcessorBase::ComputeCommonVariables()
212 auto sensorInfo = &VXD::GeoCache::get(m_sensorID);
213 m_globalResidual_um = sensorInfo->vectorToGlobal(m_residual_um,
true);
214 TVector3 globalPosition = sensorInfo->pointToGlobal(m_position,
true);
216 m_phi_deg = globalPosition.Phi() / Unit::deg;
217 m_theta_deg = globalPosition.Theta() / Unit::deg;
219 m_layerNumber = m_sensorID.getLayerNumber();
221 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
222 m_layerIndex = gTools->getLayerIndex(m_layerNumber);
223 m_correlationIndex = m_layerIndex - gTools->getFirstLayer();
224 m_sensorIndex = gTools->getSensorIndex(m_sensorID);
227 void DQMEventProcessorBase::FillCommonHistograms()
229 if (m_isNotFirstHit && ((m_layerNumber - m_layerNumberPrev) == 1)) {
230 m_histoModule->FillTRClusterCorrelations(m_phi_deg, m_phiPrev_deg, m_theta_deg, m_thetaPrev_deg, m_correlationIndex);
232 m_isNotFirstHit =
true;
235 m_histoModule->FillTRClusterHitmap(m_phi_deg, m_theta_deg, m_layerIndex);
238 void DQMEventProcessorBase::SetCommonPrevVariables()
240 m_layerNumberPrev = m_layerNumber;
241 m_phiPrev_deg = m_phi_deg;
242 m_thetaPrev_deg = m_theta_deg;
245 bool DQMEventProcessorBase::IsNotYang(
int ladderNumber,
int layerNumber)
247 switch (layerNumber) {
249 return ladderNumber < 5 || ladderNumber > 8;
251 return ladderNumber < 7 || ladderNumber > 12;
257 bool DQMEventProcessorBase::IsNotMat(
int ladderNumber,
int layerNumber)
259 switch (layerNumber) {
261 return ladderNumber < 3 || ladderNumber > 5;
263 return ladderNumber < 4 || ladderNumber > 8;
265 return ladderNumber < 5 || ladderNumber > 10;
267 return ladderNumber < 6 || ladderNumber > 13;
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
float getV() const
Get v coordinate of hit position.
float getU() const
Get u coordinate of hit position.
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.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
bool isUCluster() const
Get the direction of strips.
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Accessor to arrays stored in the data store.
Values of the result of a track fit with a given particle hypothesis.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
Class that bundles various TrackFitResults.
Abstract base class for different kinds of events.