Belle II Software development
RealisticTDCCountTranslator Class Reference

Translator mirroring the realistic Digitization. More...

#include <RealisticTDCCountTranslator.h>

Inheritance diagram for RealisticTDCCountTranslator:
TDCCountTranslatorBase

Public Member Functions

 RealisticTDCCountTranslator (bool useInWirePropagationDelay=false)
 Constructor, with the additional information, if propagation in the wire shall be considered.
 
 ~RealisticTDCCountTranslator ()
 Destructor.
 
double getDriftLength (unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
 Get Drift length.
 
double getDriftTime (unsigned short tdcCount, const WireID &wireID, double timeOfFlightEstimator, double z, unsigned short adcCount) override
 Get Drift time.
 
double getDriftLengthResolution (double driftLength, const WireID &wireID=WireID(), bool leftRight=false, double z=0, double alpha=0, double=static_cast< double >(TMath::Pi()/2.)) override
 Get position resolution^2 corresponding to the drift length from getDriftLength of this class.
 

Private Attributes

bool m_useInWirePropagationDelay
 Flag to activate the propagation delay of the sense wire.
 
bool m_realData = false
 Flag to distinguish betw.
 
StoreObjPtr< EventT0m_eventTimeStoreObject
 Event timing.
 
const CDCGeoControlParm_gcp
 Cached reference to CDC GeoControlPar object.
 
const CDCSimControlParm_scp
 Cached reference to CDC SimControlPar object.
 
const CDCGeometryParm_cdcp
 Cached reference to CDC GeometryPar object.
 
const double m_tdcBinWidth
 Cached TDC bin width (ns).
 
double m_fudgeFactor = 1.
 Cached fudge factor for space resol.
 

Detailed Description

Translator mirroring the realistic Digitization.

Definition at line 25 of file RealisticTDCCountTranslator.h.

Constructor & Destructor Documentation

◆ RealisticTDCCountTranslator()

RealisticTDCCountTranslator ( bool  useInWirePropagationDelay = false)
explicit

Constructor, with the additional information, if propagation in the wire shall be considered.

Definition at line 17 of file RealisticTDCCountTranslator.cc.

17 :
21{
23 if (m_realData) {
25 } else {
27 }
28 // B2INFO("RealisticTDCCountTranslator:: m_fudgeFactor= " << m_fudgeFactor);
29
30#if defined(CDC_DEBUG)
31 cout << " " << endl;
32 cout << "RealisticTDCCountTranslator constructor" << endl;
33 cout << "m_cdcp=" << &m_cdcp << endl;
34 cout << "m_tdcBinWidth=" << m_tdcBinWidth << endl;
35#endif
36}
static CDCGeoControlPar & getInstance()
Static method to get a reference to the CDCGeoControlPar instance.
double getTdcBinWidth() const
Return TDC bin width (nsec).
double getFudgeFactorForSigma(unsigned short target) const
Return the fuge factor for space resol.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
static CDCSimControlPar & getInstance()
Static method to get a reference to the CDCSimControlPar instance.
const double m_tdcBinWidth
Cached TDC bin width (ns).
double m_fudgeFactor
Cached fudge factor for space resol.
const CDCSimControlPar & m_scp
Cached reference to CDC SimControlPar object.
const CDCGeometryPar & m_cdcp
Cached reference to CDC GeometryPar object.
bool m_useInWirePropagationDelay
Flag to activate the propagation delay of the sense wire.
const CDCGeoControlPar & m_gcp
Cached reference to CDC GeoControlPar object.
bool isMC() const
Do we have generated, not real data?
Definition: Environment.cc:54
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28

◆ ~RealisticTDCCountTranslator()

Destructor.

Definition at line 32 of file RealisticTDCCountTranslator.h.

32{};

Member Function Documentation

◆ getDriftLength()

double getDriftLength ( unsigned short  tdcCount,
const WireID wireID = WireID(),
double  timeOfFlightEstimator = 0,
bool  leftRight = false,
double  z = 0,
double  alpha = 0,
double  theta = static_cast<double>(TMath::Pi() / 2.),
unsigned short  adcCount = 0 
)
overridevirtual

Get Drift length.

Parameters
tdcCountTDC count (ns).
wireIDEncoded sense wire ID.
timeOfFlightEstimatorTime of flight (ns).
leftRightleft/right flag.
zz-position on the wire (cm).
alphaTrack incident angle in r-phi plane (rad).
thetaTrack incident angle in s-z plane (=polar angle) (rad).
adcCountADC count.
Returns
Drift length (cm) if drift time >= 0; v*(drift time) (i.e. negative value) otherwise, where v is set to one (cm/ns) for simplicity.

Implements TDCCountTranslatorBase.

Definition at line 92 of file RealisticTDCCountTranslator.cc.

100{
101 const double driftTime = getDriftTime(tdcCount, wireID, timeOfFlightEstimator, z, adcCount);
102
103 unsigned short layer = wireID.getICLayer();
104
105 //Now we have an estimate for the time it took from the ionisation to the hitting of the wire.
106 //Need to reverse calculate the relation between drift lenght and drift time.
107 // double driftL = std::copysign(m_cdcp.getDriftLength(fabs(driftTime), layer, leftRight, alpha, theta), driftTime);
108 //Note: The above treatment for negative drifttime is now done in m_cdcp.getDriftLength, so the line is commented out
109 double driftL = m_cdcp.getDriftLength(driftTime, layer, leftRight, alpha, theta);
110
111#if defined(CDC_DEBUG)
112 cout << " " << endl;
113 cout << "RealisticTDCCountTranslator::getDriftLength" << endl;
114 cout << "driftTime=" << driftTime << endl;
115 cout << "layer=" << layer << endl;
116 cout << "leftright=" << leftRight << endl;
117 cout << "driftL= " << driftL << endl;
118#endif
119
120 return driftL;
121}
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.
double getDriftTime(unsigned short tdcCount, const WireID &wireID, double timeOfFlightEstimator, double z, unsigned short adcCount) override
Get Drift time.
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:24

◆ getDriftLengthResolution()

double getDriftLengthResolution ( double  driftLength,
const WireID wireID = WireID(),
bool  leftRight = false,
double  z = 0,
double  alpha = 0,
double  theta = static_cast<double>(TMath::Pi() / 2.) 
)
overridevirtual

Get position resolution^2 corresponding to the drift length from getDriftLength of this class.

this function returns the variance that is used as the CDC measurment resolution in track fitting

Parameters
driftLengthDrift length (cm).
wireIDEncoded sense wire ID.
leftRightLeft/right flag.
zz-position on the wire (cm).
alphaTrack incident angle in r-phi plane (rad).
thetaTrack incident angle in s-z plane (=polar angle) (rad).
Returns
Uncertainty^2 (cm^2) on the drift length.

Implements TDCCountTranslatorBase.

Definition at line 126 of file RealisticTDCCountTranslator.cc.

128{
129 static_cast<void>(z); //just to suppress warning of unused
130 double resol = m_fudgeFactor * m_cdcp.getSigma(driftLength, wireID.getICLayer(), leftRight, alpha, theta);
131 // B2DEBUG(29, "fudgeFactor in TDCTranslator= " << m_fudgeFactor);
132
133#if defined(CDC_DEBUG)
134 cout << " " << endl;
135 cout << "RealisticTDCCountTranslator::getDriftLengthResolution" << endl;
136 cout << "spaceResol= " << resol << endl;
137#endif
138
139 return resol * resol;;
140}
double getSigma(double dist, unsigned short layer, unsigned short lr, double alpha=0., double theta=0.5 *M_PI) const
Return the basic resolution of drift length (cm).

◆ getDriftTime()

double getDriftTime ( unsigned short  tdcCount,
const WireID wireID,
double  timeOfFlightEstimator,
double  z,
unsigned short  adcCount 
)
overridevirtual

Get Drift time.

Parameters
tdcCountTDC count (ns).
wireIDEncoded sense wire ID.
timeOfFlightEstimatorTime of flight (ns).
zz-position on the wire (cm).
adcCountADC count.
Returns
Drift time (ns)

Implements TDCCountTranslatorBase.

Definition at line 39 of file RealisticTDCCountTranslator.cc.

44{
45 // translate TDC Count into time information:
46 // N.B. No correction (+ or -0.5 count) is needed in the translation since no bias is in the real TDC count on average (info. from KEK electronics division).
47 double driftTime = m_cdcp.getT0(wireID) - tdcCount * m_tdcBinWidth;
48 // std::cout << "t0,tdcbinw= " << m_cdcp.getT0(wireID) <<" "<< m_tdcBinWidth << std::endl;
49
50 unsigned short layer = wireID.getICLayer();
51
52 // Need to undo everything the digitization does in reverse order.
53 // First: Undo propagation in wire, if it was used:
55 const B2Vector3D& backWirePos = m_cdcp.wireBackwardPosition(wireID, CDCGeometryPar::c_Aligned);
56 const B2Vector3D& diffWirePos = m_cdcp.wireForwardPosition(wireID, CDCGeometryPar::c_Aligned) - backWirePos;
57 //subtract distance divided by speed of electric signal in the wire from the drift time.
58 // std::cout << layer <<" "<< diffWirePos.Z() <<" "<< stereoAngleFactor << std::endl;
59 double propLength = z - backWirePos.Z();
60 double dZ = diffWirePos.Z();
61 if (dZ != 0.) {
62 propLength *= diffWirePos.Mag() / dZ;
63 }
64 if (m_gcp.getSenseWireZposMode() == 1) {
65 // std::cout <<"layer,zb,dzb,zf,dzf= "<< layer <<" "<< zb <<" "<< m_cdcp.getBwdDeltaZ(layer) <<" "<< m_cdcp.wireForwardPosition(wireID, CDCGeometryPar::c_Aligned).Z() <<" "<< m_cdcp.getFwdDeltaZ(layer) << std::endl;
66 propLength += m_cdcp.getBwdDeltaZ(layer);
67 }
68 driftTime -= propLength * m_cdcp.getPropSpeedInv(layer);
69 }
70
71 // Second: correct for event time. If this wasn't simulated, m_eventTime can just be set to 0.
72 if (m_eventTimeStoreObject.isValid() && m_eventTimeStoreObject->hasEventT0()) {
73 driftTime -= m_eventTimeStoreObject->getEventT0();
74 }
75
76 //Third: If time of flight was simulated, this has to be undone, too. If it wasn't timeOfFlightEstimator should be taken as 0.
77 driftTime -= timeOfFlightEstimator;
78
79 //Forth: Time-walk correction
80 if (m_realData) { //for data, always correct
81 driftTime -= m_cdcp.getTimeWalk(wireID, adcCount);
82 // B2INFO("RealisticTDCCountTranslator:: time-walk corr. done.");
83 } else if (m_scp.getTimeWalk()) { //for MC, ccorrect if the flag is on
84 driftTime -= m_cdcp.getTimeWalk(wireID, adcCount);
85 // B2INFO("RealisticTDCCountTranslator:: time-walk corr. done for MC.");
86 }
87
88 return driftTime;
89}
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
DataType Mag() const
The magnitude (rho in spherical coordinate system).
Definition: B2Vector3.h:159
int getSenseWireZposMode() const
Get sense wire z position mode.
double getTimeWalk(const WireID &wID, unsigned short adcCount) const
Returns time-walk.
const B2Vector3D wireForwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
float getT0(const WireID &wireID) const
Returns t0 parameter of the specified sense wire.
double getBwdDeltaZ(unsigned short layerID) const
Return backward 'deltaZ'.
double getPropSpeedInv(const unsigned int layerID) const
Get the inversel of propagation speed in the sense wire.
bool getTimeWalk() const
Get time-walk flag.
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event timing.

