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