CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc File Reference

#include "CalibTracker/SiPixelSCurveCalibration/interface/SiPixelSCurveCalibrationAnalysis.h"
#include "TMath.h"
#include <iostream>
#include <fstream>
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "DataFormats/SiPixelDigi/interface/SiPixelCalibDigiError.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h"
#include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h"
#include "CondFormats/SiPixelObjects/interface/DetectorIndex.h"
#include "CondFormats/SiPixelObjects/interface/LocalPixel.h"
#include <sstream>

Go to the source code of this file.

Functions

void calculateEffAndError (int nADCResponse, int nTriggers, float &eff, float &error)
void chi2toMinimize (int &npar, double *grad, double &fcnval, double *xval, int iflag)

Function Documentation

void calculateEffAndError ( int  nADCResponse,
int  nTriggers,
float &  eff,
float &  error 
)

Definition at line 248 of file SiPixelSCurveCalibrationAnalysis.cc.

Referenced by SiPixelSCurveCalibrationAnalysis::doFits().

{
   eff = (float)nADCResponse / (float)nTriggers;
   double effForErrorCalculation = eff;
   if (eff <= 0 || eff >= 1)
      effForErrorCalculation = 0.5 / (double)nTriggers;
   error = TMath::Sqrt(effForErrorCalculation*(1-effForErrorCalculation) / (double)nTriggers);
}
void chi2toMinimize ( int &  npar,
double *  grad,
double &  fcnval,
double *  xval,
int  iflag 
)

Definition at line 84 of file SiPixelSCurveCalibrationAnalysis.cc.

References SiPixelSCurveCalibrationAnalysis::effErrors_, SiPixelSCurveCalibrationAnalysis::efficiencies_, SiPixelOfflineCalibAnalysisBase::fitFunction_, SiPixelOfflineCalibAnalysisBase::getVcalValues(), and i.

Referenced by SiPixelSCurveCalibrationAnalysis::doFits().

{
   TF1 * theFormula = SiPixelSCurveCalibrationAnalysis::fitFunction_;
   //setup function parameters
   for (int i = 0; i < npar; i++)
      theFormula->SetParameter(i, xval[i]);
   fcnval = 0;
   //compute Chi2 of all points
   const std::vector<short>* theVCalValues = SiPixelSCurveCalibrationAnalysis::getVcalValues();
   for (uint32_t i = 0; i < theVCalValues->size(); i++)
   {
      float chi = (SiPixelSCurveCalibrationAnalysis::efficiencies_[i] - theFormula->Eval((*theVCalValues)[i]) );
      chi       /= SiPixelSCurveCalibrationAnalysis::effErrors_[i];
      fcnval += chi*chi;
   }
}