CMS 3D CMS Logo

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