Belle II Software  release-05-01-25
ROIStripTranslator.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 *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/svdROIFinder/ROIStripTranslator.h>
12 #include <framework/logging/Logger.h>
13 #include <vxd/geometry/GeoCache.h>
14 #include <vxd/geometry/SensorInfoBase.h>
15 
16 using namespace std;
17 using namespace Belle2;
18 
19 ROIStripTranslator::ROIStripTranslator(double user_sigmaSystU, double user_sigmaSystV, double user_numSigmaTotU,
20  double user_numSigmaTotV, double user_maxWidthU, double user_maxWidthV)
21  : m_sigmaSystU(user_sigmaSystU)
22  , m_sigmaSystV(user_sigmaSystV)
23  , m_numSigmaTotU(user_numSigmaTotU)
24  , m_numSigmaTotV(user_numSigmaTotV)
25  , m_maxWidthU(user_maxWidthU)
26  , m_maxWidthV(user_maxWidthV)
27 {}
28 
29 
31  : m_sigmaSystU(theROIinfo->sigmaSystU)
32  , m_sigmaSystV(theROIinfo->sigmaSystV)
33  , m_numSigmaTotU(theROIinfo->numSigmaTotU)
34  , m_numSigmaTotV(theROIinfo->numSigmaTotV)
35  , m_maxWidthU(theROIinfo->maxWidthU)
36  , m_maxWidthV(theROIinfo->maxWidthV)
37 {}
38 
39 
41 {}
42 
43 
44 void
46  StoreArray<ROIid>* ROIidList)
47 {
48 
50 
51  for (int i = 0; i < listOfIntercepts->getEntries(); i++) {
52 
53  B2DEBUG(10, " --->> a NEW INTERCEPT!");
54 
55 
56  const VXD::SensorInfoBase& aSensorInfo = aGeometry.getSensorInfo((*listOfIntercepts)[i]->getSensorID());
57 
58  double widthTotU = std::min(m_maxWidthU ,
59  sqrt((*listOfIntercepts)[i]->getSigmaU() * (*listOfIntercepts)[i]->getSigmaU() + m_sigmaSystU * m_sigmaSystU) * m_numSigmaTotU);
60  double widthTotV = std::min(m_maxWidthV ,
61  sqrt((*listOfIntercepts)[i]->getSigmaV() * (*listOfIntercepts)[i]->getSigmaV() + m_sigmaSystV * m_sigmaSystV) * m_numSigmaTotV);
62 
63  double minU = (*listOfIntercepts)[i]->getCoorU() - widthTotU / 2 ;
64  double maxU = (*listOfIntercepts)[i]->getCoorU() + widthTotU / 2 ;
65  const int nStripsU = aSensorInfo.getUCells() - 1;
66 
67  double minV = (*listOfIntercepts)[i]->getCoorV() - widthTotV / 2;
68  double maxV = (*listOfIntercepts)[i]->getCoorV() + widthTotV / 2;
69  const int nStripsV = aSensorInfo.getVCells() - 1;
70 
71  const int firstStripID = 0;
72 
73  double min_uID = aSensorInfo.getUCellID(minU, minV, false);
74  double min_vID = aSensorInfo.getVCellID(minV, false);
75  double max_uID = aSensorInfo.getUCellID(maxU, maxV, false);
76  double max_vID = aSensorInfo.getVCellID(maxV, false);
77 
78  B2DEBUG(10, " LAYER = " << VxdID((*listOfIntercepts)[i]->getSensorID()).getLayerNumber()
79  << " LADDER = " << VxdID((*listOfIntercepts)[i]->getSensorID()).getLadderNumber()
80  << " SENSOR = " << VxdID((*listOfIntercepts)[i]->getSensorID()).getSensorNumber()
81  );
82 
83  B2DEBUG(10, " nStrips (U,V) = (" << nStripsU << "," << nStripsV << ")");
84 
85  B2DEBUG(10, " widthU = " << maxU - minU
86  << " minU = " << minU
87  << " maxU = " << maxU
88  << " lengthU = " << aSensorInfo.getUSize((*listOfIntercepts)[i]->getCoorV())
89  );
90 
91  B2DEBUG(10, " widthV = " << maxV - minV
92  << " minV = " << minV
93  << " maxV = " << maxV
94  << " lengthV = " << aSensorInfo.getVSize());
95 
96  B2DEBUG(10, " U strips in (" << min_uID << "," << max_uID << ")");
97  B2DEBUG(10, " V strips in (" << min_vID << "," << max_vID << ")");
98 
99 
100  //check that the pixel belong to the sensor
101  bool inside = true;
102  if (min_uID > nStripsU || max_uID < firstStripID || min_vID > nStripsV || max_vID < firstStripID) {
103  B2DEBUG(5, " OOOPS: this pixel does NOT belong to the sensor");
104  inside = false;
105  }
106 
107  ROIid tmpROIid;
108 
109  if (inside) {
110  tmpROIid.setMinUid(aSensorInfo.getUCellID(minU, minV, true));
111  tmpROIid.setMinVid(aSensorInfo.getVCellID(minV, true));
112  tmpROIid.setMaxUid(aSensorInfo.getUCellID(maxU, maxV, true));
113  tmpROIid.setMaxVid(aSensorInfo.getVCellID(maxV, true));
114  tmpROIid.setSensorID((*listOfIntercepts)[i]->getSensorID()) ;
115 
116  ROIidList->appendNew(tmpROIid);
117 
118  // this is the pointer to the transient copy of tmpROIid
119  ROIid* transientROIid = (*ROIidList)[ROIidList->getEntries() - 1];
120 
121  (*listOfIntercepts)[i]->addRelationTo(transientROIid);
122 
123  }
124 
125  }
126 
127 }
128 
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::VXD::SensorInfoBase::getUCells
int getUCells() const
Return number of pixel/strips in u direction.
Definition: SensorInfoBase.h:223
Belle2::ROIStripTranslator::m_sigmaSystU
double m_sigmaSystU
systematic error along the U coordinate
Definition: ROIStripTranslator.h:59
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::VXD::SensorInfoBase::getUCellID
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
Definition: SensorInfoBase.h:203
Belle2::RelationsInterface::addRelationTo
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Definition: RelationsObject.h:144
Belle2::VXD::SensorInfoBase
Base class to provide Sensor Information for PXD and SVD.
Definition: SensorInfoBase.h:40
Belle2::ROIStripTranslator::m_numSigmaTotU
double m_numSigmaTotU
number of standard deviations to be taken to define a ROI along U
Definition: ROIStripTranslator.h:61
Belle2::ROIStripTranslator::m_maxWidthU
double m_maxWidthU
ROI maximum width allowed in the U direction.
Definition: ROIStripTranslator.h:63
Belle2::VXD::SensorInfoBase::getVCellID
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
Definition: SensorInfoBase.h:213
Belle2::ROIid
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
Definition: ROIid.h:35
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::VXD::SensorInfoBase::getVCells
int getVCells() const
Return number of pixel/strips in v direction.
Definition: SensorInfoBase.h:225
Belle2::ROIStripTranslator::m_sigmaSystV
double m_sigmaSystV
systematic error along the V coordinate
Definition: ROIStripTranslator.h:60
Belle2::VXD::SensorInfoBase::getUSize
double getUSize(double v=0) const
Return the width of the sensor.
Definition: SensorInfoBase.h:127
Belle2::ROIStripTranslator::ROIStripTranslator
ROIStripTranslator(const ROIinfo *theROIinfo)
Constructor.
Definition: ROIStripTranslator.cc:30
Belle2::ROIStripTranslator::~ROIStripTranslator
~ROIStripTranslator()
Destructor.
Definition: ROIStripTranslator.cc:40
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::ROIStripTranslator::m_maxWidthV
double m_maxWidthV
ROI maximum width allowed in the V direction.
Definition: ROIStripTranslator.h:64
Belle2::VXD::GeoCache::getSensorInfo
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:68
Belle2::ROIStripTranslator::fillRoiIDList
void fillRoiIDList(StoreArray< SVDIntercept > *listOfIntercepts, StoreArray< ROIid > *ROIidList)
Append the ROIid to the list listToBeFilled.
Definition: ROIStripTranslator.cc:45
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::VXD::SensorInfoBase::getVSize
double getVSize() const
Return the length of the sensor.
Definition: SensorInfoBase.h:132
Belle2::ROIStripTranslator::m_numSigmaTotV
double m_numSigmaTotV
number of standard deviations to be taken to define a ROI along V
Definition: ROIStripTranslator.h:62
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226