9 #include <top/dataobjects/TOPDigit.h>
10 #include <top/dataobjects/TOPRawDigit.h>
11 #include <top/dataobjects/TOPSimHit.h>
12 #include <mdst/dataobjects/MCParticle.h>
13 #include <framework/datastore/RelationVector.h>
23 float TOPDigit::s_doubleHitResolution = 0;
24 float TOPDigit::s_pileupTime = 0;
26 int TOPDigit::getModulo256Sample()
const
28 int sample = int(m_rawTime);
29 if (m_rawTime < 0) sample--;
30 sample += (int) m_firstWindow * 64;
31 if (sample < 0)
return 256 + sample % 256;
38 const auto* bgDigit =
static_cast<const TOPDigit*
>(bg);
39 double diff = m_time - bgDigit->
getTime();
41 if (fabs(diff) > s_doubleHitResolution)
return DigitBase::c_Append;
43 if (fabs(diff) < s_pileupTime) {
44 const double time[2] = {m_time, bgDigit->getTime()};
45 const double rawTime[2] = {m_rawTime, bgDigit->getRawTime()};
46 const int pulseHeight[2] = {m_pulseHeight, bgDigit->getPulseHeight()};
47 double sum = pulseHeight[0] + pulseHeight[1];
49 m_time = (time[0] * pulseHeight[0] + time[1] * pulseHeight[1]) / sum;
50 m_rawTime = (rawTime[0] * pulseHeight[0] + rawTime[1] * pulseHeight[1]) / sum;
55 m_time = (time[0] + time[1]) / 2;
56 m_rawTime = (rawTime[0] + rawTime[1]) / 2;
61 m_pulseHeight = int(sum);
62 double reweight = sum > 0 ? pulseHeight[0] / sum : 0.5;
63 auto relSimHits = this->getRelationsTo<TOPSimHit>();
64 for (
size_t i = 0; i < relSimHits.size(); ++i) {
65 float weight = relSimHits.weight(i) * reweight;
66 relSimHits.setWeight(i, weight);
68 auto relRawDigits = this->getRelationsTo<TOPRawDigit>();
69 for (
size_t i = 0; i < relRawDigits.size(); ++i) {
70 float weight = relRawDigits.weight(i) * reweight;
71 relRawDigits.setWeight(i, weight);
73 auto relMCParticles = this->getRelationsTo<MCParticle>();
74 for (
size_t i = 0; i < relMCParticles.size(); ++i) {
75 float weight = relMCParticles.weight(i) * reweight;
76 relMCParticles.setWeight(i, weight);
84 auto relSimHits = this->getRelationsTo<TOPSimHit>();
85 for (
int i = relSimHits.size() - 1; i >= 0; --i) {
88 auto relRawDigits = this->getRelationsTo<TOPRawDigit>();
89 for (
int i = relRawDigits.size() - 1; i >= 0; --i) {
90 relRawDigits.remove(i);
92 auto relMCParticles = this->getRelationsTo<MCParticle>();
93 for (
int i = relMCParticles.size() - 1; i >= 0; --i) {
94 relMCParticles.remove(i);
98 return DigitBase::c_DontAppend;
A common base for subdetector Digits.
EAppendStatus
Enum for return state of addBGDigit function.
Class to store TOP digitized hits (output of TOPDigitizer or raw data unpacker) relations to TOPSimHi...
double getTime() const
Returns t0-subtracted and calibrated time.
Abstract base class for different kinds of events.