Belle II Software development
Belle2::PXD Namespace Reference

Namespace to encapsulate code needed for simulation and reconstrucion of the PXD. More...

Classes

class  ActivatePXDClusterPositionEstimatorModule
 The ActivatePXDClusterPositionEstimator module. More...
 
class  ActivatePXDGainCalibratorModule
 The ActivatePXDGainCalibrator module. More...
 
class  ActivatePXDPixelMaskerModule
 The ActivatePXDPixelMasker module. More...
 
struct  Cluster_t
 Struct to hold variables for PXD clusters. More...
 
class  ClusterCache
 Class to remember recently assigned clusters This class will remember the current and the last pixel row to allow fast finding of the correct cluster a pixel belongs to. More...
 
class  ClusterCandidate
 Class representing a possible cluster during clustering of the PXD It supports merging of different clusters and keeps track of the highest charge inside the cluster. More...
 
class  ClusterProjection
 Helper struct to collect information about the 1D projection of a Pixel cluster. More...
 
struct  dhc_commode_frame
 DHH common mode frame data struct. More...
 
struct  dhc_dhe_end_frame
 DHE End frame data struct. More...
 
struct  dhc_dhe_start_frame
 DHH start frame data struct. More...
 
struct  dhc_direct_readout_frame
 DHC direct readout frame data struct. More...
 
struct  dhc_direct_readout_frame_raw
 DHC RAW direct readout frame data struct. More...
 
struct  dhc_direct_readout_frame_zsd
 DHC Zero supressed direct readout frame data struct. More...
 
struct  dhc_end_frame
 DHC End frame data struct. More...
 
struct  dhc_frame_header_word0
 DHC frame header word data struct. More...
 
class  dhc_frames
 DHC frame wrapper class. More...
 
struct  dhc_ghost_frame
 DHC Ghost frame data struct. More...
 
struct  dhc_onsen_roi_frame
 ONSEN (debug) ROI frame data struct. More...
 
struct  dhc_onsen_trigger_frame
 ONSEN Trigger frame data struct. More...
 
struct  dhc_start_frame
 DHC start frame data struct. More...
 
class  Digit
 Class to represent the coordinates of one pixel. More...
 
class  DigitValue
 Class representing the charge and particle contributions for one pixel. More...
 
class  GeoPXDCreator
 The creator for the PXD geometry of the Belle II detector. More...
 
class  NoiseMap
 Base Class to represent pixel dependent Noise Map. More...
 
class  Pixel
 Class to represent one pixel, used in clustering for fast access. More...
 
class  PXDBackgroundModule
 PXD Background module. More...
 
class  PXDBadSensorTagModule
 The PXD bad sensor tagger module. More...
 
class  PXDBeamBackHitFilterModule
 The PXDBeamBackHitFilter module. More...
 
class  PXDBgTupleProducerModule
 PXD Background Tuple Producer. More...
 
class  PXDClusterCheckModule
 The PXDClusterCheck module. More...
 
class  PXDClusterizerModule
 The PXDClusterizer module. More...
 
class  PXDClusterPositionEstimator
 Singleton class that estimates cluster positions taking into account the estimated track incidence angles into the sensor. More...
 
class  PXDClusterShape
 Class to correct estimation of cluster error and position base on its shape. More...
 
class  PXDDAQDQMModule
 The PXD DAQ DQM module. More...
 
class  PXDDigitizerModule
 The PXD Digitizer module. More...
 
class  PXDDigitSorterModule
 The PXDDigitSorter module. More...
 
class  PXDEventPlotModule
 Plot each event with ROI and Pixels. More...
 
class  PXDGainCalibrator
 Singleton class for managing gain corrections for the PXD. More...
 
class  PXDGatedDHCDQMModule
 The PXD Gatint after Injection DQM module. More...
 
class  PXDGatedInfoFillerModule
 PXD Gates Mode infromation on readout gate basis. More...
 
class  PXDGatedModeDQMModule
 The PXD for GatedMode DQM module. More...
 
class  PXDInjectionDQMModule
 The PXD Occupancy after Injection DQM module. More...
 
class  PXDMappingLookup
 Class to make the mapping between u/v cell ID of pixels back to DCD drain lines, pixel row/col, DCD and Switcher IDs Details: Belle Note: BELLE2-NOTE-TE-2015-01 "The vertex detector numbering scheme" https://docs.belle2.org/record/243/files/Belle%20II%20note%200010.pdf PXD WhiteBook 3.1.3 Sensor Design and Appendix #3 https://confluence.desy.de/display/BI/PXD+WebHome?preview=/34029260/56330158/PXDwb.pdf. More...
 
class  PXDMCBgTupleProducerModule
 PXD MC Background Tuple Producer. More...
 
class  PXDPackerErrModule
 The PXDPackerErr module. More...
 
class  PXDPackerModule
 The PXDPacker module. More...
 
class  PXDPixelMasker
 Singleton class for managing pixel masking for the PXD. More...
 
class  PXDPostErrorCheckerModule
 The PXD DAQ Post Unpacking Error Check. More...
 
class  PXDRawDQMChipsModule
 The raw PXD DQM module. More...
 
class  PXDRawDQMModule
 The raw PXD DQM module. More...
 
class  PXDRawDumperModule
 Dump Raw PXD/ ONSEN event data. More...
 
class  PXDRawHitMaskingModule
 The PXDRawHitMasking module. More...
 
class  PXDRawHitSorterModule
 The PXDRawHitSorter module. More...
 
