Belle II Software  release-05-02-19
PXDInterceptor.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Giulia Casarosa, Eugenio Paoloni *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/dataobjects/RecoTrack.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <tracking/pxdDataReductionClasses/PXDInterceptor.h>
15 #include <vxd/geometry/GeoCache.h>
16 #include <vxd/geometry/SensorInfoBase.h>
17 
18 using namespace std;
19 using namespace Belle2;
20 
21 PXDInterceptor::PXDInterceptor(const ROIinfo* theROIinfo, double toleranceZ, double tolerancePhi):
22  m_theROIinfo(*theROIinfo)
23 {
24  m_theROIGeometry.fillPlaneList(toleranceZ, tolerancePhi);
25 }
26 
28 {
29 }
30 
31 void
33  RelationArray* recoTrackToPXDIntercepts)
34 {
35 
37  std::set<Belle2::VxdID> pxdLayers = vxdGeometry.getLayers(VXD::SensorInfoBase::PXD);
38 
39  for (int i = 0; i < trackList.getEntries(); ++i) { //loop over all tracks
40 
41  B2DEBUG(20, " %%%%% track candidate Nr. : " << i + 1);
42 
43  if (! trackList[i] ->wasFitSuccessful()) {
44  B2DEBUG(20, "%%%%% Fit not successful! discard this RecoTrack");
45  continue;
46  }
47 
48  // extrapolate track to cylinders (PXD layers 1 and 2)
49  for (unsigned int pxdLayer = 0; pxdLayer < pxdLayers.size(); pxdLayer++) {
50 
51  B2DEBUG(20, " fill intercept List, Layer: " << pxdLayer);
52  // get current state of track
53  genfit::MeasuredStateOnPlane gfTrackState = trackList[i]->getMeasuredStateOnPlaneFromFirstHit();
54 
55  try {
56  gfTrackState.extrapolateToCylinder(m_pxdLayerRadius[pxdLayer]);
57  } catch (...) {
58  B2DEBUG(20, "extrapolation to cylinder failed");
59  continue;
60  }
61 
62  std::list<ROIDetPlane> selectedPlanes;
63  B2DEBUG(20, " append selected planes, position " << gfTrackState.getPos().X() << ", " << gfTrackState.getPos().Y() << ", " <<
64  gfTrackState.getPos().Z());
65  m_theROIGeometry.appendSelectedPlanes(&selectedPlanes, gfTrackState.getPos(), pxdLayer + 1);
66 
67  B2DEBUG(20, " append intercepts for track " << i);
68  appendIntercepts(interceptList, selectedPlanes, trackList[i], i, recoTrackToPXDIntercepts);
69  } //loop on layers
70  } //loop on the track list
71 
72 } //fillInterceptList
73 
74 void
75 PXDInterceptor::appendIntercepts(StoreArray<PXDIntercept>* interceptList, std::list<ROIDetPlane> planeList, RecoTrack* recoTrack,
76  int recoTrackIndex, RelationArray* recoTrackToPXDIntercepts)
77 {
78 
79 
80  PXDIntercept tmpPXDIntercept;
81 
83 
84  std::list<ROIDetPlane>::iterator itPlanes = planeList.begin();
85 
86  B2DEBUG(20, "appendIntercepts, checking " << planeList.size() << " planes");
87 
88  double lambda = 0;
89 
90 
91  while (itPlanes != planeList.end()) {
92 
94 
95  try {
96  state = gfTrack.getFittedState();
97  lambda = state.extrapolateToPlane(itPlanes->getSharedPlanePtr());
98  } catch (...) {
99  B2DEBUG(20, "extrapolation to plane failed");
100  ++itPlanes;
101  continue;
102  }
103 
104  const TVectorD& predictedIntersect = state.getState();
105  const TMatrixDSym& covMatrix = state.getCov();
106 
107  tmpPXDIntercept.setCoorU(predictedIntersect[3]);
108  tmpPXDIntercept.setCoorV(predictedIntersect[4]);
109  tmpPXDIntercept.setSigmaU(sqrt(covMatrix(3, 3)));
110  tmpPXDIntercept.setSigmaV(sqrt(covMatrix(4, 4)));
111  tmpPXDIntercept.setSigmaUprime(sqrt(covMatrix(1, 1)));
112  tmpPXDIntercept.setSigmaVprime(sqrt(covMatrix(2, 2)));
113  tmpPXDIntercept.setLambda(lambda);
114  tmpPXDIntercept.setVxdID(itPlanes->getVxdID());
115 
116  interceptList->appendNew(tmpPXDIntercept);
117 
118  recoTrackToPXDIntercepts->add(recoTrackIndex, interceptList->getEntries() - 1);
119 
120  ++itPlanes;
121 
122  }
123 
124 }
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::RelationArray
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:72
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::RecoTrackGenfitAccess::getGenfitTrack
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition: RecoTrack.cc:389
Belle2::PXDInterceptor::m_pxdLayerRadius
const float m_pxdLayerRadius[2]
mean PXD layer radius for both layers
Definition: PXDInterceptor.h:60
Belle2::PXDInterceptor::fillInterceptList
void fillInterceptList(StoreArray< PXDIntercept > *listToBeFilled, const StoreArray< RecoTrack > &trackList, RelationArray *recoTrackToPXDIntercepts)
Fill the list of PXD intecepts corresponding to the list of track candidates.
Definition: PXDInterceptor.cc:32
genfit::Track
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Belle2::VXD::GeoCache::getLayers
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
Definition: GeoCache.cc:177
Belle2::PXDInterceptor::m_theROIGeometry
ROIGeometry m_theROIGeometry
the geometry of the Region Of Interest
Definition: PXDInterceptor.h:63
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::VXD::GeoCache::getInstance
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:215
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RelationArray::add
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
Definition: RelationArray.h:291
genfit::Track::getFittedState
const MeasuredStateOnPlane & getFittedState(int id=0, const AbsTrackRep *rep=nullptr, bool biased=true) const
Shortcut to get FittedStates.
Definition: Track.cc:285
Belle2::VXD::SensorInfoBase::PXD
@ PXD
PXD Sensor.
Definition: SensorInfoBase.h:44
Belle2::VXD::GeoCache
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:41
ROIinfo
ROIinfo contains the parameters that can be changed by the user in the python script.
Definition: ROIinfo.h:8
Belle2::ROIGeometry::appendSelectedPlanes
void appendSelectedPlanes(std::list< ROIDetPlane > *selectedPlanes, TVector3 recoTrackPosition, int layer)
Append to selectedPlanes those in the internal list for which a sensor is near the RecoTrack position...
Definition: ROIGeometry.cc:78
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::PXDIntercept
PXDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an PXD ...
Definition: PXDIntercept.h:32
Belle2::PXDInterceptor::~PXDInterceptor
virtual ~PXDInterceptor()
Destructor.
Definition: PXDInterceptor.cc:27
Belle2::ROIGeometry::fillPlaneList
void fillPlaneList(double toleranceZ, double tolerancePhi)
fill the list of planes
Definition: ROIGeometry.cc:35
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::PXDInterceptor::appendIntercepts
void appendIntercepts(StoreArray< PXDIntercept > *interceptList, std::list< ROIDetPlane > planeList, RecoTrack *recoTrack, int recoTrackIndex, RelationArray *recoTrackToPXDIntercepts)
Append the PXDIntercept infos related to the track theTrack to the listToBeFilled.
Definition: PXDInterceptor.cc:75