CMS 3D CMS Logo

DTDigiSimLink.h
Go to the documentation of this file.
1 #ifndef DigiSimLinks_DTDigiSimLink_h
2 #define DigiSimLinks_DTDigiSimLink_h
3 
5 
6 class DTDigiSimLink {
7 public:
8  typedef uint32_t ChannelType;
9 
10  // Construct from the wire number and the digi number (this identifies
11  // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id.
12  // Base is related to the tdc unit (32 = Phase 1; 30 = Phase 2)
13  explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base = 32);
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(
19  int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base = 32);
20 
21  // Default constructor.
22  DTDigiSimLink();
23 
24  // The channel identifier and the digi number packed together
25  ChannelType channel() const;
26 
27  // Return wire number
28  int wire() const;
29 
30  // Identifies different digis within the same cell
31  int number() const;
32 
33  // Get raw TDC count
34  uint32_t countsTDC() const;
35 
36  // Get time in ns
37  double time() const;
38 
39  // Return the SimTrack Id
40  unsigned int SimTrackId() const;
41 
42  // Return the Encoded Event Id
43  EncodedEventId eventId() const;
44 
45  // Used to repack the channel number to an int
46  struct ChannelPacking {
47  uint16_t wi;
48  uint16_t num;
49  };
50 
51 private:
52  // The value of one TDC count in ns
53  static const double reso;
54 
55 private:
56  uint16_t theWire; // wire number
57  uint8_t theDigiNumber; // counter for digis in the same cell
58  uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2)
59  int32_t theCounts; // TDC count, in units given by 1/theTDCBase
60  uint32_t theSimTrackId; // identifier of the SimTrack that produced the digi
62 };
63 
64 #include <iostream>
65 #include <cstdint>
66 inline std::ostream& operator<<(std::ostream& o, const DTDigiSimLink& digisimlink) {
67  return o << "wire:" << digisimlink.wire() << " digi:" << digisimlink.number() << " time:" << digisimlink.time()
68  << " SimTrack:" << digisimlink.SimTrackId() << " eventId:" << digisimlink.eventId().rawId();
69 }
70 
71 #endif
uint32_t rawId() const
get the raw id
base
Main Program
Definition: newFWLiteAna.py:92