CMS 3D CMS Logo

MuonAlignmentFromReference.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonAlignmentAlgorithms
4 // Class: MuonAlignmentFromReference
5 //
13 //
14 // Original Author: Jim Pivarski,,,
15 // Created: Sat Jan 24 16:20:28 CST 2009
16 // $Id: MuonAlignmentFromReference.cc,v 1.39 2011/10/13 00:03:12 khotilov Exp $
17 
19 
27 
32 
38 
44 
46 
59 
65 
66 #include "TFile.h"
67 #include "TTree.h"
68 #include "TStopwatch.h"
69 
70 #include <map>
71 #include <sstream>
72 #include <fstream>
73 
75 public:
77  ~MuonAlignmentFromReference() override;
78 
79  void initialize(const edm::EventSetup& iSetup,
80  AlignableTracker* alignableTracker,
81  AlignableMuon* alignableMuon,
82  AlignableExtras* extras,
83  AlignmentParameterStore* alignmentParameterStore) override;
84 
85  void startNewLoop() override{};
86 
87  void run(const edm::EventSetup& iSetup, const EventInfo& eventInfo) override;
88 
90 
91  void terminate(const edm::EventSetup& iSetup) override;
92 
93 private:
94  bool numeric(std::string s);
95  int number(std::string s);
97 
99  const align::Alignables& all_DT_chambers,
100  const align::Alignables& all_CSC_chambers);
101 
102  void fitAndAlign();
103  void readTmpFiles();
104  void writeTmpFiles();
105 
106  void selectResidualsPeaks();
107  void correctBField();
108  void fiducialCuts();
110 
111  void fillNtuple();
112 
113  // tokens
119 
120  // configutarion paramenters:
122  std::vector<std::string> m_reference;
123  double m_minTrackPt;
124  double m_maxTrackPt;
125  double m_minTrackP;
126  double m_maxTrackP;
127  double m_maxDxy;
136  std::vector<std::string> m_readTemporaryFiles;
141  bool m_twoBin;
147  double m_peakNSigma;
149  bool m_doDT;
150  bool m_doCSC;
152 
153  // utility objects
157  std::map<Alignable*, Alignable*> m_me11map;
158  std::map<Alignable*, MuonResidualsTwoBin*> m_fitters;
159  std::vector<unsigned int> m_indexes;
160  std::map<unsigned int, MuonResidualsTwoBin*> m_fitterOrder;
161 
162  // counters
186 
187  // debug ntuple
188  void bookNtuple();
189  TTree* m_ttree;
191 
192  bool m_debug;
193 };
194 
197  m_cscGeometryToken(iC.esConsumes<edm::Transition::BeginRun>()),
198  m_globTackingToken(iC.esConsumes()),
199  m_MagFieldToken(iC.esConsumes()),
200  m_propToken(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))),
201  m_DetIdToken(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))),
202  m_muonCollectionTag(cfg.getParameter<edm::InputTag>("muonCollectionTag")),
203  m_reference(cfg.getParameter<std::vector<std::string> >("reference")),
204  m_minTrackPt(cfg.getParameter<double>("minTrackPt")),
205  m_maxTrackPt(cfg.getParameter<double>("maxTrackPt")),
206  m_minTrackP(cfg.getParameter<double>("minTrackP")),
207  m_maxTrackP(cfg.getParameter<double>("maxTrackP")),
208  m_maxDxy(cfg.getParameter<double>("maxDxy")),
209  m_minTrackerHits(cfg.getParameter<int>("minTrackerHits")),
210  m_maxTrackerRedChi2(cfg.getParameter<double>("maxTrackerRedChi2")),
211  m_allowTIDTEC(cfg.getParameter<bool>("allowTIDTEC")),
212  m_minNCrossedChambers(cfg.getParameter<int>("minNCrossedChambers")),
213  m_minDT13Hits(cfg.getParameter<int>("minDT13Hits")),
214  m_minDT2Hits(cfg.getParameter<int>("minDT2Hits")),
215  m_minCSCHits(cfg.getParameter<int>("minCSCHits")),
216  m_writeTemporaryFile(cfg.getParameter<std::string>("writeTemporaryFile")),
217  m_readTemporaryFiles(cfg.getParameter<std::vector<std::string> >("readTemporaryFiles")),
218  m_doAlignment(cfg.getParameter<bool>("doAlignment")),
219  m_strategy(cfg.getParameter<int>("strategy")),
220  m_residualsModel(cfg.getParameter<std::string>("residualsModel")),
221  m_minAlignmentHits(cfg.getParameter<int>("minAlignmentHits")),
222  m_twoBin(cfg.getParameter<bool>("twoBin")),
223  m_combineME11(cfg.getParameter<bool>("combineME11")),
224  m_weightAlignment(cfg.getParameter<bool>("weightAlignment")),
225  m_reportFileName(cfg.getParameter<std::string>("reportFileName")),
226  m_maxResSlopeY(cfg.getParameter<double>("maxResSlopeY")),
227  m_createNtuple(cfg.getParameter<bool>("createNtuple")),
228  m_peakNSigma(cfg.getParameter<double>("peakNSigma")),
229  m_BFieldCorrection(cfg.getParameter<int>("bFieldCorrection")),
230  m_doDT(cfg.getParameter<bool>("doDT")),
231  m_doCSC(cfg.getParameter<bool>("doCSC")),
232  m_useResiduals(cfg.getParameter<std::string>("useResiduals")) {
233  // alignment requires a TFile to provide plots to check the fit output
234  // just filling the residuals lists does not
235  // but we don't want to wait until the end of the job to find out that the TFile is missing
236  if (m_doAlignment || m_createNtuple) {
238  TFile& tfile = fs->file();
239  tfile.ls();
240  }
241 
242  m_ttree = nullptr;
243  if (m_createNtuple)
244  bookNtuple();
245 
246  m_counter_events = 0;
247  m_counter_tracks = 0;
249  m_counter_trackdxy = 0;
260  m_counter_station4 = 0;
264  m_counter_csc = 0;
265  m_counter_cscvalid = 0;
266  m_counter_cschits = 0;
269 
270  m_debug = false;
271 }
272 
274 
277  m_ttree = fs->make<TTree>("mual_ttree", "mual_ttree");
278  m_ttree->Branch("is_plus", &m_tree_row.is_plus, "is_plus/O");
279  m_ttree->Branch("is_dt", &m_tree_row.is_dt, "is_dt/O");
280  m_ttree->Branch("station", &m_tree_row.station, "station/b");
281  m_ttree->Branch("ring_wheel", &m_tree_row.ring_wheel, "ring_wheel/B");
282  m_ttree->Branch("sector", &m_tree_row.sector, "sector/b");
283  m_ttree->Branch("res_x", &m_tree_row.res_x, "res_x/F");
284  m_ttree->Branch("res_y", &m_tree_row.res_y, "res_y/F");
285  m_ttree->Branch("res_slope_x", &m_tree_row.res_slope_x, "res_slope_x/F");
286  m_ttree->Branch("res_slope_y", &m_tree_row.res_slope_y, "res_slope_y/F");
287  m_ttree->Branch("pos_x", &m_tree_row.pos_x, "pos_x/F");
288  m_ttree->Branch("pos_y", &m_tree_row.pos_y, "pos_y/F");
289  m_ttree->Branch("angle_x", &m_tree_row.angle_x, "angle_x/F");
290  m_ttree->Branch("angle_y", &m_tree_row.angle_y, "angle_y/F");
291  m_ttree->Branch("pz", &m_tree_row.pz, "pz/F");
292  m_ttree->Branch("pt", &m_tree_row.pt, "pt/F");
293  m_ttree->Branch("q", &m_tree_row.q, "q/B");
294  m_ttree->Branch("select", &m_tree_row.select, "select/O");
295  //m_ttree->Branch("",&m_tree_row.,"/");
296 }
297 
298 bool MuonAlignmentFromReference::numeric(std::string s) { return s.length() == 1 && std::isdigit(s[0]); }
299 
301  if (!numeric(s))
302  assert(false);
303  return atoi(s.c_str());
304 }
305 
307  AlignableTracker* alignableTracker,
308  AlignableMuon* alignableMuon,
309  AlignableExtras* extras,
310  AlignmentParameterStore* alignmentParameterStore) {
311  if (alignableMuon == nullptr)
312  throw cms::Exception("MuonAlignmentFromReference") << "doMuon must be set to True" << std::endl;
313 
314  m_alignableNavigator = new AlignableNavigator(alignableMuon);
315  m_alignmentParameterStore = alignmentParameterStore;
317 
318  int residualsModel;
319  if (m_residualsModel == std::string("pureGaussian"))
321  else if (m_residualsModel == std::string("pureGaussian2D"))
323  else if (m_residualsModel == std::string("powerLawTails"))
325  else if (m_residualsModel == std::string("ROOTVoigt"))
327  else if (m_residualsModel == std::string("GaussPowerTails"))
329  else
330  throw cms::Exception("MuonAlignmentFromReference")
331  << "unrecognized residualsModel: \"" << m_residualsModel << "\"" << std::endl;
332 
333  int useResiduals;
334  if (m_useResiduals == std::string("1111"))
336  else if (m_useResiduals == std::string("1110"))
338  else if (m_useResiduals == std::string("1100"))
340  else if (m_useResiduals == std::string("1000"))
342  else if (m_useResiduals == std::string("1010"))
344  else if (m_useResiduals == std::string("0010"))
346  else
347  throw cms::Exception("MuonAlignmentFromReference")
348  << "unrecognized useResiduals: \"" << m_useResiduals << "\"" << std::endl;
349 
350  const CSCGeometry* cscGeometry = &iSetup.getData(m_cscGeometryToken);
351 
352  // set up the MuonResidualsFitters (which also collect residuals for fitting)
353  m_me11map.clear();
354  m_fitters.clear();
355  m_indexes.clear();
356  m_fitterOrder.clear();
357 
358  for (const auto& ali : m_alignables) {
359  bool made_fitter = false;
360 
361  // fitters for DT
362  if (ali->alignableObjectId() == align::AlignableDTChamber) {
363  DTChamberId id(ali->geomDetId().rawId());
364 
365  if (id.station() == 4) {
366  m_fitters[ali] = new MuonResidualsTwoBin(
367  m_twoBin,
370  made_fitter = true;
371  } else {
372  m_fitters[ali] = new MuonResidualsTwoBin(
373  m_twoBin,
376  made_fitter = true;
377  }
378  }
379 
380  // fitters for CSC
381  else if (ali->alignableObjectId() == align::AlignableCSCChamber) {
382  auto thisali = ali;
383  CSCDetId id(ali->geomDetId().rawId());
384 
385  // take care of ME1/1a
386  if (m_combineME11 && id.station() == 1 && id.ring() == 4) {
387  CSCDetId pairid(id.endcap(), 1, 1, id.chamber());
388 
389  for (const auto& ali2 : m_alignables) {
390  if (ali2->alignableObjectId() == align::AlignableCSCChamber && ali2->geomDetId().rawId() == pairid.rawId()) {
391  thisali = ali2;
392  break;
393  }
394  }
395  m_me11map[ali] = thisali; // points from each ME1/4 chamber to the corresponding ME1/1 chamber
396  }
397 
398  if (thisali == ali) // don't make fitters for ME1/4; they get taken care of in ME1/1
399  {
400  m_fitters[ali] = new MuonResidualsTwoBin(
401  m_twoBin,
406  made_fitter = true;
407  }
408  }
409 
410  else {
411  throw cms::Exception("MuonAlignmentFromReference")
412  << "only DTChambers and CSCChambers can be aligned with this module" << std::endl;
413  }
414 
415  if (made_fitter) {
416  m_fitters[ali]->setStrategy(m_strategy);
417 
418  int index = ali->geomDetId().rawId();
419  m_indexes.push_back(index);
420  m_fitterOrder[index] = m_fitters[ali];
421  }
422  } // end loop over chambers chosen for alignment
423 
424  // cannonical order of fitters in the file
425  std::sort(m_indexes.begin(), m_indexes.end());
426 
427  // de-weight all chambers but the reference
428  const auto& all_DT_chambers = alignableMuon->DTChambers();
429  const auto& all_CSC_chambers = alignableMuon->CSCChambers();
431  if (!m_reference.empty())
432  parseReference(reference, all_DT_chambers, all_CSC_chambers);
433 
434  alignmentParameterStore->setAlignmentPositionError(all_DT_chambers, 100000000., 0.);
435  alignmentParameterStore->setAlignmentPositionError(all_CSC_chambers, 100000000., 0.);
436  alignmentParameterStore->setAlignmentPositionError(reference, 0., 0.);
437 }
438 
440  if (m_debug)
441  std::cout << "****** EVENT START *******" << std::endl;
443 
444  const GlobalTrackingGeometry* globalGeometry = &iSetup.getData(m_globTackingToken);
446  const Propagator* prop = &iSetup.getData(m_propToken);
448 
449  if (m_muonCollectionTag.label().empty()) // use trajectories
450  {
451  if (m_debug)
452  std::cout << "JUST BEFORE LOOP OVER trajTrackPairs" << std::endl;
453  // const ConstTrajTrackPairCollection &trajtracks = eventInfo.trajTrackPairs_; // trajTrackPairs_ now private
454  const ConstTrajTrackPairCollection& trajtracks = eventInfo.trajTrackPairs();
455 
456  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
457  ++trajtrack) {
459 
460  const Trajectory* traj = (*trajtrack).first;
461  const reco::Track* track = (*trajtrack).second;
462 
463  if (m_minTrackPt < track->pt() && track->pt() < m_maxTrackPt && m_minTrackP < track->p() &&
464  track->p() < m_maxTrackP) {
466 
467  if (fabs(track->dxy(eventInfo.beamSpot().position())) < m_maxDxy) {
469  if (m_debug)
470  std::cout << "JUST BEFORE muonResidualsFromTrack" << std::endl;
471  MuonResidualsFromTrack muonResidualsFromTrack(iSetup,
473  globalGeometry,
475  prop,
476  traj,
477  track,
479  1000.);
480  if (m_debug)
481  std::cout << "JUST AFTER muonResidualsFromTrack" << std::endl;
482 
483  if (m_debug)
484  std::cout << "JUST BEFORE PROCESS" << std::endl;
485  processMuonResidualsFromTrack(muonResidualsFromTrack);
486  if (m_debug)
487  std::cout << "JUST AFTER PROCESS" << std::endl;
488  }
489  } // end if track p is within range
490  } // end if track pT is within range
491  if (m_debug)
492  std::cout << "JUST AFTER LOOP OVER trajTrackPairs" << std::endl;
493 
494  } else // use muons
495  {
496  /*
497  for (reco::MuonCollection::const_iterator muon = eventInfo.muonCollection_->begin(); muon != eventInfo.muonCollection_->end(); ++muon)
498  {
499  if ( !(muon->isTrackerMuon() && muon->innerTrack().isNonnull() ) ) continue;
500 
501  m_counter_tracks++;
502 
503  if (m_minTrackPt < muon->pt() && muon->pt() < m_maxTrackPt && m_minTrackP < muon->p() && muon->p() < m_maxTrackP)
504  {
505  m_counter_trackmomentum++;
506 
507  if (fabs(muon->innerTrack()->dxy(eventInfo.beamSpot_.position())) < m_maxDxy)
508  {
509  m_counter_trackdxy++;
510 
511  //std::cout<<" *** will make MuonResidualsFromTrack ***"<<std::endl;
512  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, &(*muon), m_alignableNavigator, 100.);
513  //std::cout<<" *** have made MuonResidualsFromTrack ***"<<std::endl;
514 
515  //std::cout<<" trk eta="<<muon->eta()<<" ndof="<<muon->innerTrack()->ndof()<<" nchi2="<<muon->innerTrack()->normalizedChi2()
516  // <<" muresnchi2="<<muonResidualsFromTrack.normalizedChi2()<<" muresnhits="<<muonResidualsFromTrack.trackerNumHits()<<std::endl;
517 
518  processMuonResidualsFromTrack(muonResidualsFromTrack);
519  } // end if track p is within range
520  } // end if track pT is within range
521  } // end loop over tracks
522  */
523  }
524 }
525 
527  // std::cout << "minTrackerHits: " << mrft.trackerNumHits() << std::endl;
528  if (mrft.trackerNumHits() >= m_minTrackerHits) {
530  // std::cout << "mrft.normalizedChi2(): " << mrft.normalizedChi2() << std::endl;
531 
532  if (mrft.normalizedChi2() < m_maxTrackerRedChi2) {
534  if (m_allowTIDTEC || !mrft.contains_TIDTEC()) {
536 
537  std::vector<DetId> chamberIds = mrft.chamberIds();
538 
539  if ((int)chamberIds.size() >= m_minNCrossedChambers) {
541 
542  char charge = (mrft.getTrack()->charge() > 0 ? 1 : -1);
543 
544  for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end();
545  ++chamberId) {
546  if (chamberId->det() != DetId::Muon)
547  continue;
549 
550  // DT station 1,2,3
551  if (m_doDT && chamberId->subdetId() == MuonSubdetId::DT && DTChamberId(chamberId->rawId()).station() != 4) {
554 
556  if (dt13 != nullptr && dt2 != nullptr) {
558  if (dt13->numHits() >= m_minDT13Hits) {
560  if (dt2->numHits() >= m_minDT2Hits) {
562  std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
563  m_fitters.find(dt13->chamberAlignable());
564  if (fitter != m_fitters.end()) {
566  if (fabs(dt2->resslope()) < m_maxResSlopeY && (dt2->chi2() / double(dt2->ndof())) < 2.0) {
568  double* residdata = new double[MuonResiduals6DOFFitter::kNData];
569  residdata[MuonResiduals6DOFFitter::kResidX] = dt13->residual();
570  residdata[MuonResiduals6DOFFitter::kResidY] = dt2->residual();
571  residdata[MuonResiduals6DOFFitter::kResSlopeX] = dt13->resslope();
572  residdata[MuonResiduals6DOFFitter::kResSlopeY] = dt2->resslope();
573  residdata[MuonResiduals6DOFFitter::kPositionX] = dt13->trackx();
574  residdata[MuonResiduals6DOFFitter::kPositionY] = dt13->tracky();
575  residdata[MuonResiduals6DOFFitter::kAngleX] = dt13->trackdxdz();
576  residdata[MuonResiduals6DOFFitter::kAngleY] = dt13->trackdydz();
578  (dt13->chi2() + dt2->chi2()) / double(dt13->ndof() + dt2->ndof());
579  residdata[MuonResiduals6DOFFitter::kPz] = mrft.getTrack()->pz();
580  residdata[MuonResiduals6DOFFitter::kPt] = mrft.getTrack()->pt();
581  residdata[MuonResiduals6DOFFitter::kCharge] = mrft.getTrack()->charge();
582  residdata[MuonResiduals6DOFFitter::kStation] = DTChamberId(chamberId->rawId()).station();
583  residdata[MuonResiduals6DOFFitter::kWheel] = DTChamberId(chamberId->rawId()).wheel();
584  residdata[MuonResiduals6DOFFitter::kSector] = DTChamberId(chamberId->rawId()).sector();
585  residdata[MuonResiduals6DOFFitter::kChambW] = dt13->ChambW();
586  residdata[MuonResiduals6DOFFitter::kChambl] = dt13->Chambl();
587 
588  if (m_debug) {
589  std::cout << "processMuonResidualsFromTrack 6DOF dt13->residual() " << dt13->residual()
590  << std::endl;
591  std::cout << " dt2->residual() " << dt2->residual()
592  << std::endl;
593  std::cout << " dt13->resslope() " << dt13->resslope()
594  << std::endl;
595  std::cout << " dt2->resslope() " << dt2->resslope()
596  << std::endl;
597  std::cout << " dt13->trackx() " << dt13->trackx()
598  << std::endl;
599  std::cout << " dt13->tracky() " << dt13->tracky()
600  << std::endl;
601  std::cout << " dt13->trackdxdz() " << dt13->trackdxdz()
602  << std::endl;
603  std::cout << " dt13->trackdydz() " << dt13->trackdydz()
604  << std::endl;
605  }
606 
607  fitter->second->fill(charge, residdata);
608  // the MuonResidualsFitter will delete the array when it is destroyed
609  }
610  }
611  }
612  }
613  }
614  }
615 
616  // DT 4th station
617  else if (m_doDT && chamberId->subdetId() == MuonSubdetId::DT &&
618  DTChamberId(chamberId->rawId()).station() == 4) {
620 
622  if (dt13 != nullptr) {
624  if (dt13->numHits() >= m_minDT13Hits) {
626 
627  std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter =
628  m_fitters.find(dt13->chamberAlignable());
629  if (fitter != m_fitters.end()) {
631 
632  double* residdata = new double[MuonResiduals5DOFFitter::kNData];
633  residdata[MuonResiduals5DOFFitter::kResid] = dt13->residual();
634  residdata[MuonResiduals5DOFFitter::kResSlope] = dt13->resslope();
635  residdata[MuonResiduals5DOFFitter::kPositionX] = dt13->trackx();
636  residdata[MuonResiduals5DOFFitter::kPositionY] = dt13->tracky();
637  residdata[MuonResiduals5DOFFitter::kAngleX] = dt13->trackdxdz();
638  residdata[MuonResiduals5DOFFitter::kAngleY] = dt13->trackdydz();
639  residdata[MuonResiduals5DOFFitter::kRedChi2] = dt13->chi2() / double(dt13->ndof());
640  residdata[MuonResiduals5DOFFitter::kPz] = mrft.getTrack()->pz();
641  residdata[MuonResiduals5DOFFitter::kPt] = mrft.getTrack()->pt();
642  residdata[MuonResiduals5DOFFitter::kCharge] = mrft.getTrack()->charge();
643  residdata[MuonResiduals5DOFFitter::kStation] = DTChamberId(chamberId->rawId()).station();
644  residdata[MuonResiduals5DOFFitter::kWheel] = DTChamberId(chamberId->rawId()).wheel();
645  residdata[MuonResiduals5DOFFitter::kSector] = DTChamberId(chamberId->rawId()).sector();
646  residdata[MuonResiduals5DOFFitter::kChambW] = dt13->ChambW();
647  residdata[MuonResiduals5DOFFitter::kChambl] = dt13->Chambl();
648 
649  if (m_debug) {
650  std::cout << "processMuonResidualsFromTrack 5DOF dt13->residual() " << dt13->residual()
651  << std::endl;
652  std::cout << " dt13->resslope() " << dt13->resslope()
653  << std::endl;
654  std::cout << " dt13->trackx() " << dt13->trackx()
655  << std::endl;
656  std::cout << " dt13->tracky() " << dt13->tracky()
657  << std::endl;
658  std::cout << " dt13->trackdxdz() " << dt13->trackdxdz()
659  << std::endl;
660  std::cout << " dt13->trackdydz() " << dt13->trackdydz()
661  << std::endl;
662  }
663 
664  fitter->second->fill(charge, residdata);
665  // the MuonResidualsFitter will delete the array when it is destroyed
666  }
667  }
668  }
669  } // end DT 4th station
670 
671  // CSC
672  else if (m_doCSC && chamberId->subdetId() == MuonSubdetId::CSC) {
674  m_counter_csc++;
675  if (csc != nullptr) {
677  if (csc->numHits() >= m_minCSCHits) {
679  Alignable* ali = csc->chamberAlignable();
680 
681  CSCDetId id(ali->geomDetId().rawId());
682  if (m_combineME11 && id.station() == 1 && id.ring() == 4)
683  ali = m_me11map[ali];
684 
685  std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(ali);
686  if (fitter != m_fitters.end()) {
688  double* residdata = new double[MuonResiduals6DOFrphiFitter::kNData];
689  residdata[MuonResiduals6DOFrphiFitter::kResid] = csc->residual();
690  residdata[MuonResiduals6DOFrphiFitter::kResSlope] = csc->resslope();
691  residdata[MuonResiduals6DOFrphiFitter::kPositionX] = csc->trackx();
692  residdata[MuonResiduals6DOFrphiFitter::kPositionY] = csc->tracky();
693  residdata[MuonResiduals6DOFrphiFitter::kAngleX] = csc->trackdxdz();
694  residdata[MuonResiduals6DOFrphiFitter::kAngleY] = csc->trackdydz();
695  residdata[MuonResiduals6DOFrphiFitter::kRedChi2] = csc->chi2() / double(csc->ndof());
696  residdata[MuonResiduals6DOFrphiFitter::kPz] = mrft.getTrack()->pz();
697  residdata[MuonResiduals6DOFrphiFitter::kPt] = mrft.getTrack()->pt();
699 
700  if (m_debug) {
701  std::cout << "processMuonResidualsFromTrack 6DOFrphi csc->residual() " << csc->residual()
702  << std::endl;
703  std::cout << " csc->resslope() " << csc->resslope()
704  << std::endl;
705  std::cout << " csc->trackx() " << csc->trackx()
706  << std::endl;
707  std::cout << " csc->tracky() " << csc->tracky()
708  << std::endl;
709  std::cout << " csc->trackdxdz() " << csc->trackdxdz()
710  << std::endl;
711  std::cout << " csc->trackdydz() " << csc->trackdydz()
712  << std::endl;
713  }
714 
715  fitter->second->fill(charge, residdata);
716  // the MuonResidualsFitter will delete the array when it is destroyed
717  }
718  }
719  }
720  } // end CSC
721 
722  else if (m_doDT && m_doCSC)
723  assert(false);
724 
725  } // end loop over chamberIds
726  } // # crossed muon chambers ok
727  } // endcap tracker ok
728  } // chi2 ok
729  } // trackerNumHits ok
730 }
731 
733  bool m_debug = false;
734 
735  // one-time print-out
736  std::cout << "Counters:" << std::endl
737  << "COUNT{ events: " << m_counter_events << " }" << std::endl
738  << "COUNT{ tracks: " << m_counter_tracks << " }" << std::endl
739  << "COUNT{ trackppt: " << m_counter_trackmomentum << " }" << std::endl
740  << "COUNT{ trackdxy: " << m_counter_trackdxy << " }" << std::endl
741  << "COUNT{ trackerhits: " << m_counter_trackerhits << " }" << std::endl
742  << "COUNT{ trackerchi2: " << m_counter_trackerchi2 << " }" << std::endl
743  << "COUNT{ trackertidtec: " << m_counter_trackertidtec << " }" << std::endl
744  << "COUNT{ minnchambers: " << m_counter_minchambers << " }" << std::endl
745  << "COUNT{ totchambers: " << m_counter_totchambers << " }" << std::endl
746  << "COUNT{ station123: " << m_counter_station123 << " }" << std::endl
747  << "COUNT{ station123valid: " << m_counter_station123valid << " }" << std::endl
748  << "COUNT{ station123dt13hits: " << m_counter_station123dt13hits << " }" << std::endl
749  << "COUNT{ station123dt2hits: " << m_counter_station123dt2hits << " }" << std::endl
750  << "COUNT{ station123aligning: " << m_counter_station123aligning << " }" << std::endl
751  << "COUNT{ resslopey: " << m_counter_resslopey << " }" << std::endl
752  << "COUNT{ station4: " << m_counter_station4 << " }" << std::endl
753  << "COUNT{ station4valid: " << m_counter_station4valid << " }" << std::endl
754  << "COUNT{ station4hits: " << m_counter_station4hits << " }" << std::endl
755  << "COUNT{ station4aligning: " << m_counter_station4aligning << " }" << std::endl
756  << "COUNT{ csc: " << m_counter_csc << " }" << std::endl
757  << "COUNT{ cscvalid: " << m_counter_cscvalid << " }" << std::endl
758  << "COUNT{ cschits: " << m_counter_cschits << " }" << std::endl
759  << "COUNT{ cscaligning: " << m_counter_cscaligning << " }" << std::endl
760  << "That's all!" << std::endl;
761 
762  TStopwatch stop_watch;
763 
764  // collect temporary files
765  if (!m_readTemporaryFiles.empty()) {
766  stop_watch.Start();
767  readTmpFiles();
768  if (m_debug)
769  std::cout << "readTmpFiles took " << stop_watch.CpuTime() << " sec" << std::endl;
770  stop_watch.Stop();
771  }
772 
773  // select residuals peaks and discard tails if peakNSigma>0 (only while doing alignment)
774  if (m_peakNSigma > 0. && m_doAlignment) {
775  stop_watch.Start();
777  if (m_debug)
778  std::cout << "selectResidualsPeaks took " << stop_watch.CpuTime() << " sec" << std::endl;
779  stop_watch.Stop();
780  }
781 
782  if (m_BFieldCorrection > 0 && m_doAlignment) {
783  stop_watch.Start();
784  correctBField();
785  if (m_debug)
786  std::cout << "correctBField took " << stop_watch.CpuTime() << " sec" << std::endl;
787  stop_watch.Stop();
788  }
789 
790  if (m_doAlignment && !m_doCSC) // for now apply fiducial cuts to DT only
791  {
792  stop_watch.Start();
793  fiducialCuts();
794  if (m_debug)
795  std::cout << "fiducialCuts took " << stop_watch.CpuTime() << " sec" << std::endl;
796  stop_watch.Stop();
797  }
798 
799  // optionally, create an nutuple for easy debugging
800  if (m_createNtuple) {
801  stop_watch.Start();
802  fillNtuple();
803  if (m_debug)
804  std::cout << "fillNtuple took " << stop_watch.CpuTime() << " sec" << std::endl;
805  stop_watch.Stop();
806  }
807 
808  if (m_doAlignment) {
809  stop_watch.Start();
811  if (m_debug)
812  std::cout << "eraseNotSelectedResiduals took " << stop_watch.CpuTime() << " sec" << std::endl;
813  stop_watch.Stop();
814  }
815 
816  // fit and align (time-consuming, so the user can turn it off if in a residuals-gathering job)
817  if (m_doAlignment) {
818  stop_watch.Start();
819  fitAndAlign();
820  if (m_debug)
821  std::cout << "fitAndAlign took " << stop_watch.CpuTime() << " sec" << std::endl;
822  stop_watch.Stop();
823  }
824 
825  // write out the pseudontuples for a later job to collect
827  writeTmpFiles();
828  if (m_debug)
829  std::cout << "end: MuonAlignmentFromReference::terminate()" << std::endl;
830 }
831 
833  bool m_debug = false;
834 
835  edm::Service<TFileService> tfileService;
836  TFileDirectory rootDirectory(tfileService->mkdir("MuonAlignmentFromReference"));
837 
838  std::ofstream report;
839  bool writeReport = (m_reportFileName != std::string(""));
840  if (writeReport) {
841  report.open(m_reportFileName.c_str());
842  report << "nan = None; NAN = None" << std::endl;
843  report << "nan = 0" << std::endl;
844  report << "reports = []" << std::endl;
845  report << "class ValErr:" << std::endl
846  << " def __init__(self, value, error, antisym):" << std::endl
847  << " self.value, self.error, self.antisym = value, error, antisym" << std::endl
848  << "" << std::endl
849  << " def __repr__(self):" << std::endl
850  << " if self.antisym == 0.:" << std::endl
851  << " return \"%g +- %g\" % (self.value, self.error)" << std::endl
852  << " else:" << std::endl
853  << " return \"%g +- %g ~ %g\" % (self.value, self.error, self.antisym)" << std::endl
854  << "" << std::endl
855  << "class Report:" << std::endl
856  << " def __init__(self, chamberId, postal_address, name):" << std::endl
857  << " self.chamberId, self.postal_address, self.name = chamberId, postal_address, name" << std::endl
858  << " self.status = \"NOFIT\"" << std::endl
859  << " self.fittype = None" << std::endl
860  << "" << std::endl
861  << " def add_parameters(self, deltax, deltay, deltaz, deltaphix, deltaphiy, deltaphiz, loglikelihood, "
862  "numsegments, sumofweights, redchi2):"
863  << std::endl
864  << " self.status = \"PASS\"" << std::endl
865  << " self.deltax, self.deltay, self.deltaz, self.deltaphix, self.deltaphiy, self.deltaphiz = deltax, "
866  "deltay, deltaz, deltaphix, deltaphiy, deltaphiz"
867  << std::endl
868  << " self.loglikelihood, self.numsegments, self.sumofweights, self.redchi2 = loglikelihood, "
869  "numsegments, sumofweights, redchi2"
870  << std::endl
871  << "" << std::endl
872  << " def add_stats(self, median_x, median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, "
873  "mean50_dydz, mean15_x, mean15_y, mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, "
874  "wmean50_dydz, wmean15_x, wmean15_y, wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, "
875  "stdev50_dydz, stdev15_x, stdev15_y, stdev10_dxdz, stdev25_dydz):"
876  << std::endl
877  << " self.median_x, self.median_y, self.median_dxdz, self.median_dydz, self.mean30_x, self.mean30_y, "
878  "self.mean20_dxdz, self.mean50_dydz, self.mean15_x, self.mean15_y, self.mean10_dxdz, self.mean25_dydz, "
879  "self.wmean30_x, self.wmean30_y, self.wmean20_dxdz, self.wmean50_dydz, self.wmean15_x, self.wmean15_y, "
880  "self.wmean10_dxdz, self.wmean25_dydz, self.stdev30_x, self.stdev30_y, self.stdev20_dxdz, "
881  "self.stdev50_dydz, self.stdev15_x, self.stdev15_y, self.stdev10_dxdz, self.stdev25_dydz = median_x, "
882  "median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, mean50_dydz, mean15_x, mean15_y, "
883  "mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, wmean50_dydz, wmean15_x, wmean15_y, "
884  "wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, stdev50_dydz, stdev15_x, stdev15_y, "
885  "stdev10_dxdz, stdev25_dydz"
886  << std::endl
887  << "" << std::endl
888  << " def __repr__(self):" << std::endl
889  << " return \"<Report %s %s %s>\" % (self.postal_address[0], \" \".join(map(str, "
890  "self.postal_address[1:])), self.status)"
891  << std::endl
892  << std::endl;
893  }
894 
895  if (m_debug)
896  std::cout << "***** just after report.open" << std::endl;
897 
898  for (const auto& ali : m_alignables) {
899  if (m_debug)
900  std::cout << "***** Start loop over alignables" << std::endl;
901 
902  std::vector<bool> selector = ali->alignmentParameters()->selector();
903  bool align_x = selector[0];
904  bool align_y = selector[1];
905  bool align_z = selector[2];
906  bool align_phix = selector[3];
907  bool align_phiy = selector[4];
908  bool align_phiz = selector[5];
909  int numParams = ((align_x ? 1 : 0) + (align_y ? 1 : 0) + (align_z ? 1 : 0) + (align_phix ? 1 : 0) +
910  (align_phiy ? 1 : 0) + (align_phiz ? 1 : 0));
911 
912  // map from 0-5 to the index of params, above
913  std::vector<int> paramIndex;
914  int paramIndex_counter = -1;
915  if (align_x)
916  paramIndex_counter++;
917  paramIndex.push_back(paramIndex_counter);
918  if (align_y)
919  paramIndex_counter++;
920  paramIndex.push_back(paramIndex_counter);
921  if (align_z)
922  paramIndex_counter++;
923  paramIndex.push_back(paramIndex_counter);
924  if (align_phix)
925  paramIndex_counter++;
926  paramIndex.push_back(paramIndex_counter);
927  if (align_phiy)
928  paramIndex_counter++;
929  paramIndex.push_back(paramIndex_counter);
930  if (align_phiz)
931  paramIndex_counter++;
932  paramIndex.push_back(paramIndex_counter);
933 
934  DetId id = ali->geomDetId();
935 
936  auto thisali = ali;
937  if (m_combineME11 && id.subdetId() == MuonSubdetId::CSC) {
938  CSCDetId cscid(id.rawId());
939  if (cscid.station() == 1 && cscid.ring() == 4)
940  thisali = m_me11map[ali];
941  }
942 
943  if (m_debug)
944  std::cout << "***** loop over alignables 1" << std::endl;
945 
946  char cname[40];
947  char wheel_label[][2] = {"A", "B", "C", "D", "E"};
948 
949  if (id.subdetId() == MuonSubdetId::DT) {
950  DTChamberId chamberId(id.rawId());
951 
952  //if ( ! ( (chamberId.station()==1&&chamberId.wheel()==0) || (chamberId.station()==4&&chamberId.wheel()==2) ) ) continue;
953 
954  sprintf(cname, "MBwh%sst%dsec%02d", wheel_label[chamberId.wheel() + 2], chamberId.station(), chamberId.sector());
955  if (writeReport) {
956  report << "reports.append(Report(" << id.rawId() << ", (\"DT\", " << chamberId.wheel() << ", "
957  << chamberId.station() << ", " << chamberId.sector() << "), \"" << cname << "\"))" << std::endl;
958  }
959  } else if (id.subdetId() == MuonSubdetId::CSC) {
960  CSCDetId chamberId(id.rawId());
961  sprintf(cname,
962  "ME%s%d%d_%02d",
963  (chamberId.endcap() == 1 ? "p" : "m"),
964  chamberId.station(),
965  chamberId.ring(),
966  chamberId.chamber());
967 
968  //if ( chamberId.chamber()>6 || chamberId.endcap()==2 || ! ( (chamberId.station()==2&&chamberId.ring()==1) || (chamberId.station()==3&&chamberId.ring()==2) ) ) continue;
969 
970  if (writeReport) {
971  report << "reports.append(Report(" << id.rawId() << ", (\"CSC\", " << chamberId.endcap() << ", "
972  << chamberId.station() << ", " << chamberId.ring() << ", " << chamberId.chamber() << "), \"" << cname
973  << "\"))" << std::endl;
974  }
975  }
976 
977  if (m_debug)
978  std::cout << "***** loop over alignables 2" << std::endl;
979 
980  //if(! ( strcmp(cname,"MBwhCst3sec12")==0 || strcmp(cname,"MBwhCst3sec06")==0)) continue;
981 
982  std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(thisali);
983 
984  if (m_debug)
985  std::cout << "***** loop over alignables 3" << std::endl;
986 
987  if (fitter != m_fitters.end()) {
988  //if (fitter->second->type() != MuonResidualsFitter::k6DOFrphi) continue;
989 
990  TStopwatch stop_watch;
991  stop_watch.Start();
992 
993  // MINUIT is verbose in std::cout anyway
994  if (m_debug)
995  std::cout << "============================================================================================="
996  << std::endl;
997  if (m_debug)
998  std::cout << "Fitting " << cname << std::endl;
999 
1000  if (writeReport) {
1001  report << "reports[-1].posNum = " << fitter->second->numResidualsPos() << std::endl;
1002  report << "reports[-1].negNum = " << fitter->second->numResidualsNeg() << std::endl;
1003  }
1004 
1005  if (fitter->second->type() == MuonResidualsFitter::k5DOF) {
1006  if (!align_x)
1007  fitter->second->fix(MuonResiduals5DOFFitter::kAlignX);
1008  if (!align_z)
1009  fitter->second->fix(MuonResiduals5DOFFitter::kAlignZ);
1010  if (!align_phix)
1011  fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiX);
1012  if (!align_phiy)
1013  fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiY);
1014  if (!align_phiz)
1015  fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiZ);
1016  } else if (fitter->second->type() == MuonResidualsFitter::k6DOF) {
1017  if (!align_x)
1018  fitter->second->fix(MuonResiduals6DOFFitter::kAlignX);
1019  if (!align_y)
1020  fitter->second->fix(MuonResiduals6DOFFitter::kAlignY);
1021  if (!align_z)
1022  fitter->second->fix(MuonResiduals6DOFFitter::kAlignZ);
1023  if (!align_phix)
1024  fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiX);
1025  if (!align_phiy)
1026  fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiY);
1027  if (!align_phiz)
1028  fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiZ);
1029  } else if (fitter->second->type() == MuonResidualsFitter::k6DOFrphi) {
1030  if (!align_x)
1031  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignX);
1032  if (!align_y)
1033  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignY);
1034  if (!align_z)
1035  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignZ);
1036  if (!align_phix)
1037  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1038  if (!align_phiy)
1039  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1040  if (!align_phiz)
1041  fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1042  } else
1043  assert(false);
1044 
1045  if (m_debug)
1046  std::cout << "***** loop over alignables 4" << std::endl;
1047 
1048  AlgebraicVector params(numParams);
1049  AlgebraicSymMatrix cov(numParams);
1050 
1051  if (fitter->second->numsegments() >= m_minAlignmentHits) {
1052  if (m_debug)
1053  std::cout << "***** loop over alignables 5" << std::endl;
1054 
1055  bool successful_fit = fitter->second->fit(thisali);
1056 
1057  if (m_debug)
1058  std::cout << "***** loop over alignables 6 " << fitter->second->type() << std::endl;
1059 
1060  double loglikelihood = fitter->second->loglikelihood();
1061  double numsegments = fitter->second->numsegments();
1062  double sumofweights = fitter->second->sumofweights();
1063  double redchi2 = fitter->second->plot(cname, &rootDirectory, thisali);
1064 
1065  if (fitter->second->type() == MuonResidualsFitter::k5DOF) {
1066  if (m_debug)
1067  std::cout << "***** loop over alignables k5DOF" << std::endl;
1068 
1069  double deltax_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignX);
1070  double deltax_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignX);
1071  double deltax_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignX);
1072 
1073  double deltaz_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignZ);
1074  double deltaz_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignZ);
1075  double deltaz_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignZ);
1076 
1077  double deltaphix_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiX);
1078  double deltaphix_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiX);
1079  double deltaphix_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiX);
1080 
1081  double deltaphiy_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiY);
1082  double deltaphiy_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiY);
1083  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiY);
1084 
1085  double deltaphiz_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiZ);
1086  double deltaphiz_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiZ);
1087  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiZ);
1088 
1089  double sigmaresid_value = fitter->second->value(MuonResiduals5DOFFitter::kResidSigma);
1090  double sigmaresid_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResidSigma);
1091  double sigmaresid_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResidSigma);
1092 
1093  double sigmaresslope_value = fitter->second->value(MuonResiduals5DOFFitter::kResSlopeSigma);
1094  double sigmaresslope_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResSlopeSigma);
1095  double sigmaresslope_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResSlopeSigma);
1096 
1097  double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1098  gammaresslope_antisym;
1099  gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1100  gammaresslope_antisym = 0.;
1101 
1102  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1103  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1104  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1105  gammaresid_value = fitter->second->value(MuonResiduals5DOFFitter::kResidGamma);
1106  gammaresid_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResidGamma);
1107  gammaresid_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResidGamma);
1108 
1109  gammaresslope_value = fitter->second->value(MuonResiduals5DOFFitter::kResSlopeGamma);
1110  gammaresslope_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResSlopeGamma);
1111  gammaresslope_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResSlopeGamma);
1112  }
1113 
1114  if (writeReport) {
1115  report << "reports[-1].fittype = \"5DOF\"" << std::endl;
1116  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", "
1117  << deltax_antisym << "), \\" << std::endl
1118  << " None, \\" << std::endl
1119  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", "
1120  << deltaz_antisym << "), \\" << std::endl
1121  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", "
1122  << deltaphix_antisym << "), \\" << std::endl
1123  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", "
1124  << deltaphiy_antisym << "), \\" << std::endl
1125  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", "
1126  << deltaphiz_antisym << "), \\" << std::endl
1127  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights
1128  << ", " << redchi2 << ")" << std::endl;
1129  report << "reports[-1].sigmaresid = ValErr(" << sigmaresid_value << ", " << sigmaresid_error << ", "
1130  << sigmaresid_antisym << ")" << std::endl;
1131  report << "reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value << ", " << sigmaresslope_error
1132  << ", " << sigmaresslope_antisym << ")" << std::endl;
1133  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1134  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1135  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1136  report << "reports[-1].gammaresid = ValErr(" << gammaresid_value << ", " << gammaresid_error << ", "
1137  << gammaresid_antisym << ")" << std::endl;
1138  report << "reports[-1].gammaresslope = ValErr(" << gammaresslope_value << ", " << gammaresslope_error
1139  << ", " << gammaresslope_antisym << ")" << std::endl;
1140  }
1141 
1142  report << "reports[-1].add_stats(" << fitter->second->median(MuonResiduals5DOFFitter::kResid) << ", "
1143  << "None, " << fitter->second->median(MuonResiduals5DOFFitter::kResSlope) << ", "
1144  << "None, " << fitter->second->mean(MuonResiduals5DOFFitter::kResid, 30.) << ", "
1145  << "None, " << fitter->second->mean(MuonResiduals5DOFFitter::kResSlope, 20.) << ", "
1146  << "None, " << fitter->second->mean(MuonResiduals5DOFFitter::kResid, 15.) << ", "
1147  << "None, " << fitter->second->mean(MuonResiduals5DOFFitter::kResSlope, 10.) << ", "
1148  << "None, "
1150  << ", "
1151  << "None, "
1153  << ", "
1154  << "None, "
1156  << ", "
1157  << "None, "
1159  << ", "
1160  << "None, " << fitter->second->stdev(MuonResiduals5DOFFitter::kResid, 30.) << ", "
1161  << "None, " << fitter->second->stdev(MuonResiduals5DOFFitter::kResSlope, 20.) << ", "
1162  << "None, " << fitter->second->stdev(MuonResiduals5DOFFitter::kResid, 15.) << ", "
1163  << "None, " << fitter->second->stdev(MuonResiduals5DOFFitter::kResSlope, 10.) << ", "
1164  << "None)" << std::endl;
1165 
1166  std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1167  namesimple_x << cname << "_simple_x";
1168  namesimple_dxdz << cname << "_simple_dxdz";
1169  nameweighted_x << cname << "_weighted_x";
1170  nameweighted_dxdz << cname << "_weighted_dxdz";
1171 
1172  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals5DOFFitter::kResid, 10.);
1173  fitter->second->plotsimple(
1174  namesimple_dxdz.str(), &rootDirectory, MuonResiduals5DOFFitter::kResSlope, 1000.);
1175 
1176  fitter->second->plotweighted(nameweighted_x.str(),
1177  &rootDirectory,
1180  10.);
1181  fitter->second->plotweighted(nameweighted_dxdz.str(),
1182  &rootDirectory,
1185  1000.);
1186  }
1187 
1188  if (successful_fit) {
1189  if (align_x)
1190  params[paramIndex[0]] = deltax_value;
1191  if (align_z)
1192  params[paramIndex[2]] = deltaz_value;
1193  if (align_phix)
1194  params[paramIndex[3]] = deltaphix_value;
1195  if (align_phiy)
1196  params[paramIndex[4]] = deltaphiy_value;
1197  if (align_phiz)
1198  params[paramIndex[5]] = deltaphiz_value;
1199  }
1200  } // end if 5DOF
1201 
1202  else if (fitter->second->type() == MuonResidualsFitter::k6DOF) {
1203  if (m_debug)
1204  std::cout << "***** loop over alignables k6DOF" << std::endl;
1205 
1206  double deltax_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignX);
1207  double deltax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignX);
1208  double deltax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignX);
1209 
1210  double deltay_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignY);
1211  double deltay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignY);
1212  double deltay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignY);
1213 
1214  double deltaz_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignZ);
1215  double deltaz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignZ);
1216  double deltaz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignZ);
1217 
1218  double deltaphix_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiX);
1219  double deltaphix_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiX);
1220  double deltaphix_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiX);
1221 
1222  double deltaphiy_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiY);
1223  double deltaphiy_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiY);
1224  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiY);
1225 
1226  double deltaphiz_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiZ);
1227  double deltaphiz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiZ);
1228  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiZ);
1229 
1230  double sigmax_value = fitter->second->value(MuonResiduals6DOFFitter::kResidXSigma);
1231  double sigmax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidXSigma);
1232  double sigmax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidXSigma);
1233 
1234  double sigmay_value = fitter->second->value(MuonResiduals6DOFFitter::kResidYSigma);
1235  double sigmay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidYSigma);
1236  double sigmay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidYSigma);
1237 
1238  double sigmadxdz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeXSigma);
1239  double sigmadxdz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeXSigma);
1240  double sigmadxdz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeXSigma);
1241 
1242  double sigmadydz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeYSigma);
1243  double sigmadydz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeYSigma);
1244  double sigmadydz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeYSigma);
1245 
1246  double gammax_value, gammax_error, gammax_antisym, gammay_value, gammay_error, gammay_antisym,
1247  gammadxdz_value, gammadxdz_error, gammadxdz_antisym, gammadydz_value, gammadydz_error, gammadydz_antisym;
1248  gammax_value = gammax_error = gammax_antisym = gammay_value = gammay_error = gammay_antisym =
1249  gammadxdz_value = gammadxdz_error = gammadxdz_antisym = gammadydz_value = gammadydz_error =
1250  gammadydz_antisym = 0.;
1251  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1252  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1253  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1254  gammax_value = fitter->second->value(MuonResiduals6DOFFitter::kResidXGamma);
1255  gammax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidXGamma);
1256  gammax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidXGamma);
1257 
1258  gammay_value = fitter->second->value(MuonResiduals6DOFFitter::kResidYGamma);
1259  gammay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidYGamma);
1260  gammay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidYGamma);
1261 
1262  gammadxdz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeXGamma);
1263  gammadxdz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeXGamma);
1264  gammadxdz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeXGamma);
1265 
1266  gammadydz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeYGamma);
1267  gammadydz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeYGamma);
1268  gammadydz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeYGamma);
1269  }
1270 
1271  if (writeReport) {
1272  report << "reports[-1].fittype = \"6DOF\"" << std::endl;
1273  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", "
1274  << deltax_antisym << "), \\" << std::endl
1275  << " ValErr(" << deltay_value << ", " << deltay_error << ", "
1276  << deltay_antisym << "), \\" << std::endl
1277  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", "
1278  << deltaz_antisym << "), \\" << std::endl
1279  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", "
1280  << deltaphix_antisym << "), \\" << std::endl
1281  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", "
1282  << deltaphiy_antisym << "), \\" << std::endl
1283  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", "
1284  << deltaphiz_antisym << "), \\" << std::endl
1285  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights
1286  << ", " << redchi2 << ")" << std::endl;
1287  report << "reports[-1].sigmax = ValErr(" << sigmax_value << ", " << sigmax_error << ", " << sigmax_antisym
1288  << ")" << std::endl;
1289  report << "reports[-1].sigmay = ValErr(" << sigmay_value << ", " << sigmay_error << ", " << sigmay_antisym
1290  << ")" << std::endl;
1291  report << "reports[-1].sigmadxdz = ValErr(" << sigmadxdz_value << ", " << sigmadxdz_error << ", "
1292  << sigmadxdz_antisym << ")" << std::endl;
1293  report << "reports[-1].sigmadydz = ValErr(" << sigmadydz_value << ", " << sigmadydz_error << ", "
1294  << sigmadydz_antisym << ")" << std::endl;
1295  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1296  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1297  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1298  report << "reports[-1].gammax = ValErr(" << gammax_value << ", " << gammax_error << ", " << gammax_antisym
1299  << ")" << std::endl;
1300  report << "reports[-1].gammay = ValErr(" << gammay_value << ", " << gammay_error << ", " << gammay_antisym
1301  << ")" << std::endl;
1302  report << "reports[-1].gammadxdz = ValErr(" << gammadxdz_value << ", " << gammadxdz_error << ", "
1303  << gammadxdz_antisym << ")" << std::endl;
1304  report << "reports[-1].gammadydz = ValErr(" << gammadydz_value << ", " << gammadydz_error << ", "
1305  << gammadydz_antisym << ")" << std::endl;
1306  }
1307 
1308  report << "reports[-1].add_stats(" << fitter->second->median(MuonResiduals6DOFFitter::kResidX) << ", "
1309  << fitter->second->median(MuonResiduals6DOFFitter::kResidY) << ", "
1310  << fitter->second->median(MuonResiduals6DOFFitter::kResSlopeX) << ", "
1311  << fitter->second->median(MuonResiduals6DOFFitter::kResSlopeY) << ", "
1312  << fitter->second->mean(MuonResiduals6DOFFitter::kResidX, 30.) << ", "
1313  << fitter->second->mean(MuonResiduals6DOFFitter::kResidY, 30.) << ", "
1314  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeX, 20.) << ", "
1315  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeY, 50.) << ", "
1316  << fitter->second->mean(MuonResiduals6DOFFitter::kResidX, 15.) << ", "
1317  << fitter->second->mean(MuonResiduals6DOFFitter::kResidY, 15.) << ", "
1318  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeX, 10.) << ", "
1319  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeY, 25.) << ", "
1321  << ", "
1323  << ", "
1325  << ", "
1327  << ", "
1329  << ", "
1331  << ", "
1333  << ", "
1335  << ", " << fitter->second->stdev(MuonResiduals6DOFFitter::kResidX, 30.) << ", "
1336  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidY, 30.) << ", "
1337  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeX, 20.) << ", "
1338  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeY, 50.) << ", "
1339  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidX, 15.) << ", "
1340  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidY, 15.) << ", "
1341  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeX, 10.) << ", "
1342  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeY, 25.) << ")" << std::endl;
1343 
1344  std::stringstream namesimple_x, namesimple_y, namesimple_dxdz, namesimple_dydz, nameweighted_x,
1345  nameweighted_y, nameweighted_dxdz, nameweighted_dydz;
1346  namesimple_x << cname << "_simple_x";
1347  namesimple_y << cname << "_simple_y";
1348  namesimple_dxdz << cname << "_simple_dxdz";
1349  namesimple_dydz << cname << "_simple_dydz";
1350  nameweighted_x << cname << "_weighted_x";
1351  nameweighted_y << cname << "_weighted_y";
1352  nameweighted_dxdz << cname << "_weighted_dxdz";
1353  nameweighted_dydz << cname << "_weighted_dydz";
1354 
1355  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidX, 10.);
1356  fitter->second->plotsimple(namesimple_y.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidY, 10.);
1357  fitter->second->plotsimple(
1358  namesimple_dxdz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeX, 1000.);
1359  fitter->second->plotsimple(
1360  namesimple_dydz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeY, 1000.);
1361 
1362  fitter->second->plotweighted(nameweighted_x.str(),
1363  &rootDirectory,
1366  10.);
1367  fitter->second->plotweighted(nameweighted_y.str(),
1368  &rootDirectory,
1371  10.);
1372  fitter->second->plotweighted(nameweighted_dxdz.str(),
1373  &rootDirectory,
1376  1000.);
1377  fitter->second->plotweighted(nameweighted_dydz.str(),
1378  &rootDirectory,
1381  1000.);
1382  }
1383 
1384  if (successful_fit) {
1385  if (align_x)
1386  params[paramIndex[0]] = deltax_value;
1387  if (align_y)
1388  params[paramIndex[1]] = deltay_value;
1389  if (align_z)
1390  params[paramIndex[2]] = deltaz_value;
1391  if (align_phix)
1392  params[paramIndex[3]] = deltaphix_value;
1393  if (align_phiy)
1394  params[paramIndex[4]] = deltaphiy_value;
1395  if (align_phiz)
1396  params[paramIndex[5]] = deltaphiz_value;
1397  }
1398  } // end if 6DOF
1399 
1400  else if (fitter->second->type() == MuonResidualsFitter::k6DOFrphi) {
1401  if (m_debug)
1402  std::cout << "***** loop over alignables k6DOFrphi" << std::endl;
1403 
1404  double deltax_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignX);
1405  double deltax_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignX);
1406  double deltax_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignX);
1407 
1408  double deltay_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignY);
1409  double deltay_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignY);
1410  double deltay_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignY);
1411 
1412  double deltaz_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignZ);
1413  double deltaz_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignZ);
1414  double deltaz_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignZ);
1415 
1416  double deltaphix_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1417  double deltaphix_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1418  double deltaphix_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1419 
1420  double deltaphiy_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1421  double deltaphiy_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1422  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1423 
1424  double deltaphiz_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1425  double deltaphiz_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1426  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1427 
1428  double sigmaresid_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResidSigma);
1429  double sigmaresid_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResidSigma);
1430  double sigmaresid_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResidSigma);
1431 
1432  double sigmaresslope_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1433  double sigmaresslope_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1434  double sigmaresslope_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1435 
1436  double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error,
1437  gammaresslope_antisym;
1438  gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error =
1439  gammaresslope_antisym = 0.;
1440  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1441  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1442  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1443  gammaresid_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResidGamma);
1444  gammaresid_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResidGamma);
1445  gammaresid_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResidGamma);
1446 
1447  gammaresslope_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1448  gammaresslope_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1449  gammaresslope_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1450  }
1451 
1452  if (writeReport) {
1453  report << "reports[-1].fittype = \"6DOFrphi\"" << std::endl;
1454  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", "
1455  << deltax_antisym << "), \\" << std::endl
1456  << " ValErr(" << deltay_value << ", " << deltay_error << ", "
1457  << deltay_antisym << "), \\" << std::endl
1458  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", "
1459  << deltaz_antisym << "), \\" << std::endl
1460  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", "
1461  << deltaphix_antisym << "), \\" << std::endl
1462  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", "
1463  << deltaphiy_antisym << "), \\" << std::endl
1464  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", "
1465  << deltaphiz_antisym << "), \\" << std::endl
1466  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights
1467  << ", " << redchi2 << ")" << std::endl;
1468  report << "reports[-1].sigmaresid = ValErr(" << sigmaresid_value << ", " << sigmaresid_error << ", "
1469  << sigmaresid_antisym << ")" << std::endl;
1470  report << "reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value << ", " << sigmaresslope_error
1471  << ", " << sigmaresslope_antisym << ")" << std::endl;
1472  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1473  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1474  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails) {
1475  report << "reports[-1].gammaresid = ValErr(" << gammaresid_value << ", " << gammaresid_error << ", "
1476  << gammaresid_antisym << ")" << std::endl;
1477  report << "reports[-1].gammaresslope = ValErr(" << gammaresslope_value << ", " << gammaresslope_error
1478  << ", " << gammaresslope_antisym << ")" << std::endl;
1479  }
1480 
1481  report << "reports[-1].add_stats(" << fitter->second->median(MuonResiduals6DOFrphiFitter::kResid) << ", "
1482  << "None, " << fitter->second->median(MuonResiduals6DOFrphiFitter::kResSlope) << ", "
1483  << "None, " << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResid, 30.) << ", "
1484  << "None, " << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResSlope, 20.) << ", "
1485  << "None, " << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResid, 15.) << ", "
1486  << "None, " << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResSlope, 10.) << ", "
1487  << "None, "
1488  << fitter->second->wmean(
1490  << ", "
1491  << "None, "
1492  << fitter->second->wmean(
1494  << ", "
1495  << "None, "
1496  << fitter->second->wmean(
1498  << ", "
1499  << "None, "
1500  << fitter->second->wmean(
1502  << ", "
1503  << "None, " << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResid, 30.) << ", "
1504  << "None, " << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResSlope, 20.) << ", "
1505  << "None, " << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResid, 15.) << ", "
1506  << "None, " << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResSlope, 10.) << ", "
1507  << "None)" << std::endl;
1508 
1509  std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1510  namesimple_x << cname << "_simple_x";
1511  namesimple_dxdz << cname << "_simple_dxdz";
1512  nameweighted_x << cname << "_weighted_x";
1513  nameweighted_dxdz << cname << "_weighted_dxdz";
1514 
1515  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResid, 10.);
1516  fitter->second->plotsimple(
1517  namesimple_dxdz.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResSlope, 1000.);
1518 
1519  fitter->second->plotweighted(nameweighted_x.str(),
1520  &rootDirectory,
1523  10.);
1524  fitter->second->plotweighted(nameweighted_dxdz.str(),
1525  &rootDirectory,
1528  1000.);
1529  }
1530 
1531  if (successful_fit) {
1532  if (align_x)
1533  params[paramIndex[0]] = deltax_value;
1534  if (align_y)
1535  params[paramIndex[1]] = deltay_value;
1536  if (align_z)
1537  params[paramIndex[2]] = deltaz_value;
1538  if (align_phix)
1539  params[paramIndex[3]] = deltaphix_value;
1540  if (align_phiy)
1541  params[paramIndex[4]] = deltaphiy_value;
1542  if (align_phiz)
1543  params[paramIndex[5]] = deltaphiz_value;
1544  }
1545  } // end if 6DOFrphi
1546 
1547  if (successful_fit) {
1548  align::Alignables oneortwo;
1549  oneortwo.push_back(ali);
1550  if (thisali != ali)
1551  oneortwo.push_back(thisali);
1553  } else {
1554  if (m_debug)
1555  std::cout << "MINUIT fit failed!" << std::endl;
1556  if (writeReport) {
1557  report << "reports[-1].status = \"MINUITFAIL\"" << std::endl;
1558  }
1559 
1560  for (int i = 0; i < numParams; i++)
1561  cov[i][i] = 1000.;
1562 
1563  align::Alignables oneortwo;
1564  oneortwo.push_back(ali);
1565  if (thisali != ali)
1566  oneortwo.push_back(thisali);
1568  }
1569  } else { // too few hits
1570  if (m_debug)
1571  std::cout << "Too few hits!" << std::endl;
1572  if (writeReport) {
1573  report << "reports[-1].status = \"TOOFEWHITS\"" << std::endl;
1574  }
1575 
1576  for (int i = 0; i < numParams; i++)
1577  cov[i][i] = 1000.;
1578 
1579  align::Alignables oneortwo;
1580  oneortwo.push_back(ali);
1581  if (thisali != ali)
1582  oneortwo.push_back(thisali);
1584  }
1585 
1586  AlignmentParameters* parnew = ali->alignmentParameters()->cloneFromSelected(params, cov);
1587  ali->setAlignmentParameters(parnew);
1589  ali->alignmentParameters()->setValid(true);
1590 
1591  if (m_debug)
1592  std::cout << cname << " fittime= " << stop_watch.CpuTime() << " sec" << std::endl;
1593  } // end we have a fitter for this alignable
1594 
1595  if (writeReport)
1596  report << std::endl;
1597 
1598  } // end loop over alignables
1599 
1600  if (writeReport)
1601  report.close();
1602 }
1603 
1605  for (std::vector<std::string>::const_iterator fileName = m_readTemporaryFiles.begin();
1606  fileName != m_readTemporaryFiles.end();
1607  ++fileName) {
1608  FILE* file;
1609  int size;
1610  file = fopen((*fileName).c_str(), "r");
1611  if (file == nullptr)
1612  throw cms::Exception("MuonAlignmentFromReference")
1613  << "file \"" << *fileName << "\" can't be opened (doesn't exist?)" << std::endl;
1614 
1615  fread(&size, sizeof(int), 1, file);
1616  if (int(m_indexes.size()) != size)
1617  throw cms::Exception("MuonAlignmentFromReference")
1618  << "file \"" << *fileName << "\" has " << size << " fitters, but this job has " << m_indexes.size()
1619  << " fitters (probably corresponds to the wrong alignment job)" << std::endl;
1620 
1621  int i = 0;
1622  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index, ++i) {
1624  unsigned int index_toread;
1625  fread(&index_toread, sizeof(unsigned int), 1, file);
1626  if (*index != index_toread)
1627  throw cms::Exception("MuonAlignmentFromReference")
1628  << "file \"" << *fileName << "\" has index " << index_toread << " at position " << i
1629  << ", but this job is expecting " << *index << " (probably corresponds to the wrong alignment job)"
1630  << std::endl;
1631  fitter->read(file, i);
1632  }
1633 
1634  fclose(file);
1635  }
1636 }
1637 
1639  FILE* file;
1640  file = fopen(m_writeTemporaryFile.c_str(), "w");
1641  int size = m_indexes.size();
1642  fwrite(&size, sizeof(int), 1, file);
1643 
1644  int i = 0;
1645  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index, ++i) {
1647  unsigned int index_towrite = *index;
1648  fwrite(&index_towrite, sizeof(unsigned int), 1, file);
1649  fitter->write(file, i);
1650  }
1651 
1652  fclose(file);
1653 }
1654 
1656  bool m_debug = false;
1657 
1658  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index) {
1659  if (m_debug)
1660  std::cout << "correcting B in " << chamberPrettyNameFromId(*index) << std::endl;
1662  fitter->correctBField();
1663  }
1664 }
1665 
1667  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index) {
1668  if (m_debug)
1669  std::cout << "applying fiducial cuts in " << chamberPrettyNameFromId(*index) << std::endl;
1671  fitter->fiducialCuts();
1672  }
1673 }
1674 
1676  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index) {
1677  if (m_debug)
1678  std::cout << "erasing in " << chamberPrettyNameFromId(*index) << std::endl;
1680  fitter->eraseNotSelectedResiduals();
1681  }
1682 }
1683 
1685  // should not be called with negative peakNSigma
1686  assert(m_peakNSigma > 0.);
1687 
1688  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index) {
1690 
1691  int nvar = 2;
1692  int vars_index[10] = {0, 1};
1693  if (fitter->type() == MuonResidualsFitter::k5DOF) {
1694  if (fitter->useRes() == MuonResidualsFitter::k1111 || fitter->useRes() == MuonResidualsFitter::k1110 ||
1695  fitter->useRes() == MuonResidualsFitter::k1010) {
1696  nvar = 2;
1697  vars_index[0] = MuonResiduals5DOFFitter::kResid;
1698  vars_index[1] = MuonResiduals5DOFFitter::kResSlope;
1699  } else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1700  nvar = 1;
1701  vars_index[0] = MuonResiduals5DOFFitter::kResid;
1702  } else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1703  nvar = 1;
1704  vars_index[0] = MuonResiduals5DOFFitter::kResSlope;
1705  }
1706  } else if (fitter->type() == MuonResidualsFitter::k6DOF) {
1707  if (fitter->useRes() == MuonResidualsFitter::k1111) {
1708  nvar = 4;
1709  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1710  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1711  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1712  vars_index[3] = MuonResiduals6DOFFitter::kResSlopeY;
1713  } else if (fitter->useRes() == MuonResidualsFitter::k1110) {
1714  nvar = 3;
1715  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1716  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1717  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1718  } else if (fitter->useRes() == MuonResidualsFitter::k1010) {
1719  nvar = 2;
1720  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1721  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1722  } else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1723  nvar = 2;
1724  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1725  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1726  } else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1727  nvar = 1;
1728  vars_index[0] = MuonResiduals6DOFFitter::kResSlopeX;
1729  }
1730  } else if (fitter->type() == MuonResidualsFitter::k6DOFrphi) {
1731  if (fitter->useRes() == MuonResidualsFitter::k1111 || fitter->useRes() == MuonResidualsFitter::k1110 ||
1732  fitter->useRes() == MuonResidualsFitter::k1010) {
1733  nvar = 2;
1734  vars_index[0] = MuonResiduals6DOFrphiFitter::kResid;
1736  } else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1737  nvar = 1;
1738  vars_index[0] = MuonResiduals6DOFrphiFitter::kResid;
1739  } else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1740  nvar = 1;
1742  }
1743  } else
1744  assert(false);
1745 
1746  if (m_debug)
1747  std::cout << "selecting in " << chamberPrettyNameFromId(*index) << std::endl;
1748 
1749  fitter->selectPeakResiduals(m_peakNSigma, nvar, vars_index);
1750  }
1751 }
1752 
1754  DetId id(idx);
1755  char cname[40];
1756  if (id.subdetId() == MuonSubdetId::DT) {
1757  DTChamberId chamberId(id.rawId());
1758  sprintf(cname, "MB%+d/%d/%02d", chamberId.wheel(), chamberId.station(), chamberId.sector());
1759  } else if (id.subdetId() == MuonSubdetId::CSC) {
1760  CSCDetId chamberId(id.rawId());
1761  sprintf(cname,
1762  "ME%s%d/%d/%02d",
1763  (chamberId.endcap() == 1 ? "+" : "-"),
1764  chamberId.station(),
1765  chamberId.ring(),
1766  chamberId.chamber());
1767  }
1768  return std::string(cname);
1769 }
1770 
1772  // WARNING: does not support two bin option!!!
1773 
1774  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index) {
1775  DetId detid(*index);
1776  if (detid.det() != DetId::Muon || !(detid.subdetId() == MuonSubdetId::DT || detid.subdetId() == MuonSubdetId::CSC))
1777  assert(false);
1778 
1779  if (detid.subdetId() == MuonSubdetId::DT) {
1780  m_tree_row.is_dt = (Bool_t) true;
1781  DTChamberId id(*index);
1782  m_tree_row.is_plus = (Bool_t) true;
1783  m_tree_row.station = (UChar_t)id.station();
1784  m_tree_row.ring_wheel = (Char_t)id.wheel();
1785  m_tree_row.sector = (UChar_t)id.sector();
1786  } else {
1787  m_tree_row.is_dt = (Bool_t) false;
1788  CSCDetId id(*index);
1789  m_tree_row.is_plus = (Bool_t)(id.endcap() == 1);
1790  m_tree_row.station = (UChar_t)id.station();
1791  m_tree_row.ring_wheel = (Char_t)id.ring();
1792  m_tree_row.sector = (UChar_t)id.chamber();
1793  }
1794 
1796 
1797  std::vector<double*>::const_iterator residual = fitter->residualsPos_begin();
1798  std::vector<bool>::const_iterator residual_ok = fitter->residualsPos_ok_begin();
1799  for (; residual != fitter->residualsPos_end(); ++residual, ++residual_ok) {
1800  if (fitter->type() == MuonResidualsFitter::k5DOF || fitter->type() == MuonResidualsFitter::k6DOFrphi) {
1801  m_tree_row.res_x = (Float_t)(*residual)[MuonResiduals5DOFFitter::kResid];
1802  m_tree_row.res_y = (Float_t)0.;
1804  m_tree_row.res_slope_y = (Float_t)0.;
1805  m_tree_row.pos_x = (Float_t)(*residual)[MuonResiduals5DOFFitter::kPositionX];
1806  m_tree_row.pos_y = (Float_t)(*residual)[MuonResiduals5DOFFitter::kPositionY];
1807  m_tree_row.angle_x = (Float_t)(*residual)[MuonResiduals5DOFFitter::kAngleX];
1808  m_tree_row.angle_y = (Float_t)(*residual)[MuonResiduals5DOFFitter::kAngleY];
1809  m_tree_row.pz = (Float_t)(*residual)[MuonResiduals5DOFFitter::kPz];
1810  m_tree_row.pt = (Float_t)(*residual)[MuonResiduals5DOFFitter::kPt];
1811  m_tree_row.q = (Char_t)(*residual)[MuonResiduals5DOFFitter::kCharge];
1812  m_tree_row.select = (Bool_t)*residual_ok;
1813  } else if (fitter->type() == MuonResidualsFitter::k6DOF) {
1814  m_tree_row.res_x = (Float_t)(*residual)[MuonResiduals6DOFFitter::kResidX];
1815  m_tree_row.res_y = (Float_t)(*residual)[MuonResiduals6DOFFitter::kResidY];
1818  m_tree_row.pos_x = (Float_t)(*residual)[MuonResiduals6DOFFitter::kPositionX];
1819  m_tree_row.pos_y = (Float_t)(*residual)[MuonResiduals6DOFFitter::kPositionY];
1820  m_tree_row.angle_x = (Float_t)(*residual)[MuonResiduals6DOFFitter::kAngleX];
1821  m_tree_row.angle_y = (Float_t)(*residual)[MuonResiduals6DOFFitter::kAngleY];
1822  m_tree_row.pz = (Float_t)(*residual)[MuonResiduals6DOFFitter::kPz];
1823  m_tree_row.pt = (Float_t)(*residual)[MuonResiduals6DOFFitter::kPt];
1824  m_tree_row.q = (Char_t)(*residual)[MuonResiduals6DOFFitter::kCharge];
1825  m_tree_row.select = (Bool_t)*residual_ok;
1826  } else
1827  assert(false);
1828 
1829  m_ttree->Fill();
1830  }
1831  }
1832 }
1833 
1835  const align::Alignables& all_DT_chambers,
1836  const align::Alignables& all_CSC_chambers) {
1837  std::map<Alignable*, bool> already_seen;
1838 
1839  for (std::vector<std::string>::const_iterator name = m_reference.begin(); name != m_reference.end(); ++name) {
1840  bool parsing_error = false;
1841 
1842  bool barrel = (name->substr(0, 2) == std::string("MB"));
1843  bool endcap = (name->substr(0, 2) == std::string("ME"));
1844  if (!barrel && !endcap)
1845  parsing_error = true;
1846 
1847  if (!parsing_error && barrel) {
1848  int index = 2;
1849  if (name->substr(index, 1) == std::string(" "))
1850  index++;
1851 
1852  bool plus = true;
1853  if (name->substr(index, 1) == std::string("+")) {
1854  plus = true;
1855  index++;
1856  } else if (name->substr(index, 1) == std::string("-")) {
1857  plus = false;
1858  index++;
1859  } else if (numeric(name->substr(index, 1))) {
1860  } else
1861  parsing_error = true;
1862 
1863  int wheel = 0;
1864  bool wheel_digit = false;
1865  while (!parsing_error && numeric(name->substr(index, 1))) {
1866  wheel *= 10;
1867  wheel += number(name->substr(index, 1));
1868  wheel_digit = true;
1869  index++;
1870  }
1871  if (!plus)
1872  wheel *= -1;
1873  if (!wheel_digit)
1874  parsing_error = true;
1875 
1876  if (name->substr(index, 1) != std::string(" "))
1877  parsing_error = true;
1878  index++;
1879 
1880  int station = 0;
1881  bool station_digit = false;
1882  while (!parsing_error && numeric(name->substr(index, 1))) {
1883  station *= 10;
1884  station += number(name->substr(index, 1));
1885  station_digit = true;
1886  index++;
1887  }
1888  if (!station_digit)
1889  parsing_error = true;
1890 
1891  if (name->substr(index, 1) != std::string(" "))
1892  parsing_error = true;
1893  index++;
1894 
1895  int sector = 0;
1896  bool sector_digit = false;
1897  while (!parsing_error && numeric(name->substr(index, 1))) {
1898  sector *= 10;
1899  sector += number(name->substr(index, 1));
1900  sector_digit = true;
1901  index++;
1902  }
1903  if (!sector_digit)
1904  parsing_error = true;
1905 
1906  if (!parsing_error) {
1907  bool no_such_chamber = false;
1908 
1909  if (wheel < -2 || wheel > 2)
1910  no_such_chamber = true;
1911  if (station < 1 || station > 4)
1912  no_such_chamber = true;
1913  if (station == 4 && (sector < 1 || sector > 14))
1914  no_such_chamber = true;
1915  if (station < 4 && (sector < 1 || sector > 12))
1916  no_such_chamber = true;
1917 
1918  if (no_such_chamber)
1919  throw cms::Exception("MuonAlignmentFromReference")
1920  << "reference chamber doesn't exist: " << (*name) << std::endl;
1921 
1922  DTChamberId id(wheel, station, sector);
1923  for (const auto& ali : all_DT_chambers) {
1924  if (ali->geomDetId().rawId() == id.rawId()) {
1925  std::map<Alignable*, bool>::const_iterator trial = already_seen.find(ali);
1926  if (trial == already_seen.end()) {
1927  reference.push_back(ali);
1928  already_seen[ali] = true;
1929  }
1930  }
1931  }
1932  } // if (!parsing_error)
1933  }
1934 
1935  if (!parsing_error && endcap) {
1936  int index = 2;
1937  if (name->substr(index, 1) == std::string(" "))
1938  index++;
1939 
1940  bool plus = true;
1941  if (name->substr(index, 1) == std::string("+")) {
1942  plus = true;
1943  index++;
1944  } else if (name->substr(index, 1) == std::string("-")) {
1945  plus = false;
1946  index++;
1947  } else if (numeric(name->substr(index, 1))) {
1948  } else
1949  parsing_error = true;
1950 
1951  int station = 0;
1952  bool station_digit = false;
1953  while (!parsing_error && numeric(name->substr(index, 1))) {
1954  station *= 10;
1955  station += number(name->substr(index, 1));
1956  station_digit = true;
1957  index++;
1958  }
1959  if (!plus)
1960  station *= -1;
1961  if (!station_digit)
1962  parsing_error = true;
1963 
1964  if (name->substr(index, 1) != std::string("/"))
1965  parsing_error = true;
1966  index++;
1967 
1968  int ring = 0;
1969  bool ring_digit = false;
1970  while (!parsing_error && numeric(name->substr(index, 1))) {
1971  ring *= 10;
1972  ring += number(name->substr(index, 1));
1973  ring_digit = true;
1974  index++;
1975  }
1976  if (!ring_digit)
1977  parsing_error = true;
1978 
1979  if (name->substr(index, 1) != std::string(" "))
1980  parsing_error = true;
1981  index++;
1982 
1983  int chamber = 0;
1984  bool chamber_digit = false;
1985  while (!parsing_error && numeric(name->substr(index, 1))) {
1986  chamber *= 10;
1987  chamber += number(name->substr(index, 1));
1988  chamber_digit = true;
1989  index++;
1990  }
1991  if (!chamber_digit)
1992  parsing_error = true;
1993 
1994  if (!parsing_error) {
1995  bool no_such_chamber = false;
1996 
1997  int endcap = (station > 0 ? 1 : 2);
1998  station = abs(station);
1999  if (station < 1 || station > 4)
2000  no_such_chamber = true;
2001  if (station == 1 && (ring < 1 || ring > 4))
2002  no_such_chamber = true;
2003  if (station > 1 && (ring < 1 || ring > 2))
2004  no_such_chamber = true;
2005  if (station == 1 && (chamber < 1 || chamber > 36))
2006  no_such_chamber = true;
2007  if (station > 1 && ring == 1 && (chamber < 1 || chamber > 18))
2008  no_such_chamber = true;
2009  if (station > 1 && ring == 2 && (chamber < 1 || chamber > 36))
2010  no_such_chamber = true;
2011 
2012  if (no_such_chamber)
2013  throw cms::Exception("MuonAlignmentFromReference")
2014  << "reference chamber doesn't exist: " << (*name) << std::endl;
2015 
2017  for (const auto& ali : all_CSC_chambers) {
2018  if (ali->geomDetId().rawId() == id.rawId()) {
2019  std::map<Alignable*, bool>::const_iterator trial = already_seen.find(ali);
2020  if (trial == already_seen.end()) {
2021  reference.push_back(ali);
2022  already_seen[ali] = true;
2023  }
2024  }
2025  }
2026  } // if (!parsing_error)
2027  } // endcap
2028 
2029  if (parsing_error)
2030  throw cms::Exception("MuonAlignmentFromReference")
2031  << "reference chamber name is malformed: " << (*name) << std::endl;
2032  }
2033 }
2034 
MuonAlignmentFromReference::m_allowTIDTEC
bool m_allowTIDTEC
Definition: MuonAlignmentFromReference.cc:130
MuonResiduals6DOFrphiFitter::kResid
Definition: MuonResiduals6DOFrphiFitter.h:36
Propagator.h
MuonChamberResidual::resslope
double resslope() const
Definition: MuonChamberResidual.h:56
MuonAlignmentFromReference::m_minNCrossedChambers
int m_minNCrossedChambers
Definition: MuonAlignmentFromReference.cc:131
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
MuonResiduals6DOFFitter::kResidX
Definition: MuonResiduals6DOFFitter.h:41
MuonAlignmentFromReference::m_counter_trackerhits
long m_counter_trackerhits
Definition: MuonAlignmentFromReference.cc:167
MuonResiduals5DOFFitter::kRedChi2
Definition: MuonResiduals5DOFFitter.h:41
MuonResiduals6DOFrphiFitter::kPz
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonAlignmentFromReference::m_counter_station4valid
long m_counter_station4valid
Definition: MuonAlignmentFromReference.cc:178
electrons_cff.bool
bool
Definition: electrons_cff.py:366
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.muonDetIdAssociator
muonDetIdAssociator
Definition: HLT_FULL_cff.py:7988
MuonResiduals6DOFrphiFitter::kRedChi2
Definition: MuonResiduals6DOFrphiFitter.h:36
AlignmentAlgorithmBase::ConstTrajTrackPairCollection
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
Definition: AlignmentAlgorithmBase.h:68
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
MessageLogger.h
AlignableDetUnit.h
MuonAlignmentFromReference::m_minAlignmentHits
int m_minAlignmentHits
Definition: MuonAlignmentFromReference.cc:140
MuonResidualsFitter::MuonAlignmentTreeRow::ring_wheel
Char_t ring_wheel
Definition: MuonResidualsFitter.h:96
MuonResiduals6DOFrphiFitter::kNData
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonResiduals5DOFFitter::kStation
Definition: MuonResiduals5DOFFitter.h:45
MuonResiduals5DOFFitter::kPositionY
Definition: MuonResiduals5DOFFitter.h:38
align_cfg.useResiduals
useResiduals
Definition: align_cfg.py:36
AlignmentParameterStore::alignables
const align::Alignables & alignables(void) const
get all alignables
Definition: AlignmentParameterStore.h:47
MuonResiduals6DOFFitter::kResSlopeXSigma
Definition: MuonResiduals6DOFFitter.h:29
ESHandle.h
MuonResidualsFitter::k6DOFrphi
Definition: MuonResidualsFitter.h:88
ESInputTag
MuonAlignmentFromReference::m_writeTemporaryFile
std::string m_writeTemporaryFile
Definition: MuonAlignmentFromReference.cc:135
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
MuonAlignmentFromReference::m_readTemporaryFiles
std::vector< std::string > m_readTemporaryFiles
Definition: MuonAlignmentFromReference.cc:136
relativeConstraints.station
station
Definition: relativeConstraints.py:67
MuonResidualsTwoBin
Definition: MuonResidualsTwoBin.h:15
edm
HLT enums.
Definition: AlignableModifier.h:19
MuonResiduals6DOFFitter::kAlignY
Definition: MuonResiduals6DOFFitter.h:22
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
MuonAlignmentFromReference::m_peakNSigma
double m_peakNSigma
Definition: MuonAlignmentFromReference.cc:147
MuonAlignmentFromReference::readTmpFiles
void readTmpFiles()
Definition: MuonAlignmentFromReference.cc:1604
MuonResiduals5DOFFitter::kAlignZ
Definition: MuonResiduals5DOFFitter.h:22
MuonResiduals6DOFFitter::kResidXGamma
Definition: MuonResiduals6DOFFitter.h:33
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TFileService::file
TFile & file() const
return opened TFile
Definition: TFileService.h:37
MuonResiduals6DOFFitter::kAlignPhiZ
Definition: MuonResiduals6DOFFitter.h:26
MuonAlignmentFromReference::MuonAlignmentFromReference
MuonAlignmentFromReference(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: MuonAlignmentFromReference.cc:195
Alignable
Definition: Alignable.h:27
MuonResidualsTwoBin::eraseNotSelectedResiduals
void eraseNotSelectedResiduals()
Definition: MuonResidualsTwoBin.h:247
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MuonResidualsFitter::k1100
Definition: MuonResidualsFitter.h:90
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
MuonResidualsFromTrack::chamberResidual
MuonChamberResidual * chamberResidual(DetId chamberId, int type)
Definition: MuonResidualsFromTrack.cc:735
MuonAlignmentFromReference::m_combineME11
bool m_combineME11
Definition: MuonAlignmentFromReference.cc:142
MuonResidualsTwoBin::selectPeakResiduals
void selectPeakResiduals(double nsigma, int nvar, int *vars)
Definition: MuonResidualsTwoBin.h:231
MuonResidualsFromTrack::trackerNumHits
int trackerNumHits() const
Definition: MuonResidualsFromTrack.h:78
MuonResidualsFitter::MuonAlignmentTreeRow::angle_x
Float_t angle_x
Definition: MuonResidualsFitter.h:104
MuonResiduals5DOFFitter::kSector
Definition: MuonResiduals5DOFFitter.h:47
MuonResiduals6DOFFitter::kChambW
Definition: MuonResiduals6DOFFitter.h:56
MuonAlignmentFromReference::m_alignableNavigator
AlignableNavigator * m_alignableNavigator
Definition: MuonAlignmentFromReference.cc:154
cms::cuda::assert
assert(be >=bs)
MuonResidualsTwoBin.h
MuonAlignmentFromReference::m_counter_csc
long m_counter_csc
Definition: MuonAlignmentFromReference.cc:181
MuonAlignmentFromReference::processMuonResidualsFromTrack
void processMuonResidualsFromTrack(MuonResidualsFromTrack &mrft)
Definition: MuonAlignmentFromReference.cc:526
MuonResiduals6DOFFitter::kAlignX
Definition: MuonResiduals6DOFFitter.h:21
MuonAlignmentFromReference::fitAndAlign
void fitAndAlign()
Definition: MuonAlignmentFromReference.cc:832
MuonAlignmentFromReference::m_tree_row
MuonResidualsFitter::MuonAlignmentTreeRow m_tree_row
Definition: MuonAlignmentFromReference.cc:190
MuonResidualsFitter::kGaussPowerTails
Definition: MuonResidualsFitter.h:86
AlignmentParameterStore::setAlignmentPositionError
void setAlignmentPositionError(const align::Alignables &alivec, double valshift, double valrot)
Set Alignment position error.
Definition: AlignmentParameterStore.cc:646
MuonAlignmentFromReference::numeric
bool numeric(std::string s)
Definition: MuonAlignmentFromReference.cc:298
MuonResidualsFitter::MuonAlignmentTreeRow::q
Char_t q
Definition: MuonResidualsFitter.h:108
MuonResiduals6DOFFitter::kResSlopeYSigma
Definition: MuonResiduals6DOFFitter.h:30
MuonResiduals5DOFFitter::kChambl
Definition: MuonResiduals5DOFFitter.h:49
TFileDirectory
Definition: TFileDirectory.h:24
MuonResidualsFitter::MuonAlignmentTreeRow::is_plus
Bool_t is_plus
Definition: MuonResidualsFitter.h:93
MuonResiduals5DOFFitter.h
MuonAlignmentFromReference::m_propToken
const edm::ESGetToken< Propagator, TrackingComponentsRecord > m_propToken
Definition: MuonAlignmentFromReference.cc:117
AlignableMuon::CSCChambers
align::Alignables CSCChambers()
Definition: AlignableMuon.cc:418
MuonAlignmentFromReference::m_indexes
std::vector< unsigned int > m_indexes
Definition: MuonAlignmentFromReference.cc:159
MuonAlignmentFromReference::m_maxTrackP
double m_maxTrackP
Definition: MuonAlignmentFromReference.cc:126
AlignmentAlgorithmPluginFactory.h
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
MuonResiduals6DOFFitter::kCharge
Definition: MuonResiduals6DOFFitter.h:52
MuonResiduals6DOFFitter::kResidYSigma
Definition: MuonResiduals6DOFFitter.h:28
align::AlignableDTChamber
Definition: StructureType.h:76
MuonResidualsTwoBin::correctBField
void correctBField()
Definition: MuonResidualsTwoBin.h:240
MuonResiduals6DOFFitter::kResSlopeYGamma
Definition: MuonResiduals6DOFFitter.h:36
MuonAlignmentFromReference::m_counter_station123
long m_counter_station123
Definition: MuonAlignmentFromReference.cc:172
MuonAlignmentFromReference::m_counter_tracks
long m_counter_tracks
Definition: MuonAlignmentFromReference.cc:164
AlignmentAlgorithmBase
Definition: AlignmentAlgorithmBase.h:60
MuonAlignmentFromReference::m_reference
std::vector< std::string > m_reference
Definition: MuonAlignmentFromReference.cc:122
AlignmentParameters
Definition: AlignmentParameters.h:35
align_cfg.residualsModel
residualsModel
Definition: align_cfg.py:34
MuonResiduals5DOFFitter::kResidSigma
Definition: MuonResiduals5DOFFitter.h:26
MuonAlignmentFromReference::m_counter_station123dt2hits
long m_counter_station123dt2hits
Definition: MuonAlignmentFromReference.cc:175
MuonResiduals6DOFFitter::kResSlopeY
Definition: MuonResiduals6DOFFitter.h:44
MuonAlignmentFromReference::m_alignables
align::Alignables m_alignables
Definition: MuonAlignmentFromReference.cc:156
MuonResiduals5DOFFitter::kChambW
Definition: MuonResiduals5DOFFitter.h:48
MuonAlignmentFromReference::m_muonCollectionTag
edm::InputTag m_muonCollectionTag
Definition: MuonAlignmentFromReference.cc:121
MuonAlignmentFromReference::m_twoBin
bool m_twoBin
Definition: MuonAlignmentFromReference.cc:141
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
MuonResiduals5DOFFitter::kAngleX
Definition: MuonResiduals5DOFFitter.h:39
MuonChamberResidual::trackdxdz
double trackdxdz() const
Definition: MuonChamberResidual.h:62
MuonResiduals6DOFFitter::kPositionX
Definition: MuonResiduals6DOFFitter.h:45
CSCGeometry
Definition: CSCGeometry.h:24
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
MuonResidualsFitter::MuonAlignmentTreeRow
Definition: MuonResidualsFitter.h:92
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
MuonAlignmentFromReference::startNewLoop
void startNewLoop() override
Definition: MuonAlignmentFromReference.cc:85
Propagator
Definition: Propagator.h:44
MuonAlignmentFromReference::m_useResiduals
std::string m_useResiduals
Definition: MuonAlignmentFromReference.cc:151
DetId
Definition: DetId.h:17
MuonResiduals5DOFFitter::kResSlope
Definition: MuonResiduals5DOFFitter.h:36
MuonChamberResidual::residual
double residual() const
Definition: MuonChamberResidual.h:54
csc
Definition: L1Track.h:19
MuonResidualsFitter::k1111
Definition: MuonResidualsFitter.h:90
MuonAlignmentFromReference::m_counter_minchambers
long m_counter_minchambers
Definition: MuonAlignmentFromReference.cc:170
AlignableMuon::DTChambers
align::Alignables DTChambers()
Definition: AlignableMuon.cc:375
alignCSCRings.s
s
Definition: alignCSCRings.py:92
MuonResiduals6DOFrphiFitter::kAlignPhiZ
Definition: MuonResiduals6DOFrphiFitter.h:27
MuonAlignmentFromReference::m_counter_cscaligning
long m_counter_cscaligning
Definition: MuonAlignmentFromReference.cc:184
MuonAlignmentFromReference::m_counter_trackdxy
long m_counter_trackdxy
Definition: MuonAlignmentFromReference.cc:166
MuonAlignmentFromReference::bookNtuple
void bookNtuple()
Definition: MuonAlignmentFromReference.cc:275
MuonResiduals6DOFrphiFitter::kAngleY
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonResiduals5DOFFitter::kResSlopeGamma
Definition: MuonResiduals5DOFFitter.h:30
MuonAlignmentFromReference::selectResidualsPeaks
void selectResidualsPeaks()
Definition: MuonAlignmentFromReference.cc:1684
Track.h
AlignableDTWheel.h
MuonAlignmentFromReference::m_counter_cscvalid
long m_counter_cscvalid
Definition: MuonAlignmentFromReference.cc:182
BeamSpot.h
MuonResiduals6DOFFitter::kStation
Definition: MuonResiduals6DOFFitter.h:53
MuonResiduals6DOFrphiFitter.h
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
AlignableCSCChamber.h
GlobalTrackingGeometry
Definition: GlobalTrackingGeometry.h:20
reco::HaloData::plus
Definition: HaloData.h:14
MuonAlignmentFromReference::correctBField
void correctBField()
Definition: MuonAlignmentFromReference.cc:1655
AlignmentParameterStore::applyParameters
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
Definition: AlignmentParameterStore.cc:255
MuonResidualsTwoBin::residualsPos_ok_begin
std::vector< bool >::const_iterator residualsPos_ok_begin() const
Definition: MuonResidualsTwoBin.h:261
Service.h
MuonResiduals6DOFFitter::kPt
Definition: MuonResiduals6DOFFitter.h:51
MuonAlignmentFromReference::m_counter_station4
long m_counter_station4
Definition: MuonAlignmentFromReference.cc:177
MuonResiduals6DOFrphiFitter::kResidGamma
Definition: MuonResiduals6DOFrphiFitter.h:31
tfile
Definition: tfile.py:1
MuonResidualsFitter::kPowerLawTails
Definition: MuonResidualsFitter.h:86
MuonAlignmentFromReference::m_counter_events
long m_counter_events
Definition: MuonAlignmentFromReference.cc:163
MuonAlignmentFromReference::m_DetIdToken
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > m_DetIdToken
Definition: MuonAlignmentFromReference.cc:118
reco::Track
Definition: Track.h:27
MuonResiduals6DOFrphiFitter::kPositionX
Definition: MuonResiduals6DOFrphiFitter.h:36
IdealMagneticFieldRecord.h
MuonResidualsFromTrack
Definition: MuonResidualsFromTrack.h:52
MuonAlignmentFromReference::m_ttree
TTree * m_ttree
Definition: MuonAlignmentFromReference.cc:189
MuonResiduals5DOFFitter::kResidGamma
Definition: MuonResiduals5DOFFitter.h:29
AlignableTracker
Definition: AlignableTracker.h:17
MuonResidualsFromTrack::getTrack
const reco::Track * getTrack()
Definition: MuonResidualsFromTrack.h:75
MuonResidualsFitter::MuonAlignmentTreeRow::pt
Float_t pt
Definition: MuonResidualsFitter.h:107
MuonAlignmentFromReference::m_counter_totchambers
long m_counter_totchambers
Definition: MuonAlignmentFromReference.cc:171
MuonChamberResidual::chi2
double chi2() const
Definition: MuonChamberResidual.h:59
MuonResidualsFromTrack::chamberIds
const std::vector< DetId > chamberIds() const
Definition: MuonResidualsFromTrack.h:86
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:596
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
MuonAlignmentFromReference::m_maxDxy
double m_maxDxy
Definition: MuonAlignmentFromReference.cc:127
MuonResidualsTwoBin::write
void write(FILE *file, int which=0)
Definition: MuonResidualsTwoBin.h:102
MuonResiduals6DOFFitter::kAlignZ
Definition: MuonResiduals6DOFFitter.h:23
MuonAlignmentFromReference::m_me11map
std::map< Alignable *, Alignable * > m_me11map
Definition: MuonAlignmentFromReference.cc:157
AlignableExtras
Definition: AlignableExtras.h:19
MuonAlignmentFromReference
Definition: MuonAlignmentFromReference.cc:74
MuonResidualsFromTrack::normalizedChi2
double normalizedChi2() const
Definition: MuonResidualsFromTrack.cc:729
MuonResiduals6DOFrphiFitter::kResSlope
Definition: MuonResiduals6DOFrphiFitter.h:36
AlignableNavigator.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
MuonResiduals6DOFFitter::kNData
Definition: MuonResiduals6DOFFitter.h:58
DTChamberId.h
AlignableNavigator
Definition: AlignableNavigator.h:25
MuonResiduals5DOFFitter::kCharge
Definition: MuonResiduals5DOFFitter.h:44
MuonAlignmentFromReference::m_counter_station4hits
long m_counter_station4hits
Definition: MuonAlignmentFromReference.cc:179
AlignmentParameterStore.h
MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_y
Float_t res_slope_y
Definition: MuonResidualsFitter.h:101
MuonAlignmentFromReference::writeTmpFiles
void writeTmpFiles()
Definition: MuonAlignmentFromReference.cc:1638
MuonResiduals6DOFFitter::kRedChi2
Definition: MuonResiduals6DOFFitter.h:49
MuonResidualsTwoBin::type
int type() const
Definition: MuonResidualsTwoBin.h:40
MuonResidualsFitter::MuonAlignmentTreeRow::res_x
Float_t res_x
Definition: MuonResidualsFitter.h:98
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
GlobalTrackingGeometryRecord.h
MuonResidualsFitter::k1010
Definition: MuonResidualsFitter.h:90
MuonResiduals5DOFFitter::kAlignPhiY
Definition: MuonResiduals5DOFFitter.h:24
TFileService.h
geometryDiff.file
file
Definition: geometryDiff.py:13
DetIdAssociator
Definition: DetIdAssociator.h:45
MuonResiduals5DOFFitter::kAlignX
Definition: MuonResiduals5DOFFitter.h:21
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
MuonResidualsTwoBin::residualsPos_end
std::vector< double * >::const_iterator residualsPos_end() const
Definition: MuonResidualsTwoBin.h:257
MuonAlignmentFromReference::~MuonAlignmentFromReference
~MuonAlignmentFromReference() override
Definition: MuonAlignmentFromReference.cc:273
MuonAlignmentFromReference::m_globTackingToken
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_globTackingToken
Definition: MuonAlignmentFromReference.cc:115
MuonChamberResidual::kDT2
Definition: MuonChamberResidual.h:28
MuonResidualsFitter::k6DOF
Definition: MuonResidualsFitter.h:88
MuonAlignmentFromReference::m_minDT2Hits
int m_minDT2Hits
Definition: MuonAlignmentFromReference.cc:133
AlignmentAlgorithmBase::terminate
virtual void terminate()
Called at end of job (must be implemented in derived class)
Definition: AlignmentAlgorithmBase.h:158
edm::ParameterSet
Definition: ParameterSet.h:47
edm::Transition
Transition
Definition: Transition.h:12
MuonResiduals6DOFFitter::kChambl
Definition: MuonResiduals6DOFFitter.h:57
MuonResiduals5DOFFitter::kResid
Definition: MuonResiduals5DOFFitter.h:35
MuonResidualsFitter::kPureGaussian
Definition: MuonResidualsFitter.h:86
MuonResiduals5DOFFitter::kWheel
Definition: MuonResiduals5DOFFitter.h:46
MuonAlignmentFromReference::m_minTrackPt
double m_minTrackPt
Definition: MuonAlignmentFromReference.cc:123
MuonResidualsFitter::k1110
Definition: MuonResidualsFitter.h:90
MuonChamberResidual::numHits
int numHits() const
Definition: MuonChamberResidual.h:52
Event.h
MuonResiduals5DOFFitter::kAlignPhiZ
Definition: MuonResiduals5DOFFitter.h:25
MuonResidualsFitter::k1000
Definition: MuonResidualsFitter.h:90
AlignableMuon.h
MuonResiduals6DOFFitter::kAlignPhiY
Definition: MuonResiduals6DOFFitter.h:25
MuonAlignmentFromReference::m_counter_station123aligning
long m_counter_station123aligning
Definition: MuonAlignmentFromReference.cc:176
MuonChamberResidual::chamberAlignable
AlignableDetOrUnitPtr chamberAlignable() const
Definition: MuonChamberResidual.h:50
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
MuonAlignmentFromReference::m_minTrackerHits
int m_minTrackerHits
Definition: MuonAlignmentFromReference.cc:128
MuonResiduals6DOFFitter::kAngleY
Definition: MuonResiduals6DOFFitter.h:48
MuonChamberResidual::trackx
double trackx() const
Definition: MuonChamberResidual.h:64
AlignableCSCRing.h
MuonResidualsFitter::MuonAlignmentTreeRow::pos_y
Float_t pos_y
Definition: MuonResidualsFitter.h:103
MuonAlignmentFromReference::m_residualsModel
std::string m_residualsModel
Definition: MuonAlignmentFromReference.cc:139
CSCDetId
Definition: CSCDetId.h:26
MuonResiduals6DOFFitter.h
dtNoiseDBValidation_cfg.trial
trial
Definition: dtNoiseDBValidation_cfg.py:9
AlignableMuon
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
MuonAlignmentFromReference::m_counter_trackmomentum
long m_counter_trackmomentum
Definition: MuonAlignmentFromReference.cc:165
RecoTauValidation_cfi.reference
reference
Definition: RecoTauValidation_cfi.py:233
MuonResiduals6DOFrphiFitter::kResSlopeSigma
Definition: MuonResiduals6DOFrphiFitter.h:29
MuonAlignmentFromReference::m_BFieldCorrection
int m_BFieldCorrection
Definition: MuonAlignmentFromReference.cc:148
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
edm::Service< TFileService >
createfilelist.int
int
Definition: createfilelist.py:10
MuonResidualsTwoBin::read
void read(FILE *file, int which=0)
Definition: MuonResidualsTwoBin.h:110
MuonChamberResidual
Definition: MuonChamberResidual.h:26
MuonResiduals6DOFrphiFitter::kAlignPhiX
Definition: MuonResiduals6DOFrphiFitter.h:25
MuonAlignmentFromReference::initialize
void initialize(const edm::EventSetup &iSetup, AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *extras, AlignmentParameterStore *alignmentParameterStore) override
Call at beginning of job (must be implemented in derived class)
Definition: MuonAlignmentFromReference.cc:306
MuonResiduals6DOFrphiFitter::kAlignY
Definition: MuonResiduals6DOFrphiFitter.h:23
MuonResidualsFitter::MuonAlignmentTreeRow::pos_x
Float_t pos_x
Definition: MuonResidualsFitter.h:102
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
MuonResidualsFromTrack::contains_TIDTEC
bool contains_TIDTEC() const
Definition: MuonResidualsFromTrack.h:84
AlignableDTStation.h
MuonAlignmentFromReference::m_maxTrackerRedChi2
double m_maxTrackerRedChi2
Definition: MuonAlignmentFromReference.cc:129
MuonAlignmentFromReference::m_reportFileName
std::string m_reportFileName
Definition: MuonAlignmentFromReference.cc:144
DetIdAssociatorRecord.h
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
align::AlignableCSCChamber
Definition: StructureType.h:82
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
MuonAlignmentFromReference::m_debug
bool m_debug
Definition: MuonAlignmentFromReference.cc:192
MuonResiduals6DOFFitter::kSector
Definition: MuonResiduals6DOFFitter.h:55
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
MuonResidualsFitter::MuonAlignmentTreeRow::pz
Float_t pz
Definition: MuonResidualsFitter.h:106
MuonResiduals5DOFFitter::kPt
Definition: MuonResiduals5DOFFitter.h:43
MuonChamberResidual::kCSC
Definition: MuonChamberResidual.h:28
MuonResidualsFromTrack.h
MuonAlignmentFromReference::m_doAlignment
bool m_doAlignment
Definition: MuonAlignmentFromReference.cc:137
MuonResidualsFitter::MuonAlignmentTreeRow::station
UChar_t station
Definition: MuonResidualsFitter.h:95
MuonResiduals6DOFFitter::kAngleX
Definition: MuonResiduals6DOFFitter.h:47
MuonAlignmentFromReference::m_minCSCHits
int m_minCSCHits
Definition: MuonAlignmentFromReference.cc:134
MuonAlignmentFromReference::m_strategy
int m_strategy
Definition: MuonAlignmentFromReference.cc:138
MuonResiduals6DOFrphiFitter::kPositionY
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonAlignmentFromReference::m_maxTrackPt
double m_maxTrackPt
Definition: MuonAlignmentFromReference.cc:124
MuonResidualsTwoBin::useRes
int useRes() const
Definition: MuonResidualsTwoBin.h:44
MuonSubdetId.h
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::ESGetToken< CSCGeometry, MuonGeometryRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MuonResidualsFitter::kROOTVoigt
Definition: MuonResidualsFitter.h:86
MuonResidualsFitter::k5DOF
Definition: MuonResidualsFitter.h:88
MuonAlignmentFromReference::m_counter_resslopey
long m_counter_resslopey
Definition: MuonAlignmentFromReference.cc:185
MuonResiduals6DOFrphiFitter::kResidSigma
Definition: MuonResiduals6DOFrphiFitter.h:28
edmIntegrityCheck.report
report
Definition: edmIntegrityCheck.py:348
InputTag.h
MuonResidualsFitter::MuonAlignmentTreeRow::sector
UChar_t sector
Definition: MuonResidualsFitter.h:97
MuonResiduals6DOFFitter::kPositionY
Definition: MuonResiduals6DOFFitter.h:46
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
looper.cfg
cfg
Definition: looper.py:296
MuonResidualsFitter::MuonAlignmentTreeRow::angle_y
Float_t angle_y
Definition: MuonResidualsFitter.h:105
MuonResiduals5DOFFitter::kAlignPhiX
Definition: MuonResiduals5DOFFitter.h:23
MuonResidualsFitter::MuonAlignmentTreeRow::res_y
Float_t res_y
Definition: MuonResidualsFitter.h:99
MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_x
Float_t res_slope_x
Definition: MuonResidualsFitter.h:100
dumpTauVariables_cfi.eventInfo
eventInfo
add run, event number and lumi section
Definition: dumpTauVariables_cfi.py:12
MuonAlignmentFromReference::chamberPrettyNameFromId
std::string chamberPrettyNameFromId(unsigned int idx)
Definition: MuonAlignmentFromReference.cc:1753
Trajectory.h
MuonAlignmentFromReference::m_counter_station123valid
long m_counter_station123valid
Definition: MuonAlignmentFromReference.cc:173
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
MuonAlignmentFromReference::m_fitters
std::map< Alignable *, MuonResidualsTwoBin * > m_fitters
Definition: MuonAlignmentFromReference.cc:158
MuonAlignmentFromReference::m_doDT
bool m_doDT
Definition: MuonAlignmentFromReference.cc:149
MuonResidualsTwoBin::residualsPos_begin
std::vector< double * >::const_iterator residualsPos_begin() const
Definition: MuonResidualsTwoBin.h:256
MuonResidualsFitter::MuonAlignmentTreeRow::select
Bool_t select
Definition: MuonResidualsFitter.h:109
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
AlignableDTChamber.h
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MuonResiduals6DOFrphiFitter::kAlignX
Definition: MuonResiduals6DOFrphiFitter.h:22
MuonChamberResidual::ChambW
double ChambW() const
Definition: MuonChamberResidual.h:67
MuonAlignmentFromReference::m_minDT13Hits
int m_minDT13Hits
Definition: MuonAlignmentFromReference.cc:132
MuonResiduals5DOFFitter::kResSlopeSigma
Definition: MuonResiduals5DOFFitter.h:27
MuonChamberResidual::trackdydz
double trackdydz() const
Definition: MuonChamberResidual.h:63
AlignmentParameterStore
Definition: AlignmentParameterStore.h:23
MuonResiduals6DOFFitter::kAlignPhiX
Definition: MuonResiduals6DOFFitter.h:24
MuonChamberResidual::tracky
double tracky() const
Definition: MuonChamberResidual.h:65
AlignableCSCStation.h
Trajectory
Definition: Trajectory.h:38
MuonResiduals6DOFFitter::kWheel
Definition: MuonResiduals6DOFFitter.h:54
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
AlignmentParameters::cloneFromSelected
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
MuonResiduals5DOFFitter::kNData
Definition: MuonResiduals5DOFFitter.h:50
MuonAlignmentFromReference::m_MagFieldToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
Definition: MuonAlignmentFromReference.cc:116
MuonResiduals6DOFFitter::kResSlopeX
Definition: MuonResiduals6DOFFitter.h:43
MuonAlignmentFromReference::m_maxResSlopeY
double m_maxResSlopeY
Definition: MuonAlignmentFromReference.cc:145
MuonAlignmentFromReference::parseReference
void parseReference(align::Alignables &reference, const align::Alignables &all_DT_chambers, const align::Alignables &all_CSC_chambers)
Definition: MuonAlignmentFromReference.cc:1834
MuonResiduals6DOFrphiFitter::kAlignPhiY
Definition: MuonResiduals6DOFrphiFitter.h:26
TrackingComponentsRecord.h
MuonResidualsFitter::k0010
Definition: MuonResidualsFitter.h:90
Exception
Definition: hltDiff.cc:245
MuonResiduals6DOFFitter::kPz
Definition: MuonResiduals6DOFFitter.h:50
MuonResiduals6DOFFitter::kResSlopeXGamma
Definition: MuonResiduals6DOFFitter.h:35
MuonAlignmentFromReference::eraseNotSelectedResiduals
void eraseNotSelectedResiduals()
Definition: MuonAlignmentFromReference.cc:1675
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
Alignable.h
MuonAlignmentFromReference::m_weightAlignment
bool m_weightAlignment
Definition: MuonAlignmentFromReference.cc:143
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MuonResiduals5DOFFitter::kAngleY
Definition: MuonResiduals5DOFFitter.h:40
AlignableDTSuperLayer.h
MuonAlignmentFromReference::m_counter_cschits
long m_counter_cschits
Definition: MuonAlignmentFromReference.cc:183
MuonResiduals6DOFrphiFitter::kAlignZ
Definition: MuonResiduals6DOFrphiFitter.h:24
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
MuonResiduals6DOFFitter::kResidY
Definition: MuonResiduals6DOFFitter.h:42
MuonResiduals5DOFFitter::kPositionX
Definition: MuonResiduals5DOFFitter.h:37
MuonAlignmentFromReference::fiducialCuts
void fiducialCuts()
Definition: MuonAlignmentFromReference.cc:1666
MuonAlignmentFromReference::m_counter_trackertidtec
long m_counter_trackertidtec
Definition: MuonAlignmentFromReference.cc:169
AlignmentAlgorithmBase.h
Interface/Base class for alignment algorithms, each alignment algorithm has to be derived from this c...
MuonResiduals5DOFFitter
Definition: MuonResiduals5DOFFitter.h:18
MuonAlignmentFromReference::m_doCSC
bool m_doCSC
Definition: MuonAlignmentFromReference.cc:150
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
MuonResiduals6DOFFitter::kResidYGamma
Definition: MuonResiduals6DOFFitter.h:34
MuonAlignmentFromReference::m_fitterOrder
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
Definition: MuonAlignmentFromReference.cc:160
MuonResiduals6DOFrphiFitter::kPt
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonAlignmentFromReference::m_counter_trackerchi2
long m_counter_trackerchi2
Definition: MuonAlignmentFromReference.cc:168
DetId::Muon
Definition: DetId.h:26
MuonChamberResidual::ndof
int ndof() const
Definition: MuonChamberResidual.h:60
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
MuonAlignmentFromReference::m_counter_station4aligning
long m_counter_station4aligning
Definition: MuonAlignmentFromReference.cc:180
MuonResidualsFitter::kPureGaussian2D
Definition: MuonResidualsFitter.h:86
MuonResiduals6DOFFitter
Definition: MuonResiduals6DOFFitter.h:18
ParameterSet.h
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
DTSuperLayerId.h
MuonResidualsFitter::MuonAlignmentTreeRow::is_dt
Bool_t is_dt
Definition: MuonResidualsFitter.h:94
MuonGeometryRecord.h
MuonAlignmentFromReference::run
void run(const edm::EventSetup &iSetup, const EventInfo &eventInfo) override
Run the algorithm (must be implemented in derived class)
Definition: MuonAlignmentFromReference.cc:439
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
MuonResidualsTwoBin::fiducialCuts
void fiducialCuts()
Definition: MuonResidualsTwoBin.h:245
GlobalTrackingGeometry.h
MuonChamberResidual::kDT13
Definition: MuonChamberResidual.h:28
MagneticField
Definition: MagneticField.h:19
MuonAlignmentFromReference::fillNtuple
void fillNtuple()
Definition: MuonAlignmentFromReference.cc:1771
AlignmentAlgorithmPluginFactory
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
MuonAlignmentFromReference::m_cscGeometryToken
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeometryToken
Definition: MuonAlignmentFromReference.cc:114
MuonChamberResidual::Chambl
double Chambl() const
Definition: MuonChamberResidual.h:68
edm::InputTag
Definition: InputTag.h:15
MuonAlignmentFromReference::m_alignmentParameterStore
AlignmentParameterStore * m_alignmentParameterStore
Definition: MuonAlignmentFromReference.cc:155
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
MuonResiduals6DOFrphiFitter::kAngleX
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonResiduals6DOFFitter::kResidXSigma
Definition: MuonResiduals6DOFFitter.h:27
MuonAlignmentFromReference::m_counter_station123dt13hits
long m_counter_station123dt13hits
Definition: MuonAlignmentFromReference.cc:174
MuonResiduals5DOFFitter::kPz
Definition: MuonResiduals5DOFFitter.h:42
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
MuonAlignmentFromReference::number
int number(std::string s)
Definition: MuonAlignmentFromReference.cc:300
CSCGeometry.h
AlignmentAlgorithmBase::EventInfo
define event information passed to algorithms
Definition: AlignmentAlgorithmBase.h:73
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MuonResiduals6DOFrphiFitter
Definition: MuonResiduals6DOFrphiFitter.h:19
MuonAlignmentFromReference::m_createNtuple
bool m_createNtuple
Definition: MuonAlignmentFromReference.cc:146
MuonResiduals6DOFrphiFitter::kResSlopeGamma
Definition: MuonResiduals6DOFrphiFitter.h:32
MuonResiduals6DOFrphiFitter::kCharge
Definition: MuonResiduals6DOFrphiFitter.h:36
MuonAlignmentFromReference::m_minTrackP
double m_minTrackP
Definition: MuonAlignmentFromReference.cc:125