9#include <tracking/roiFinding/VXDInterceptor.h>
10#include <tracking/roiFinding/ROIDetPlane.h>
11#include <tracking/dataobjects/RecoTrack.h>
12#include <framework/logging/Logger.h>
13#include <framework/datastore/StoreArray.h>
14#include <vxd/geometry/GeoCache.h>
15#include <vxd/geometry/SensorInfoBase.h>
17#include <genfit/MeasuredStateOnPlane.h>
25 template<
class aIntercept>
30 for (
int i = 0; i < trackList.
getEntries(); ++i) {
32 B2DEBUG(20,
" %%%%% track candidate Nr. : " << i + 1);
34 if (! trackList[i] ->wasFitSuccessful()) {
35 B2DEBUG(20,
"%%%%% Fit not successful! discard this RecoTrack");
40 for (
unsigned int layer = 0; layer < m_layerRadii.size(); layer++) {
43 B2DEBUG(20,
" .fill intercept List, Layer: " << layer + layerOffset);
47 for (
short direction : (m_ForDQM ? c_backwards : c_both)) {
48 std::list<ROIDetPlane> selectedPlanes;
49 genfit::MeasuredStateOnPlane gfTrackState;
52 gfTrackState = trackList[i]->getMeasuredStateOnPlaneFromFirstHit();
55 gfTrackState = trackList[i]->getMeasuredStateOnPlaneFromLastHit();
56 gfTrackState.setPosMom(gfTrackState.getPos(), -gfTrackState.getMom());
57 gfTrackState.setChargeSign(-gfTrackState.getCharge());
64 gfTrackState.extrapolateToCylinder(m_layerRadii[layer]);
66 B2DEBUG(20,
" .-extrapolation to cylinder failed");
70 B2DEBUG(20,
" ..append selected planes, position " << gfTrackState.getPos().X() <<
", " << gfTrackState.getPos().Y() <<
", " <<
71 gfTrackState.getPos().Z());
73 m_theROIGeometry.appendSelectedPlanes(&selectedPlanes, ROOT::Math::XYZVector(gfTrackState.getPos()), layer + layerOffset);
74 B2DEBUG(20,
" ...append intercepts for track " << i <<
"\n"\
75 " ...the size of the selectedPlanes : " << selectedPlanes.size() <<
"\n"\
76 " ...extrapolating in direction " << direction <<
" (-1 for backwards from first hit, +1 for forwards from last hit)");
77 appendIntercepts(interceptList, selectedPlanes, gfTrackState, i, recoTrackToIntercepts);
86 template<
class aIntercept>
88 std::list<ROIDetPlane> planeList,
89 genfit::MeasuredStateOnPlane state,
93 aIntercept tmpIntercept;
95 B2DEBUG(20,
" ...-appendIntercepts, checking " << planeList.size() <<
" planes");
99 std::list<ROIDetPlane>::iterator itPlanes = planeList.begin();
100 while (itPlanes != planeList.end()) {
101 B2DEBUG(20,
" searching in appendIntercepts : " << (itPlanes->getVxdID()));
104 lambda = state.extrapolateToPlane(itPlanes->getSharedPlanePtr());
106 B2DEBUG(20,
" ...-extrapolation to plane failed");
111 const TVectorD& predictedIntersect = state.getState();
112 const TMatrixDSym& covMatrix = state.getCov();
114 tmpIntercept.setCoorU(predictedIntersect[3]);
115 tmpIntercept.setCoorV(predictedIntersect[4]);
116 tmpIntercept.setSigmaU(
sqrt(covMatrix(3, 3)));
117 tmpIntercept.setSigmaV(
sqrt(covMatrix(4, 4)));
118 tmpIntercept.setSigmaUprime(
sqrt(covMatrix(1, 1)));
119 tmpIntercept.setSigmaVprime(
sqrt(covMatrix(2, 2)));
120 tmpIntercept.setLambda(lambda);
121 tmpIntercept.setVxdID(itPlanes->getVxdID());
122 tmpIntercept.setUprime(predictedIntersect[1]);
123 tmpIntercept.setVprime(predictedIntersect[2]);
125 B2DEBUG(20,
"extrapolate to plane!!! >>> coordinates with getPos = " << state.getPos().X()
126 <<
", " << state.getPos().Y()
127 <<
", " << state.getPos().Z());
128 B2DEBUG(20,
"coordinates with predInter = " << predictedIntersect[3]
129 <<
", " << predictedIntersect[4]);
130 B2DEBUG(20,
"momentum with getMom = " << state.getMom().X()
131 <<
", " << state.getMom().Y()
132 <<
", " << state.getMom().Z());
133 B2DEBUG(20,
"U/V prime momentum with getMom = " << state.getMom().Z() / state.getMom().X()
134 <<
", " << state.getMom().Z() / state.getMom().Y());
135 B2DEBUG(20,
"U/V prime momentum with predInter = " << predictedIntersect[1]
136 <<
", " << predictedIntersect[2]);
140 recoTrackToIntercepts->
add(recoTrackIndex, interceptList->
getEntries() - 1);
Low-level class to create/modify relations between StoreArrays.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
double sqrt(double a)
sqrt for double
void fillInterceptList(StoreArray< aIntercept > *listToBeFilled, const StoreArray< RecoTrack > &trackList, RelationArray *recoTrackToIntercepts)
Fill the list of PXD intecepts corresponding to the list of track candidates.
void appendIntercepts(StoreArray< aIntercept > *interceptList, std::list< ROIDetPlane > planeList, genfit::MeasuredStateOnPlane state, int recoTrackIndex, RelationArray *recoTrackToIntercepts)
Append the Intercept infos related to the track theTrack to the listToBeFilled.
Abstract base class for different kinds of events.