Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:49

0001 #ifndef DigiSimLinks_DTDigiSimLink_h
0002 #define DigiSimLinks_DTDigiSimLink_h
0003 
0004 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
0005 
0006 class DTDigiSimLink {
0007 public:
0008   typedef uint32_t ChannelType;
0009 
0010   // Construct from the wire number and the digi number (this identifies
0011   // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id.
0012   // Base is related to the tdc unit (32 = Phase 1; 30 = Phase 2)
0013   explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base = 32);
0014 
0015   // Construct from the wire number and the digi number (this identifies
0016   // uniquely multiple digis on the same wire), the time (ns), the SimTrack Id and the EncodedEvent Id.
0017   // time is converted in TDC counts (1 TDC = 25./32. ns)
0018   explicit DTDigiSimLink(
0019       int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base = 32);
0020 
0021   // Default constructor.
0022   DTDigiSimLink();
0023 
0024   // The channel identifier and the digi number packed together
0025   ChannelType channel() const;
0026 
0027   // Return wire number
0028   int wire() const;
0029 
0030   // Identifies different digis within the same cell
0031   int number() const;
0032 
0033   // Get raw TDC count
0034   uint32_t countsTDC() const;
0035 
0036   // Get time in ns
0037   double time() const;
0038 
0039   // Return the SimTrack Id
0040   unsigned int SimTrackId() const;
0041 
0042   // Return the Encoded Event Id
0043   EncodedEventId eventId() const;
0044 
0045   // Used to repack the channel number to an int
0046   struct ChannelPacking {
0047     uint16_t wi;
0048     uint16_t num;
0049   };
0050 
0051 private:
0052   // The value of one TDC count in ns
0053   static const double reso;
0054 
0055 private:
0056   uint16_t theWire;        // wire number
0057   uint8_t theDigiNumber;   // counter for digis in the same cell
0058   uint8_t theTDCBase;      // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2)
0059   int32_t theCounts;       // TDC count, in units given by 1/theTDCBase
0060   uint32_t theSimTrackId;  // identifier of the SimTrack that produced the digi
0061   EncodedEventId theEventId;
0062 };
0063 
0064 #include <iostream>
0065 #include <cstdint>
0066 inline std::ostream& operator<<(std::ostream& o, const DTDigiSimLink& digisimlink) {
0067   return o << "wire:" << digisimlink.wire() << " digi:" << digisimlink.number() << " time:" << digisimlink.time()
0068            << " SimTrack:" << digisimlink.SimTrackId() << " eventId:" << digisimlink.eventId().rawId();
0069 }
0070 
0071 #endif