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
/** \file
 * 
 *  $Date: 2014/02/02 22:12:32 $
 *  $Revision: 1.0 $
 *
 * \author Marcello Maggi
 */

#include "DataFormats/GEMDigi/interface/ME0DigiPreReco.h"
#include <iostream>

//ME0DigiPreReco::ME0DigiPreReco (float x, float y, float ex, float ey, float corr, float tof) :
ME0DigiPreReco::ME0DigiPreReco(float x, float y, float ex, float ey, float corr, float tof, int pdgid, int prompt)
    : x_(x), y_(y), ex_(ex), ey_(ey), corr_(corr), tof_(tof), pdgid_(pdgid), prompt_(prompt) {}

ME0DigiPreReco::ME0DigiPreReco() : x_(0.), y_(0.), ex_(0.), ey_(0.), corr_(0.), tof_(-1.), pdgid_(0), prompt_(0) {}

// Comparison
bool ME0DigiPreReco::operator==(const ME0DigiPreReco& digi) const {
  return x_ == digi.x() and y_ == digi.y() and tof_ == digi.tof();
}

// Comparison
bool ME0DigiPreReco::operator!=(const ME0DigiPreReco& digi) const {
  return x_ != digi.x() or y_ != digi.y() or tof_ != digi.tof();
}

///Precedence operator
bool ME0DigiPreReco::operator<(const ME0DigiPreReco& digi) const {
  if (digi.tof() == tof_) {
    if (digi.x() == x_)
      return digi.y() < y_;
    else
      return digi.x() < x_;
  } else {
    return digi.tof() < tof_;
  }
}

std::ostream& operator<<(std::ostream& o, const ME0DigiPreReco& digi) {
  //  return o << "local x=" << digi.x() << " cm y=" << digi.y()<<" cm ex=" << digi.ex() << " cm ey=" << digi.ey()<< " cm tof="<<digi.tof()<<" ns";
  return o << "local x=" << digi.x() << " cm y=" << digi.y() << " cm ex=" << digi.ex() << " cm ey=" << digi.ey()
           << " cm tof=" << digi.tof() << " ns"
           << " pdgID " << digi.pdgid() << " prompt? " << digi.prompt();
}

void ME0DigiPreReco::print() const {
  //  std::cout << "local x=" << this->x() << " cm y=" << this->y() <<" cm tof="<<this->tof()<<" ns"<<std::endl;
  std::cout << "local x=" << this->x() << " cm y=" << this->y() << " cm tof=" << this->tof() << " ns"
            << " pdgID " << this->pdgid() << " prompt? " << this->prompt() << std::endl;
}