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
/** \file
 * 
 *
 * \author FRC
 */

#include <DataFormats/DTDigi/interface/DTLocalTrigger.h>

using namespace std;

DTLocalTrigger::DTLocalTrigger(int eventBx, int bx, int data) : theEventBX(eventBx), theBX(bx), theData(data) {}

DTLocalTrigger::DTLocalTrigger() : theEventBX(0), theBX(0), theData(0) {}

// Comparison
bool DTLocalTrigger::operator==(const DTLocalTrigger& trig) const {
  if (theBX != trig.bx() || this->quality() != trig.quality())
    return false;
  return true;
}

// Getters

uint16_t DTLocalTrigger::bx() const { return theBX; }

uint16_t DTLocalTrigger::quality() const { return ((theData & 0xE) >> 1); }
uint16_t DTLocalTrigger::trTheta() const { return ((theData & 0x30) >> 4); }

bool DTLocalTrigger::secondTrack() const { return (theData & 0x1); }
bool DTLocalTrigger::trOut() const { return ((theData & 0x40) >> 6); }

// Setters ??

// Debug

void DTLocalTrigger::print() const {
  cout << " trigger at BX " << bx() << ": " << theData;
  if (secondTrack())
    cout << " IT IS A SECOND TRACK !! ";
  cout << " Quality " << quality();
  if (trTheta() == 1)
    cout << " with a low Theta trigger ";
  if (trTheta() == 3)
    cout << " with a high Theta trigger ";
  if (trOut())
    cout << " Trigger Out set ";
  cout << endl;
}

uint16_t DTLocalTrigger::eventBx() const { return theEventBX; }