Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /* 
0002  *  \class TMTQ
0003  *
0004  *  \author: Julie Malcles - CEA/Saclay
0005  */
0006 
0007 #include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMom.h>
0008 #include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMTQ.h>
0009 #include <CalibCalorimetry/EcalLaserAnalyzer/interface/TMarkov.h>
0010 #include <TMath.h>
0011 
0012 using namespace std;
0013 
0014 //ClassImp(TMTQ)
0015 
0016 // Default Constructor...
0017 TMTQ::TMTQ() { init(); }
0018 
0019 // Destructor
0020 TMTQ::~TMTQ() {}
0021 
0022 void TMTQ::init() {
0023   for (int j = 0; j < nOutVar; j++) {
0024     cuts[0][j] = 0.0;
0025     cuts[1][j] = 10.0e9;
0026     mom[j] = new TMom();
0027   }
0028 }
0029 
0030 void TMTQ::addEntry(double peak,
0031                     double sigma,
0032                     double fit,
0033                     double ampl,
0034                     double trise,
0035                     double fwhm,
0036                     double fw20,
0037                     double fw80,
0038                     double ped,
0039                     double pedsig,
0040                     double sliding) {
0041   double val[nOutVar];
0042 
0043   val[iPeak] = peak;
0044   val[iSigma] = sigma;
0045   val[iFit] = fit;
0046   val[iAmpl] = ampl;
0047   val[iTrise] = trise;
0048   val[iFwhm] = fwhm;
0049   val[iFw20] = fw20;
0050   val[iFw80] = fw80;
0051   val[iPed] = ped;
0052   val[iPedsig] = pedsig;
0053   val[iSlide] = sliding;
0054 
0055   for (int ivar = 0; ivar < nOutVar; ivar++) {
0056     mom[ivar]->addEntry(val[ivar]);
0057   }
0058 }
0059 
0060 void TMTQ::setCut(int ivar, double mean, double sig) {
0061   if (ivar < nOutVar) {
0062     cuts[0][ivar] = mean - 2.0 * sig;
0063     cuts[1][ivar] = mean + 2.0 * sig;
0064 
0065     mom[ivar]->setCut(cuts[0][ivar], cuts[1][ivar]);
0066   }
0067 }
0068 
0069 std::vector<double> TMTQ::get(int ivar) {
0070   std::vector<double> res;
0071 
0072   if (ivar < nOutVar) {
0073     res.push_back(mom[ivar]->getMean());
0074     res.push_back(mom[ivar]->getRMS());
0075     res.push_back(mom[ivar]->getM3());
0076     res.push_back(mom[ivar]->getNevt());
0077     res.push_back(mom[ivar]->getMin());
0078     res.push_back(mom[ivar]->getMax());
0079   }
0080   return res;
0081 }
0082 
0083 std::vector<double> TMTQ::getPeak() {
0084   std::vector<double> x = get(TMTQ::iPeak);
0085   return x;
0086 }
0087 std::vector<double> TMTQ::getAmpl() {
0088   std::vector<double> x = get(TMTQ::iAmpl);
0089   return x;
0090 }
0091 std::vector<double> TMTQ::getSigma() {
0092   std::vector<double> x = get(TMTQ::iSigma);
0093   return x;
0094 }
0095 std::vector<double> TMTQ::getTrise() {
0096   std::vector<double> x = get(TMTQ::iTrise);
0097   return x;
0098 }
0099 std::vector<double> TMTQ::getFit() {
0100   std::vector<double> x = get(TMTQ::iFit);
0101   return x;
0102 }
0103 std::vector<double> TMTQ::getFwhm() {
0104   std::vector<double> x = get(TMTQ::iFwhm);
0105   return x;
0106 }
0107 std::vector<double> TMTQ::getFw20() {
0108   std::vector<double> x = get(TMTQ::iFw20);
0109   return x;
0110 }
0111 std::vector<double> TMTQ::getFw80() {
0112   std::vector<double> x = get(TMTQ::iFw80);
0113   return x;
0114 }
0115 std::vector<double> TMTQ::getPed() {
0116   std::vector<double> x = get(TMTQ::iPed);
0117   return x;
0118 }
0119 std::vector<double> TMTQ::getPedsig() {
0120   std::vector<double> x = get(TMTQ::iPedsig);
0121   return x;
0122 }
0123 std::vector<double> TMTQ::getSliding() {
0124   std::vector<double> x = get(TMTQ::iSlide);
0125   return x;
0126 }