class  PXDReadRawBonnDAQMatchedModule
 Module to Load BonnDAQ file and store it as RawPXD in Data Store This is meant for lab use (standalone testing, debugging) without an event builder. More...
 
class  PXDReadRawBonnDAQModule
 Module to Load Raw PXD Data from DHH network-dump file and store it as RawPXD in Data Store This is meant for lab use (standalone testing, debugging) without an event builder. More...
 
class  PXDReadRawONSENModule
 A class definition of an input module for Sequential ROOT I/O. More...
 
class  PXDROIDQMModule
 The raw PXD DQM module. More...
 
class  PXDROIPlotModule
 Plot each event with ROI and Pixels. More...
 
class  PXDUnpackerModule
 The PXDUnpacker module. More...
 
class  PXDUnpackerOldModule
 The PXDUnpacker module. More...
 
class  PXDUnpackerOTModule
 The PXDUnpackerOT module. More...
 
class  SensorInfo
 Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific information. More...
 
struct  TrackBase_t
 Struct to hold variables from a track which contains a vector of data type like TrackCluster. More...
 
struct  TrackCluster_t
 Struct to hold variables for track clusters. More...
 
struct  TrackPoint_t
 Struct to hold variables for intersection points. More...
 

Typedefs

typedef std::map< Digit, DigitValueSensor
 Map of all hits in one Sensor.
 
typedef std::map< VxdID, SensorSensors
 Map of all hits in all Sensors.
 
typedef std::map< pxdClusterShapeType, std::string > pxdClusterShapeDescr
 Type specifies cluster shape type description.
 
typedef VXD::SensitiveDetector< PXDSimHit, PXDTrueHitSensitiveDetector
 The PXD Sensitive Detector class.
 
using ulittle16_t = boost::endian::little_uint16_t
 define alias ulittle16_t
 
using ulittle32_t = boost::endian::little_uint32_t
 define alias ulittle32_t
 
using ubig16_t = boost::endian::big_uint16_t
 define alias ubig16_t
 
using ubig32_t = boost::endian::big_uint32_t
 define alias ubig32_t
 
typedef boost::crc_optimal< 32, 0x04C11DB7, 0, 0, false, false > dhc_crc_32_type
 define our CRC function
 
typedef TrackBase_t< TrackCluster_tTrack_t
 Typedef TrackBase_t<TrackCluster_t> Track_t.
 
typedef genfit::MeasuredStateOnPlane TrackState
 Typedef TrackState (genfit::MeasuredStateOnPlane)
 

Enumerations

enum class  pxdClusterShapeType {
  no_shape_set = 0 ,
  shape_1 ,
  shape_2_u ,
  shape_2_v ,
  shape_2_uv_diag ,
  shape_2_uv_antidiag ,
  shape_N1 ,
  shape_1M ,
  shape_N2 ,
  shape_2M ,
  shape_4 ,
  shape_3_L ,
  shape_3_L_mirr_u ,
  shape_3_L_mirr_v ,
  shape_3_L_mirr_uv ,
  shape_large
}
 Type specifies cluster shape type. More...
 
enum  EDHPFrameHeaderDataType {
  c_RAW = 0x0 ,
  c_ZSD = 0x5
}
 Enums for DHP data modes in the DHP header. More...
 
enum  EDHCFrameHeaderDataType {
  c_DHP_RAW = 0x0 ,
  c_DHP_ZSD = 0x5 ,
  c_FCE_RAW = 0x1 ,
  c_COMMODE = 0x6 ,
  c_GHOST = 0x2 ,
  c_DHE_START = 0x3 ,
  c_DHE_END = 0x4 ,
  c_DHC_START = 0xB ,
  c_DHC_END = 0xC ,
  c_ONSEN_DHP = 0xD ,
  c_ONSEN_FCE = 0x9 ,
  c_ONSEN_ROI = 0xF ,
  c_ONSEN_TRG = 0xE ,
  c_UNUSED_7 = 0x7 ,
  c_UNUSED_8 = 0x8 ,
  c_UNUSED_A = 0xA
}
 Enums for DHC data frame types. More...
 
enum  EDHEStateMachineError {
  c_DHESM_NO_ERROR = 0x0 ,
  c_DHESM_MISS_DHP_FRM = 0x1 ,
  c_DHESM_TIMEOUT = 0x2 ,
  c_DHESM_DHP_LINKDOWN = 0x3 ,
  c_DHESM_DHP_MASKED = 0x4 ,
  c_DHESM_EVTNR_MM = 0x5 ,
  c_DHESM_DHP_SIZE_OVERFLOW = 0x6
}
 Enums for DHE DHP StateMachine Error States. More...
 

Functions

void getNumberOfBins (const std::shared_ptr< TH1I > &histo_ptr, unsigned short &nBinsU, unsigned short &nBinsV)
 Helper function to extract number of bins along u side and v side from counter histogram labels.
 
unsigned short getNumberOfSensors (const std::shared_ptr< TH1I > &histo_ptr)
 Helper function to extract number of sensors from counter histogram labels.
 
double CalculateMedian (std::vector< double > &signals)
 Helper function to calculate a median from unsorted signal vector.
 
double CalculateMedian (TH1 *hist)
 Helper function to calculate a median from 1D histogram.
 
double FitLandau (TH1 *hist)
 Helper function to estimate MPV from 1D histogram.
 
