Belle II Software  release-05-01-25
DriftTimeUtil.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <cdc/geometry/CDCGeometryPar.h>
13 #include <TRandom.h>
14 #include <cdc/geometry/CDCGeoControlPar.h>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
24  struct DriftTimeUtil {
25 
34  static double getDriftV(double driftTime,
35  unsigned short iCLayer,
36  unsigned short lr,
37  double alpha = 0.,
38  double theta = 0.5 * M_PI)
39  {
40  return CDC::CDCGeometryPar::Instance().getDriftV(driftTime, iCLayer, lr, alpha, theta);
41  }
42 
51  static double getDriftLength(double driftTime,
52  unsigned short iCLayer,
53  unsigned short lr,
54  double alpha = 0.,
55  double theta = 0.5 * M_PI)
56  {
57  return CDC::CDCGeometryPar::Instance().getDriftLength(driftTime, iCLayer, lr, alpha, theta);
58  }
59 
68  static double getDriftTime(double dist,
69  unsigned short iCLayer,
70  unsigned short lr,
71  double alpha,
72  double theta)
73  {
74  return CDC::CDCGeometryPar::Instance().getDriftTime(dist, iCLayer, lr, alpha, theta);
75  }
76 
82  static double getPropTime(const WireID& wireID, double z)
83  {
84  unsigned short iCLayer = wireID.getICLayer();
87  TVector3 backwardWirePos =
88  geometryPar.wireBackwardPosition(wireID, CDC::CDCGeometryPar::c_Aligned);
89  TVector3 forwardWirePos =
90  geometryPar.wireForwardPosition(wireID, CDC::CDCGeometryPar::c_Aligned);
91  double zDistance = z - backwardWirePos.Z();
92 
93  // Actually are very small correction
94  double stereoFactor =
95  (forwardWirePos - backwardWirePos).Mag() / (forwardWirePos.Z() - backwardWirePos.Z());
96 
97  double distance = zDistance * stereoFactor;
98  if (controlPar.getSenseWireZposMode() == 1) {
99  distance += geometryPar.getBwdDeltaZ(iCLayer);
100  }
101  return distance * geometryPar.getPropSpeedInv(iCLayer);
102  }
103 
110  static double getTimeWalk(const WireID& wireID, unsigned short adcCount)
111  {
112  return CDC::CDCGeometryPar::Instance().getTimeWalk(wireID, adcCount);
113  }
114 
121  static double getMeasuredTime(const WireID& wireID, unsigned short tdcCount, bool smear)
122  {
123  double smearing = 0;
124  if (smear) {
125  smearing = gRandom->Rndm() - 0.5;
126  }
127  double channelT0 = static_cast<double>(CDC::CDCGeometryPar::Instance().getT0(wireID));
128  double measuredTime =
129  channelT0 - (tdcCount + smearing) * CDC::CDCGeometryPar::Instance().getTdcBinWidth();
130  if (measuredTime > 2000) {
131  B2INFO("channelT0 " << channelT0);
132  B2INFO("measuredTime " << measuredTime);
133  }
134  return measuredTime;
135  }
136 
137  };
138  }
140 }
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::CDC::CDCGeometryPar::getPropSpeedInv
double getPropSpeedInv(const unsigned int layerID) const
Get the inversel of propagation speed in the sense wire.
Definition: CDCGeometryPar.h:832
Belle2::CDC::CDCGeometryPar::wireForwardPosition
const TVector3 wireForwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
Definition: CDCGeometryPar.cc:1625
Belle2::CDC::CDCGeoControlPar::getInstance
static CDCGeoControlPar & getInstance()
Static method to get a reference to the CDCGeoControlPar instance.
Definition: CDCGeoControlPar.cc:18
Belle2::CDC::CDCGeometryPar::getTdcBinWidth
double getTdcBinWidth() const
Return TDC bin width (nsec).
Definition: CDCGeometryPar.h:732
Belle2::TrackFindingCDC::DriftTimeUtil::getMeasuredTime
static double getMeasuredTime(const WireID &wireID, unsigned short tdcCount, bool smear)
Returns the time measured at the readout board.
Definition: DriftTimeUtil.h:129
Belle2::TrackFindingCDC::DriftTimeUtil::getTimeWalk
static double getTimeWalk(const WireID &wireID, unsigned short adcCount)
Returns time-walk.
Definition: DriftTimeUtil.h:118
Belle2::TrackFindingCDC::DriftTimeUtil::getDriftTime
static double getDriftTime(double dist, unsigned short iCLayer, unsigned short lr, double alpha, double theta)
Return the drift time to the sense wire.
Definition: DriftTimeUtil.h:76
Belle2::CDC::CDCGeometryPar::getDriftLength
double getDriftLength(double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI, bool calculateMinTime=true, double minTime=0.) const
Return the drift dength to the sense wire.
Definition: CDCGeometryPar.cc:2168
Belle2::CDC::CDCGeometryPar
The Class for CDC Geometry Parameters.
Definition: CDCGeometryPar.h:75
Belle2::CDC::CDCGeometryPar::wireBackwardPosition
const TVector3 wireBackwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
Definition: CDCGeometryPar.cc:1662
Belle2::CDC::CDCGeometryPar::Instance
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Definition: CDCGeometryPar.cc:41
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDC::CDCGeometryPar::getDriftTime
double getDriftTime(double dist, unsigned short layer, unsigned short lr, double alpha, double theta) const
Return the drift time to the sense wire.
Definition: CDCGeometryPar.cc:2457
Belle2::CDC::CDCGeometryPar::getDriftV
double getDriftV(double dt, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
Get the realistic drift velocity.
Definition: CDCGeometryPar.cc:2006
Belle2::TrackFindingCDC::DriftTimeUtil::getPropTime
static double getPropTime(const WireID &wireID, double z)
Getter for the in wire propagation time.
Definition: DriftTimeUtil.h:90
Belle2::TrackFindingCDC::DriftTimeUtil::getDriftV
static double getDriftV(double driftTime, unsigned short iCLayer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI)
Get the realistic drift velocity.
Definition: DriftTimeUtil.h:42
Belle2::CDC::CDCGeometryPar::getT0
float getT0(const WireID &wireID) const
Returns t0 parameter of the specified sense wire.
Definition: CDCGeometryPar.h:565
Belle2::CDC::CDCGeoControlPar::getSenseWireZposMode
int getSenseWireZposMode() const
Get sense wire z position mode.
Definition: CDCGeoControlPar.h:362
Belle2::CDC::CDCGeometryPar::getTimeWalk
double getTimeWalk(const WireID &wID, unsigned short adcCount) const
Returns time-walk.
Definition: CDCGeometryPar.h:612
Belle2::CDC::CDCGeometryPar::getBwdDeltaZ
double getBwdDeltaZ(unsigned short layerID) const
Return backward 'deltaZ'.
Definition: CDCGeometryPar.h:800
Belle2::WireID::getICLayer
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:26
Belle2::CDC::CDCGeoControlPar
The Class for CDC Geometry Control Parameters.
Definition: CDCGeoControlPar.h:33
Belle2::TrackFindingCDC::DriftTimeUtil::getDriftLength
static double getDriftLength(double driftTime, unsigned short iCLayer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI)
Return the drift length to the sense wire.
Definition: DriftTimeUtil.h:59