CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiPixelLAHarvestMCS::FitFPixMuH Class Reference
Inheritance diagram for SiPixelLAHarvestMCS::FitFPixMuH:

Public Member Functions

void add (const FPixMuH &fmh)
 
int fit (double initVal)
 
 FitFPixMuH ()
 
double getMuH ()
 
double getMuHErr ()
 
unsigned int size ()
 
 ~FitFPixMuH () override=default
 

Private Member Functions

double calcChi2 (double par_0)
 

Private Attributes

std::vector< FPixMuHcmvar
 
TVirtualFitter * minuit
 
double muH
 
double muHErr
 

Friends

void fcn_func (Int_t &npar, Double_t *deriv, Double_t &f, Double_t *par, Int_t flag)
 

Detailed Description

Definition at line 77 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Constructor & Destructor Documentation

◆ FitFPixMuH()

SiPixelLAHarvestMCS::FitFPixMuH::FitFPixMuH ( )
inline

◆ ~FitFPixMuH()

SiPixelLAHarvestMCS::FitFPixMuH::~FitFPixMuH ( )
overridedefault

Member Function Documentation

◆ add()

void SiPixelLAHarvestMCS::FitFPixMuH::add ( const FPixMuH fmh)
inline

◆ calcChi2()

double SiPixelLAHarvestMCS::FitFPixMuH::calcChi2 ( double  par_0)
inlineprivate

Definition at line 116 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

References isoTrack_cff::chi2, cmvar, mps_fire::i, create_idmaps::n, and findQualityFiles::v.

116  {
117  double tanlorpertesla = par_0;
118  double tlpt2 = tanlorpertesla * tanlorpertesla;
119  double v[3], xshift, yshift;
120 
121  int n = cmvar.size();
122 
123  double chi2 = 0.0;
124  for (int i = 0; i < n; i++) {
125  v[0] = -(tanlorpertesla * cmvar[i].bfield[1] + tlpt2 * cmvar[i].bfield[0] * cmvar[i].bfield[2]);
126  v[1] = tanlorpertesla * cmvar[i].bfield[0] - tlpt2 * cmvar[i].bfield[1] * cmvar[i].bfield[2];
127  v[2] = -(1. + tlpt2 * cmvar[i].bfield[2] * cmvar[i].bfield[2]);
128 
129  xshift = v[0] / v[2];
130  yshift = v[1] / v[2];
131 
132  chi2 += (xshift - cmvar[i].shiftx) * (xshift - cmvar[i].shiftx) / cmvar[i].shiftx_err / cmvar[i].shiftx_err +
133  (yshift - cmvar[i].shifty) * (yshift - cmvar[i].shifty) / cmvar[i].shifty_err / cmvar[i].shifty_err;
134  }
135  return chi2;
136  }

◆ fit()

int SiPixelLAHarvestMCS::FitFPixMuH::fit ( double  initVal)
inline

Definition at line 87 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

References fcn_func, isoTrack_cff::Fitter, minuit, muH, muHErr, mps_update::status, and up.

Referenced by SiPixelLorentzAnglePCLHarvesterMCS::dqmEndJob(), and trackingPlots.Iteration::modules().

87  {
88  minuit = TVirtualFitter::Fitter(this, 1);
89  minuit->SetFCN(fcn_func);
90  double tanlorpertesla = initVal;
91  minuit->SetParameter(0, "muH", tanlorpertesla, 0.1, 0., 0.);
92 
93  double arglist[100];
94  arglist[0] = 3.;
95  minuit->ExecuteCommand("SET PRINT", arglist, 0);
96  double up = 1.0;
97  minuit->SetErrorDef(up);
98  arglist[0] = 100000.;
99  int status = minuit->ExecuteCommand("MIGRAD", arglist, 0);
100  muH = minuit->GetParameter(0);
101  muHErr = minuit->GetParError(0);
102 
103  return status;
104  }
Definition: BitonicSort.h:7
friend void fcn_func(Int_t &npar, Double_t *deriv, Double_t &f, Double_t *par, Int_t flag)

◆ getMuH()

double SiPixelLAHarvestMCS::FitFPixMuH::getMuH ( )
inline

◆ getMuHErr()

double SiPixelLAHarvestMCS::FitFPixMuH::getMuHErr ( )
inline

◆ size()

unsigned int SiPixelLAHarvestMCS::FitFPixMuH::size ( void  )
inline

Friends And Related Function Documentation

◆ fcn_func

void fcn_func ( Int_t &  npar,
Double_t *  deriv,
Double_t &  f,
Double_t *  par,
Int_t  flag 
)
friend

Definition at line 139 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Referenced by fit().

139  {
140  f = ((dynamic_cast<FitFPixMuH*>((TVirtualFitter::GetFitter())->GetObjectFit()))->calcChi2(par[0]));
141  }
double f[11][100]

Member Data Documentation

◆ cmvar

std::vector<FPixMuH> SiPixelLAHarvestMCS::FitFPixMuH::cmvar
private

Definition at line 112 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Referenced by add(), calcChi2(), and size().

◆ minuit

TVirtualFitter* SiPixelLAHarvestMCS::FitFPixMuH::minuit
private

Definition at line 111 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Referenced by fit().

◆ muH

double SiPixelLAHarvestMCS::FitFPixMuH::muH
private

Definition at line 113 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Referenced by fit(), and getMuH().

◆ muHErr

double SiPixelLAHarvestMCS::FitFPixMuH::muHErr
private

Definition at line 114 of file SiPixelLorentzAnglePCLHarvesterMCS.cc.

Referenced by fit(), and getMuHErr().