double FitLandau (std::vector< double > &signals)
 Helper function to calculate MPV from a vector.
 
 TEST (ClusterCache, FindNeighbours)
 Check that we cluster to hits next to each other but not if one is in between.
 
 TEST (ClusterCache, Merging)
 Test that clusters get merged if they are found to have a common pixel.
 
 TEST (ClusterCache, Empty)
 Check if the cluster cache is empty.
 
 TEST (ClusterCache, OutOfRange)
 Check that out_of_range exceptions are raised if the pixel is out of range.
 
double xiBeta2_L (const int Z=Z_Si, const double A=A_Si, const double rho=rho_Si, const int z=1)
 xi = (K/2)*(Z/A)*z*z*(rho*L)/beta2 in MeV
 
double hbarWp (const int Z=Z_Si, const double A=A_Si, const double rho=rho_Si)
 hbarWp = sqrt(rho*Z/A)*28.816 in eV
 
double getDeltaP (const double mom, const double length, const double mass=Const::electronMass)
 helper function to estimate the most probable energy loss for a given track length.
 
unsigned short getPXDModuleID (const VxdID &sensorID)
 Helper function to get DHE id like module id from VxdID.
 
VxdID getVxdIDFromPXDModuleID (const unsigned short &id)
 Helper function to get VxdID from DHE id like module iid.
 
std::shared_ptr< TrackStategetTrackStateOnModule (const VXD::SensorInfoBase &pxdSensorInfo, RecoTrack &recoTrack, double lambda=0.0)
 Helper function to get a track state on a module.
 
bool isCloseToBorder (int u, int v, int checkDistance)
 Helper function to check if a pixel is close to the border.
 
bool isDefectivePixelClose (int u, int v, int checkDistance, const VxdID &moduleID)
 Helper function to check if a defective (hot/dead) pixel is close.
 
bool isClusterAtUEdge (VxdID id, unsigned int umin, unsigned int umax)
 Helper function to check if one of the end pixels are at the edge of the sensor.
 
bool isClusterAtVEdge (VxdID id, unsigned int vmin, unsigned int vmax)
 Helper function to check if one of the end pixels are at the edge of the sensor.
 
bool isClusterAtLadderJoint (VxdID id, unsigned int vmin, unsigned int vmax)
 Helper function to check if one of the end pixels are at the ladder joint.
 
unsigned short getBinU (VxdID id, unsigned int uid, unsigned int vid, unsigned short nBinsU)
 Function to return a bin number for equal sized binning in U.
 
unsigned short getBinV (VxdID id, unsigned int vid, unsigned short nBinsV)
 Function to return a bin number for equal sized binning in V.
 

Variables

geometry::CreatorFactory< GeoPXDCreatorGeoPXDFactory ("PXDCreator")
 Register the creator.
 
const int Z_Si = 14
 Const and Const expressions Only valid when g_mol is the default unit.
 
const double A_Si = 28.085
 Atomic mass of silicon in g mol^-1.
 
const double rho_Si = 2.3290 * Unit::g_cm3
 Silicon density in g cm^-3.
 

Detailed Description

Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.

Typedef Documentation

◆ dhc_crc_32_type

typedef boost::crc_optimal<32, 0x04C11DB7, 0, 0, false, false> dhc_crc_32_type

define our CRC function

Definition at line 29 of file PXDRawDataStructs.cc.

◆ pxdClusterShapeDescr

typedef std::map<pxdClusterShapeType, std::string> pxdClusterShapeDescr

Type specifies cluster shape type description.

Definition at line 43 of file PXDClusterShape.h.

◆ SensitiveDetector

The PXD Sensitive Detector class.

Definition at line 23 of file SensitiveDetector.h.

◆ Sensor

typedef std::map<Digit, DigitValue> Sensor

Map of all hits in one Sensor.

Definition at line 82 of file PXDDigitizerModule.h.

◆ Sensors

typedef std::map<VxdID, Sensor> Sensors

Map of all hits in all Sensors.

Definition at line 84 of file PXDDigitizerModule.h.

◆ Track_t

Typedef TrackBase_t<TrackCluster_t> Track_t.

Definition at line 150 of file PXDPerformanceStructs.h.

◆ TrackState

typedef genfit::MeasuredStateOnPlane TrackState

Typedef TrackState (genfit::MeasuredStateOnPlane)

Definition at line 92 of file PXDUtilities.h.

◆ ubig16_t

typedef boost::endian::big_uint16_t ubig16_t

define alias ubig16_t

Definition at line 33 of file PXDRawDataStructs.h.

◆ ubig32_t

typedef boost::endian::big_uint32_t ubig32_t

define alias ubig32_t

Definition at line 35 of file PXDRawDataStructs.h.

◆ ulittle16_t

using ulittle16_t = boost::endian::little_uint16_t

define alias ulittle16_t

Definition at line 29 of file PXDRawDataStructs.h.

◆ ulittle32_t

using ulittle32_t = boost::endian::little_uint32_t

define alias ulittle32_t

Definition at line 31 of file PXDRawDataStructs.h.

Enumeration Type Documentation

◆ EDHCFrameHeaderDataType

Enums for DHC data frame types.

4 bits value; found in the first header word of each frame. See Data format definitions [BELLE2-NOTE-TE-2016-009] on https://docs.belle2.org/

Definition at line 28 of file PXDRawDataDefinitions.h.

