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