Member Data Documentation

◆ m_cdcp

const CDCGeometryPar& m_cdcp
private

Cached reference to CDC GeometryPar object.

Definition at line 119 of file RealisticTDCCountTranslator.h.

◆ m_eventTimeStoreObject

StoreObjPtr<EventT0> m_eventTimeStoreObject
private

Event timing.

The event time is fetched from the data store using this pointer.

Definition at line 104 of file RealisticTDCCountTranslator.h.

◆ m_fudgeFactor

double m_fudgeFactor = 1.
private

Cached fudge factor for space resol.

Definition at line 135 of file RealisticTDCCountTranslator.h.

◆ m_gcp

const CDCGeoControlPar& m_gcp
private

Cached reference to CDC GeoControlPar object.

Definition at line 109 of file RealisticTDCCountTranslator.h.

◆ m_realData

bool m_realData = false
private

Flag to distinguish betw.

data and MC.

Definition at line 99 of file RealisticTDCCountTranslator.h.

◆ m_scp

const CDCSimControlPar& m_scp
private

Cached reference to CDC SimControlPar object.

Definition at line 114 of file RealisticTDCCountTranslator.h.

◆ m_tdcBinWidth

const double m_tdcBinWidth
private

Cached TDC bin width (ns).

N.B. The declaration should be after m_cdcp for proper initialization.

Definition at line 130 of file RealisticTDCCountTranslator.h.

◆ m_useInWirePropagationDelay

bool m_useInWirePropagationDelay
private

Flag to activate the propagation delay of the sense wire.

true : activated, false : the propagation delay is not used.

Definition at line 94 of file RealisticTDCCountTranslator.h.


The documentation for this class was generated from the following files: