00001 #ifndef DigiSimLinks_DTDigiSimLink_h 00002 #define DigiSimLinks_DTDigiSimLink_h 00003 00004 #include "boost/cstdint.hpp" 00005 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" 00006 00007 class DTDigiSimLink { 00008 00009 public: 00010 typedef uint32_t ChannelType; 00011 00012 // Construct from the wire number and the digi number (this identifies 00013 // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id. 00014 explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId); 00015 00016 // Construct from the wire number and the digi number (this identifies 00017 // uniquely multiple digis on the same wire), the time (ns), the SimTrack Id and the EncodedEvent Id. 00018 // time is converted in TDC counts (1 TDC = 25./32. ns) 00019 explicit DTDigiSimLink(int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId); 00020 00021 // Default constructor. 00022 DTDigiSimLink(); 00023 00024 // The channel identifier and the digi number packed together 00025 ChannelType channel() const; 00026 00027 // Return wire number 00028 int wire() const; 00029 00030 // Identifies different digis within the same cell 00031 int number() const; 00032 00033 // Get raw TDC count 00034 uint32_t countsTDC() const; 00035 00036 // Get time in ns 00037 double time() const; 00038 00039 // Return the SimTrack Id 00040 unsigned int SimTrackId() const; 00041 00042 // Return the Encoded Event Id 00043 EncodedEventId eventId() const; 00044 00045 private: 00046 // The value of one TDC count in ns 00047 static const double reso; 00048 00049 // Used to repack the channel number to an int 00050 struct ChannelPacking { 00051 uint16_t wi; 00052 uint16_t num; 00053 }; 00054 00055 private: 00056 uint16_t theWire; // wire number 00057 uint16_t theDigiNumber; // digi number on the wire 00058 uint32_t theCounts; // TDC count, up to 20 bits actually used 00059 uint32_t theSimTrackId; // identifier of the SimTrack that produced the digi 00060 EncodedEventId theEventId; 00061 }; 00062 00063 #include<iostream> 00064 inline std::ostream & operator<<(std::ostream & o, const DTDigiSimLink& digisimlink) { 00065 return o << "wire:"<<digisimlink.wire() 00066 << " digi:" << digisimlink.number() 00067 << " time:" << digisimlink.time() 00068 << " SimTrack:" << digisimlink.SimTrackId() 00069 << " eventId:" << digisimlink.eventId().rawId(); 00070 } 00071 00072 #endif