File indexing completed on 2024-04-06 12:29:41
0001 #include <SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h>
0002
0003 using namespace std;
0004
0005 DTDigiSimLink::DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base)
0006 : theWire(wireNr),
0007 theDigiNumber(digiNr),
0008 theTDCBase(base),
0009 theCounts(nTDC),
0010 theSimTrackId(trackId),
0011 theEventId(evId) {}
0012
0013 DTDigiSimLink::DTDigiSimLink(int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base)
0014 : theWire(wireNr),
0015 theDigiNumber(digiNr),
0016 theTDCBase(base),
0017 theCounts(static_cast<int>(tdrift * base / 25.)),
0018 theSimTrackId(trackId),
0019 theEventId(evId) {}
0020
0021 DTDigiSimLink::DTDigiSimLink()
0022 : theWire(0), theDigiNumber(0), theTDCBase(32), theCounts(0), theSimTrackId(0), theEventId(0) {}
0023
0024 DTDigiSimLink::ChannelType DTDigiSimLink::channel() const {
0025 #pragma GCC diagnostic push
0026 #pragma GCC diagnostic ignored "-Wuninitialized"
0027 ChannelPacking result;
0028 result.wi = theWire;
0029 result.num = theDigiNumber;
0030 DTDigiSimLink::ChannelType* p_result = reinterpret_cast<DTDigiSimLink::ChannelType*>(&result);
0031 return *p_result;
0032 #pragma GCC diagnostic pop
0033 }
0034
0035 int DTDigiSimLink::wire() const { return theWire; }
0036
0037 int DTDigiSimLink::number() const { return theDigiNumber; }
0038
0039 uint32_t DTDigiSimLink::countsTDC() const { return theCounts; }
0040
0041 double DTDigiSimLink::time() const { return theCounts * 25. / theTDCBase; }
0042
0043 unsigned int DTDigiSimLink::SimTrackId() const { return theSimTrackId; }
0044
0045 EncodedEventId DTDigiSimLink::eventId() const { return theEventId; }