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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
/* 
 *  \class TMTQ
 *
 *  \author: Julie Malcles - CEA/Saclay
 */

#include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMom.h>
#include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMTQ.h>
#include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMarkov.h>
#include <TMath.h>

using namespace std;

//ClassImp(TMTQ)

// Default Constructor...
TMTQ::TMTQ() { init(); }

// Destructor
TMTQ::~TMTQ() {}

void TMTQ::init() {
  for (int j = 0; j < nOutVar; j++) {
    cuts[0][j] = 0.0;
    cuts[1][j] = 10.0e9;
    mom[j] = new TMom();
  }
}

void TMTQ::addEntry(double peak,
                    double sigma,
                    double fit,
                    double ampl,
                    double trise,
                    double fwhm,
                    double fw20,
                    double fw80,
                    double ped,
                    double pedsig,
                    double sliding) {
  double val[nOutVar];

  val[iPeak] = peak;
  val[iSigma] = sigma;
  val[iFit] = fit;
  val[iAmpl] = ampl;
  val[iTrise] = trise;
  val[iFwhm] = fwhm;
  val[iFw20] = fw20;
  val[iFw80] = fw80;
  val[iPed] = ped;
  val[iPedsig] = pedsig;
  val[iSlide] = sliding;

  for (int ivar = 0; ivar < nOutVar; ivar++) {
    mom[ivar]->addEntry(val[ivar]);
  }
}

void TMTQ::setCut(int ivar, double mean, double sig) {
  if (ivar < nOutVar) {
    cuts[0][ivar] = mean - 2.0 * sig;
    cuts[1][ivar] = mean + 2.0 * sig;

    mom[ivar]->setCut(cuts[0][ivar], cuts[1][ivar]);
  }
}

std::vector<double> TMTQ::get(int ivar) {
  std::vector<double> res;

  if (ivar < nOutVar) {
    res.push_back(mom[ivar]->getMean());
    res.push_back(mom[ivar]->getRMS());
    res.push_back(mom[ivar]->getM3());
    res.push_back(mom[ivar]->getNevt());
    res.push_back(mom[ivar]->getMin());
    res.push_back(mom[ivar]->getMax());
  }
  return res;
}

std::vector<double> TMTQ::getPeak() {
  std::vector<double> x = get(TMTQ::iPeak);
  return x;
}
std::vector<double> TMTQ::getAmpl() {
  std::vector<double> x = get(TMTQ::iAmpl);
  return x;
}
std::vector<double> TMTQ::getSigma() {
  std::vector<double> x = get(TMTQ::iSigma);
  return x;
}
std::vector<double> TMTQ::getTrise() {
  std::vector<double> x = get(TMTQ::iTrise);
  return x;
}
std::vector<double> TMTQ::getFit() {
  std::vector<double> x = get(TMTQ::iFit);
  return x;
}
std::vector<double> TMTQ::getFwhm() {
  std::vector<double> x = get(TMTQ::iFwhm);
  return x;
}
std::vector<double> TMTQ::getFw20() {
  std::vector<double> x = get(TMTQ::iFw20);
  return x;
}
std::vector<double> TMTQ::getFw80() {
  std::vector<double> x = get(TMTQ::iFw80);
  return x;
}
std::vector<double> TMTQ::getPed() {
  std::vector<double> x = get(TMTQ::iPed);
  return x;
}
std::vector<double> TMTQ::getPedsig() {
  std::vector<double> x = get(TMTQ::iPedsig);
  return x;
}
std::vector<double> TMTQ::getSliding() {
  std::vector<double> x = get(TMTQ::iSlide);
  return x;
}