Belle II Software  release-06-02-00
SimpleTDCCountTranslator.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <cdc/translators/SimpleTDCCountTranslator.h>
10 #include <cdc/geometry/CDCGeometryPar.h>
11 
12 using namespace std;
13 using namespace Belle2;
14 using namespace CDC;
15 
16 double SimpleTDCCountTranslator::getDriftLength(unsigned short tdcCount,
17  const WireID& wireID,
18  double timeOfFlightEstimator,
19  bool,
20  double z,
21  double,
22  double,
23  unsigned short)
24 {
25  const double driftTime = getDriftTime(tdcCount, wireID, timeOfFlightEstimator, z, 0);
26 
27  //Now we have an estimate for the time it took from the ionisation to the hitting of the wire.
28  //Need to reverse calculate the relation between drift lenght and drift time.
29  double driftL = (driftTime >= 0.) ? driftTime * 4e-3 : -999.;
30  return driftL;
31 }
32 
33 double SimpleTDCCountTranslator::getDriftTime(unsigned short tdcCount,
34  const WireID& wireID,
35  double timeOfFlightEstimator,
36  double z,
37  unsigned short)
38 {
39  // translate TDC Count into time information:
40  CDCGeometryPar& geometryPar = CDCGeometryPar::Instance();
41  double driftTime = (static_cast<double>(geometryPar.getTdcOffset() - (tdcCount + 0.5))); // 1 Unit in the TDC count equals 1 ns
42 
43  // Need to undo everything the simple digitization does in reverse order.
44  // First: Undo propagation in wire, if it was used:
45  if (m_useInWirePropagationDelay) {
46  // CDCGeometryPar& geometryPar = CDCGeometryPar::Instance();
47  // m_backWirePos = geometryPar.wireBackwardPosition(wireID);
48  m_backWirePos = geometryPar.wireBackwardPosition(wireID, CDCGeometryPar::c_Aligned);
49  //subtract distance divided by speed of electric signal in the wire from the drift time.
50  driftTime -= (z - m_backWirePos.Z()) / 27.25;
51  }
52 
53  // Second: correct for event time. If this wasn't simulated, m_eventTime can just be set to 0.
54  driftTime -= m_eventTime;
55 
56  //Third: If time of flight was simulated, this has to be undone, too. If it wasn't timeOfFlightEstimator should be taken as 0.
57  driftTime -= timeOfFlightEstimator;
58 
59  return driftTime;
60 }
61 
68 double SimpleTDCCountTranslator::getDriftLengthResolution(double,
69  const WireID&,
70  bool,
71  double,
72  double,
73  double)
74 {
75 // return 0.000169 + 1.3333333E-6; // (130 µm)^2 in cm^2 + (40/sqrt(12) µm)^2 also in cm
76  return 0.000169; //the above should be taken into account in the digitizer, not here
77 }
The Class for CDC Geometry Parameters.
const TVector3 wireBackwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
unsigned short getTdcOffset() const
Return TDC offset value (default = 0 ch).
Class to identify a wire inside the CDC.
Definition: WireID.h:34
Abstract base class for different kinds of events.