28 {
29 c_DHP_RAW = 0x0, // DHP memory dump ("pedestals")
30 c_DHP_ZSD = 0x5, // DHP zero supressed data
31 c_FCE_RAW = 0x1, // Clustered data
32 c_COMMODE = 0x6, // Common mode data
33 c_GHOST = 0x2, // Ghost frame, no data
34 // DHE envelope
35 c_DHE_START = 0x3, // DHE Start
36 c_DHE_END = 0x4, // DHE End
37 // DHC envelope
38 c_DHC_START = 0xB, // DHC Start
39 c_DHC_END = 0xC, // DHC End
40 // Onsen processed data, new
41 c_ONSEN_DHP = 0xD, // Onsen processed zero supressed DHP
42 c_ONSEN_FCE = 0x9, // Onsen processed clustered
43 c_ONSEN_ROI = 0xF, // Onsen ROIs (HLT+DATCON)
44 c_ONSEN_TRG = 0xE, // Trigger frame (the 1st frame)
45 // Free IDs are 0x7 0x8 0xA
46 c_UNUSED_7 = 0x7,
47 c_UNUSED_8 = 0x8,
48 c_UNUSED_A = 0xA,
49 };

◆ EDHEStateMachineError

Enums for DHE DHP StateMachine Error States.

4 bits value; Currently the same definitions as the ones encoded in ghost frame (new! but 3 bit only) See Data format definitions [BELLE2-NOTE-TE-2016-009] on https://docs.belle2.org/

Definition at line 56 of file PXDRawDataDefinitions.h.

56 {
57 c_DHESM_NO_ERROR = 0x0, // no errors
58 c_DHESM_MISS_DHP_FRM = 0x1, // missing DHPT frame
59 c_DHESM_TIMEOUT = 0x2, // timeout
60 c_DHESM_DHP_LINKDOWN = 0x3, // DHP link down
61 c_DHESM_DHP_MASKED = 0x4, // DHP masked
62 c_DHESM_EVTNR_MM = 0x5, // event number mismatch (between FSM_START and FSM_END; DHE error.)
63 c_DHESM_DHP_SIZE_OVERFLOW = 0x6, // DHPT frame bigger than maximum allowed, data truncated
65 };

◆ EDHPFrameHeaderDataType

Enums for DHP data modes in the DHP header.

DHP modes have the same value as for the DHC/DHE frame See Data format definitions [BELLE2-NOTE-TE-2016-009] on https://docs.belle2.org/

Definition at line 22 of file PXDRawDataDefinitions.h.

22{ c_RAW = 0x0, c_ZSD = 0x5};

◆ pxdClusterShapeType

enum class pxdClusterShapeType
strong

Type specifies cluster shape type.

Definition at line 21 of file PXDClusterShape.h.

21 {
22 no_shape_set = 0,
23
24 shape_1,
25 shape_2_u,
26 shape_2_v,
27 shape_2_uv_diag,
28 shape_2_uv_antidiag,
29 shape_N1,
30 shape_1M,
31 shape_N2,
32 shape_2M,
33 shape_4,
34 shape_3_L,
35 shape_3_L_mirr_u,
36 shape_3_L_mirr_v,
37 shape_3_L_mirr_uv,
38 shape_large
39
40 };

Function Documentation

◆ CalculateMedian() [1/2]

double CalculateMedian ( std::vector< double > &  signals)

Helper function to calculate a median from unsorted signal vector.

The input vector gets sorted.

Definition at line 88 of file PXDCalibrationUtilities.cc.

89 {
90 auto size = signals.size();
91
92 if (size == 0) {
93 return 0.0; // Undefined, really.
94 } else if (size <= 100) {
95 // sort() or partial_sort is in O(NlogN)
96 sort(signals.begin(), signals.end());
97 if (size % 2 == 0) {
98 return (signals[size / 2 - 1] + signals[size / 2]) / 2;
99 } else {
100 return signals[size / 2];
101 }
102 } else {
103 // nth_element or max_element in O(N) only
104 // All elements before the nth are guanranteed smaller
105 auto n = size / 2;
106 nth_element(signals.begin(), signals.begin() + n, signals.end());
107 auto med = signals[n];
108 if (!(size & 1)) { // if size is even
109 auto max_it = max_element(signals.begin(), signals.begin() + n);
110 med = (*max_it + med) / 2.0;
111 }
112 return med;
113 }
114 }

◆ CalculateMedian() [2/2]

double CalculateMedian ( TH1 *  hist)

Helper function to calculate a median from 1D histogram.

Definition at line 116 of file PXDCalibrationUtilities.cc.

117 {
118 double quantiles[1]; // One element just for median
119 double probSums[1] = {0.5}; // median definiton
120 hist->GetQuantiles(1, quantiles, probSums);
121 return quantiles[0];
122 }

◆ FitLandau() [1/2]

double FitLandau ( std::vector< double > &  signals)

Helper function to calculate MPV from a vector.

The input vector gets sorted.

Definition at line 157 of file PXDCalibrationUtilities.cc.

158 {
159 auto size = signals.size();
160 if (size == 0) return 0.0; // Undefined, really.
161
162 // get max and min values of signal vector
163 double max = *max_element(signals.begin(), signals.end());
164 double min = *min_element(signals.begin(), signals.end());
165
166 // create histogram to hold signals and fill it
167 TH1D* hist_signals = new TH1D("", "", max - min, min, max);
168 for (auto it = signals.begin(); it != signals.end(); ++it) {
169 hist_signals->Fill(*it);
170 }
171
172 double MPV = FitLandau(hist_signals);
173 delete hist_signals;
174
175 return MPV;
176 }

◆ FitLandau() [2/2]

double FitLandau ( TH1 *  hist)

Helper function to estimate MPV from 1D histogram.

Definition at line 125 of file PXDCalibrationUtilities.cc.

126 {
127 auto size = hist->GetEntries();
128 if (size == 0) return 0.0; // Undefined.
129
130 int max = hist->GetBinLowEdge(hist->GetNbinsX() + 1);
131 int min = hist->GetBinLowEdge(1);
132
133 // create fit function
134 TF1* landau = new TF1("landau", "TMath::Landau(x,[0],[1])*[2]", min, max);
135 landau->SetParNames("MPV", "sigma", "scale");
136 landau->SetParameters(1., 0.1, 1000);
137 landau->SetParLimits(0, 0., 3.);
138
139 Int_t status = hist->Fit("landau", "Lq", "", min, max);
140 double MPV = landau->GetParameter("MPV");
141
142 B2INFO("Fit result: " << status << " MPV " << MPV << " sigma " << landau->GetParameter("sigma")
143 << " scale " << landau->GetParameter("scale") << " chi2 " << landau->GetChisquare());
144
145 // clean up
146 delete landau;
147
148 // check fit status
149 if (status == 0) return MPV;
150 else {
151 B2WARNING("Fit failed!. using default value.");
152 return 0.0;
153 }
154 }

◆ getBinU()

unsigned short getBinU ( VxdID  id,
unsigned int  uid,
unsigned int  vid,
unsigned short  nBinsU 
)
inline

Function to return a bin number for equal sized binning in U.

Parameters
idVxdID of the sensor
uiduID of the pixel
vidvID of the pixel
nBinsUnumber of bins in U within a sensor

Definition at line 161 of file PXDUtilities.h.

162 {
163 unsigned int drainsPerBin = 4 * Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getUCells() / nBinsU;
164 return (uid * 4 + vid % 4) / drainsPerBin;
165 }
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
int getUCells() const
Return number of pixel/strips in u direction.

◆ getBinV()

unsigned short getBinV ( VxdID  id,
unsigned int  vid,
unsigned short  nBinsV 
)
inline

Function to return a bin number for equal sized binning in V.

Parameters
idVxdID of the sensor
vidvID of the pixel
nBinsVnumber of bins in V within a sensor

Definition at line 171 of file PXDUtilities.h.

172 {
173 unsigned int rowsPerBin = Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getVCells() / nBinsV;
174 return vid / rowsPerBin;
175 }
int getVCells() const
Return number of pixel/strips in v direction.

◆ getDeltaP()

double getDeltaP ( const double  mom,
const double  length,
const double  mass = Const::electronMass 
)
inline

helper function to estimate the most probable energy loss for a given track length.

Parameters
momMagnitude of the momentum
lengthTrack path length
massMass of the incident particle, using e- as default
Returns
the most probable energy

Definition at line 68 of file PXDUtilities.h.

69 {
70 double betaGamma = mom / mass;
71 if (betaGamma <= 100) return 0.0; // requirement of the formula.
72 double beta2 = 1. / (1. + 1. / betaGamma / betaGamma);
73 double xi = xiBeta2_L() * length / beta2;
74 return xi * log(2 * mass * xi / pow(hbarWp(), 2) + 0.2);
75 }
double xiBeta2_L(const int Z=Z_Si, const double A=A_Si, const double rho=rho_Si, const int z=1)
xi = (K/2)*(Z/A)*z*z*(rho*L)/beta2 in MeV
Definition: PXDUtilities.h:40
double hbarWp(const int Z=Z_Si, const double A=A_Si, const double rho=rho_Si)
hbarWp = sqrt(rho*Z/A)*28.816 in eV
Definition: PXDUtilities.h:55

◆ getNumberOfBins()

void getNumberOfBins ( const std::shared_ptr< TH1I > &  histo_ptr,
unsigned short &  nBinsU,
unsigned short &  nBinsV 
)

Helper function to extract number of bins along u side and v side from counter histogram labels.

Definition at line 35 of file PXDCalibrationUtilities.cc.

36 {
37 set<unsigned short> uBinSet;
38 set<unsigned short> vBinSet;
39
40 // Loop over all bins of input histo
41 for (auto histoBin = 1; histoBin <= histo_ptr->GetXaxis()->GetNbins(); histoBin++) {
42 // The bin label contains the vxdid, uBin and vBin
43 string label = histo_ptr->GetXaxis()->GetBinLabel(histoBin);
44
45 // Parse label string format to read sensorID, uBin and vBin
46 istringstream stream(label);
47 string token;
48 getline(stream, token, '_');
49 getline(stream, token, '_');
50 unsigned short uBin = std::stoi(token);
51
52 getline(stream, token, '_');
53 unsigned short vBin = std::stoi(token);
54
55 uBinSet.insert(uBin);
56 vBinSet.insert(vBin);
57 }
58
59 if (uBinSet.empty() || vBinSet.empty()) {
60 B2FATAL("Not able to determine the grid size. Something is wrong with collected data.");
61 } else {
62 nBinsU = *uBinSet.rbegin() + 1;
63 nBinsV = *vBinSet.rbegin() + 1;
64 }
65 }

◆ getNumberOfSensors()

unsigned short getNumberOfSensors ( const std::shared_ptr< TH1I > &  histo_ptr)

Helper function to extract number of sensors from counter histogram labels.

Definition at line 68 of file PXDCalibrationUtilities.cc.

