CMS 3D CMS Logo

DTDigiSimLink.h
Go to the documentation of this file.
1 #ifndef DigiSimLinks_DTDigiSimLink_h
2 #define DigiSimLinks_DTDigiSimLink_h
3 
4 #include "boost/cstdint.hpp"
6 
7 class DTDigiSimLink {
8 public:
9  typedef uint32_t ChannelType;
10 
11  // Construct from the wire number and the digi number (this identifies
12  // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id.
13  explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId);
14 
15  // Construct from the wire number and the digi number (this identifies
16  // uniquely multiple digis on the same wire), the time (ns), the SimTrack Id and the EncodedEvent Id.
17  // time is converted in TDC counts (1 TDC = 25./32. ns)
18  explicit DTDigiSimLink(int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId);
19 
20  // Default constructor.
21  DTDigiSimLink();
22 
23  // The channel identifier and the digi number packed together
24  ChannelType channel() const;
25 
26  // Return wire number
27  int wire() const;
28 
29  // Identifies different digis within the same cell
30  int number() const;
31 
32  // Get raw TDC count
33  uint32_t countsTDC() const;
34 
35  // Get time in ns
36  double time() const;
37 
38  // Return the SimTrack Id
39  unsigned int SimTrackId() const;
40 
41  // Return the Encoded Event Id
42  EncodedEventId eventId() const;
43 
44  // Used to repack the channel number to an int
45  struct ChannelPacking {
46  uint16_t wi;
47  uint16_t num;
48  };
49 
50 private:
51  // The value of one TDC count in ns
52  static const double reso;
53 
54 private:
55  uint16_t theWire; // wire number
56  uint16_t theDigiNumber; // digi number on the wire
57  uint32_t theCounts; // TDC count, up to 20 bits actually used
58  uint32_t theSimTrackId; // identifier of the SimTrack that produced the digi
60 };
61 
62 #include <iostream>
63 inline std::ostream& operator<<(std::ostream& o, const DTDigiSimLink& digisimlink) {
64  return o << "wire:" << digisimlink.wire() << " digi:" << digisimlink.number() << " time:" << digisimlink.time()
65  << " SimTrack:" << digisimlink.SimTrackId() << " eventId:" << digisimlink.eventId().rawId();
66 }
67 
68 #endif
uint32_t rawId() const
get the raw id