L1AcceptBunchCrossing

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
/*
 *  File: DataFormats/Scalers/interface/L1AcceptBunchCrossing.h   (W.Badgett)
 *
 *  Bunch crossing information for a single L1 accept.  The information 
 *  comes from the Scalers FED.   Normally there are four of these objects 
 *  per event, each representing the current L1 accept, as well as the 
 *  previous three L1 accepts in time.
 *
 *  orbitNumber_     32-bits     Orbit counter since last reset
 *  bunchCrossing_   0...3563    Bunch counter within orbit
 *  eventType_       0...7       Event Type: 
 *                               1: Physics
 *                               2: Calibration
 *                               3: Test
 *                               4: Technical
 *  l1AcceptOffset_              Offset of the L1 Accept relative to 
 *                               the current event's L1 accept
 *                               Typically 0, -1, -2, -3
 */

#ifndef DATAFORMATS_SCALERS_L1ACCEPTBUNCHCROSSING_H
#define DATAFORMATS_SCALERS_L1ACCEPTBUNCHCROSSING_H

#include <ostream>
#include <vector>

/*! \file L1AcceptBunchCrossings.h
 * \Header file for L1Accept bunch crossing data from the scalers system
 * 
 * \author: William Badgett
 *
 */

/// \class L1AcceptBunchCrossings.h
/// \brief Persistable copy of Scalers L1Accept bunch crossing info

class L1AcceptBunchCrossing {
public:
  L1AcceptBunchCrossing();
  L1AcceptBunchCrossing(const int l1AcceptOffset__,
                        const unsigned int orbitNumber__,
                        const unsigned int bunchCrossing__,
                        const unsigned int eventType__);
  L1AcceptBunchCrossing(const int index, const unsigned long long data);
  virtual ~L1AcceptBunchCrossing();

  enum {
    ORBIT_NUMBER_SHIFT = 32ULL,
    ORBIT_NUMBER_MASK = 0xFFFFFFFFULL,
    BUNCH_CROSSING_SHIFT = 4ULL,
    BUNCH_CROSSING_MASK = 0xFFFULL,
    EVENT_TYPE_SHIFT = 0,
    EVENT_TYPE_MASK = 0xFULL
  };

  /// name method
  std::string name() const { return "L1AcceptBunchCrossing"; }

  /// empty method (= false)
  bool empty() const { return false; }

  int l1AcceptOffset() const { return (l1AcceptOffset_); }
  unsigned int orbitNumber() const { return (orbitNumber_); }
  unsigned int bunchCrossing() const { return (bunchCrossing_); }
  unsigned int eventType() const { return (eventType_); }

  /// equality operator
  int operator==(const L1AcceptBunchCrossing& e) const { return false; }

  /// inequality operator
  int operator!=(const L1AcceptBunchCrossing& e) const { return false; }

protected:
  int l1AcceptOffset_;
  unsigned int orbitNumber_;
  unsigned int bunchCrossing_;
  unsigned int eventType_;
};

/// Pretty-print operator for L1AcceptBunchCrossings
std::ostream& operator<<(std::ostream& s, const L1AcceptBunchCrossing& c);

typedef std::vector<L1AcceptBunchCrossing> L1AcceptBunchCrossingCollection;

#endif