Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:56

0001 /*
0002  *  File: DataFormats/Scalers/interface/Level1TriggerScalers.h   (W.Badgett)
0003  *
0004  *  Various Level 1 Trigger Scalers from the GT/TS
0005  *
0006  */
0007 
0008 #ifndef DATAFORMATS_SCALERS_LEVEL1TRIGGERSCALERS_H
0009 #define DATAFORMATS_SCALERS_LEVEL1TRIGGERSCALERS_H
0010 
0011 #include <ostream>
0012 #include <vector>
0013 
0014 #include "DataFormats/Scalers/interface/TimeSpec.h"
0015 
0016 /*! \file Level1TriggerScalers.h
0017  * \Header file for Level 1 Global Trigger Scalers
0018  * 
0019  * \author: William Badgett
0020  *
0021  */
0022 
0023 /// \class Level1TriggerScalers.h
0024 /// \brief Persistable copy of Level1 Trigger Scalers
0025 
0026 class Level1TriggerScalers {
0027 public:
0028   enum { nLevel1Triggers = 128, nLevel1TestTriggers = 64, firstShortLSRun = 125574 };
0029 
0030   static const unsigned long long N_BX = 3564ULL;
0031   static const unsigned long long N_BX_ACTIVE = 2808ULL;
0032   static const unsigned long long N_ORBITS_LUMI_SECTION = 0x100000ULL;
0033   static const unsigned long long N_BX_LUMI_SECTION = N_ORBITS_LUMI_SECTION * N_BX;
0034 
0035   Level1TriggerScalers();
0036   Level1TriggerScalers(const unsigned char* rawData);
0037   virtual ~Level1TriggerScalers();
0038 
0039   /// name method
0040   std::string name() const { return "Level1TriggerScalers"; }
0041 
0042   /// empty method (= false)
0043   bool empty() const { return false; }
0044 
0045   // Data accessor methods
0046   int version() const { return (version_); }
0047 
0048   unsigned int trigType() const { return (trigType_); }
0049   unsigned int eventID() const { return (eventID_); }
0050   unsigned int sourceID() const { return (sourceID_); }
0051   unsigned int bunchNumber() const { return (bunchNumber_); }
0052 
0053   struct timespec collectionTime() const { return (collectionTime_.get_timespec()); }
0054 
0055   unsigned int lumiSegmentNr() const { return (lumiSegmentNr_); }
0056   unsigned int lumiSegmentOrbits() const { return (lumiSegmentOrbits_); }
0057   unsigned int orbitNr() const { return (orbitNr_); }
0058 
0059   unsigned int gtResets() const { return (gtResets_); }
0060   unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); }
0061   unsigned long long gtTriggers() const { return (gtTriggers_); }
0062   unsigned long long gtEvents() const { return (gtEvents_); }
0063   float gtTriggersRate() const { return (gtTriggersRate_); }
0064   float gtEventsRate() const { return (gtEventsRate_); }
0065   int prescaleIndexAlgo() const { return (prescaleIndexAlgo_); }
0066   int prescaleIndexTech() const { return (prescaleIndexTech_); }
0067 
0068   struct timespec collectionTimeLumiSeg() const { return (collectionTimeLumiSeg_.get_timespec()); }
0069 
0070   unsigned int lumiSegmentNrLumiSeg() const { return (lumiSegmentNrLumiSeg_); }
0071 
0072   unsigned long long triggersPhysicsGeneratedFDL() const { return (triggersPhysicsGeneratedFDL_); }
0073   unsigned long long triggersPhysicsLost() const { return (triggersPhysicsLost_); }
0074   unsigned long long triggersPhysicsLostBeamActive() const { return (triggersPhysicsLostBeamActive_); }
0075   unsigned long long triggersPhysicsLostBeamInactive() const { return (triggersPhysicsLostBeamInactive_); }
0076   unsigned long long l1AsPhysics() const { return (l1AsPhysics_); }
0077   unsigned long long l1AsRandom() const { return (l1AsRandom_); }
0078   unsigned long long l1AsTest() const { return (l1AsTest_); }
0079   unsigned long long l1AsCalibration() const { return (l1AsCalibration_); }
0080   unsigned long long deadtime() const { return (deadtime_); }
0081   unsigned long long deadtimeBeamActive() const { return (deadtimeBeamActive_); }
0082   unsigned long long deadtimeBeamActiveTriggerRules() const { return (deadtimeBeamActiveTriggerRules_); }
0083   unsigned long long deadtimeBeamActiveCalibration() const { return (deadtimeBeamActiveCalibration_); }
0084   unsigned long long deadtimeBeamActivePrivateOrbit() const { return (deadtimeBeamActivePrivateOrbit_); }
0085   unsigned long long deadtimeBeamActivePartitionController() const { return (deadtimeBeamActivePartitionController_); }
0086   unsigned long long deadtimeBeamActiveTimeSlot() const { return (deadtimeBeamActiveTimeSlot_); }
0087 
0088   unsigned int lastOrbitCounter0() const { return (lastOrbitCounter0_); }
0089   unsigned int lastTestEnable() const { return (lastTestEnable_); }
0090   unsigned int lastResync() const { return (lastResync_); }
0091   unsigned int lastStart() const { return (lastStart_); }
0092   unsigned int lastEventCounter0() const { return (lastEventCounter0_); }
0093   unsigned int lastHardReset() const { return (lastHardReset_); }
0094   unsigned long long spare0() const { return (spare0_); }
0095   unsigned long long spare1() const { return (spare1_); }
0096   unsigned long long spare2() const { return (spare2_); }
0097 
0098   static double rateLS(unsigned long long counts);
0099   static double rateLS(unsigned int counts);
0100   static double percentLS(unsigned long long counts);
0101   static double percentLSActive(unsigned long long counts);
0102 
0103   static double rateLS(unsigned long long counts, int runNumber);
0104   static double rateLS(unsigned int counts, int runNumber);
0105   static double percentLS(unsigned long long counts, int runNumber);
0106   static double percentLSActive(unsigned long long counts, int runNumber);
0107 
0108   std::vector<unsigned int> gtAlgoCounts() const { return (gtAlgoCounts_); }
0109 
0110   std::vector<unsigned int> gtTechCounts() const { return (gtTechCounts_); }
0111 
0112   /// equality operator
0113   int operator==(const Level1TriggerScalers& e) const { return false; }
0114 
0115   /// inequality operator
0116   int operator!=(const Level1TriggerScalers& e) const { return false; }
0117 
0118 protected:
0119   int version_;
0120 
0121   unsigned int trigType_;
0122   unsigned int eventID_;
0123   unsigned int sourceID_;
0124   unsigned int bunchNumber_;
0125 
0126   TimeSpec collectionTime_;
0127   unsigned int lumiSegmentNr_;
0128   unsigned int lumiSegmentOrbits_;
0129   unsigned int orbitNr_;
0130   unsigned int gtResets_;
0131   unsigned int bunchCrossingErrors_;
0132   unsigned long long gtTriggers_;
0133   unsigned long long gtEvents_;
0134   float gtTriggersRate_;
0135   float gtEventsRate_;
0136   int prescaleIndexAlgo_;
0137   int prescaleIndexTech_;
0138 
0139   TimeSpec collectionTimeLumiSeg_;
0140   unsigned int lumiSegmentNrLumiSeg_;
0141   unsigned long long triggersPhysicsGeneratedFDL_;
0142   unsigned long long triggersPhysicsLost_;
0143   unsigned long long triggersPhysicsLostBeamActive_;
0144   unsigned long long triggersPhysicsLostBeamInactive_;
0145   unsigned long long l1AsPhysics_;
0146   unsigned long long l1AsRandom_;
0147   unsigned long long l1AsTest_;
0148   unsigned long long l1AsCalibration_;
0149   unsigned long long deadtime_;
0150   unsigned long long deadtimeBeamActive_;
0151   unsigned long long deadtimeBeamActiveTriggerRules_;
0152   unsigned long long deadtimeBeamActiveCalibration_;
0153   unsigned long long deadtimeBeamActivePrivateOrbit_;
0154   unsigned long long deadtimeBeamActivePartitionController_;
0155   unsigned long long deadtimeBeamActiveTimeSlot_;
0156 
0157   std::vector<unsigned int> gtAlgoCounts_;
0158   std::vector<unsigned int> gtTechCounts_;
0159 
0160   // Orbit counter markers indicating when the last BGO
0161   // command of a particular type was received, relative
0162   // to the last OrbitCounter0 (OC0), for this L1 accept
0163   unsigned int lastOrbitCounter0_;
0164   unsigned int lastTestEnable_;
0165   unsigned int lastResync_;
0166   unsigned int lastStart_;
0167   unsigned int lastEventCounter0_;
0168   unsigned int lastHardReset_;
0169 
0170   // For future use
0171   unsigned long long spare0_;
0172   unsigned long long spare1_;
0173   unsigned long long spare2_;
0174 };
0175 
0176 /// Pretty-print operator for Level1TriggerScalers
0177 std::ostream& operator<<(std::ostream& s, const Level1TriggerScalers& c);
0178 
0179 typedef std::vector<Level1TriggerScalers> Level1TriggerScalersCollection;
0180 
0181 #endif