CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PVFitter.cc
Go to the documentation of this file.
1 
14 
20 
23 
30 
33 
34 #include "Minuit2/FCNBase.h"
35 #include "Minuit2/FunctionMinimum.h"
36 #include "Minuit2/MnMigrad.h"
37 #include "Minuit2/MnPrint.h" // Defines operator<< for cout << ierr (Dario)
38 #include "TF1.h"
39 
40 #include <iostream> // Dario
41 using namespace std ; // Dario
42 // ----------------------------------------------------------------------
43 // Useful function:
44 // ----------------------------------------------------------------------
45 
46 // static char * formatTime(const std::time_t & t) {
47 // struct std::tm * ptm;
48 // ptm = gmtime(&t);
49 // static char ts[32];
50 // strftime(ts,sizeof(ts),"%Y.%m.%d %H:%M:%S %Z",ptm);
51 // return ts;
52 // }
54  edm::ConsumesCollector &&iColl)
55  : ftree_(0)
56 {
57  initialize(iConfig, iColl);
58 }
59 
62  :ftree_(0)
63 {
64  initialize(iConfig, iColl);
65 }
66 
69 {
70  debug_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<bool>("Debug");
72  iConfig.getParameter<edm::ParameterSet>("PVFitter")
73  .getUntrackedParameter<edm::InputTag>("VertexCollection",
74  edm::InputTag("offlinePrimaryVertices")));
75  do3DFit_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<bool>("Apply3DFit");
76  //writeTxt_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<bool>("WriteAscii");
77  //outputTxt_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<std::string>("AsciiFileName");
78 
79  maxNrVertices_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("maxNrStoredVertices");
80  minNrVertices_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
81  minVtxNdf_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
82  maxVtxNormChi2_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("maxVertexNormChi2");
83  minVtxTracks_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minVertexNTracks");
84  minVtxWgt_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
85  maxVtxR_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("maxVertexR");
86  maxVtxZ_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("maxVertexZ");
87  errorScale_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("errorScale");
88  sigmaCut_ = iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<double>("nSigmaCut");
89  fFitPerBunchCrossing=iConfig.getParameter<edm::ParameterSet>("PVFitter").getUntrackedParameter<bool>("FitPerBunchCrossing");
90 
91  // preset quality cut to "infinite"
92  dynamicQualityCut_ = 1.e30;
93 
94  hPVx = new TH2F("hPVx","PVx vs PVz distribution",200,-maxVtxR_, maxVtxR_, 200, -maxVtxZ_, maxVtxZ_);
95  hPVy = new TH2F("hPVy","PVy vs PVz distribution",200,-maxVtxR_, maxVtxR_, 200, -maxVtxZ_, maxVtxZ_);
96 }
97 
99 
100 }
101 
103 {
104 
105 // frun = iEvent.id().run();
106 // const edm::TimeValue_t ftimestamp = iEvent.time().value();
107 // const std::time_t ftmptime = ftimestamp >> 32;
108 
109 // if (fbeginLumiOfFit == -1) freftime[0] = freftime[1] = ftmptime;
110 // if (freftime[0] == 0 || ftmptime < freftime[0]) freftime[0] = ftmptime;
111 // const char* fbeginTime = formatTime(freftime[0]);
112 // sprintf(fbeginTimeOfFit,"%s",fbeginTime);
113 
114 // if (freftime[1] == 0 || ftmptime > freftime[1]) freftime[1] = ftmptime;
115 // const char* fendTime = formatTime(freftime[1]);
116 // sprintf(fendTimeOfFit,"%s",fendTime);
117 
118 // flumi = iEvent.luminosityBlock();
119 // frunFit = frun;
120 
121 // if (fbeginLumiOfFit == -1 || fbeginLumiOfFit > flumi) fbeginLumiOfFit = flumi;
122 // if (fendLumiOfFit == -1 || fendLumiOfFit < flumi) fendLumiOfFit = flumi;
123 // std::cout << "flumi = " <<flumi<<"; fbeginLumiOfFit = " << fbeginLumiOfFit <<"; fendLumiOfFit = "<<fendLumiOfFit<<std::endl;
124 
125  //------ Primary Vertices
127  bool hasPVs = false;
128  //edm::View<reco::Vertex> vertices;
129  //const reco::VertexCollection & vertices = 0;
130 
131  if ( iEvent.getByToken(vertexToken_, PVCollection ) ) {
132  //pv = *PVCollection;
133  //vertices = *PVCollection;
134  hasPVs = true;
135  }
136  //------
137 
138  if ( hasPVs ) {
139 
140  for (reco::VertexCollection::const_iterator pv = PVCollection->begin(); pv != PVCollection->end(); ++pv ) {
141 
142 
143  //for ( size_t ipv=0; ipv != pv.size(); ++ipv ) {
144 
145  //--- vertex selection
146  if ( pv->isFake() || pv->tracksSize()==0 ) continue;
147  if ( pv->ndof() < minVtxNdf_ || (pv->ndof()+3.)/pv->tracksSize()<2*minVtxWgt_ ) continue;
148  //---
149  hPVx->Fill( pv->x(), pv->z() );
150  hPVy->Fill( pv->y(), pv->z() );
151 
152  //
153  // 3D fit section
154  //
155  // apply additional quality cut
156  if ( pvQuality(*pv)>dynamicQualityCut_ ) continue;
157  // if store exceeds max. size: reduce size and apply new quality cut
158  if ( pvStore_.size()>=maxNrVertices_ ) {
159  compressStore();
160  if ( pvQuality(*pv)>dynamicQualityCut_ ) continue;
161  }
162  //
163  // copy PV to store
164  //
165  int bx = iEvent.bunchCrossing();
166  BeamSpotFitPVData pvData;
167  pvData.bunchCrossing = bx;
168  pvData.position[0] = pv->x();
169  pvData.position[1] = pv->y();
170  pvData.position[2] = pv->z();
171  pvData.posError[0] = pv->xError();
172  pvData.posError[1] = pv->yError();
173  pvData.posError[2] = pv->zError();
174  pvData.posCorr[0] = pv->covariance(0,1)/pv->xError()/pv->yError();
175  pvData.posCorr[1] = pv->covariance(0,2)/pv->xError()/pv->zError();
176  pvData.posCorr[2] = pv->covariance(1,2)/pv->yError()/pv->zError();
177  pvStore_.push_back(pvData);
178 
179  if(ftree_ != 0){
180  theBeamSpotTreeData_.run(iEvent.id().run());
184  ftree_->Fill();
185  }
186 
187  if (fFitPerBunchCrossing) bxMap_[bx].push_back(pvData);
188 
189  }
190 
191  }
192 
193 
194 
195 
196 }
197 
198 void PVFitter::setTree(TTree* tree){
199  ftree_ = tree;
201 }
202 
204 
205  using namespace ROOT::Minuit2;
206  edm::LogInfo("PVFitter") << " Number of bunch crossings: " << bxMap_.size() << std::endl;
207 
208  bool fit_ok = true;
209 
210  for ( std::map<int,std::vector<BeamSpotFitPVData> >::const_iterator pvStore = bxMap_.begin();
211  pvStore!=bxMap_.end(); ++pvStore) {
212 
213  // first set null beam spot in case
214  // fit fails
215  fbspotMap[pvStore->first] = reco::BeamSpot();
216 
217  edm::LogInfo("PVFitter") << " Number of PVs collected for PVFitter: " << (pvStore->second).size() << " in bx: " << pvStore->first << std::endl;
218 
219  if ( (pvStore->second).size() <= minNrVertices_ ) {
220  edm::LogWarning("PVFitter") << " not enough PVs, continue" << std::endl;
221  fit_ok = false;
222  continue;
223  }
224 
225  //bool fit_ok = false;
226  edm::LogInfo("PVFitter") << "Calculating beam spot with PVs ..." << std::endl;
227 
228  //
229  // LL function and fitter
230  //
231  FcnBeamSpotFitPV* fcn = new FcnBeamSpotFitPV(pvStore->second);
232  //
233  // fit parameters: positions, widths, x-y correlations, tilts in xz and yz
234  //
235  MnUserParameters upar;
236  upar.Add("x" , 0. , 0.02 , -10., 10.); // 0
237  upar.Add("y" , 0. , 0.02 , -10., 10.); // 1
238  upar.Add("z" , 0. , 0.20 , -30., 30.); // 2
239  upar.Add("ex" , 0.015, 0.01 , 0. , 10.); // 3
240  upar.Add("corrxy", 0. , 0.02 , -1. , 1. ); // 4
241  upar.Add("ey" , 0.015, 0.01 , 0. , 10.); // 5
242  upar.Add("dxdz" , 0. , 0.0002, -0.1, 0.1); // 6
243  upar.Add("dydz" , 0. , 0.0002, -0.1, 0.1); // 7
244  upar.Add("ez" , 1. , 0.1 , 0. , 30.); // 8
245  upar.Add("scale", errorScale_ , errorScale_/10.,
246  errorScale_/2., errorScale_*2.); // 9
247  MnMigrad migrad(*fcn, upar);
248 
249  //
250  // first iteration without correlations
251  //
252  upar.Fix(4);
253  upar.Fix(6);
254  upar.Fix(7);
255  upar.Fix(9);
256  FunctionMinimum ierr = migrad(0,1.);
257  if ( !ierr.IsValid() ) {
258  edm::LogInfo("PVFitter") << "3D beam spot fit failed in 1st iteration" << std::endl;
259  fit_ok = false;
260  continue;
261  }
262  //
263  // refit with harder selection on vertices
264  //
265  fcn->setLimits(upar.Value(0)-sigmaCut_*upar.Value(3),
266  upar.Value(0)+sigmaCut_*upar.Value(3),
267  upar.Value(1)-sigmaCut_*upar.Value(5),
268  upar.Value(1)+sigmaCut_*upar.Value(5),
269  upar.Value(2)-sigmaCut_*upar.Value(8),
270  upar.Value(2)+sigmaCut_*upar.Value(8));
271  ierr = migrad(0,1.);
272  if ( !ierr.IsValid() ) {
273  edm::LogInfo("PVFitter") << "3D beam spot fit failed in 2nd iteration" << std::endl;
274  fit_ok = false;
275  continue;
276  }
277  //
278  // refit with correlations
279  //
280  upar.Release(4);
281  upar.Release(6);
282  upar.Release(7);
283  ierr = migrad(0,1.);
284  if ( !ierr.IsValid() ) {
285  edm::LogInfo("PVFitter") << "3D beam spot fit failed in 3rd iteration" << std::endl;
286  fit_ok = false;
287  continue;
288  }
289  // refit with floating scale factor
290  // minuitx.ReleaseParameter(9);
291  // minuitx.Minimize();
292 
293  //minuitx.PrintResults(0,0);
294 
295  fwidthX = upar.Value(3);
296  fwidthY = upar.Value(5);
297  fwidthZ = upar.Value(8);
298  fwidthXerr = upar.Error(3);
299  fwidthYerr = upar.Error(5);
300  fwidthZerr = upar.Error(8);
301 
303  // need to get the full cov matrix
304  matrix(0,0) = pow( upar.Error(0), 2);
305  matrix(1,1) = pow( upar.Error(1), 2);
306  matrix(2,2) = pow( upar.Error(2), 2);
307  matrix(3,3) = fwidthZerr * fwidthZerr;
308  matrix(4,4) = pow( upar.Error(6), 2);
309  matrix(5,5) = pow( upar.Error(7), 2);
310  matrix(6,6) = fwidthXerr * fwidthXerr;
311 
313  upar.Value(1),
314  upar.Value(2) ),
315  fwidthZ,
316  upar.Value(6), upar.Value(7),
317  fwidthX,
318  matrix );
322 
323  fbspotMap[pvStore->first] = fbeamspot;
324  edm::LogInfo("PVFitter") << "3D PV fit done for this bunch crossing."<<std::endl;
325  //delete fcn;
326  fit_ok = fit_ok & true;
327  }
328 
329  return fit_ok;
330 }
331 
332 
334 
335  using namespace ROOT::Minuit2;
336  edm::LogInfo("PVFitter") << " Number of PVs collected for PVFitter: " << pvStore_.size() << std::endl;
337 
338  if ( pvStore_.size() <= minNrVertices_ ) return false;
339 
340  //bool fit_ok = false;
341 
342  TH1F *h1PVx = (TH1F*) hPVx->ProjectionX("h1PVx", 0, -1, "e");
343  TH1F *h1PVy = (TH1F*) hPVy->ProjectionX("h1PVy", 0, -1, "e");
344  TH1F *h1PVz = (TH1F*) hPVx->ProjectionY("h1PVz", 0, -1, "e");
345 
346  //Use our own copy for thread safety
347  TF1 gaus("localGaus","gaus");
348 
349  h1PVx->Fit(&gaus,"QLM0");
350  h1PVy->Fit(&gaus,"QLM0");
351  h1PVz->Fit(&gaus,"QLM0");
352 
353  TF1 *gausx = h1PVx->GetFunction("localGaus");
354  TF1 *gausy = h1PVy->GetFunction("localGaus");
355  TF1 *gausz = h1PVz->GetFunction("localGaus");
356 
357  fwidthX = gausx->GetParameter(2);
358  fwidthY = gausy->GetParameter(2);
359  fwidthZ = gausz->GetParameter(2);
360  fwidthXerr = gausx->GetParError(2);
361  fwidthYerr = gausy->GetParError(2);
362  fwidthZerr = gausz->GetParError(2);
363 
364  double estX = gausx->GetParameter(1);
365  double estY = gausy->GetParameter(1);
366  double estZ = gausz->GetParameter(1);
367  double errX = fwidthX*3.;
368  double errY = fwidthY*3.;
369  double errZ = fwidthZ*3.;
370 
371  if ( ! do3DFit_ ) {
372 
374  matrix(2,2) = gausz->GetParError(1) * gausz->GetParError(1);
375  matrix(3,3) = fwidthZerr * fwidthZerr;
376  matrix(6,6) = fwidthXerr * fwidthXerr;
377 
378  fbeamspot = reco::BeamSpot( reco::BeamSpot::Point(gausx->GetParameter(1),
379  gausy->GetParameter(1),
380  gausz->GetParameter(1) ),
381  fwidthZ,
382  0., 0.,
383  fwidthX,
384  matrix );
388 
389  }
390  else { // do 3D fit
391  //
392  // LL function and fitter
393  //
395  //
396  // fit parameters: positions, widths, x-y correlations, tilts in xz and yz
397  //
398  MnUserParameters upar;
399  upar.Add("x" , estX , errX , -10. , 10. ); // 0
400  upar.Add("y" , estY , errY , -10. , 10. ); // 1
401  upar.Add("z" , estZ , errZ , -30. , 30. ); // 2
402  upar.Add("ex" , 0.015 , 0.01 , 0. , 10. ); // 3
403  upar.Add("corrxy", 0. , 0.02 , -1. , 1. ); // 4
404  upar.Add("ey" , 0.015 , 0.01 , 0. , 10. ); // 5
405  upar.Add("dxdz" , 0. , 0.0002 , -0.1 , 0.1 ); // 6
406  upar.Add("dydz" , 0. , 0.0002 , -0.1 , 0.1 ); // 7
407  upar.Add("ez" , 1. , 0.1 , 0. , 30. ); // 8
408  upar.Add("scale" , errorScale_, errorScale_/10.,errorScale_/2., errorScale_*2.); // 9
409  MnMigrad migrad(*fcn, upar);
410  //
411  // first iteration without correlations
412  //
413  migrad.Fix(4);
414  migrad.Fix(6);
415  migrad.Fix(7);
416  migrad.Fix(9);
417  FunctionMinimum ierr = migrad(0,1.);
418  if ( !ierr.IsValid() ) {
419  edm::LogWarning("PVFitter") << "3D beam spot fit failed in 1st iteration" << std::endl;
420  return false;
421  }
422  //
423  // refit with harder selection on vertices
424  //
425 
426  vector<double> results ;
427  vector<double> errors ;
428  results = ierr.UserParameters().Params() ; \
429  errors = ierr.UserParameters().Errors() ; \
430 
431  fcn->setLimits(results[0]-sigmaCut_*results[3],
432  results[0]+sigmaCut_*results[3],
433  results[1]-sigmaCut_*results[5],
434  results[1]+sigmaCut_*results[5],
435  results[2]-sigmaCut_*results[8],
436  results[2]+sigmaCut_*results[8]);
437  ierr = migrad(0,1.);
438  if ( !ierr.IsValid() ) {
439  edm::LogWarning("PVFitter") << "3D beam spot fit failed in 2nd iteration" << std::endl;
440  return false;
441  }
442  //
443  // refit with correlations
444  //
445  migrad.Release(4);
446  migrad.Release(6);
447  migrad.Release(7);
448  ierr = migrad(0,1.);
449  if ( !ierr.IsValid() ) {
450  edm::LogWarning("PVFitter") << "3D beam spot fit failed in 3rd iteration" << std::endl;
451  return false;
452  }
453  // refit with floating scale factor
454  // minuitx.ReleaseParameter(9);
455  // minuitx.Minimize();
456 
457  //minuitx.PrintResults(0,0);
458 
459  results = ierr.UserParameters().Params() ; \
460  errors = ierr.UserParameters().Errors() ; \
461 
462  fwidthX = results[3];
463  fwidthY = results[5];
464  fwidthZ = results[8];
465  fwidthXerr = errors[3];
466  fwidthYerr = errors[5];
467  fwidthZerr = errors[8];
468 
469  // check errors on widths and sigmaZ for nan
471  edm::LogWarning("PVFitter") << "3D beam spot fit returns nan in 3rd iteration" << std::endl;
472  return false;
473  }
474 
476  // need to get the full cov matrix
477  matrix(0,0) = pow( errors[0], 2);
478  matrix(1,1) = pow( errors[1], 2);
479  matrix(2,2) = pow( errors[2], 2);
480  matrix(3,3) = fwidthZerr * fwidthZerr;
481  matrix(6,6) = fwidthXerr * fwidthXerr;
482 
484  results[1],
485  results[2] ),
486  fwidthZ,
487  results[6], results[7],
488  fwidthX,
489  matrix );
493  }
494 
495  return true; //FIXME: Need to add quality test for the fit results!
496 }
497 
499 /*
500  fasciiFile << "Runnumber " << frun << std::endl;
501  fasciiFile << "BeginTimeOfFit " << fbeginTimeOfFit << std::endl;
502  fasciiFile << "EndTimeOfFit " << fendTimeOfFit << std::endl;
503  fasciiFile << "LumiRange " << fbeginLumiOfFit << " - " << fendLumiOfFit << std::endl;
504  fasciiFile << "Type " << fbeamspot.type() << std::endl;
505  fasciiFile << "X0 " << fbeamspot.x0() << std::endl;
506  fasciiFile << "Y0 " << fbeamspot.y0() << std::endl;
507  fasciiFile << "Z0 " << fbeamspot.z0() << std::endl;
508  fasciiFile << "sigmaZ0 " << fbeamspot.sigmaZ() << std::endl;
509  fasciiFile << "dxdz " << fbeamspot.dxdz() << std::endl;
510  fasciiFile << "dydz " << fbeamspot.dydz() << std::endl;
511  if (inputBeamWidth_ > 0 ) {
512  fasciiFile << "BeamWidthX " << inputBeamWidth_ << std::endl;
513  fasciiFile << "BeamWidthY " << inputBeamWidth_ << std::endl;
514  } else {
515  fasciiFile << "BeamWidthX " << fbeamspot.BeamWidthX() << std::endl;
516  fasciiFile << "BeamWidthY " << fbeamspot.BeamWidthY() << std::endl;
517  }
518 
519  for (int i = 0; i<6; ++i) {
520  fasciiFile << "Cov("<<i<<",j) ";
521  for (int j=0; j<7; ++j) {
522  fasciiFile << fbeamspot.covariance(i,j) << " ";
523  }
524  fasciiFile << std::endl;
525  }
526  // beam width error
527  if (inputBeamWidth_ > 0 ) {
528  fasciiFile << "Cov(6,j) 0 0 0 0 0 0 " << "1e-4" << std::endl;
529  } else {
530  fasciiFile << "Cov(6,j) 0 0 0 0 0 0 " << fbeamspot.covariance(6,6) << std::endl;
531  }
532  fasciiFile << "EmittanceX " << fbeamspot.emittanceX() << std::endl;
533  fasciiFile << "EmittanceY " << fbeamspot.emittanceY() << std::endl;
534  fasciiFile << "BetaStar " << fbeamspot.betaStar() << std::endl;
535 
536 */
537 }
538 
539 
540 void
542 {
543  //
544  // fill vertex qualities
545  //
546  pvQualities_.resize(pvStore_.size());
547  for ( unsigned int i=0; i<pvStore_.size(); ++i ) pvQualities_[i] = pvQuality(pvStore_[i]);
548  sort(pvQualities_.begin(),pvQualities_.end());
549  //
550  // Set new quality cut to median. This cut will be used to reduce the
551  // number of vertices in the store and also apply to all new vertices
552  // until the next reset
553  //
555  //
556  // remove all vertices failing the cut from the store
557  // (to be moved to a more efficient memory management!)
558  //
559  unsigned int iwrite(0);
560  for ( unsigned int i=0; i<pvStore_.size(); ++i ) {
561  if ( pvQuality(pvStore_[i])>dynamicQualityCut_ ) continue;
562  if ( i!=iwrite ) pvStore_[iwrite] = pvStore_[i];
563  ++iwrite;
564  }
565  pvStore_.resize(iwrite);
566  edm::LogInfo("PVFitter") << "Reduced primary vertex store size to "
567  << pvStore_.size() << " ; new dynamic quality cut = "
568  << dynamicQualityCut_ << std::endl;
569 
570 }
571 
572 double
574 {
575  //
576  // determinant of the transverse part of the PV covariance matrix
577  //
578  return
579  pv.covariance(0,0)*pv.covariance(1,1)-
580  pv.covariance(0,1)*pv.covariance(0,1);
581 }
582 
583 double
585 {
586  //
587  // determinant of the transverse part of the PV covariance matrix
588  //
589  double ex = pv.posError[0];
590  double ey = pv.posError[1];
591  return ex*ex*ey*ey*(1-pv.posCorr[0]*pv.posCorr[0]);
592 }
RunNumber_t run() const
Definition: EventID.h:39
std::vector< double > pvQualities_
Definition: PVFitter.h:205
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
bool debug_
Definition: PVFitter.h:145
double maxVtxNormChi2_
Definition: PVFitter.h:154
void setTree(TTree *tree)
Definition: PVFitter.cc:198
std::map< int, std::vector< BeamSpotFitPVData > > bxMap_
Definition: PVFitter.h:203
void initialize(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iColl)
Definition: PVFitter.cc:67
void run(unsigned int run)
void compressStore()
reduce size of primary vertex cache by increasing quality limit
Definition: PVFitter.cc:541
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
double minVtxWgt_
Definition: PVFitter.h:156
double minVtxNdf_
Definition: PVFitter.h:153
int bunchCrossing() const
Definition: EventBase.h:66
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:123
double fwidthY
Definition: PVFitter.h:183
double errorScale_
Definition: PVFitter.h:159
bool do3DFit_
Definition: PVFitter.h:146
double dynamicQualityCut_
Definition: PVFitter.h:204
double fwidthYerr
Definition: PVFitter.h:186
double fwidthZ
Definition: PVFitter.h:184
double fwidthXerr
Definition: PVFitter.h:185
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:131
void bunchCrossing(unsigned int bunchCrossing)
reco::BeamSpot fbeamspot
Definition: PVFitter.h:139
void lumi(unsigned int lumi)
int iEvent
Definition: GenABIO.cc:230
std::vector< BeamSpotFitPVData > pvStore_
Definition: PVFitter.h:202
void readEvent(const edm::Event &iEvent)
Definition: PVFitter.cc:102
bool isNotFinite(T x)
Definition: isFinite.h:10
void setBeamWidthY(double v)
Definition: BeamSpot.h:109
BeamSpotTreeData theBeamSpotTreeData_
Definition: PVFitter.h:207
bool fFitPerBunchCrossing
Definition: PVFitter.h:141
TH2F * hPVy
Definition: PVFitter.h:166
void pvData(const BeamSpotFitPVData &pvData)
TTree * ftree_
Definition: PVFitter.h:168
std::map< int, reco::BeamSpot > fbspotMap
Definition: PVFitter.h:140
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: PVFitter.h:147
double pvQuality(const reco::Vertex &pv) const
vertex quality measure
Definition: PVFitter.cc:573
double maxVtxR_
Definition: PVFitter.h:157
double maxVtxZ_
Definition: PVFitter.h:158
unsigned int maxNrVertices_
Definition: PVFitter.h:151
double fwidthZerr
Definition: PVFitter.h:187
void branch(TTree *tree)
PVFitter()
Definition: PVFitter.h:45
unsigned int minVtxTracks_
Definition: PVFitter.h:155
void fcn(int &, double *, double &, double *, int)
bool runFitter()
Definition: PVFitter.cc:333
TH2F * hPVx
Definition: PVFitter.h:166
unsigned int minNrVertices_
Definition: PVFitter.h:152
void setLimits(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
bool runBXFitter()
Definition: PVFitter.cc:203
double sigmaCut_
Definition: PVFitter.h:160
edm::EventID id() const
Definition: EventBase.h:60
void setBeamWidthX(double v)
Definition: BeamSpot.h:108
virtual ~PVFitter()
Definition: PVFitter.cc:98
double fwidthX
Definition: PVFitter.h:182
void dumpTxtFile()
Definition: PVFitter.cc:498
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40