Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:38

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 {
0054     return (collectionTime_.get_timespec());
0055   }
0056 
0057   unsigned int lumiSegmentNr() const { return (lumiSegmentNr_); }
0058   unsigned int lumiSegmentOrbits() const { return (lumiSegmentOrbits_); }
0059   unsigned int orbitNr() const { return (orbitNr_); }
0060 
0061   unsigned int gtResets() const { return (gtResets_); }
0062   unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); }
0063   unsigned long long gtTriggers() const { return (gtTriggers_); }
0064   unsigned long long gtEvents() const { return (gtEvents_); }
0065   float gtTriggersRate() const { return (gtTriggersRate_); }
0066   float gtEventsRate() const { return (gtEventsRate_); }
0067   int prescaleIndexAlgo() const { return (prescaleIndexAlgo_); }
0068   int prescaleIndexTech() const { return (prescaleIndexTech_); }
0069 
0070   struct timespec collectionTimeLumiSeg() const {
0071     return (collectionTimeLumiSeg_.get_timespec());
0072   }
0073 
0074   unsigned int lumiSegmentNrLumiSeg() const { return (lumiSegmentNrLumiSeg_); }
0075 
0076   unsigned long long triggersPhysicsGeneratedFDL() const { return (triggersPhysicsGeneratedFDL_); }
0077   unsigned long long triggersPhysicsLost() const { return (triggersPhysicsLost_); }
0078   unsigned long long triggersPhysicsLostBeamActive() const { return (triggersPhysicsLostBeamActive_); }
0079   unsigned long long triggersPhysicsLostBeamInactive() const { return (triggersPhysicsLostBeamInactive_); }
0080   unsigned long long l1AsPhysics() const { return (l1AsPhysics_); }
0081   unsigned long long l1AsRandom() const { return (l1AsRandom_); }
0082   unsigned long long l1AsTest() const { return (l1AsTest_); }
0083   unsigned long long l1AsCalibration() const { return (l1AsCalibration_); }
0084   unsigned long long deadtime() const { return (deadtime_); }
0085   unsigned long long deadtimeBeamActive() const { return (deadtimeBeamActive_); }
0086   unsigned long long deadtimeBeamActiveTriggerRules() const { return (deadtimeBeamActiveTriggerRules_); }
0087   unsigned long long deadtimeBeamActiveCalibration() const { return (deadtimeBeamActiveCalibration_); }
0088   unsigned long long deadtimeBeamActivePrivateOrbit() const { return (deadtimeBeamActivePrivateOrbit_); }
0089   unsigned long long deadtimeBeamActivePartitionController() const { return (deadtimeBeamActivePartitionController_); }
0090   unsigned long long deadtimeBeamActiveTimeSlot() const { return (deadtimeBeamActiveTimeSlot_); }
0091 
0092   unsigned int lastOrbitCounter0() const { return (lastOrbitCounter0_); }
0093   unsigned int lastTestEnable() const { return (lastTestEnable_); }
0094   unsigned int lastResync() const { return (lastResync_); }
0095   unsigned int lastStart() const { return (lastStart_); }
0096   unsigned int lastEventCounter0() const { return (lastEventCounter0_); }
0097   unsigned int lastHardReset() const { return (lastHardReset_); }
0098   unsigned long long spare0() const { return (spare0_); }
0099   unsigned long long spare1() const { return (spare1_); }
0100   unsigned long long spare2() const { return (spare2_); }
0101 
0102   static double rateLS(unsigned long long counts);
0103   static double rateLS(unsigned int counts);
0104   static double percentLS(unsigned long long counts);
0105   static double percentLSActive(unsigned long long counts);
0106 
0107   static double rateLS(unsigned long long counts, int runNumber);
0108   static double rateLS(unsigned int counts, int runNumber);
0109   static double percentLS(unsigned long long counts, int runNumber);
0110   static double percentLSActive(unsigned long long counts, int runNumber);
0111 
0112   std::vector<unsigned int> gtAlgoCounts() const { return (gtAlgoCounts_); }
0113 
0114   std::vector<unsigned int> gtTechCounts() const { return (gtTechCounts_); }
0115 
0116   /// equality operator
0117   int operator==(const Level1TriggerScalers& e) const { return false; }
0118 
0119   /// inequality operator
0120   int operator!=(const Level1TriggerScalers& e) const { return false; }
0121 
0122 protected:
0123   int version_;
0124 
0125   unsigned int trigType_;
0126   unsigned int eventID_;
0127   unsigned int sourceID_;
0128   unsigned int bunchNumber_;
0129 
0130   TimeSpec collectionTime_;
0131   unsigned int lumiSegmentNr_;
0132   unsigned int lumiSegmentOrbits_;
0133   unsigned int orbitNr_;
0134   unsigned int gtResets_;
0135   unsigned int bunchCrossingErrors_;
0136   unsigned long long gtTriggers_;
0137   unsigned long long gtEvents_;
0138   float gtTriggersRate_;
0139   float gtEventsRate_;
0140   int prescaleIndexAlgo_;
0141   int prescaleIndexTech_;
0142 
0143   TimeSpec collectionTimeLumiSeg_;
0144   unsigned int lumiSegmentNrLumiSeg_;
0145   unsigned long long triggersPhysicsGeneratedFDL_;
0146   unsigned long long triggersPhysicsLost_;
0147   unsigned long long triggersPhysicsLostBeamActive_;
0148   unsigned long long triggersPhysicsLostBeamInactive_;
0149   unsigned long long l1AsPhysics_;
0150   unsigned long long l1AsRandom_;
0151   unsigned long long l1AsTest_;
0152   unsigned long long l1AsCalibration_;
0153   unsigned long long deadtime_;
0154   unsigned long long deadtimeBeamActive_;
0155   unsigned long long deadtimeBeamActiveTriggerRules_;
0156   unsigned long long deadtimeBeamActiveCalibration_;
0157   unsigned long long deadtimeBeamActivePrivateOrbit_;
0158   unsigned long long deadtimeBeamActivePartitionController_;
0159   unsigned long long deadtimeBeamActiveTimeSlot_;
0160 
0161   std::vector<unsigned int> gtAlgoCounts_;
0162   std::vector<unsigned int> gtTechCounts_;
0163 
0164   // Orbit counter markers indicating when the last BGO
0165   // command of a particular type was received, relative
0166   // to the last OrbitCounter0 (OC0), for this L1 accept
0167   unsigned int lastOrbitCounter0_;
0168   unsigned int lastTestEnable_;
0169   unsigned int lastResync_;
0170   unsigned int lastStart_;
0171   unsigned int lastEventCounter0_;
0172   unsigned int lastHardReset_;
0173 
0174   // For future use
0175   unsigned long long spare0_;
0176   unsigned long long spare1_;
0177   unsigned long long spare2_;
0178 };
0179 
0180 /// Pretty-print operator for Level1TriggerScalers
0181 std::ostream& operator<<(std::ostream& s, const Level1TriggerScalers& c);
0182 
0183 typedef std::vector<Level1TriggerScalers> Level1TriggerScalersCollection;
0184 
0185 #endif