CMS 3D CMS Logo

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