69 {
70 set<unsigned short> sensorSet;
71
72 // Loop over all bins of input histo
73 for (auto histoBin = 1; histoBin <= histo_ptr->GetXaxis()->GetNbins(); histoBin++) {
74 // The bin label contains the vxdid, uBin and vBin
75 string label = histo_ptr->GetXaxis()->GetBinLabel(histoBin);
76
77 // Parse label string format to read sensorID, uBin and vBin
78 istringstream stream(label);
79 string token;
80 getline(stream, token, '_');
81 VxdID sensorID(token);
82 sensorSet.insert(sensorID.getID());
83 }
84 return sensorSet.size();
85 }
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33

◆ getPXDModuleID()

unsigned short getPXDModuleID ( const VxdID sensorID)
inline

Helper function to get DHE id like module id from VxdID.

Definition at line 78 of file PXDUtilities.h.

79 {
80 return sensorID.getLayerNumber() * 1000 +
81 sensorID.getLadderNumber() * 10 +
82 sensorID.getSensorNumber();
83 }
baseType getSensorNumber() const
Get the sensor id.
Definition: VxdID.h:100
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:98
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96

◆ getTrackStateOnModule()

std::shared_ptr< TrackState > getTrackStateOnModule ( const VXD::SensorInfoBase pxdSensorInfo,
RecoTrack recoTrack,
double  lambda = 0.0 
)

Helper function to get a track state on a module.

Parameters
pxdSensorInfoof the PXD module intersecting with the track.
recoTrackthe recoTrack to be extrapolated.
lambdathe extrapolation length from track POCA.
Returns
the shared pointer of the intersection track state on the module.

Definition at line 21 of file PXDUtilities.cc.

24 {
25 // get sensor plane, always enable alignment.
26 auto centerP = pxdSensorInfo.pointToGlobal(ROOT::Math::XYZVector(0, 0, 0), true);
27 auto normalV = pxdSensorInfo.vectorToGlobal(ROOT::Math::XYZVector(0, 0, 1), true);
28 genfit::SharedPlanePtr sensorPlaneSptr(new genfit::DetPlane(XYZToTVector(centerP), XYZToTVector(normalV)));
29
30 // genfit track and measured state on plane
31 const genfit::Track& gfTrack = RecoTrackGenfitAccess::getGenfitTrack(recoTrack);
32 auto statePtr = std::make_shared<TrackState>();
33
34 try {
35 *statePtr = gfTrack.getFittedState();
36 lambda = statePtr->extrapolateToPlane(sensorPlaneSptr);
37 } catch (...) {
38 B2DEBUG(20, "extrapolation to plane failed! Lambda = " << lambda);
39 return std::shared_ptr<TrackState>(nullptr);
40 }
41 auto intersec = pxdSensorInfo.pointToLocal(ROOT::Math::XYZVector(statePtr->getPos()), true);
42
43 // check if the intersection is inside (no tolerance).
44 double tolerance = 0.0;
45 bool inside = pxdSensorInfo.inside(intersec.X(), intersec.Y(), tolerance, tolerance);
46 if (!inside) return std::shared_ptr<TrackState>(nullptr);
47
48 return statePtr;
49 }
ROOT::Math::XYZVector pointToLocal(const ROOT::Math::XYZVector &global, bool reco=false) const
Convert a point from global to local coordinates.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
bool inside(double u, double v, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON) const
Check wether a given point is inside the active area.
ROOT::Math::XYZVector vectorToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a vector from local to global coordinates.

◆ getVxdIDFromPXDModuleID()

VxdID getVxdIDFromPXDModuleID ( const unsigned short &  id)
inline

Helper function to get VxdID from DHE id like module iid.

Definition at line 86 of file PXDUtilities.h.

87 {
88 return VxdID(id / 1000, (id % 1000) / 10, id % 10);
89 }

◆ hbarWp()

double hbarWp ( const int  Z = Z_Si,
const double  A = A_Si,
const double  rho = rho_Si 
)
inline

hbarWp = sqrt(rho*Z/A)*28.816 in eV

Parameters
ZAtomic number of absorber
AAtomic mass of absorber in g*mol^{-1}
rhoDensity of the absorber in g*cm^{-3}
Returns
plasma energy

Definition at line 55 of file PXDUtilities.h.

58 {
59 return std::sqrt(rho * Z / A) * 28.816 * Unit::eV;
60 }

◆ isCloseToBorder()

bool isCloseToBorder ( int  u,
int  v,
int  checkDistance 
)

Helper function to check if a pixel is close to the border.

Parameters
uuID of the pixel of interest
vvID of the pixel of interest
checkDistancethe distance along u/v
Returns
true if the pixel is close to border

Definition at line 51 of file PXDUtilities.cc.

52 {
53
54 if (u - checkDistance < 0 || u + checkDistance >= 250 ||
55 v - checkDistance < 0 || v + checkDistance >= 768) {
56 return true;
57 }
58 return false;
59 }

◆ isClusterAtLadderJoint()

bool isClusterAtLadderJoint ( VxdID  id,
unsigned int  vmin,
unsigned int  vmax 
)
inline

Helper function to check if one of the end pixels are at the ladder joint.

Parameters
idVxdID of the sensor
vminminimum vID within the cluster
vmaxmaximum vID within the cluster
Returns
true if one of the end pixels are at the ladder joint

Definition at line 148 of file PXDUtilities.h.

