CMS 3D CMS Logo

CSCOverlapsAlignmentAlgorithm.cc
Go to the documentation of this file.
2 
5  : AlignmentAlgorithmBase(iConfig, iC),
6  m_minHitsPerChamber(iConfig.getParameter<int>("minHitsPerChamber")),
7  m_maxdrdz(iConfig.getParameter<double>("maxdrdz")),
8  m_fiducial(iConfig.getParameter<bool>("fiducial")),
9  m_useHitWeights(iConfig.getParameter<bool>("useHitWeights")),
10  m_slopeFromTrackRefit(iConfig.getParameter<bool>("slopeFromTrackRefit")),
11  m_minStationsInTrackRefits(iConfig.getParameter<int>("minStationsInTrackRefits")),
12  m_truncateSlopeResid(iConfig.getParameter<double>("truncateSlopeResid")),
13  m_truncateOffsetResid(iConfig.getParameter<double>("truncateOffsetResid")),
14  m_combineME11(iConfig.getParameter<bool>("combineME11")),
15  m_useTrackWeights(iConfig.getParameter<bool>("useTrackWeights")),
16  m_errorFromRMS(iConfig.getParameter<bool>("errorFromRMS")),
17  m_minTracksPerOverlap(iConfig.getParameter<int>("minTracksPerOverlap")),
18  m_makeHistograms(iConfig.getParameter<bool>("makeHistograms")),
19  m_cscGeometryToken(iC.esConsumes<edm::Transition::BeginRun>()),
20  m_propToken(iC.esConsumes(edm::ESInputTag(
21  "",
22  m_slopeFromTrackRefit
23  ? iConfig.getParameter<edm::ParameterSet>("TrackTransformer").getParameter<std::string>("Propagator")
24  : std::string("")))),
25  m_tthbToken(iC.esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
26  m_mode_string(iConfig.getParameter<std::string>("mode")),
27  m_reportFileName(iConfig.getParameter<std::string>("reportFileName")),
28  m_minP(iConfig.getParameter<double>("minP")),
29  m_maxRedChi2(iConfig.getParameter<double>("maxRedChi2")),
30  m_writeTemporaryFile(iConfig.getParameter<std::string>("writeTemporaryFile")),
31  m_readTemporaryFiles(iConfig.getParameter<std::vector<std::string> >("readTemporaryFiles")),
32  m_doAlignment(iConfig.getParameter<bool>("doAlignment")) {
33  if (m_mode_string == std::string("phiy"))
35  else if (m_mode_string == std::string("phipos"))
37  else if (m_mode_string == std::string("phiz"))
39  else if (m_mode_string == std::string("radius"))
41  else
42  throw cms::Exception("BadConfig") << "mode must be one of \"phiy\", \"phipos\", \"phiz\", \"radius\"" << std::endl;
43 
44  std::vector<edm::ParameterSet> fitters = iConfig.getParameter<std::vector<edm::ParameterSet> >("fitters");
45  for (std::vector<edm::ParameterSet>::const_iterator fitter = fitters.begin(); fitter != fitters.end(); ++fitter) {
47  }
48 
49  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin();
50  residualsConstraint != m_residualsConstraints.end();
51  ++residualsConstraint) {
52  (*residualsConstraint)->configure(this);
53  m_quickChamberLookup[std::pair<CSCDetId, CSCDetId>((*residualsConstraint)->id_i(), (*residualsConstraint)->id_j())] =
54  *residualsConstraint;
55  }
56 
58  m_trackTransformer = new TrackTransformer(iConfig.getParameter<edm::ParameterSet>("TrackTransformer"), iC);
59  } else {
60  m_trackTransformer = nullptr;
61  }
62 
63  m_propagatorPointer = nullptr;
64 
65  if (m_makeHistograms) {
66  edm::Service<TFileService> tFileService;
67  m_histP10 = tFileService->make<TH1F>("P10", "", 100, 0, 10);
68  m_histP100 = tFileService->make<TH1F>("P100", "", 100, 0, 100);
69  m_histP1000 = tFileService->make<TH1F>("P1000", "", 100, 0, 1000);
70 
71  m_hitsPerChamber = tFileService->make<TH1F>("hitsPerChamber", "", 10, -0.5, 9.5);
72 
73  m_fiducial_ME11 = tFileService->make<TProfile>("fiducial_ME11", "", 100, 0.075, 0.100);
74  m_fiducial_ME12 = tFileService->make<TProfile>("fiducial_ME12", "", 100, 0.080, 0.105);
75  m_fiducial_MEx1 = tFileService->make<TProfile>("fiducial_MEx1", "", 100, 0.160, 0.210);
76  m_fiducial_MEx2 = tFileService->make<TProfile>("fiducial_MEx2", "", 100, 0.080, 0.105);
77 
78  m_slope = tFileService->make<TH1F>("slope", "", 100, -0.5, 0.5);
79  m_slope_MEp4 = tFileService->make<TH1F>("slope_MEp4", "", 100, -0.5, 0.5);
80  m_slope_MEp3 = tFileService->make<TH1F>("slope_MEp3", "", 100, -0.5, 0.5);
81  m_slope_MEp2 = tFileService->make<TH1F>("slope_MEp2", "", 100, -0.5, 0.5);
82  m_slope_MEp1 = tFileService->make<TH1F>("slope_MEp1", "", 100, -0.5, 0.5);
83  m_slope_MEm1 = tFileService->make<TH1F>("slope_MEm1", "", 100, -0.5, 0.5);
84  m_slope_MEm2 = tFileService->make<TH1F>("slope_MEm2", "", 100, -0.5, 0.5);
85  m_slope_MEm3 = tFileService->make<TH1F>("slope_MEm3", "", 100, -0.5, 0.5);
86  m_slope_MEm4 = tFileService->make<TH1F>("slope_MEm4", "", 100, -0.5, 0.5);
87 
88  m_slopeResiduals = tFileService->make<TH1F>("slopeResiduals", "mrad", 300, -30., 30.);
89  m_slopeResiduals_weighted = tFileService->make<TH1F>("slopeResiduals_weighted", "mrad", 300, -30., 30.);
90  m_slopeResiduals_normalized = tFileService->make<TH1F>("slopeResiduals_normalized", "", 200, -20., 20.);
91  m_offsetResiduals = tFileService->make<TH1F>("offsetResiduals", "mm", 300, -30., 30.);
92  m_offsetResiduals_weighted = tFileService->make<TH1F>("offsetResiduals_weighted", "mm", 300, -30., 30.);
93  m_offsetResiduals_normalized = tFileService->make<TH1F>("offsetResiduals_normalized", "", 200, -20., 20.);
94 
95  m_drdz = tFileService->make<TH1F>("drdz", "", 100, -0.5, 0.5);
96 
97  m_occupancy = tFileService->make<TH2F>("occupancy", "", 36, 1, 37, 20, 1, 21);
98  for (int i = 1; i <= 36; i++) {
99  std::stringstream pairname;
100  pairname << i << "-";
101  if (i + 1 == 37)
102  pairname << 1;
103  else
104  pairname << (i + 1);
105  m_occupancy->GetXaxis()->SetBinLabel(i, pairname.str().c_str());
106  }
107  m_occupancy->GetYaxis()->SetBinLabel(1, "ME-4/2");
108  m_occupancy->GetYaxis()->SetBinLabel(2, "ME-4/1");
109  m_occupancy->GetYaxis()->SetBinLabel(3, "ME-3/2");
110  m_occupancy->GetYaxis()->SetBinLabel(4, "ME-3/1");
111  m_occupancy->GetYaxis()->SetBinLabel(5, "ME-2/2");
112  m_occupancy->GetYaxis()->SetBinLabel(6, "ME-2/1");
113  m_occupancy->GetYaxis()->SetBinLabel(7, "ME-1/3");
114  m_occupancy->GetYaxis()->SetBinLabel(8, "ME-1/2");
115  if (!m_combineME11) {
116  m_occupancy->GetYaxis()->SetBinLabel(9, "ME-1/1b");
117  m_occupancy->GetYaxis()->SetBinLabel(10, "ME-1/1a");
118  m_occupancy->GetYaxis()->SetBinLabel(11, "ME+1/1a");
119  m_occupancy->GetYaxis()->SetBinLabel(12, "ME+1/1b");
120  } else {
121  m_occupancy->GetYaxis()->SetBinLabel(9, "ME-1/1");
122  m_occupancy->GetYaxis()->SetBinLabel(10, "");
123  m_occupancy->GetYaxis()->SetBinLabel(11, "");
124  m_occupancy->GetYaxis()->SetBinLabel(12, "ME+1/1");
125  }
126  m_occupancy->GetYaxis()->SetBinLabel(13, "ME+1/2");
127  m_occupancy->GetYaxis()->SetBinLabel(14, "ME+1/3");
128  m_occupancy->GetYaxis()->SetBinLabel(15, "ME+2/1");
129  m_occupancy->GetYaxis()->SetBinLabel(16, "ME+2/2");
130  m_occupancy->GetYaxis()->SetBinLabel(17, "ME+3/1");
131  m_occupancy->GetYaxis()->SetBinLabel(18, "ME+3/2");
132  m_occupancy->GetYaxis()->SetBinLabel(19, "ME+4/1");
133  m_occupancy->GetYaxis()->SetBinLabel(20, "ME+4/2");
134 
135  m_XYpos_mep1 = tFileService->make<TH2F>("XYpos_mep1", "Positions: ME+1", 140, -700., 700., 140, -700., 700.);
136  m_XYpos_mep2 = tFileService->make<TH2F>("XYpos_mep2", "Positions: ME+2", 140, -700., 700., 140, -700., 700.);
137  m_XYpos_mep3 = tFileService->make<TH2F>("XYpos_mep3", "Positions: ME+3", 140, -700., 700., 140, -700., 700.);
138  m_XYpos_mep4 = tFileService->make<TH2F>("XYpos_mep4", "Positions: ME+4", 140, -700., 700., 140, -700., 700.);
139  m_XYpos_mem1 = tFileService->make<TH2F>("XYpos_mem1", "Positions: ME-1", 140, -700., 700., 140, -700., 700.);
140  m_XYpos_mem2 = tFileService->make<TH2F>("XYpos_mem2", "Positions: ME-2", 140, -700., 700., 140, -700., 700.);
141  m_XYpos_mem3 = tFileService->make<TH2F>("XYpos_mem3", "Positions: ME-3", 140, -700., 700., 140, -700., 700.);
142  m_XYpos_mem4 = tFileService->make<TH2F>("XYpos_mem4", "Positions: ME-4", 140, -700., 700., 140, -700., 700.);
143  m_RPhipos_mep1 = tFileService->make<TH2F>("RPhipos_mep1", "Positions: ME+1", 144, -M_PI, M_PI, 21, 0., 700.);
144  m_RPhipos_mep2 = tFileService->make<TH2F>("RPhipos_mep2", "Positions: ME+2", 144, -M_PI, M_PI, 21, 0., 700.);
145  m_RPhipos_mep3 = tFileService->make<TH2F>("RPhipos_mep3", "Positions: ME+3", 144, -M_PI, M_PI, 21, 0., 700.);
146  m_RPhipos_mep4 = tFileService->make<TH2F>("RPhipos_mep4", "Positions: ME+4", 144, -M_PI, M_PI, 21, 0., 700.);
147  m_RPhipos_mem1 = tFileService->make<TH2F>("RPhipos_mem1", "Positions: ME-1", 144, -M_PI, M_PI, 21, 0., 700.);
148  m_RPhipos_mem2 = tFileService->make<TH2F>("RPhipos_mem2", "Positions: ME-2", 144, -M_PI, M_PI, 21, 0., 700.);
149  m_RPhipos_mem3 = tFileService->make<TH2F>("RPhipos_mem3", "Positions: ME-3", 144, -M_PI, M_PI, 21, 0., 700.);
150  m_RPhipos_mem4 = tFileService->make<TH2F>("RPhipos_mem4", "Positions: ME-4", 144, -M_PI, M_PI, 21, 0., 700.);
151  } else {
152  m_histP10 = nullptr;
153  m_histP100 = nullptr;
154  m_histP1000 = nullptr;
155  m_hitsPerChamber = nullptr;
156  m_fiducial_ME11 = nullptr;
157  m_fiducial_ME12 = nullptr;
158  m_fiducial_MEx1 = nullptr;
159  m_fiducial_MEx2 = nullptr;
160  m_slope = nullptr;
161  m_slope_MEp4 = nullptr;
162  m_slope_MEp3 = nullptr;
163  m_slope_MEp2 = nullptr;
164  m_slope_MEp1 = nullptr;
165  m_slope_MEm1 = nullptr;
166  m_slope_MEm2 = nullptr;
167  m_slope_MEm3 = nullptr;
168  m_slope_MEm4 = nullptr;
169  m_slopeResiduals = nullptr;
170  m_slopeResiduals_weighted = nullptr;
171  m_slopeResiduals_normalized = nullptr;
172  m_offsetResiduals = nullptr;
173  m_offsetResiduals_weighted = nullptr;
175  m_drdz = nullptr;
176  m_occupancy = nullptr;
177  m_XYpos_mep1 = nullptr;
178  m_XYpos_mep2 = nullptr;
179  m_XYpos_mep3 = nullptr;
180  m_XYpos_mep4 = nullptr;
181  m_XYpos_mem1 = nullptr;
182  m_XYpos_mem2 = nullptr;
183  m_XYpos_mem3 = nullptr;
184  m_XYpos_mem4 = nullptr;
185  m_RPhipos_mep1 = nullptr;
186  m_RPhipos_mep2 = nullptr;
187  m_RPhipos_mep3 = nullptr;
188  m_RPhipos_mep4 = nullptr;
189  m_RPhipos_mem1 = nullptr;
190  m_RPhipos_mem2 = nullptr;
191  m_RPhipos_mem3 = nullptr;
192  m_RPhipos_mem4 = nullptr;
193  }
194 }
195 
197 
199  AlignableTracker* alignableTracker,
200  AlignableMuon* alignableMuon,
201  AlignableExtras* alignableExtras,
202  AlignmentParameterStore* alignmentParameterStore) {
203  m_alignmentParameterStore = alignmentParameterStore;
205 
206  if (alignableTracker == nullptr)
207  m_alignableNavigator = new AlignableNavigator(alignableMuon);
208  else
209  m_alignableNavigator = new AlignableNavigator(alignableTracker, alignableMuon);
210 
211  for (const auto& alignable : m_alignables) {
212  DetId id = alignable->geomDetId();
213  if (id.det() != DetId::Muon || id.subdetId() != MuonSubdetId::CSC || CSCDetId(id.rawId()).layer() != 0) {
214  throw cms::Exception("BadConfig") << "Only CSC chambers may be alignable" << std::endl;
215  }
216 
217  std::vector<bool> selector = alignable->alignmentParameters()->selector();
218  for (std::vector<bool>::const_iterator i = selector.begin(); i != selector.end(); ++i) {
219  if (!(*i))
220  throw cms::Exception("BadConfig") << "All selector strings should be \"111111\"" << std::endl;
221  }
222  }
223 
224  const CSCGeometry* cscGeometry = &iSetup.getData(m_cscGeometryToken);
225 
226  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin();
227  residualsConstraint != m_residualsConstraints.end();
228  ++residualsConstraint) {
229  (*residualsConstraint)->setZplane(cscGeometry);
230  }
231 
232  if (!m_readTemporaryFiles.empty()) {
233  std::vector<std::ifstream*> input;
234  for (std::vector<std::string>::const_iterator fileName = m_readTemporaryFiles.begin();
236  ++fileName) {
237  input.push_back(new std::ifstream(fileName->c_str()));
238  }
239 
240  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin();
241  residualsConstraint != m_residualsConstraints.end();
242  ++residualsConstraint) {
243  (*residualsConstraint)->read(input, m_readTemporaryFiles);
244  }
245 
246  for (std::vector<std::ifstream*>::const_iterator file = input.begin(); file != input.end(); ++file) {
247  delete (*file);
248  }
249  }
250 }
251 
254  if (m_slopeFromTrackRefit) {
255  iSetup.getHandle(m_propToken);
256  if (m_propagatorPointer != &*propagator) {
258 
259  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint =
260  m_residualsConstraints.begin();
261  residualsConstraint != m_residualsConstraints.end();
262  ++residualsConstraint) {
263  (*residualsConstraint)->setPropagator(m_propagatorPointer);
264  }
265  }
266  }
267 
268  const TransientTrackBuilder* transientTrackBuilder = &iSetup.getData(m_tthbToken);
269 
270  if (m_trackTransformer != nullptr)
272 
273  const ConstTrajTrackPairCollection& trajtracks = eventInfo.trajTrackPairs();
274  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
275  ++trajtrack) {
276  const Trajectory* traj = (*trajtrack).first;
277  const reco::Track* track = (*trajtrack).second;
278 
279  if (m_makeHistograms) {
280  m_histP10->Fill(track->p());
281  m_histP100->Fill(track->p());
282  m_histP1000->Fill(track->p());
283  }
284  if (track->p() >= m_minP) {
285  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
286  reco::TransientTrack transientTrack = transientTrackBuilder->build(track);
287 
288  std::map<int, std::map<CSCDetId, bool> > stationsToChambers;
289  for (std::vector<TrajectoryMeasurement>::const_iterator measurement = measurements.begin();
290  measurement != measurements.end();
291  ++measurement) {
292  DetId id = measurement->recHit()->geographicalId();
293  if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC) {
294  CSCDetId cscid(id.rawId());
295  CSCDetId chamberId(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 0);
296  if (m_combineME11 && cscid.station() == 1 && cscid.ring() == 4)
297  chamberId = CSCDetId(cscid.endcap(), 1, 1, cscid.chamber(), 0);
298  int station = (cscid.endcap() == 1 ? 1 : -1) * cscid.station();
299 
300  if (stationsToChambers.find(station) == stationsToChambers.end())
301  stationsToChambers[station] = std::map<CSCDetId, bool>();
302  stationsToChambers[station][chamberId] = true;
303 
304  if (m_makeHistograms) {
305  GlobalPoint pos = measurement->recHit()->globalPosition();
306  if (cscid.endcap() == 1 && cscid.station() == 1) {
307  m_XYpos_mep1->Fill(pos.x(), pos.y());
308  m_RPhipos_mep1->Fill(pos.phi(), pos.perp());
309  }
310  if (cscid.endcap() == 1 && cscid.station() == 2) {
311  m_XYpos_mep2->Fill(pos.x(), pos.y());
312  m_RPhipos_mep2->Fill(pos.phi(), pos.perp());
313  }
314  if (cscid.endcap() == 1 && cscid.station() == 3) {
315  m_XYpos_mep3->Fill(pos.x(), pos.y());
316  m_RPhipos_mep3->Fill(pos.phi(), pos.perp());
317  }
318  if (cscid.endcap() == 1 && cscid.station() == 4) {
319  m_XYpos_mep4->Fill(pos.x(), pos.y());
320  m_RPhipos_mep4->Fill(pos.phi(), pos.perp());
321  }
322  if (cscid.endcap() == 2 && cscid.station() == 1) {
323  m_XYpos_mem1->Fill(pos.x(), pos.y());
324  m_RPhipos_mem1->Fill(pos.phi(), pos.perp());
325  }
326  if (cscid.endcap() == 2 && cscid.station() == 2) {
327  m_XYpos_mem2->Fill(pos.x(), pos.y());
328  m_RPhipos_mem2->Fill(pos.phi(), pos.perp());
329  }
330  if (cscid.endcap() == 2 && cscid.station() == 3) {
331  m_XYpos_mem3->Fill(pos.x(), pos.y());
332  m_RPhipos_mem3->Fill(pos.phi(), pos.perp());
333  }
334  if (cscid.endcap() == 2 && cscid.station() == 4) {
335  m_XYpos_mem4->Fill(pos.x(), pos.y());
336  m_RPhipos_mem4->Fill(pos.phi(), pos.perp());
337  }
338  }
339  }
340  }
341 
342  std::map<CSCPairResidualsConstraint*, bool> residualsConstraints;
343  for (std::map<int, std::map<CSCDetId, bool> >::const_iterator iter = stationsToChambers.begin();
344  iter != stationsToChambers.end();
345  ++iter) {
346  for (std::map<CSCDetId, bool>::const_iterator one = iter->second.begin(); one != iter->second.end(); ++one) {
347  for (std::map<CSCDetId, bool>::const_iterator two = one; two != iter->second.end(); ++two) {
348  if (one != two) {
349  std::map<std::pair<CSCDetId, CSCDetId>, CSCPairResidualsConstraint*>::const_iterator quick;
350 
351  quick = m_quickChamberLookup.find(std::pair<CSCDetId, CSCDetId>(one->first, two->first));
352  if (quick != m_quickChamberLookup.end())
353  residualsConstraints[quick->second] = true;
354 
355  quick = m_quickChamberLookup.find(std::pair<CSCDetId, CSCDetId>(two->first, one->first));
356  if (quick != m_quickChamberLookup.end())
357  residualsConstraints[quick->second] = true;
358  }
359  }
360  }
361  }
362 
363  for (std::map<CSCPairResidualsConstraint*, bool>::const_iterator residualsConstraint =
364  residualsConstraints.begin();
365  residualsConstraint != residualsConstraints.end();
366  ++residualsConstraint) {
367  residualsConstraint->first->addTrack(measurements, transientTrack, m_trackTransformer);
368  }
369  }
370  }
371 }
372 
374  // write residuals partial fits to temporary files for collection
375  if (m_writeTemporaryFile != std::string("")) {
376  std::ofstream output(m_writeTemporaryFile.c_str());
377  for (std::vector<CSCPairResidualsConstraint*>::const_iterator residualsConstraint = m_residualsConstraints.begin();
378  residualsConstraint != m_residualsConstraints.end();
379  ++residualsConstraint) {
380  (*residualsConstraint)->write(output);
381  }
382  }
383 
384  // write report for alignment results
385  if (m_doAlignment) {
386  std::ofstream report;
387  bool writeReport = (m_reportFileName != std::string(""));
388  if (writeReport) {
389  report.open(m_reportFileName.c_str());
390  report << "cscReports = []" << std::endl
391  << std::endl
392  << "class CSCChamberCorrection:" << std::endl
393  << " def __init__(self, name, detid, value):" << std::endl
394  << " self.name, self.detid, self.value = name, detid, value" << std::endl
395  << std::endl
396  << "class CSCErrorMode:" << std::endl
397  << " def __init__(self, error):" << std::endl
398  << " self.error = error" << std::endl
399  << " self.terms = {}" << std::endl
400  << " self.detids = {}" << std::endl
401  << " def addTerm(self, name, detid, coefficient):" << std::endl
402  << " self.terms[name] = coefficient" << std::endl
403  << " self.detids[name] = detid" << std::endl
404  << std::endl
405  << "class CSCConstraintResidual:" << std::endl
406  << " def __init__(self, i, j, before, uncert, residual, pull):" << std::endl
407  << " self.i, self.j, self.before, self.error, self.residual, self.pull = i, j, before, uncert, "
408  "residual, pull"
409  << std::endl
410  << std::endl
411  << "class CSCFitterReport:" << std::endl
412  << " def __init__(self, name, oldchi2, newchi2):" << std::endl
413  << " self.name, self.oldchi2, self.newchi2 = name, oldchi2, newchi2" << std::endl
414  << " self.chamberCorrections = []" << std::endl
415  << " self.errorModes = []" << std::endl
416  << " self.constraintResiduals = []" << std::endl
417  << std::endl
418  << " def addChamberCorrection(self, name, detid, value):" << std::endl
419  << " self.chamberCorrections.append(CSCChamberCorrection(name, detid, value))" << std::endl
420  << std::endl
421  << " def addErrorMode(self, error):" << std::endl
422  << " self.errorModes.append(CSCErrorMode(error))" << std::endl
423  << std::endl
424  << " def addErrorModeTerm(self, name, detid, coefficient):" << std::endl
425  << " self.errorModes[-1].addTerm(name, detid, coefficient)" << std::endl
426  << std::endl
427  << " def addCSCConstraintResidual(self, i, j, before, uncert, residual, pull):" << std::endl
428  << " self.constraintResiduals.append(CSCConstraintResidual(i, j, before, uncert, residual, pull))"
429  << std::endl
430  << std::endl
431  << "import re" << std::endl
432  << "def nameToKey(name):" << std::endl
433  << " match = re.match(\"ME([\\+\\-])([1-4])/([1-4])/([0-9]{2})\", name)" << std::endl
434  << " if match is None: return None" << std::endl
435  << " endcap, station, ring, chamber = match.groups()" << std::endl
436  << " if endcap == \"+\": endcap = 1" << std::endl
437  << " else: endcap = 2" << std::endl
438  << " station = int(station)" << std::endl
439  << " ring = int(ring)" << std::endl
440  << " chamber = int(chamber)" << std::endl
441  << " return endcap, station, ring, chamber" << std::endl
442  << std::endl;
443  }
444 
445  for (std::vector<CSCChamberFitter>::const_iterator fitter = m_fitters.begin(); fitter != m_fitters.end();
446  ++fitter) {
449 
450  } else {
451  std::vector<CSCAlignmentCorrections*> corrections;
452  fitter->fit(corrections);
453 
454  // corrections only exist if the fit was successful
455  for (std::vector<CSCAlignmentCorrections*>::iterator correction = corrections.begin();
456  correction != corrections.end();
457  ++correction) {
458  (*correction)->applyAlignment(m_alignableNavigator, m_alignmentParameterStore, m_mode, m_combineME11);
459  if (m_makeHistograms)
460  (*correction)->plot();
461  if (writeReport)
462  (*correction)->report(report);
463  }
464  }
465  }
466  }
467 }
468 
const edm::ESGetToken< Propagator, TrackingComponentsRecord > m_propToken
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< CSCChamberFitter > m_fitters
void setServices(const edm::EventSetup &) override
set the services needed by the TrackTransformer
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::vector< std::string > m_readTemporaryFiles
CSCOverlapsAlignmentAlgorithm(const edm::ParameterSet &iConfig, edm::ConsumesCollector &)
void run(const edm::EventSetup &iSetup, const EventInfo &eventInfo) override
Run the algorithm (must be implemented in derived class)
const align::Alignables & alignables(void) const
get all alignables
AlignmentParameterStore * m_alignmentParameterStore
std::map< std::pair< CSCDetId, CSCDetId >, CSCPairResidualsConstraint * > m_quickChamberLookup
define event information passed to algorithms
static std::string const input
Definition: EdmProvDump.cc:50
DataContainer const & measurements() const
Definition: Trajectory.h:178
reco::TransientTrack build(const reco::Track *p) const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void initialize(const edm::EventSetup &iSetup, AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *alignableExtras, AlignmentParameterStore *alignmentParameterStore) override
Call at beginning of job (must be implemented in derived class)
Transition
Definition: Transition.h:12
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > m_cscGeometryToken
int chamber() const
Definition: CSCDetId.h:62
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > m_tthbToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
#define M_PI
Definition: DetId.h:17
int station() const
Definition: CSCDetId.h:79
std::vector< CSCPairResidualsConstraint * > m_residualsConstraints
int endcap() const
Definition: CSCDetId.h:85
virtual void terminate()
Called at end of job (must be implemented in derived class)
HLT enums.
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: output.py:1
eventInfo
add run, event number and lumi section
int ring() const
Definition: CSCDetId.h:68
Constructor of the full muon geometry.
Definition: AlignableMuon.h:38
static constexpr int CSC
Definition: MuonSubdetId.h:12
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection