Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:12

0001 #ifndef HCALTBTRIGGERDATA_H
0002 #define HCALTBTRIGGERDATA_H 1
0003 
0004 #include <string>
0005 #include <iostream>
0006 #include <cstdint>
0007 
0008 /** \class HcalTBTriggerData
0009 
0010 This class contains trigger information (mainly trigger type and time),
0011 and run information such as run, event, spill, bunch and orbit numbers.
0012       
0013   $Date: 2005/10/06 22:21:33 $
0014   $Revision: 1.2 $
0015   \author P. Dudero - Minnesota
0016   */
0017 class HcalTBTriggerData {
0018 public:
0019   HcalTBTriggerData();
0020 
0021   // Getter methods
0022 
0023   const std::string& runNumberSequenceId() const { return runNumberSequenceId_; }
0024 
0025   /// Returns the current run number
0026   uint32_t runNumber() const { return runNumber_; }
0027   /// Returns the entire packed trigger word
0028   uint32_t triggerWord() const { return triggerWord_; }
0029   /// Returns the relative time of this trigger in microseconds
0030   uint32_t triggerTimeUsec() const { return triggerTimeUsec_; }
0031   /// Returns the base time of the run (in seconds, from a time() call)
0032   uint32_t triggerTimeBase() const { return triggerTimeBase_; }
0033   /// Returns the spill number of this trigger
0034   uint32_t spillNumber() const { return spillNumber_; }
0035   /// Returns the orbit number of this trigger
0036   uint32_t orbitNumber() const { return orbitNumber_; }
0037   /// Returns the bunch number of this trigger
0038   uint16_t bunchNumber() const { return bunchNumber_; }
0039   /// Returns the event number of this trigger
0040   uint16_t eventNumber() const { return eventNumber_; }
0041   uint32_t flagsDaqTtype() const { return flagsDaqTtype_; }
0042   uint32_t algoBits3() const { return algoBits3_; }
0043   uint32_t algoBits2() const { return algoBits2_; }
0044   uint32_t algoBits1() const { return algoBits1_; }
0045   uint32_t algoBits0() const { return algoBits0_; }
0046   uint32_t techBits() const { return techBits_; }
0047   uint32_t gps1234() const { return gps1234_; }
0048   uint32_t gps5678() const { return gps5678_; }
0049 
0050   // Setter methods
0051   void setStandardData(uint32_t orbitNumber,
0052                        uint32_t eventNumber,
0053                        uint16_t bunchNumber,
0054                        uint32_t flags_daq_ttype,
0055                        uint32_t algo_bits_3,
0056                        uint32_t algo_bits_2,
0057                        uint32_t algo_bits_1,
0058                        uint32_t algo_bits_0,
0059                        uint32_t tech_bits,
0060                        uint32_t gps_1234,
0061                        uint32_t gps_5678);
0062 
0063   void setExtendedData(uint32_t triggerWord,
0064                        uint32_t triggerTime_usec,
0065                        uint32_t triggerTime_base,
0066                        uint32_t spillNumber,
0067                        uint32_t runNumber,
0068                        const char* runNumberSequenceId);
0069 
0070   // Parse trigger word routines
0071 
0072   /// returns true if this trigger came from beam data
0073   inline bool wasBeamTrigger() const { return (triggerWord() & 0x0F) == bit_BeamTrigger; }
0074 
0075   /// returns true if this trigger was fake (from a non-H2 manager)
0076   inline bool wasFakeTrigger() const { return (triggerWord() & 0x0F) == bit_FakeTrigger; }
0077 
0078   /// returns true if this trigger was a calibration trigger
0079   inline bool wasSpillIgnorantPedestalTrigger() const {
0080     return (triggerWord() & 0x0F) == bit_spillIgnorantPedestalTrigger;
0081   }
0082 
0083   /// returns true if this was an out-of-spill pedestal trigger
0084   inline bool wasOutSpillPedestalTrigger() const { return (triggerWord() & 0x0F) == bit_OutSpillPedestalTrigger; }
0085 
0086   /// returns true if this was an in-spill pedestal trigger
0087   inline bool wasInSpillPedestalTrigger() const { return (triggerWord() & 0x0F) == bit_InSpillPedestalTrigger; }
0088 
0089   /// returns true if this was a laser trigger
0090   inline bool wasLaserTrigger() const { return (triggerWord() & 0x0F) == bit_LaserTrigger; }
0091 
0092   /// returns true if this was a LED trigger
0093   inline bool wasLEDTrigger() const { return (triggerWord() & 0x0F) == bit_LEDTrigger; }
0094 
0095   /// returns true if the "spill" bit was set
0096   inline bool wasInSpill() const { return (triggerWord() & bit_InSpill); }
0097 
0098   static const uint32_t bit_BeamTrigger;                   // = 1;
0099   static const uint32_t bit_InSpillPedestalTrigger;        // = 2;
0100   static const uint32_t bit_OutSpillPedestalTrigger;       // = 3;
0101   static const uint32_t bit_LaserTrigger;                  // = 4
0102   static const uint32_t bit_spillIgnorantPedestalTrigger;  // = 5;
0103   static const uint32_t bit_LEDTrigger;                    // = 6
0104 
0105   static const uint32_t bit_FakeTrigger;  // = 15
0106 
0107   static const uint32_t bit_InSpill;  // = 0x10;
0108 
0109 private:
0110   std::string runNumberSequenceId_;
0111   uint32_t runNumber_;
0112   uint32_t triggerWord_;
0113   uint32_t triggerTimeUsec_;
0114   uint32_t triggerTimeBase_;
0115   uint32_t spillNumber_;
0116   uint32_t orbitNumber_;
0117   uint16_t bunchNumber_;
0118   uint32_t eventNumber_;
0119   uint32_t flagsDaqTtype_;  /// <extended type=31:28,extended size=27:24,zeros=23:7,daq#=6:4,type=3:0>
0120   uint32_t algoBits3_;
0121   uint32_t algoBits2_;
0122   uint32_t algoBits1_;
0123   uint32_t algoBits0_;
0124   uint32_t techBits_;
0125   uint32_t gps1234_;
0126   uint32_t gps5678_;
0127 };
0128 
0129 std::ostream& operator<<(std::ostream& s, const HcalTBTriggerData& htbtd);
0130 
0131 #endif