CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BeamFitter.cc
Go to the documentation of this file.
1 
18 
21 
28 
30 
31 // ----------------------------------------------------------------------
32 // Useful function:
33 // ----------------------------------------------------------------------
34 const char * BeamFitter::formatBTime(const std::time_t & t) {
35  struct std::tm * ptm;
36  ptm = gmtime(&t);
37  static char ts[] = "yyyy.mn.dd hh:mm:ss zzz ";
38  // This value should be taken directly from edm::Event::time(), which
39  // returns GMT (to be confirmed)
40  strftime(ts,sizeof(ts),"%Y.%m.%d %H:%M:%S GMT",ptm);
41  return ts;
42 }
43 // Update the string representations of the time
45  const char* fbeginTime = formatBTime(freftime[0]);
46  sprintf(fbeginTimeOfFit,"%s",fbeginTime);
47  const char* fendTime = formatBTime(freftime[1]);
48  sprintf(fendTimeOfFit,"%s",fendTime);
49 }
50 
51 
52 BeamFitter::BeamFitter(const edm::ParameterSet& iConfig): fPVTree_(0)
53 {
54 
55  debug_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("Debug");
56  tracksLabel_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<edm::InputTag>("TrackCollection");
57  vertexLabel_ = iConfig.getUntrackedParameter<edm::InputTag>("primaryVertex", edm::InputTag("offlinePrimaryVertices"));
58  writeTxt_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("WriteAscii");
59  outputTxt_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("AsciiFileName");
60  appendRunTxt_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("AppendRunToFileName");
61  writeDIPTxt_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("WriteDIPAscii");
62  // Specify whether we want to write the DIP file even if the fit is failed.
63  writeDIPBadFit_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("WriteDIPOnBadFit", true);
64  outputDIPTxt_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("DIPFileName");
65  saveNtuple_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("SaveNtuple");
66  saveBeamFit_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("SaveFitResults");
67  savePVVertices_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("SavePVVertices");
68  isMuon_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<bool>("IsMuonCollection");
69 
70  trk_MinpT_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("MinimumPt");
71  trk_MaxEta_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumEta");
72  trk_MaxIP_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumImpactParameter");
73  trk_MaxZ_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumZ");
74  trk_MinNTotLayers_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumTotalLayers");
75  trk_MinNPixLayers_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumPixelLayers");
76  trk_MaxNormChi2_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumNormChi2");
77  trk_Algorithm_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::vector<std::string> >("TrackAlgorithm");
78  trk_Quality_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::vector<std::string> >("TrackQuality");
79  min_Ntrks_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumInputTracks");
80  convergence_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("FractionOfFittedTrks");
81  inputBeamWidth_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<double>("InputBeamWidth",-1.);
82 
83  for (unsigned int j=0;j<trk_Algorithm_.size();j++)
85  for (unsigned int j=0;j<trk_Quality_.size();j++)
87 
89  outputfilename_ = iConfig.getParameter<edm::ParameterSet>("BeamFitter").getUntrackedParameter<std::string>("OutputFileName");
90  file_ = TFile::Open(outputfilename_.c_str(),"RECREATE");
91  }
92  if (saveNtuple_) {
93  ftree_ = new TTree("mytree","mytree");
94  ftree_->AutoSave();
95 
96  ftree_->Branch("pt",&fpt,"fpt/D");
97  ftree_->Branch("d0",&fd0,"fd0/D");
98  ftree_->Branch("d0bs",&fd0bs,"fd0bs/D");
99  ftree_->Branch("sigmad0",&fsigmad0,"fsigmad0/D");
100  ftree_->Branch("phi0",&fphi0,"fphi0/D");
101  ftree_->Branch("z0",&fz0,"fz0/D");
102  ftree_->Branch("sigmaz0",&fsigmaz0,"fsigmaz0/D");
103  ftree_->Branch("theta",&ftheta,"ftheta/D");
104  ftree_->Branch("eta",&feta,"feta/D");
105  ftree_->Branch("charge",&fcharge,"fcharge/I");
106  ftree_->Branch("normchi2",&fnormchi2,"fnormchi2/D");
107  ftree_->Branch("nTotLayerMeas",&fnTotLayerMeas,"fnTotLayerMeas/i");
108  ftree_->Branch("nStripLayerMeas",&fnStripLayerMeas,"fnStripLayerMeas/i");
109  ftree_->Branch("nPixelLayerMeas",&fnPixelLayerMeas,"fnPixelLayerMeas/i");
110  ftree_->Branch("nTIBLayerMeas",&fnTIBLayerMeas,"fnTIBLayerMeas/i");
111  ftree_->Branch("nTOBLayerMeas",&fnTOBLayerMeas,"fnTOBLayerMeas/i");
112  ftree_->Branch("nTIDLayerMeas",&fnTIDLayerMeas,"fnTIDLayerMeas/i");
113  ftree_->Branch("nTECLayerMeas",&fnTECLayerMeas,"fnTECLayerMeas/i");
114  ftree_->Branch("nPXBLayerMeas",&fnPXBLayerMeas,"fnPXBLayerMeas/i");
115  ftree_->Branch("nPXFLayerMeas",&fnPXFLayerMeas,"fnPXFLayerMeas/i");
116  ftree_->Branch("cov",&fcov,"fcov[7][7]/D");
117  ftree_->Branch("vx",&fvx,"fvx/D");
118  ftree_->Branch("vy",&fvy,"fvy/D");
119  ftree_->Branch("quality",&fquality,"fquality/O");
120  ftree_->Branch("algo",&falgo,"falgo/O");
121  ftree_->Branch("run",&frun,"frun/i");
122  ftree_->Branch("lumi",&flumi,"flumi/i");
123  ftree_->Branch("pvValid",&fpvValid,"fpvValid/O");
124  ftree_->Branch("pvx", &fpvx, "fpvx/D");
125  ftree_->Branch("pvy", &fpvy, "fpvy/D");
126  ftree_->Branch("pvz", &fpvz, "fpvz/D");
127  }
128  if (saveBeamFit_){
129  ftreeFit_ = new TTree("fitResults","fitResults");
130  ftreeFit_->AutoSave();
131  ftreeFit_->Branch("run",&frunFit,"frunFit/i");
132  ftreeFit_->Branch("beginLumi",&fbeginLumiOfFit,"fbeginLumiOfFit/i");
133  ftreeFit_->Branch("endLumi",&fendLumiOfFit,"fendLumiOfFit/i");
134  ftreeFit_->Branch("beginTime",fbeginTimeOfFit,"fbeginTimeOfFit/C");
135  ftreeFit_->Branch("endTime",fendTimeOfFit,"fendTimeOfFit/C");
136  ftreeFit_->Branch("x",&fx,"fx/D");
137  ftreeFit_->Branch("y",&fy,"fy/D");
138  ftreeFit_->Branch("z",&fz,"fz/D");
139  ftreeFit_->Branch("sigmaZ",&fsigmaZ,"fsigmaZ/D");
140  ftreeFit_->Branch("dxdz",&fdxdz,"fdxdz/D");
141  ftreeFit_->Branch("dydz",&fdydz,"fdydz/D");
142  ftreeFit_->Branch("xErr",&fxErr,"fxErr/D");
143  ftreeFit_->Branch("yErr",&fyErr,"fyErr/D");
144  ftreeFit_->Branch("zErr",&fzErr,"fzErr/D");
145  ftreeFit_->Branch("sigmaZErr",&fsigmaZErr,"fsigmaZErr/D");
146  ftreeFit_->Branch("dxdzErr",&fdxdzErr,"fdxdzErr/D");
147  ftreeFit_->Branch("dydzErr",&fdydzErr,"fdydzErr/D");
148  ftreeFit_->Branch("widthX",&fwidthX,"fwidthX/D");
149  ftreeFit_->Branch("widthY",&fwidthY,"fwidthY/D");
150  ftreeFit_->Branch("widthXErr",&fwidthXErr,"fwidthXErr/D");
151  ftreeFit_->Branch("widthYErr",&fwidthYErr,"fwidthYErr/D");
152  }
153 
154  fBSvector.clear();
155  ftotal_tracks = 0;
158  frun = flumi = -1;
160  fquality = falgo = true;
161  fpvValid = true;
162  fpvx = fpvy = fpvz = 0;
163  fitted_ = false;
164  resetRefTime();
165 
166  //debug histograms
167  h1ntrks = new TH1F("h1ntrks","number of tracks per event",50,0,50);
168  h1vz_event = new TH1F("h1vz_event","track Vz", 50, -30, 30 );
169  h1cutFlow = new TH1F("h1cutFlow","Cut flow table of track selection", 9, 0, 9);
170  h1cutFlow->GetXaxis()->SetBinLabel(1,"No cut");
171  h1cutFlow->GetXaxis()->SetBinLabel(2,"Traker hits");
172  h1cutFlow->GetXaxis()->SetBinLabel(3,"Pixel hits");
173  h1cutFlow->GetXaxis()->SetBinLabel(4,"norm. #chi^{2}");
174  h1cutFlow->GetXaxis()->SetBinLabel(5,"algo");
175  h1cutFlow->GetXaxis()->SetBinLabel(6,"quality");
176  h1cutFlow->GetXaxis()->SetBinLabel(7,"d_{0}");
177  h1cutFlow->GetXaxis()->SetBinLabel(8,"z_{0}");
178  h1cutFlow->GetXaxis()->SetBinLabel(9,"p_{T}");
179  resetCutFlow();
180 
181  // Primary vertex fitter
182  MyPVFitter = new PVFitter(iConfig);
183  MyPVFitter->resetAll();
184  if (savePVVertices_){
185  fPVTree_ = new TTree("PrimaryVertices","PrimaryVertices");
187  }
188 
189  // check filename
190  ffilename_changed = false;
191  if (writeDIPTxt_)
192  fasciiDIP.open(outputDIPTxt_.c_str());
193 }
194 
196 
197  if (saveNtuple_) {
198  file_->cd();
199  if (fitted_ && h1z) h1z->Write();
200  h1ntrks->Write();
201  h1vz_event->Write();
202  if (h1cutFlow) h1cutFlow->Write();
203  ftree_->Write();
204  }
205  if (saveBeamFit_){
206  file_->cd();
207  ftreeFit_->Write();
208  }
209  if (savePVVertices_){
210  file_->cd();
211  fPVTree_->Write();
212  }
213 
214 
216  file_->Close();
217  delete file_;
218  }
219  delete MyPVFitter;
220 }
221 
222 
224 {
225 
226 
227  frun = iEvent.id().run();
228  const edm::TimeValue_t ftimestamp = iEvent.time().value();
229  const std::time_t ftmptime = ftimestamp >> 32;
230 
231  if (fbeginLumiOfFit == -1) freftime[0] = freftime[1] = ftmptime;
232  if (freftime[0] == 0 || ftmptime < freftime[0]) freftime[0] = ftmptime;
233  if (freftime[1] == 0 || ftmptime > freftime[1]) freftime[1] = ftmptime;
234  // Update the human-readable string versions of the time
235  updateBTime();
236 
237  flumi = iEvent.luminosityBlock();
238  frunFit = frun;
241 
243  iEvent.getByLabel(tracksLabel_, TrackCollection);
244 
245  //------ Primary Vertices
247  bool hasPVs = false;
249  if ( iEvent.getByLabel(vertexLabel_, PVCollection ) ) {
250  pv = *PVCollection;
251  hasPVs = true;
252  }
253  //------
254 
255  //------ Beam Spot in current event
256  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
257  const reco::BeamSpot *refBS = 0;
258  if ( iEvent.getByLabel("offlineBeamSpot",recoBeamSpotHandle) )
259  refBS = recoBeamSpotHandle.product();
260  //-------
261 
262  const reco::TrackCollection *tracks = TrackCollection.product();
263 
264  double eventZ = 0;
265  double averageZ = 0;
266 
267  for ( reco::TrackCollection::const_iterator track = tracks->begin();
268  track != tracks->end();
269  ++track ) {
270 
271  if ( ! isMuon_) {
272 
273  const reco::HitPattern& trkHP = track->hitPattern();
274 
284  } else {
285 
286  fnTotLayerMeas = track->numberOfValidHits();
287 
288  }
289 
290  fpt = track->pt();
291  feta = track->eta();
292  fphi0 = track->phi();
293  fcharge = track->charge();
294  fnormchi2 = track->normalizedChi2();
295  fd0 = track->d0();
296  if (refBS) fd0bs = -1*track->dxy(refBS->position());
297  else fd0bs = 0.;
298 
299  fsigmad0 = track->d0Error();
300  fz0 = track->dz();
301  fsigmaz0 = track->dzError();
302  ftheta = track->theta();
303  fvx = track->vx();
304  fvy = track->vy();
305 
306  for (int i=0; i<5; ++i) {
307  for (int j=0; j<5; ++j) {
308  fcov[i][j] = track->covariance(i,j);
309  }
310  }
311 
312  fquality = true;
313  falgo = true;
314 
315  if (! isMuon_ ) {
316  if (quality_.size()!=0) {
317  fquality = false;
318  for (unsigned int i = 0; i<quality_.size();++i) {
319  if(debug_) edm::LogInfo("BeamFitter") << "quality_[" << i << "] = " << track->qualityName(quality_[i]) << std::endl;
320  if (track->quality(quality_[i])) {
321  fquality = true;
322  break;
323  }
324  }
325  }
326 
327 
328  // Track algorithm
329 
330  if (algorithm_.size()!=0) {
331  if (std::find(algorithm_.begin(),algorithm_.end(),track->algo())==algorithm_.end())
332  falgo = false;
333  }
334 
335  }
336 
337  // check if we have a valid PV
338  fpvValid = false;
339 
340  if ( hasPVs ) {
341 
342  for ( size_t ipv=0; ipv != pv.size(); ++ipv ) {
343 
344  if (! pv[ipv].isFake() ) fpvValid = true;
345 
346  if ( ipv==0 && !pv[0].isFake() ) { fpvx = pv[0].x(); fpvy = pv[0].y(); fpvz = pv[0].z(); } // fix this later
347 
348 
349  }
350 
351  }
352 
353 
354  if (saveNtuple_) ftree_->Fill();
355  ftotal_tracks++;
356 
358  // Track selection
359  if (fnTotLayerMeas >= trk_MinNTotLayers_) { countPass[1] += 1;
361  if (fnormchi2 < trk_MaxNormChi2_) { countPass[3] += 1;
362  if (falgo) {countPass[4] += 1;
363  if (fquality) { countPass[5] += 1;
364  if (std::abs( fd0 ) < trk_MaxIP_) { countPass[6] += 1;
365  if (std::abs( fz0 ) < trk_MaxZ_){ countPass[7] += 1;
366  if (fpt > trk_MinpT_) {
367  countPass[8] += 1;
368  if (std::abs( feta ) < trk_MaxEta_
369  //&& fpvValid
370  ) {
371  if (debug_) {
372  edm::LogInfo("BeamFitter") << "Selected track quality = " << track->qualityMask()
373  << "; track algorithm = " << track->algoName() << "= TrackAlgorithm: " << track->algo() << std::endl;
374  }
376  BSTrk.setVx(fvx);
377  BSTrk.setVy(fvy);
378  fBSvector.push_back(BSTrk);
379  averageZ += fz0;
380  }
381  }
382  }
383  }
384  }
385  }
386  }
387  }
388  }// track selection
389 
390  }// tracks
391 
392  averageZ = averageZ/(float)(fBSvector.size());
393 
394  for( std::vector<BSTrkParameters>::const_iterator iparam = fBSvector.begin(); iparam != fBSvector.end(); ++iparam) {
395 
396  eventZ += fabs( iparam->z0() - averageZ );
397 
398  }
399 
400  h1ntrks->Fill( fBSvector.size() );
401  h1vz_event->Fill( eventZ/(float)(fBSvector.size() ) ) ;
402  for (unsigned int i=0; i < sizeof(countPass)/sizeof(countPass[0]); i++)
403  h1cutFlow->SetBinContent(i+1,countPass[i]);
404 
405  MyPVFitter->readEvent(iEvent);
406 
407 }
408 
410 // run both PV and track fitters
411  bool fit_ok = false;
412  bool pv_fit_ok = false;
413  reco::BeamSpot bspotPV;
414  reco::BeamSpot bspotTrk;
415 
416  // First run PV fitter
418  edm::LogInfo("BeamFitter") << " [BeamFitterBxDebugTime] freftime[0] = " << freftime[0]
419  << "; address = " << &freftime[0]
420  << " = " << fbeginTimeOfFit << std::endl;
421  edm::LogInfo("BeamFitter") << " [BeamFitterBxDebugTime] freftime[1] = " << freftime[1]
422  << "; address = " << &freftime[1]
423  << " = " << fendTimeOfFit << std::endl;
424 
425  if ( MyPVFitter->runBXFitter() ) {
427  pv_fit_ok = true;
428  }
429  if(writeTxt_ ) dumpTxtFile(outputTxt_,true); // all reaults
430  if(writeDIPTxt_ && (pv_fit_ok || writeDIPBadFit_)) {
431  dumpTxtFile(outputDIPTxt_,false); // for DQM/DIP
432  }
433  return pv_fit_ok;
434  }
435 
436  if ( MyPVFitter->runFitter() ) {
437 
438  bspotPV = MyPVFitter->getBeamSpot();
439 
440  // take beam width from PV fit and pass it to track fitter
441  // assume circular transverse beam width
442  inputBeamWidth_ = sqrt( pow(bspotPV.BeamWidthX(),2) + pow(bspotPV.BeamWidthY(),2) )/sqrt(2);
443  pv_fit_ok = true;
444 
445  } else {
446  // problems with PV fit
448  bspotTrk.setType(reco::BeamSpot::Unknown); //propagate error to trk beam spot
449  }
450 
451  if ( runFitterNoTxt() ) {
452 
453  bspotTrk = fbeamspot;
454  fit_ok = true;
455  } else {
456  // beamfit failed, flagged as empty beam spot
457  bspotTrk.setType(reco::BeamSpot::Fake);
458  fit_ok = false;
459  }
460 
461  // combined results into one single beam spot
462 
463  // to pass errors I have to create another beam spot object
465  for (int j = 0 ; j < 7 ; ++j) {
466  for(int k = j ; k < 7 ; ++k) {
467  matrix(j,k) = bspotTrk.covariance(j,k);
468  }
469  }
470  // change beam width error to one from PV
471  if (pv_fit_ok && fit_ok ) {
473 
474  // get Z and sigmaZ from PV fit
475  matrix(2,2) = bspotPV.covariance(2,2);
476  matrix(3,3) = bspotPV.covariance(3,3);
477  reco::BeamSpot tmpbs(reco::BeamSpot::Point(bspotTrk.x0(), bspotTrk.y0(),
478  bspotPV.z0() ),
479  bspotPV.sigmaZ() ,
480  bspotTrk.dxdz(),
481  bspotTrk.dydz(),
482  bspotPV.BeamWidthX(),
483  matrix,
484  bspotPV.type() );
485  tmpbs.setBeamWidthY( bspotPV.BeamWidthY() );
486  // overwrite beam spot result
487  fbeamspot = tmpbs;
488  }
489  if (pv_fit_ok && fit_ok) {
490  fbeamspot.setType(bspotPV.type());
491  }
492  else if(!pv_fit_ok && fit_ok){
494  }
495  else if(pv_fit_ok && !fit_ok){
497  }
498  else if(!pv_fit_ok && !fit_ok){
500  }
501 
502  if(writeTxt_ ) dumpTxtFile(outputTxt_,true); // all reaults
503  if(writeDIPTxt_ && ((fit_ok && pv_fit_ok) || writeDIPBadFit_)) {
504  dumpTxtFile(outputDIPTxt_,false); // for DQM/DIP
505  for(size_t i= 0; i < 7; i++)ForDIPPV_.push_back(0.0);
506  }
507 
508  return fit_ok && pv_fit_ok;
509 }
510 
512  edm::LogInfo("BeamFitter") << " [BeamFitterDebugTime] freftime[0] = " << freftime[0]
513  << "; address = " << &freftime[0]
514  << " = " << fbeginTimeOfFit << std::endl;
515  edm::LogInfo("BeamFitter") << " [BeamFitterDebugTime] freftime[1] = " << freftime[1]
516  << "; address = " << &freftime[1]
517  << " = " << fendTimeOfFit << std::endl;
518 
519  if (fbeginLumiOfFit == -1 || fendLumiOfFit == -1) {
520  edm::LogWarning("BeamFitter") << "No event read! No Fitting!" << std::endl;
521  return false;
522  }
523 
524  bool fit_ok = false;
525  // default fit to extract beam spot info
526  if(fBSvector.size() > 1 ){
527 
528  edm::LogInfo("BeamFitter") << "Calculating beam spot..." << std::endl
529  << "We will use " << fBSvector.size() << " good tracks out of " << ftotal_tracks << std::endl;
530 
531  BSFitter *myalgo = new BSFitter( fBSvector );
532  myalgo->SetMaximumZ( trk_MaxZ_ );
533  myalgo->SetConvergence( convergence_ );
534  myalgo->SetMinimumNTrks( min_Ntrks_ );
536 
537  fbeamspot = myalgo->Fit();
538 
539 
540  // retrieve histogram for Vz
541  h1z = (TH1F*) myalgo->GetVzHisto();
542 
543  delete myalgo;
544  if ( fbeamspot.type() != 0 ) {// save all results except for Fake (all 0.)
545  fit_ok = true;
546  if (saveBeamFit_){
547  fx = fbeamspot.x0();
548  fy = fbeamspot.y0();
549  fz = fbeamspot.z0();
551  fdxdz = fbeamspot.dxdz();
552  fdydz = fbeamspot.dydz();
555  fxErr = fbeamspot.x0Error();
556  fyErr = fbeamspot.y0Error();
557  fzErr = fbeamspot.z0Error();
563  ftreeFit_->Fill();
564  }
565  }
566  }
567  else{ // tracks <= 1
568  reco::BeamSpot tmpbs;
569  fbeamspot = tmpbs;
571  edm::LogInfo("BeamFitter") << "Not enough good tracks selected! No beam fit!" << std::endl;
572 
573  }
574  fitted_ = true;
575  return fit_ok;
576 
577 }
578 
580 
581  bool fit_ok = runFitterNoTxt();
582 
583  if(writeTxt_ ) dumpTxtFile(outputTxt_,true); // all reaults
584  if(writeDIPTxt_ && (fit_ok || writeDIPBadFit_)) {
585  dumpTxtFile(outputDIPTxt_,false); // for DQM/DIP
586  }
587  return fit_ok;
588 }
589 
591  bool widthfit_ok = false;
592  // default fit to extract beam spot info
593  if(fBSvector.size() > 1 ){
594 
595  edm::LogInfo("BeamFitter") << "Calculating beam spot positions('d0-phi0' method) and width using llh Fit"<< std::endl
596  << "We will use " << fBSvector.size() << " good tracks out of " << ftotal_tracks << std::endl;
597 
598  BSFitter *myalgo = new BSFitter( fBSvector );
599  myalgo->SetMaximumZ( trk_MaxZ_ );
600  myalgo->SetConvergence( convergence_ );
601  myalgo->SetMinimumNTrks(min_Ntrks_);
603 
604 
605  myalgo->SetFitVariable(std::string("d*z"));
606  myalgo->SetFitType(std::string("likelihood"));
607  fbeamWidthFit = myalgo->Fit();
608 
609  //Add to .txt file
611 
612  delete myalgo;
613 
614  // not fake
615  if ( fbeamspot.type() != 0 )
616  widthfit_ok = true;
617  }
618  else{
620  edm::LogWarning("BeamFitter") << "Not enough good tracks selected! No beam fit!" << std::endl;
621  }
622  return widthfit_ok;
623 }
624 
625 void BeamFitter::dumpBWTxtFile(std::string & fileName ){
626  std::ofstream outFile;
627  outFile.open(fileName.c_str(),std::ios::app);
628  outFile<<"-------------------------------------------------------------------------------------------------------------------------------------------------------------"<<std::endl;
629  outFile<<"Beam width(in cm) from Log-likelihood fit (Here we assume a symmetric beam(SigmaX=SigmaY)!)"<<std::endl;
630  outFile<<" "<<std::endl;
631  outFile << "BeamWidth = " <<fbeamWidthFit.BeamWidthX() <<" +/- "<<fbeamWidthFit.BeamWidthXError() << std::endl;
632  outFile.close();
633 }
634 
635 void BeamFitter::dumpTxtFile(std::string & fileName, bool append){
636  std::ofstream outFile;
637 
638  std::string tmpname = outputTxt_;
639  char index[15];
640  if (appendRunTxt_ && !ffilename_changed ) {
641  sprintf(index,"%s%i","_Run", frun );
642  tmpname.insert(outputTxt_.length()-4,index);
643  fileName = tmpname;
644  ffilename_changed = true;
645  }
646 
647  if (!append)
648  outFile.open(fileName.c_str());
649  else
650  outFile.open(fileName.c_str(),std::ios::app);
651 
653 
654  for (std::map<int,reco::BeamSpot>::const_iterator abspot = fbspotPVMap.begin(); abspot!= fbspotPVMap.end(); ++abspot) {
655  reco::BeamSpot beamspottmp = abspot->second;
656  int bx = abspot->first;
657 
658  outFile << "Runnumber " << frun << " bx " << bx << std::endl;
659  outFile << "BeginTimeOfFit " << fbeginTimeOfFit << " " << freftime[0] << std::endl;
660  outFile << "EndTimeOfFit " << fendTimeOfFit << " " << freftime[1] << std::endl;
661  outFile << "LumiRange " << fbeginLumiOfFit << " - " << fendLumiOfFit << std::endl;
662  outFile << "Type " << beamspottmp.type() << std::endl;
663  outFile << "X0 " << beamspottmp.x0() << std::endl;
664  outFile << "Y0 " << beamspottmp.y0() << std::endl;
665  outFile << "Z0 " << beamspottmp.z0() << std::endl;
666  outFile << "sigmaZ0 " << beamspottmp.sigmaZ() << std::endl;
667  outFile << "dxdz " << beamspottmp.dxdz() << std::endl;
668  outFile << "dydz " << beamspottmp.dydz() << std::endl;
669  outFile << "BeamWidthX " << beamspottmp.BeamWidthX() << std::endl;
670  outFile << "BeamWidthY " << beamspottmp.BeamWidthY() << std::endl;
671  for (int i = 0; i<6; ++i) {
672  outFile << "Cov("<<i<<",j) ";
673  for (int j=0; j<7; ++j) {
674  outFile << beamspottmp.covariance(i,j) << " ";
675  }
676  outFile << std::endl;
677  }
678  outFile << "Cov(6,j) 0 0 0 0 0 0 " << beamspottmp.covariance(6,6) << std::endl;
679  //}
680  outFile << "EmittanceX " << beamspottmp.emittanceX() << std::endl;
681  outFile << "EmittanceY " << beamspottmp.emittanceY() << std::endl;
682  outFile << "BetaStar " << beamspottmp.betaStar() << std::endl;
683 
684  }
685  }//if bx results needed
686  else {
687  outFile << "Runnumber " << frun << std::endl;
688  outFile << "BeginTimeOfFit " << fbeginTimeOfFit << " " << freftime[0] << std::endl;
689  outFile << "EndTimeOfFit " << fendTimeOfFit << " " << freftime[1] << std::endl;
690  outFile << "LumiRange " << fbeginLumiOfFit << " - " << fendLumiOfFit << std::endl;
691  outFile << "Type " << fbeamspot.type() << std::endl;
692  outFile << "X0 " << fbeamspot.x0() << std::endl;
693  outFile << "Y0 " << fbeamspot.y0() << std::endl;
694  outFile << "Z0 " << fbeamspot.z0() << std::endl;
695  outFile << "sigmaZ0 " << fbeamspot.sigmaZ() << std::endl;
696  outFile << "dxdz " << fbeamspot.dxdz() << std::endl;
697  outFile << "dydz " << fbeamspot.dydz() << std::endl;
698  // if (inputBeamWidth_ > 0 ) {
699  // outFile << "BeamWidthX " << inputBeamWidth_ << std::endl;
700  // outFile << "BeamWidthY " << inputBeamWidth_ << std::endl;
701  // } else {
702  outFile << "BeamWidthX " << fbeamspot.BeamWidthX() << std::endl;
703  outFile << "BeamWidthY " << fbeamspot.BeamWidthY() << std::endl;
704  // }
705 
706  for (int i = 0; i<6; ++i) {
707  outFile << "Cov("<<i<<",j) ";
708  for (int j=0; j<7; ++j) {
709  outFile << fbeamspot.covariance(i,j) << " ";
710  }
711  outFile << std::endl;
712  }
713 
714  // beam width error
715  //if (inputBeamWidth_ > 0 ) {
716  // outFile << "Cov(6,j) 0 0 0 0 0 0 " << "1e-4" << std::endl;
717  //} else {
718  outFile << "Cov(6,j) 0 0 0 0 0 0 " << fbeamspot.covariance(6,6) << std::endl;
719  //}
720  outFile << "EmittanceX " << fbeamspot.emittanceX() << std::endl;
721  outFile << "EmittanceY " << fbeamspot.emittanceY() << std::endl;
722  outFile << "BetaStar " << fbeamspot.betaStar() << std::endl;
723 
724  //write here Pv info for DIP only: This added only if append is false, which happen for DIP only :)
725  if(!append){
726  outFile << "events "<< (int)ForDIPPV_[0] << std::endl;
727  outFile << "meanPV "<< ForDIPPV_[1] << std::endl;
728  outFile << "meanErrPV "<< ForDIPPV_[2] << std::endl;
729  outFile << "rmsPV "<< ForDIPPV_[3] << std::endl;
730  outFile << "rmsErrPV "<< ForDIPPV_[4] << std::endl;
731  outFile << "maxPV "<< (int)ForDIPPV_[5] << std::endl;
732  outFile << "nPV "<< (int)ForDIPPV_[6] << std::endl;
733  }//writeDIPPVInfo_
734  }//else end here
735 
736  outFile.close();
737 }
738 
740  BeamSpotObjects *pBSObjects = new BeamSpotObjects();
741 
742  pBSObjects->SetPosition(fbeamspot.position().X(),fbeamspot.position().Y(),fbeamspot.position().Z());
743  //std::cout << " wrote: x= " << fbeamspot.position().X() << " y= "<< fbeamspot.position().Y() << " z= " << fbeamspot.position().Z() << std::endl;
744  pBSObjects->SetSigmaZ(fbeamspot.sigmaZ());
745  pBSObjects->Setdxdz(fbeamspot.dxdz());
746  pBSObjects->Setdydz(fbeamspot.dydz());
747  //if (inputBeamWidth_ > 0 ) {
748  // std::cout << " beam width value forced to be " << inputBeamWidth_ << std::endl;
749  // pBSObjects->SetBeamWidthX(inputBeamWidth_);
750  // pBSObjects->SetBeamWidthY(inputBeamWidth_);
751  //} else {
752  // need to fix this
753  //std::cout << " using default value, 15e-4, for beam width!!!"<<std::endl;
754  pBSObjects->SetBeamWidthX(fbeamspot.BeamWidthX() );
755  pBSObjects->SetBeamWidthY(fbeamspot.BeamWidthY() );
756  //}
757 
758  for (int i = 0; i<7; ++i) {
759  for (int j=0; j<7; ++j) {
760  pBSObjects->SetCovariance(i,j,fbeamspot.covariance(i,j));
761  }
762  }
764  if( poolDbService.isAvailable() ) {
765  std::cout << "poolDBService available"<<std::endl;
766  if ( poolDbService->isNewTagRequest( "BeamSpotObjectsRcd" ) ) {
767  std::cout << "new tag requested" << std::endl;
768  poolDbService->createNewIOV<BeamSpotObjects>( pBSObjects, poolDbService->beginOfTime(),poolDbService->endOfTime(),
769  "BeamSpotObjectsRcd" );
770  }
771  else {
772  std::cout << "no new tag requested" << std::endl;
773  poolDbService->appendSinceTime<BeamSpotObjects>( pBSObjects, poolDbService->currentTime(),
774  "BeamSpotObjectsRcd" );
775  }
776  }
777 }
778 
780  if(fBSvector.size()!=0){
781  BSFitter *myalgo = new BSFitter( fBSvector );
782  fbeamspot = myalgo->Fit_d0phi();
783 
784  // iterative
785  if(debug_)
786  std::cout << " d0-phi Iterative:" << std::endl;
787  BSFitter *myitealgo = new BSFitter( fBSvector );
788  myitealgo->Setd0Cut_d0phi(4.0);
789  reco::BeamSpot beam_ite = myitealgo->Fit_ited0phi();
790  if (debug_){
791  std::cout << beam_ite << std::endl;
792  std::cout << "\n Now run tests of the different fits\n";
793  }
794  // from here are just tests
795  std::string fit_type = "chi2";
796  myalgo->SetFitVariable(std::string("z"));
797  myalgo->SetFitType(std::string("chi2"));
798  reco::BeamSpot beam_fit_z_chi2 = myalgo->Fit();
799  if (debug_){
800  std::cout << " z Chi2 Fit ONLY:" << std::endl;
801  std::cout << beam_fit_z_chi2 << std::endl;
802  }
803 
804  fit_type = "combined";
805  myalgo->SetFitVariable("z");
806  myalgo->SetFitType("combined");
807  reco::BeamSpot beam_fit_z_lh = myalgo->Fit();
808  if (debug_){
809  std::cout << " z Log-Likelihood Fit ONLY:" << std::endl;
810  std::cout << beam_fit_z_lh << std::endl;
811  }
812 
813  myalgo->SetFitVariable("d");
814  myalgo->SetFitType("d0phi");
815  reco::BeamSpot beam_fit_dphi = myalgo->Fit();
816  if (debug_){
817  std::cout << " d0-phi0 Fit ONLY:" << std::endl;
818  std::cout << beam_fit_dphi << std::endl;
819  }
820  /*
821  myalgo->SetFitVariable(std::string("d*z"));
822  myalgo->SetFitType(std::string("likelihood"));
823  reco::BeamSpot beam_fit_dz_lh = myalgo->Fit();
824  if (debug_){
825  std::cout << " Log-Likelihood Fit:" << std::endl;
826  std::cout << beam_fit_dz_lh << std::endl;
827  }
828 
829  myalgo->SetFitVariable(std::string("d*z"));
830  myalgo->SetFitType(std::string("resolution"));
831  reco::BeamSpot beam_fit_dresz_lh = myalgo->Fit();
832  if(debug_){
833  std::cout << " IP Resolution Fit" << std::endl;
834  std::cout << beam_fit_dresz_lh << std::endl;
835 
836  std::cout << "c0 = " << myalgo->GetResPar0() << " +- " << myalgo->GetResPar0Err() << std::endl;
837  std::cout << "c1 = " << myalgo->GetResPar1() << " +- " << myalgo->GetResPar1Err() << std::endl;
838  }
839  */
840  }
841  else
842  if (debug_) std::cout << "No good track selected! No beam fit!" << std::endl;
843 }
844 
RunNumber_t run() const
Definition: EventID.h:42
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:373
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:32
T getParameter(std::string const &) const
double trk_MaxZ_
Definition: BeamFitter.h:153
double trk_MaxEta_
Definition: BeamFitter.h:154
reco::BeamSpot fbeamspot
Definition: BeamFitter.h:136
double z0() const
z coordinate
Definition: BeamSpot.h:69
T getUntrackedParameter(std::string const &, T const &) const
double fwidthXErr
Definition: BeamFitter.h:237
int i
Definition: DBlmapReader.cc:9
double fwidthX
Definition: BeamFitter.h:235
std::vector< std::string > trk_Algorithm_
Definition: BeamFitter.h:159
edm::InputTag vertexLabel_
Definition: BeamFitter.h:146
double sigmaZ0Error() const
error on sigma z
Definition: BeamSpot.h:97
void setTree(TTree *tree)
Definition: PVFitter.cc:180
int fendLumiOfFit
Definition: BeamFitter.h:220
double fwidthY
Definition: BeamFitter.h:236
int countPass[9]
Definition: BeamFitter.h:243
bool isMuon_
Definition: BeamFitter.h:167
bool runPVandTrkFitter()
Definition: BeamFitter.cc:409
void write2DB()
Definition: BeamFitter.cc:739
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:355
reco::BeamSpot Fit()
Definition: BSFitter.cc:100
char fendTimeOfFit[32]
Definition: BeamFitter.h:222
double dydzError() const
error on dydz
Definition: BeamSpot.h:101
double fdxdz
Definition: BeamFitter.h:227
double fx
Definition: BeamFitter.h:223
double fnormchi2
Definition: BeamFitter.h:187
bool ffilename_changed
Definition: BeamFitter.h:169
bool debug_
Definition: BeamFitter.h:143
std::map< int, reco::BeamSpot > getBeamSpotMap()
Definition: PVFitter.h:86
bool runBeamWidthFitter()
Definition: BeamFitter.cc:590
void SetSigmaZ(double val)
set sigma Z, RMS bunch length
TH1F * h1z
Definition: BeamFitter.h:176
void SetMaximumZ(double z)
Definition: BSFitter.h:62
int fnTOBLayerMeas
Definition: BeamFitter.h:199
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
double feta
Definition: BeamFitter.h:185
std::vector< std::string > trk_Quality_
Definition: BeamFitter.h:160
int pixelLayersWithMeasurement() const
Definition: HitPattern.h:710
#define abs(x)
Definition: mlp_lapack.h:159
double convergence_
Definition: BeamFitter.h:164
double trk_MaxNormChi2_
Definition: BeamFitter.h:158
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
void dumpBWTxtFile(std::string &)
Definition: BeamFitter.cc:625
double fsigmaZErr
Definition: BeamFitter.h:232
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
TH1F * h1vz_event
Definition: BeamFitter.h:241
void SetCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
const char * formatBTime(const std::time_t &)
Definition: BeamFitter.cc:34
double fvy
Definition: BeamFitter.h:207
void SetInputBeamWidth(double val)
Definition: BSFitter.h:67
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void Setdydz(double val)
set dydz slope, crossing angle in XZ
int fnPixelLayerMeas
Definition: BeamFitter.h:195
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:346
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:223
double fphi0
Definition: BeamFitter.h:188
std::ofstream fasciiDIP
Definition: BeamFitter.h:141
double emittanceX() const
additional information
Definition: BeamSpot.h:137
void setType(BeamType type)
set beam type
Definition: BeamSpot.h:132
reco::BeamSpot fbeamWidthFit
Definition: BeamFitter.h:137
std::time_t freftime[2]
Definition: BeamFitter.h:214
PVFitter * MyPVFitter
Definition: BeamFitter.h:245
double betaStar() const
Definition: BeamSpot.h:139
std::vector< BSTrkParameters > fBSvector
Definition: BeamFitter.h:135
int fnTotLayerMeas
Definition: BeamFitter.h:194
double dydz() const
dydz slope
Definition: BeamSpot.h:85
std::string outputTxt_
Definition: BeamFitter.h:150
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
double fpvx
Definition: BeamFitter.h:213
int iEvent
Definition: GenABIO.cc:243
double fdxdzErr
Definition: BeamFitter.h:233
double trk_MaxIP_
Definition: BeamFitter.h:155
void readEvent(const edm::Event &iEvent)
Definition: PVFitter.cc:83
bool runFitter()
Definition: BeamFitter.cc:579
void setBeamWidthY(double v)
Definition: BeamSpot.h:110
double emittanceY() const
Definition: BeamSpot.h:138
bool runFitterNoTxt()
Definition: BeamFitter.cc:511
TFile * file_
Definition: BeamFitter.h:181
double dxdzError() const
error on dxdz
Definition: BeamSpot.h:99
TTree * ftree_
Definition: BeamFitter.h:182
double fyErr
Definition: BeamFitter.h:230
bool falgo
Definition: BeamFitter.h:211
bool isNewTagRequest(const std::string &recordName)
int ftotal_tracks
Definition: BeamFitter.h:165
int min_Ntrks_
Definition: BeamFitter.h:166
edm::InputTag tracksLabel_
Definition: BeamFitter.h:145
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:364
int trackerLayersWithMeasurement() const
Definition: HitPattern.h:705
T sqrt(T t)
Definition: SSEVec.h:46
TH1F * h1cutFlow
Definition: BeamFitter.h:242
double fdydz
Definition: BeamFitter.h:228
TTree * fPVTree_
Definition: BeamFitter.h:246
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
Definition: BeamFitter.h:162
bool isAvailable() const
Definition: Service.h:47
TH1F * h1ntrks
Definition: BeamFitter.h:240
char fbeginTimeOfFit[32]
Definition: BeamFitter.h:221
double fpvz
Definition: BeamFitter.h:213
double fz0
Definition: BeamFitter.h:192
int j
Definition: DBlmapReader.cc:9
double ftheta
Definition: BeamFitter.h:183
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:87
double fd0
Definition: BeamFitter.h:189
bool fquality
Definition: BeamFitter.h:210
double fy
Definition: BeamFitter.h:224
void Setdxdz(double val)
set dxdz slope, crossing angle
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:106
int fnStripLayerMeas
Definition: BeamFitter.h:196
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:104
double z0Error() const
error on z
Definition: BeamSpot.h:95
double fwidthYErr
Definition: BeamFitter.h:238
unsigned long long TimeValue_t
Definition: Timestamp.h:27
double fxErr
Definition: BeamFitter.h:229
bool appendRunTxt_
Definition: BeamFitter.h:144
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void setVx(double vx)
int fnTIDLayerMeas
Definition: BeamFitter.h:198
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
double dxdz() const
dxdz slope
Definition: BeamSpot.h:83
bool saveNtuple_
Definition: BeamFitter.h:177
double x0Error() const
error on x
Definition: BeamSpot.h:91
double y0Error() const
error on y
Definition: BeamSpot.h:93
int k[5][pyjets_maxn]
double fsigmaZ
Definition: BeamFitter.h:226
int fbeginLumiOfFit
Definition: BeamFitter.h:219
std::string outputfilename_
Definition: BeamFitter.h:180
bool writeTxt_
Definition: BeamFitter.h:147
double fsigmad0
Definition: BeamFitter.h:191
TimeValue_t value() const
Definition: Timestamp.cc:72
std::string outputDIPTxt_
Definition: BeamFitter.h:151
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
bool fpvValid
Definition: BeamFitter.h:212
double fdydzErr
Definition: BeamFitter.h:234
virtual ~BeamFitter()
Definition: BeamFitter.cc:195
void dumpTxtFile(std::string &, bool)
Definition: BeamFitter.cc:635
std::vector< float > ForDIPPV_
Definition: BeamFitter.h:172
double inputBeamWidth_
Definition: BeamFitter.h:163
tuple tracks
Definition: testEve_cfg.py:39
reco::BeamSpot Fit_ited0phi()
Definition: BSFitter.cc:391
bool savePVVertices_
Definition: BeamFitter.h:179
bool runFitter()
Definition: PVFitter.cc:319
void SetFitVariable(std::string name)
Definition: BSFitter.h:46
void updateBTime()
Definition: BeamFitter.cc:44
double sigmaZ() const
sigma z
Definition: BeamSpot.h:81
int stripLayersWithMeasurement() const
Definition: HitPattern.h:715
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:337
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:89
void runAllFitter()
Definition: BeamFitter.cc:779
void SetMinimumNTrks(int n)
Definition: BSFitter.h:64
size_type size() const
void resetAll()
Definition: PVFitter.h:74
bool writeDIPTxt_
Definition: BeamFitter.h:148
double fvx
Definition: BeamFitter.h:206
void setVy(double vy)
void SetBeamWidthX(double val)
set average transverse beam width X
T const * product() const
Definition: Handle.h:74
double fpt
Definition: BeamFitter.h:184
void SetBeamWidthY(double val)
set average transverse beam width Y
bool runBXFitter()
Definition: PVFitter.cc:185
void Setd0Cut_d0phi(double d0cut)
Definition: BSFitter.cc:623
std::map< int, reco::BeamSpot > fbspotPVMap
Definition: BeamFitter.h:138
double covariance(int i, int j) const
(i,j)-th element of error matrix
Definition: BeamSpot.h:113
edm::EventID id() const
Definition: EventBase.h:56
double fcov[7][7]
Definition: BeamFitter.h:205
std::vector< reco::TrackBase::TrackQuality > quality_
Definition: BeamFitter.h:161
double fsigmaz0
Definition: BeamFitter.h:193
int trk_MinNPixLayers_
Definition: BeamFitter.h:157
int fnTIBLayerMeas
Definition: BeamFitter.h:197
TH1F * GetVzHisto()
Definition: BSFitter.h:106
TTree * ftreeFit_
Definition: BeamFitter.h:217
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:382
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:55
double y0() const
y coordinate
Definition: BeamSpot.h:67
void resetCutFlow()
Definition: BeamFitter.h:100
double fd0bs
Definition: BeamFitter.h:190
tuple cout
Definition: gather_cfg.py:121
const Point & position() const
position
Definition: BeamSpot.h:63
double trk_MinpT_
Definition: BeamFitter.h:152
reco::BeamSpot getBeamSpot()
Definition: PVFitter.h:85
bool writeDIPBadFit_
Definition: BeamFitter.h:149
void SetConvergence(double val)
Definition: BSFitter.h:63
reco::BeamSpot Fit_d0phi()
Definition: BSFitter.cc:447
double fzErr
Definition: BeamFitter.h:231
int fnPXBLayerMeas
Definition: BeamFitter.h:201
bool IsFitPerBunchCrossing()
Definition: PVFitter.h:87
edm::Timestamp time() const
Definition: EventBase.h:57
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double fpvy
Definition: BeamFitter.h:213
bool saveBeamFit_
Definition: BeamFitter.h:178
double fz
Definition: BeamFitter.h:225
double getWidthXerr()
Definition: PVFitter.h:51
bool fitted_
Definition: BeamFitter.h:168
int fnPXFLayerMeas
Definition: BeamFitter.h:202
BeamType type() const
return beam type
Definition: BeamSpot.h:130
int fnTECLayerMeas
Definition: BeamFitter.h:200
int trk_MinNTotLayers_
Definition: BeamFitter.h:156
void SetPosition(double x, double y, double z)
set XYZ position
double x0() const
x coordinate
Definition: BeamSpot.h:65
void resetRefTime()
Definition: BeamFitter.h:51
void SetFitType(std::string type)
Definition: BSFitter.h:42