11 #include <cdc/dataobjects/CDCHit.h>
12 #include <cdc/dataobjects/CDCSimHit.h>
13 #include <mdst/dataobjects/MCParticle.h>
14 #include <framework/datastore/RelationVector.h>
20 CDCHit::CDCHit(
unsigned short tdcCount,
unsigned short charge,
21 unsigned short iSuperLayer,
unsigned short iLayer,
unsigned short iWire,
unsigned short status,
unsigned short tot,
22 signed short otherHitIndex,
unsigned short leadingEdgeCharge)
24 setTDCCount(tdcCount);
26 setWireID(iSuperLayer, iLayer, iWire);
29 setOtherHitIndex(otherHitIndex);
30 setADCCountAtLeadingEdge(leadingEdgeCharge);
36 const auto* bgDigit =
static_cast<const CDCHit*
>(bg);
37 const unsigned short tdc4Sg = m_tdcCount;
38 const unsigned short adc4Sg = m_adcCount;
39 const unsigned short tot4Sg = m_tot;
40 const unsigned short tdc4Bg = bgDigit->
getTDCCount();
41 const unsigned short adc4Bg = bgDigit->getADCCount();
42 const unsigned short tot4Bg = bgDigit->getTOT();
45 int diff =
static_cast<int>(m_tdcCount) -
static_cast<int>(bgDigit->getTDCCount());
52 auto relSimHits = this->getRelationsFrom<CDCSimHit>();
53 for (
int i = relSimHits.size() - 1; i >= 0; --i) {
56 auto relMCParticles = this->getRelationsFrom<MCParticle>();
57 for (
int i = relMCParticles.size() - 1; i >= 0; --i) {
58 relMCParticles.remove(i);
62 m_adcCount = adc4Sg + adc4Bg;
68 unsigned short s1 = tdc4Sg;
69 unsigned short s2 = tdc4Bg;
70 unsigned short w1 = 32 * tot4Sg;
71 unsigned short w2 = 32 * tot4Bg;
72 if (tdc4Sg < tdc4Bg) {
78 const unsigned short e1 = s1 - w1;
79 const unsigned short e2 = s2 - w2;
82 double pulseW = w1 + w2;
85 }
else if (e1 <= s2) {
90 m_tot = std::min(std::round(pulseW / 32.), 29.);
93 return DigitBase::c_DontAppend;