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
#include "CondFormats/SiStripObjects/interface/SamplingAnalysis.h"
#include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
#include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>

using namespace sistrip;

// ----------------------------------------------------------------------------
//
SamplingAnalysis::SamplingAnalysis(const uint32_t& key)
    : CommissioningAnalysis(key, "SamplingAnalysis"), sOnCut_(3), max_(sistrip::invalid_), error_(sistrip::invalid_) {
  ;
}

// ----------------------------------------------------------------------------
//
SamplingAnalysis::SamplingAnalysis()
    : CommissioningAnalysis("SamplingAnalysis"), sOnCut_(3), max_(sistrip::invalid_), error_(sistrip::invalid_) {
  ;
}

// ----------------------------------------------------------------------------
//
void SamplingAnalysis::reset() {
  error_ = sistrip::invalid_;
  max_ = sistrip::invalid_;
}

// ----------------------------------------------------------------------------
//
void SamplingAnalysis::print(std::stringstream& ss, uint32_t not_used) {
  header(ss);
  ss << " Granularity: " << SiStripEnumsAndStrings::granularity(granularity_) << std::endl;
  ss << " Delay corresponding to the maximum of the pulse : " << max_ << std::endl
     << " Error on the position (from the fit)            : " << error_ << std::endl;
}

// ----------------------------------------------------------------------------
//
float SamplingAnalysis::limit(float SoNcut) const {
  return 3.814567e+00 + 8.336601e+00 * SoNcut - 1.511334e-01 * pow(SoNcut, 2);
}

// ----------------------------------------------------------------------------
//
float SamplingAnalysis::correctMeasurement(float mean, float SoNcut) const {
  if (mean > limit(SoNcut))
    return -8.124872e+00 + 9.860108e-01 * mean - 3.618158e-03 * pow(mean, 2) + 2.037263e-05 * pow(mean, 3);
  else
    return 0.;
}