149 {
150 unsigned int vedgemax = Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getVCells();
151 return ((id.getSensorNumber() == 2 && vmax == (vedgemax - 1))
152 || (id.getSensorNumber() == 1 && vmin == 0));
153 }

◆ isClusterAtUEdge()

bool isClusterAtUEdge ( VxdID  id,
unsigned int  umin,
unsigned int  umax 
)
inline

Helper function to check if one of the end pixels are at the edge of the sensor.

Parameters
idVxdID of the sensor
uminminimum uID within the cluster
umaxmaximum uID within the cluster
Returns
true if one of the end pixels are at the edge of the sensor

Definition at line 125 of file PXDUtilities.h.

126 {
127 unsigned int uedgemax = Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getUCells();
128 return (umin == 0 || umax == (uedgemax - 1));
129 }

◆ isClusterAtVEdge()

bool isClusterAtVEdge ( VxdID  id,
unsigned int  vmin,
unsigned int  vmax 
)
inline

Helper function to check if one of the end pixels are at the edge of the sensor.

Parameters
idVxdID of the sensor
vminminimum vID within the cluster
vmaxmaximum vID within the cluster
Returns
true if one of the end pixels are at the edge of the sensor

Definition at line 136 of file PXDUtilities.h.

137 {
138 unsigned int vedgemax = Belle2::VXD::GeoCache::getInstance().getSensorInfo(id).getVCells();
139 return ((id.getSensorNumber() == 1 && vmax == (vedgemax - 1))
140 || (id.getSensorNumber() == 2 && vmin == 0));
141 }

◆ isDefectivePixelClose()

bool isDefectivePixelClose ( int  u,
int  v,
int  checkDistance,
const VxdID moduleID 
)

Helper function to check if a defective (hot/dead) pixel is close.

Parameters
uuID of the pixel of interest
vvID of the pixel of interest
checkDistancethe distance along u/v
moduleIDVxdID of the module
Returns
true if a defective pixel is found in matrix

Definition at line 61 of file PXDUtilities.cc.

62 {
63
64 //Iterate over square around the intersection to see if any close pixel is dead
65 for (int u_iter = u - checkDistance; u_iter <= u + checkDistance ; ++u_iter) {
66 for (int v_iter = v - checkDistance; v_iter <= v + checkDistance ; ++v_iter) {
67 if (PXDPixelMasker::getInstance().pixelDead(moduleID, u_iter, v_iter)
68 || !PXDPixelMasker::getInstance().pixelOK(moduleID, u_iter, v_iter)) {
69 return true;
70 }
71 }
72 }
73 return false;
74 }

◆ TEST() [1/4]

TEST ( ClusterCache  ,
Empty   
)

Check if the cluster cache is empty.

Definition at line 149 of file ClusterCache.cc.

150 {
151 ClusterCache cache;
152 ASSERT_TRUE(cache.empty());
153 cache.findCluster(0, 0);
154 ASSERT_FALSE(cache.empty());
155 }
Class to remember recently assigned clusters This class will remember the current and the last pixel ...
Definition: ClusterCache.h:77
ClusterCandidate & findCluster(unsigned int u, unsigned int v)
Find a cluster adjacent to the given coordinates.
Definition: ClusterCache.cc:42
bool empty() const
Check if there are any clusters.
Definition: ClusterCache.h:126

◆ TEST() [2/4]

TEST ( ClusterCache  ,
FindNeighbours   
)

Check that we cluster to hits next to each other but not if one is in between.

So we set a cluster at position (2,0) marked c and the findCluster should return this cluster for all positions marked 1. All other pixels should return NULL. We do not check (0,0) and (1,0) or a row above C since the cluster cache is meant to be used with ordered data so these should already be done once we set (2,0).

* u 0 1 2 3 4 5 6 7 8 9 →
* v┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
* 0│ │ │C│1│0│ │ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 1│0│1│1│1│0│ │ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 3│0│0│0│0│0│ │ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 4│ │ │ │ │ │ │ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* ↓│ │ │ │ │ │ │ │ │ │ │ │
*  └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
* 

Definition at line 45 of file ClusterCache.cc.

46 {
47 ClusterCache cache;
48 for (int v = 0; v < 4; ++v) {
49 for (int u = 0; u < 5; ++u) {
50 if (v == 0 && u <= 2) continue;
51 cache.clear();
52 ClusterCandidate& cls1 = cache.findCluster(2, 0);
53 if ((v == 0 && u == 3) || (v == 1 && u >= 1 && u <= 3)) {
54 //Check that neighboring pixels return the same cluster
55 EXPECT_EQ(&cls1, &cache.findCluster(u, v)) << "u: " << u << " v: " << v;
56 } else {
57 //And all other pixels return another cluster
58 EXPECT_NE(&cls1, &cache.findCluster(u, v)) << "u: " << u << " v: " << v;
59 }
60 }
61 }
62 }
void clear()
Clear the cache structure.
Definition: ClusterCache.cc:33
Class representing a possible cluster during clustering of the PXD It supports merging of different c...

◆ TEST() [3/4]

TEST ( ClusterCache  ,
Merging   
)

Test that clusters get merged if they are found to have a common pixel.

If we have to clusters called 1 and 2 like shown below and we add a pixel at X than all occurences of 1 and 2 should be merged to one of those two. It does not matter who is merged to whom but after adding X the result must be

  • one of the two clusters is empty
  • the other cluster contains all pixels
  • all pointers for 1 and 2 should point to the same pixel so that when we add pixels Y and Z we get the same pointer as for X
* u 0 1 2 3 4 5 6 7 8 9 →
* v┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
* 0│ │ │1│ │2│ │3│ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 1│4│ │ │X│ │ │5│ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 2│ │6│Y│ │7│Z│ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* 3│ │ │ │ │ │ │ │ │ │ │ │
*  ├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
* ↓│ │ │ │ │ │ │ │ │ │ │ │
*  └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
* 

Definition at line 90 of file ClusterCache.cc.

91 {
92 //Create clusters 1, 2, 3 and 4
93 ClusterCache cache;
94 ClusterCandidate& cls1 = cache.findCluster(2, 0);
95 ClusterCandidate& cls2 = cache.findCluster(4, 0);
96 cls1.add(Pixel(1));
97 cls2.add(Pixel(2));
98 cache.findCluster(6, 0).add(Pixel(3));
99 cache.findCluster(0, 1).add(Pixel(4));
100
101 //Add Pixel X
102 ClusterCandidate& foundX = cache.findCluster(3, 1);
103 //and the clusters 1 and 2 should have been merged
104 ASSERT_EQ(2u, foundX.size());
105 //The pointer should be one of the two
106 EXPECT_TRUE(&foundX == &cls1 || &foundX == &cls2);
107 //The sum of indices should be ok
108 EXPECT_EQ(3u, foundX.pixels()[0].getIndex() + foundX.pixels()[1].getIndex());
109 //the other cluster should be empty now
110 EXPECT_TRUE((cls1.size() == 0 && cls2.size() == 2) || (cls1.size() == 2 && cls2.size() == 0));
111
112 //And add pixel 5, 6 and Y
113 cache.findCluster(6, 1).add(Pixel(5));
114 cache.findCluster(1, 2).add(Pixel(6));
115 ClusterCandidate& foundY = cache.findCluster(2, 2);
116 EXPECT_EQ(4u, foundY.size());
117 {
118 //Check for equality by merging empty clusters. merge returns a pointer
119 //to the topmost cluster in a group of merged clusters
120 ClusterCandidate t1, t2;
121 EXPECT_EQ(foundX.merge(t1), foundY.merge(t2));
122 }
123
124 //And finally pixel 7 and Z
125 cache.findCluster(4, 2).add(Pixel(7));
126 ClusterCandidate& foundZ = cache.findCluster(5, 2);
127 ASSERT_EQ(7u, foundY.size());
128 {
129 //Check for equality by merging empty clusters. merge returns a pointer
130 //to the topmost cluster in a group of merged clusters
131 ClusterCandidate t1, t2;
132 EXPECT_EQ(foundX.merge(t1), foundZ.merge(t2));
133 }
134
135 //Check if all 7 pixels are present using a bitmask to see if we get every index from 1 to 7 once
136 std::bitset<7> check_index(-1);
137 for (const Pixel& px : foundZ.pixels()) {
138 ASSERT_LT(0u, px.getIndex());
139 ASSERT_GE(7u, px.getIndex());
140 EXPECT_TRUE(check_index[px.getIndex() - 1]) << "index: " << px.getIndex();
141 check_index[px.getIndex() - 1] = false;
142 }
143 EXPECT_TRUE(check_index.none());
144 }
size_t size() const
get the cluster size
ClusterCandidate * merge(ClusterCandidate &cls)
Merge the given cluster with this one.
void add(const Pixel &pixel)
Add a Pixel to the current cluster.
const std::vector< Pixel > & pixels() const
get a reference to all pixels in the cluster
Class to represent one pixel, used in clustering for fast access.
Definition: Pixel.h:36

◆ TEST() [4/4]

TEST ( ClusterCache  ,
OutOfRange   
)

Check that out_of_range exceptions are raised if the pixel is out of range.

Definition at line 158 of file ClusterCache.cc.

159 {
160 ClusterCache cache(250);
161 for (int i = -10; i < 260; ++i) {
162 if (i >= 0 && i < 250) {
163 ASSERT_NO_THROW(cache.findCluster(i, 0));
164 } else {
165 ASSERT_THROW(cache.findCluster(i, 0), std::out_of_range);
166 }
167 }
168 }

◆ xiBeta2_L()

double xiBeta2_L ( const int  Z = Z_Si,
const double  A = A_Si,
const double  rho = rho_Si,
const int  z = 1 
)
inline

xi = (K/2)*(Z/A)*z*z*(rho*L)/beta2 in MeV

Parameters
ZAtomic number of absorber
AAtomic mass of absorber in g*mol^{-1}
rhoDensity of the absorber in g*cm^{-3}
zCharge number of incident particle
Returns
xi*beta^2/L in MeV/cm where L is track length

Definition at line 40 of file PXDUtilities.h.

44 {
45 const double K = 0.307075 * Unit::MeV * pow(Unit::cm, 2);
46 return K / 2 * Z / A * z * z * rho;
47 }
#define K(x)
macro autogenerated by FFTW

Variable Documentation

◆ A_Si

const double A_Si = 28.085

Atomic mass of silicon in g mol^-1.

Definition at line 30 of file PXDUtilities.h.

◆ rho_Si

const double rho_Si = 2.3290 * Unit::g_cm3

Silicon density in g cm^-3.

Definition at line 31 of file PXDUtilities.h.

◆ Z_Si

const int Z_Si = 14

Const and Const expressions Only valid when g_mol is the default unit.

Atomic number of silicon

Definition at line 29 of file PXDUtilities.h.