CMS 3D CMS Logo

AlignmentProducer.cc
Go to the documentation of this file.
1 
8 #include "AlignmentProducer.h"
13 
15 
16 // System include files
17 #include <memory>
18 #include <sstream>
19 
20 // Framework
26 
27 // Conditions database
30 
31 // Geometry
58 
59 // Tracking, LAS and cluster flag map (fwd is enough!)
64 
65 // Alignment
76 
77 //_____________________________________________________________________________
79  theAlignmentAlgo(0), theAlignmentParameterStore(0),
80  theAlignableExtras(0), theAlignableTracker(0), theAlignableMuon(0),
81  globalPositions_(0),
82  uniqueRunRanges_
83  (align::makeUniqueRunRanges(iConfig.getParameter<edm::VParameterSet>("RunRangeSelection"),
84  cond::timeTypeSpecs[cond::runnumber].beginValue)),
85  nevent_(0), theParameterSet(iConfig),
86  theMaxLoops( iConfig.getUntrackedParameter<unsigned int>("maxLoops") ),
87  stNFixAlignables_(iConfig.getParameter<int>("nFixAlignables") ),
88  stRandomShift_(iConfig.getParameter<double>("randomShift")),
89  stRandomRotation_(iConfig.getParameter<double>("randomRotation")),
90  applyDbAlignment_( iConfig.getUntrackedParameter<bool>("applyDbAlignment")),
91  checkDbAlignmentValidity_( iConfig.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
92  doMisalignmentScenario_(iConfig.getParameter<bool>("doMisalignmentScenario")),
93  saveToDB_(iConfig.getParameter<bool>("saveToDB")),
94  saveApeToDB_(iConfig.getParameter<bool>("saveApeToDB")),
95  saveDeformationsToDB_(iConfig.getParameter<bool>("saveDeformationsToDB")),
96  doTracker_( iConfig.getUntrackedParameter<bool>("doTracker") ),
97  doMuon_( iConfig.getUntrackedParameter<bool>("doMuon") ),
98  useExtras_( iConfig.getUntrackedParameter<bool>("useExtras") ),
99  useSurvey_( iConfig.getParameter<bool>("useSurvey") ),
100  enableAlignableUpdates_(iConfig.getParameter<bool>("enableAlignableUpdates")),
101  tjTkAssociationMapTag_(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
102  beamSpotTag_(iConfig.getParameter<edm::InputTag>("beamSpotTag")),
103  tkLasBeamTag_(iConfig.getParameter<edm::InputTag>("tkLasBeamTag")),
104  clusterValueMapTag_(iConfig.getParameter<edm::InputTag>("hitPrescaleMapTag"))
105 {
106  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
107 
108  // Tell the framework what data is being produced
109  if (doTracker_) {
111  }
112  if (doMuon_) {
115  }
116 
117  // Create the alignment algorithm
118  createAlignmentAlgorithm(iConfig);
119 
120  // Now create monitors:
121  edm::ParameterSet monitorConfig = iConfig.getParameter<edm::ParameterSet>( "monitorConfig" );
122  std::vector<std::string> monitors = monitorConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
123  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
124  AlignmentMonitorBase* newMonitor = AlignmentMonitorPluginFactory::get()->create(*miter, monitorConfig.getUntrackedParameter<edm::ParameterSet>(*miter));
125 
126  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
127 
128  theMonitors.push_back(newMonitor);
129  }
130 
131  // Finally create integrated calibrations:
133  for (auto iCalib = calibrations.begin(); iCalib != calibrations.end(); ++iCalib) {
134  const std::string name(iCalib->getParameter<std::string>("calibrationName"));
136  // exception comes from line before: if (!theCalibrations.back()) throw cms::Exception(..) << ..;
137  }
138 
139 }
140 
141 
142 //_____________________________________________________________________________
143 // Delete new objects
145 {
146  delete theAlignmentAlgo;
147 
148  // Delete monitors as well??
149 
150  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
151  delete *iCal; // delete integrated calibration pointed to by (*iCal)
152  }
153 
155  delete theAlignableExtras;
156  delete theAlignableTracker;
157  delete theAlignableMuon;
158 
159  delete globalPositions_;
160 }
161 
162 
163 //_____________________________________________________________________________
164 // Produce tracker geometry
165 std::shared_ptr<TrackerGeometry>
167 {
168  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
169  return theTracker;
170 }
171 
172 //_____________________________________________________________________________
173 // Produce muonDT geometry
174 std::shared_ptr<DTGeometry>
176 {
177  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceDT";
178  return theMuonDT;
179 }
180 
181 //_____________________________________________________________________________
182 // Produce muonCSC geometry
183 std::shared_ptr<CSCGeometry>
185 {
186  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceCSC";
187  return theMuonCSC;
188 }
189 
190 
191 //_____________________________________________________________________________
192 // Initialize algorithm
194 {
195  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
196  initAlignmentAlgorithm(iSetup);
197 
198  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
200  }
201  // Not all algorithms support calibrations - so do not pass empty vector
202  // and throw if non-empty and not supported:
204  throw cms::Exception("BadConfig") << "[AlignmentProducer::beginOfJob]\n"
205  << "Configured " << theCalibrations.size() << " calibration(s) "
206  << "for algorithm not supporting it.";
207  }
208 
209  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
210  monitor != theMonitors.end(); ++monitor) {
212  }
213 }
214 
215 //_____________________________________________________________________________
216 // Terminate algorithm
218 {
219  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
220 
221  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
222  (*monitor)->endOfJob();
223  }
224 
225  if (0 == nevent_) {
226  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob" << "Did not process any "
227  << "events in last loop, do not dare to store to DB.";
228  } else {
229  std::vector<AlgebraicVector> beamSpotParameters;
230 
231  for (const auto& iRunRange: uniqueRunRanges_) {
232 
234 
235  // Save alignments to database
237  this->writeForRunRange(iRunRange.first);
238 
239  // Deal with extra alignables, e.g. beam spot
240  if (theAlignableExtras) {
242  if (!alis.empty()) {
243  BeamSpotAlignmentParameters *beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
244  beamSpotParameters.push_back(beamSpotAliPars->parameters());
245  }
246  }
247  }
248 
249  if (theAlignableExtras) {
250  std::ostringstream bsOutput;
251 
252  std::vector<AlgebraicVector>::const_iterator itPar = beamSpotParameters.begin();
253  for (auto iRunRange = uniqueRunRanges_.cbegin();
254  iRunRange != uniqueRunRanges_.cend();
255  ++iRunRange, ++itPar) {
256  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
257  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
258  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
259  }
260 
261  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob"
262  << "Parameters for alignable beamspot:\n"
263  << bsOutput.str();
264  }
265 
266  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
267  (*iCal)->endOfJob();
268  }
269 
270  }
271 }
272 
273 //_____________________________________________________________________________
274 // Called at beginning of loop
275 void AlignmentProducer::startingNewLoop(unsigned int iLoop )
276 {
277  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
278  << "Starting loop number " << iLoop;
279 
280  nevent_ = 0;
281 
283  // FIXME: Should this be done in algorithm::startNewLoop()??
284  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
285  (*iCal)->startNewLoop();
286  }
287 
288  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
289  (*monitor)->startingNewLoop();
290  }
292 }
293 
294 
295 //_____________________________________________________________________________
296 // Called at end of loop
298 AlignmentProducer::endOfLoop(const edm::EventSetup& iSetup, unsigned int iLoop)
299 {
300 
301  if (0 == nevent_) {
302  // beginOfJob is usually called by the framework in the first event of the first loop
303  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
304  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
305  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
306  // some geometry information that is not defined either without having seen an event.
307  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
308  << "Did not process any events in loop " << iLoop
309  << ", stop processing without terminating algorithm.";
310  return kStop;
311  }
312 
313  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
314  << "Ending loop " << iLoop << ", terminating algorithm.";
315 
316  theAlignmentAlgo->terminate(iSetup);
317  // FIXME: Should this be done in algorithm::terminate(const edm::EventSetup& iSetup)??
318  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
319  (*iCal)->endOfLoop();
320  }
321 
322  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
323  (*monitor)->endOfLoop(iSetup);
324  }
325 
326  if ( iLoop == theMaxLoops-1 || iLoop >= theMaxLoops ) return kStop;
327  else return kContinue;
328 }
329 
330 //_____________________________________________________________________________
331 // Called at each event
334  const edm::EventSetup& setup )
335 {
336  ++nevent_;
337 
338  // reading in survey records
339  this->readInSurveyRcds(setup);
340 
341  // Printout event number
342  for ( int i=10; i<10000000; i*=10 )
343  if ( nevent_<10*i && (nevent_%i)==0 )
344  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
345  << "Events processed: " << nevent_;
346 
347  // Retrieve trajectories and tracks from the event
348  // -> merely skip if collection is empty
350  if (event.getByLabel(tjTkAssociationMapTag_, m_TrajTracksMap)) {
351 
352  // Form pairs of trajectories and tracks
353  ConstTrajTrackPairCollection trajTracks;
354  for ( TrajTrackAssociationCollection::const_iterator iPair = m_TrajTracksMap->begin();
355  iPair != m_TrajTracksMap->end(); ++iPair) {
356  trajTracks.push_back( ConstTrajTrackPair( &(*(*iPair).key), &(*(*iPair).val) ) );
357  }
359  event.getByLabel(beamSpotTag_, beamSpot);
360 
361  if (nevent_==1 && theAlignableExtras) {
362  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
363  << "initializing AlignableBeamSpot" << std::endl;
364  theAlignableExtras->initializeBeamSpot(beamSpot->x0(), beamSpot->y0(), beamSpot->z0(),
365  beamSpot->dxdz(), beamSpot->dydz());
366  }
367 
368  // Run the alignment algorithm with its input
369  const AliClusterValueMap *clusterValueMapPtr = 0;
370  if(clusterValueMapTag_.encode().size()){//check that the input tag is not empty
371  edm::Handle<AliClusterValueMap> clusterValueMap;
372  event.getByLabel(clusterValueMapTag_, clusterValueMap);
373  clusterValueMapPtr = &(*clusterValueMap);
374  }
375 
376  const AlignmentAlgorithmBase::EventInfo eventInfo(event.id(), trajTracks, *beamSpot,
377  clusterValueMapPtr);
378  theAlignmentAlgo->run(setup, eventInfo);
379 
380 
381  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
382  monitor != theMonitors.end(); ++monitor) {
383  (*monitor)->duringLoop(event, setup, trajTracks); // forward eventInfo?
384  }
385  } else {
386  edm::LogError("Alignment") << "@SUB=AlignmentProducer::duringLoop"
387  << "No track collection found: skipping event";
388  }
389 
390 
391  return kContinue;
392 }
393 
394 // ----------------------------------------------------------------------------
396 {
397  const auto update = setupChanged(setup) && enableAlignableUpdates_;
398  if (update) {
399  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginRun"
400  << "EventSetup-Record changed.";
401  initAlignmentAlgorithm(setup, true);
402  }
403 
404  theAlignmentAlgo->beginRun(run, setup, update);
405 }
406 
407 // ----------------------------------------------------------------------------
409 {
410  // call with or without las beam info...
412  if (tkLasBeamTag_.encode().size()) { // non-empty InputTag
415  run.getByLabel(tkLasBeamTag_, lasBeams);
416  run.getByLabel(tkLasBeamTag_, tsoses);
417 
418  theAlignmentAlgo->endRun(EndRunInfo(run.id(), &(*lasBeams), &(*tsoses)), setup);
419  } else {
420  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endRun"
421  << "No Tk LAS beams to forward to algorithm.";
422  theAlignmentAlgo->endRun(EndRunInfo(run.id(), 0, 0), setup);
423  }
424 }
425 
426 // ----------------------------------------------------------------------------
428  const edm::EventSetup &setup)
429 {
430  theAlignmentAlgo->beginLuminosityBlock(setup); // do not forward edm::LuminosityBlock
431 }
432 
433 // ----------------------------------------------------------------------------
435  const edm::EventSetup &setup)
436 {
437  theAlignmentAlgo->endLuminosityBlock(setup); // do not forward edm::LuminosityBlock
438 }
439 
440 
441 //------------------------------------------------------------------------------
442 void
444 {
445  auto algoConfig = config.getParameter<edm::ParameterSet>("algoConfig");
446  auto iovSelection = config.getParameter<edm::VParameterSet>("RunRangeSelection");
447  algoConfig.addUntrackedParameter<edm::VParameterSet>("RunRangeSelection",
448  iovSelection);
449  algoConfig.addUntrackedParameter<RunNumber>("firstIOV",
450  uniqueRunRanges_.front().first);
451  algoConfig.addUntrackedParameter<bool>("enableAlignableUpdates",
453 
454  const auto algoName = algoConfig.getParameter<std::string>("algoName");
457 
458  if (!theAlignmentAlgo) {
459  throw cms::Exception("BadConfig")
460  << "Couldn't find the called alignment algorithm: " << algoName;
461  }
462 }
463 
464 
465 //------------------------------------------------------------------------------
466 bool
468 {
469  bool changed{false};
470 
471  if (watchIdealGeometryRcd.check(setup)) {
472  changed = true;
473  }
474 
475  if (watchGlobalPositionRcd.check(setup)) {
476  changed = true;
477  }
478 
479  if (doTracker_) {
480  if (watchTrackerAlRcd.check(setup)) {
481  changed = true;
482  }
483 
484  if (watchTrackerAlErrorExtRcd.check(setup)) {
485  changed = true;
486  }
487 
488  if (watchTrackerSurDeRcd.check(setup)) {
489  changed = true;
490  }
491  }
492 
493  if (doMuon_) {
494  if (watchDTAlRcd.check(setup)) {
495  changed = true;
496  }
497 
498  if (watchDTAlErrExtRcd.check(setup)) {
499  changed = true;
500  }
501 
502  if (watchCSCAlRcd.check(setup)) {
503  changed = true;
504  }
505 
506  if (watchCSCAlErrExtRcd.check(setup)) {
507  changed = true;
508  }
509  }
510 
511  /* TODO: ExtraAlignables: Which record(s) to check?
512  *
513  if (useExtras_) {}
514  */
515 
516  return changed;
517 }
518 
519 
520 //------------------------------------------------------------------------------
521 void
523  bool update)
524 {
525  // Retrieve tracker topology from geometry
526  edm::ESHandle<TrackerTopology> tTopoHandle;
527  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
528  const TrackerTopology* const tTopo = tTopoHandle.product();
529 
530  // Create the geometries from the ideal geometries
531  createGeometries(setup, tTopo);
532 
533  applyAlignmentsToDB(setup);
534  createAlignables(tTopo, update);
537 
538  // Initialize alignment algorithm and integrated calibration and pass the
539  // latter to algorithm
540  edm::LogInfo("Alignment")
541  << "@SUB=AlignmentProducer::initAlignmentAlgorithm"
542  << "Initializing alignment algorithm.";
548 
550 }
551 
552 
553 // ----------------------------------------------------------------------------
554 void
556  const std::string &selection,
557  float shift, float rot, bool local)
558 {
559 
560  std::ostringstream output; // collecting output
561 
562  if (shift > 0. || rot > 0.) {
563  output << "Adding random flat shift of max size " << shift
564  << " and adding random flat rotation of max size " << rot <<" to ";
565 
566  std::vector<bool> commSel(0);
567  if (selection != "-1") {
568  AlignmentParameterSelector aSelector(0,0); // no alignable needed here...
569  const std::vector<char> cSel(aSelector.convertParamSel(selection));
570  if (cSel.size() < RigidBodyAlignmentParameters::N_PARAM) {
571  throw cms::Exception("BadConfig")
572  << "[AlignmentProducer::simpleMisalignment_]\n"
573  << "Expect selection string '" << selection << "' to be at least of length "
574  << RigidBodyAlignmentParameters::N_PARAM << " or to be '-1'.\n"
575  << "(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
576  }
577  for (std::vector<char>::const_iterator cIter = cSel.begin(); cIter != cSel.end(); ++cIter) {
578  commSel.push_back(*cIter == '0' ? false : true);
579  }
580  output << "parameters defined by (" << selection
581  << "), representing (x,y,z,alpha,beta,gamma),";
582  } else {
583  output << "the active parameters of each alignable,";
584  }
585  output << " in " << (local ? "local" : "global") << " frame.";
586 
587  for (std::vector<Alignable*>::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
588  Alignable* ali=(*it);
589  std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
590 
591  if (std::abs(shift)>0.00001) {
592  double s0 = 0., s1 = 0., s2 = 0.;
593  if (mysel[RigidBodyAlignmentParameters::dx]) s0 = shift * double(random()%1000-500)/500.;
594  if (mysel[RigidBodyAlignmentParameters::dy]) s1 = shift * double(random()%1000-500)/500.;
595  if (mysel[RigidBodyAlignmentParameters::dz]) s2 = shift * double(random()%1000-500)/500.;
596 
597  if (local) ali->move( ali->surface().toGlobal(align::LocalVector(s0,s1,s2)) );
598  else ali->move( align::GlobalVector(s0,s1,s2) );
599 
600  //AlignmentPositionError ape(dx,dy,dz);
601  //ali->addAlignmentPositionError(ape);
602  }
603 
604  if (std::abs(rot)>0.00001) {
606  if (mysel[RigidBodyAlignmentParameters::dalpha]) r(1)=rot*double(random()%1000-500)/500.;
607  if (mysel[RigidBodyAlignmentParameters::dbeta]) r(2)=rot*double(random()%1000-500)/500.;
608  if (mysel[RigidBodyAlignmentParameters::dgamma]) r(3)=rot*double(random()%1000-500)/500.;
609 
610  const align::RotationType mrot = align::toMatrix(r);
611  if (local) ali->rotateInLocalFrame(mrot);
612  else ali->rotateInGlobalFrame(mrot);
613 
614  //ali->addAlignmentPositionErrorFromRotation(mrot);
615  }
616  } // end loop on alignables
617  } else {
618  output << "No simple misalignment added!";
619  }
620  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::simpleMisalignment_" << output.str();
621 }
622 
623 
624 //------------------------------------------------------------------------------
625 void
627  const TrackerTopology* tTopo)
628 {
629  if (doTracker_) {
630  edm::ESHandle<GeometricDet> geometricDet;
631  iSetup.get<IdealGeometryRecord>().get( geometricDet );
632 
634  iSetup.get<PTrackerParametersRcd>().get( ptp );
635 
636  TrackerGeomBuilderFromGeometricDet trackerBuilder;
637 
638  theTracker = std::shared_ptr<TrackerGeometry>
639  (trackerBuilder.build(&(*geometricDet), *ptp, tTopo));
640  }
641 
642  if (doMuon_) {
644  iSetup.get<IdealGeometryRecord>().get(cpv);
646  iSetup.get<MuonNumberingRecord>().get(mdc);
647  DTGeometryBuilderFromDDD DTGeometryBuilder;
649  theMuonDT = std::make_shared<DTGeometry>();
650  DTGeometryBuilder.build( theMuonDT, &(*cpv), *mdc);
651  theMuonCSC = std::make_shared<CSCGeometry>();
652  CSCGeometryBuilder.build( theMuonCSC, &(*cpv), *mdc );
653  }
654 }
655 
656 
657 //------------------------------------------------------------------------------
658 void
660 {
661  // Retrieve and apply alignments, if requested (requires z setup)
662  if (applyDbAlignment_) {
663  // we need GlobalPositionRcd - and have to keep track for later removal
664  // before writing again to DB...
665 
666  edm::ESHandle<Alignments> globalAlignments;
667  setup.get<GlobalPositionRcd>().get(globalAlignments);
668  globalPositions_ = new Alignments(*globalAlignments);
669 
670  if (doTracker_) {
674  (&(*theTracker), setup,
676  );
677 
678  applyDB<TrackerGeometry,
679  TrackerSurfaceDeformationRcd>(&(*theTracker), setup);
680  }
681 
682  if (doMuon_) {
686  (&(*theMuonDT), setup,
688  );
689 
693  (&(*theMuonCSC), setup,
695  );
696  }
697  }
698 }
699 
700 
701 
702 //------------------------------------------------------------------------------
703 void
705 {
706  if (doTracker_) {
707  if (update) {
709  } else {
711  }
712  }
713 
714  if (doMuon_) {
715  if (update) {
717  } else {
719  }
720  }
721 
722  if (useExtras_) {
723  if (update) {
724  // FIXME: Requires further code changes to track beam spot condition changes
725  } else {
727  }
728  }
729 }
730 
731 
732 //------------------------------------------------------------------------------
733 void
735 {
736  // Create alignment parameter builder
737  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::buildParameterStore"
738  << "Creating AlignmentParameterBuilder";
739 
740  auto alParamBuildCfg =
741  theParameterSet.getParameter<edm::ParameterSet>("ParameterBuilder");
742  auto alParamStoreCfg =
744 
745  AlignmentParameterBuilder alignmentParameterBuilder(theAlignableTracker,
748  alParamBuildCfg);
749 
750  // Fix alignables if requested
751  if (stNFixAlignables_ > 0) {
752  alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
753  }
754 
755  // Get list of alignables
756  auto theAlignables = alignmentParameterBuilder.alignables();
757  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::buildParameterStore"
758  << "got " << theAlignables.size() << " alignables";
759 
760  // Create AlignmentParameterStore
762  new AlignmentParameterStore(theAlignables, alParamStoreCfg);
763  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::buildParameterStore"
764  << "AlignmentParameterStore created!";
765 }
766 
767 //------------------------------------------------------------------------------
768 void
770 {
771  // Apply misalignment scenario to alignable tracker and muon if requested
772  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
773 
775  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::applyMisalignment"
776  << "Applying misalignment scenario to "
777  << (doTracker_ ? "tracker" : "")
778  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
779  auto scenarioConfig =
780  theParameterSet.getParameter<edm::ParameterSet>("MisalignmentScenario");
781 
782  if (doTracker_) {
784  scenarioBuilder.applyScenario(scenarioConfig);
785  }
786  if (doMuon_) {
787  MuonScenarioBuilder muonScenarioBuilder(theAlignableMuon);
788  muonScenarioBuilder.applyScenario(scenarioConfig);
789  }
790 
791  } else {
792  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::applyMisalignment"
793  << "NOT applying misalignment scenario!";
794  }
795 
796  // Apply simple misalignment
797  const auto sParSel =
798  theParameterSet.getParameter<std::string>("parameterSelectorSimple");
801 }
802 
803 
804 
805 //------------------------------------------------------------------------------
806 void
808 {
809  edm::LogInfo("Alignment")
810  << "@SUB=AlignmentProducer::applyAlignmentsToGeometry"
811  << "Now physically apply alignments to geometry...";
812 
813  // Propagate changes to reconstruction geometry (from initialisation or iteration)
814  GeometryAligner aligner;
815 
816  if (doTracker_) {
817  std::unique_ptr<Alignments> alignments(theAlignableTracker->alignments());
818  std::unique_ptr<AlignmentErrorsExtended>
819  alignmentErrExt(theAlignableTracker->alignmentErrors());
820  std::unique_ptr<AlignmentSurfaceDeformations>
822 
823  aligner.applyAlignments(&(*theTracker), alignments.get(),
824  alignmentErrExt.get(), AlignTransform());
825  aligner.attachSurfaceDeformations(&(*theTracker), aliDeforms.get());
826  }
827 
828  if (doMuon_) {
829  std::unique_ptr<Alignments> dtAlignments(theAlignableMuon->dtAlignments());
830  std::unique_ptr<Alignments> cscAlignments(theAlignableMuon->cscAlignments());
831 
832  std::unique_ptr<AlignmentErrorsExtended>
833  dtAlignmentErrExt (theAlignableMuon->dtAlignmentErrorsExtended());
834  std::unique_ptr<AlignmentErrorsExtended>
835  cscAlignmentErrExt(theAlignableMuon->cscAlignmentErrorsExtended());
836 
837  aligner.applyAlignments(&(*theMuonDT), &(*dtAlignments),
838  &(*dtAlignmentErrExt), AlignTransform());
839  aligner.applyAlignments(&(*theMuonCSC), &(*cscAlignments),
840  &(*cscAlignmentErrExt), AlignTransform());
841  }
842 }
843 
844 
846 {
847  const std::vector<Alignable*>& comp = ali->components();
848 
849  unsigned int nComp = comp.size();
850 
851  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo_(comp[i]);
852 
854 
855  if ( ali->id() != error.rawId() ||
856  ali->alignableObjectId() != error.structureType() )
857  {
858  throw cms::Exception("DatabaseError")
859  << "Error reading survey info from DB. Mismatched id!";
860  }
861 
862  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
863  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
864 
865  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
866  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
867  rot.yx(), rot.yy(), rot.yz(),
868  rot.zx(), rot.zy(), rot.zz() ) );
869 
870  surf.setWidth( ali->surface().width() );
871  surf.setLength( ali->surface().length() );
872 
873  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
874 
875  ++theSurveyIndex;
876 }
877 
879 
880  // Get Survey Rcds and add Survey Info
881  if ( doTracker_ && useSurvey_ ){
882  bool tkSurveyBool = watchTkSurveyRcd_.check(iSetup);
883  bool tkSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
884  edm::LogInfo("Alignment") << "watcher tksurveyrcd: " << tkSurveyBool;
885  edm::LogInfo("Alignment") << "watcher tksurveyerrrcd: " << tkSurveyErrBool;
886  if ( tkSurveyBool || tkSurveyErrBool){
887 
888  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
890  edm::ESHandle<SurveyErrors> surveyErrors;
891 
892  iSetup.get<TrackerSurveyRcd>().get(surveys);
893  iSetup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
894 
895  theSurveyIndex = 0;
896  theSurveyValues = &*surveys;
897  theSurveyErrors = &*surveyErrors;
899  }
900  }
901 
902  if ( doMuon_ && useSurvey_) {
903  bool DTSurveyBool = watchTkSurveyRcd_.check(iSetup);
904  bool DTSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
905  bool CSCSurveyBool = watchTkSurveyRcd_.check(iSetup);
906  bool CSCSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
907 
908  if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
909  edm::ESHandle<Alignments> dtSurveys;
910  edm::ESHandle<SurveyErrors> dtSurveyErrors;
911  edm::ESHandle<Alignments> cscSurveys;
912  edm::ESHandle<SurveyErrors> cscSurveyErrors;
913 
914  iSetup.get<DTSurveyRcd>().get(dtSurveys);
915  iSetup.get<DTSurveyErrorExtendedRcd>().get(dtSurveyErrors);
916  iSetup.get<CSCSurveyRcd>().get(cscSurveys);
917  iSetup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
918 
919  theSurveyIndex = 0;
920  theSurveyValues = &*dtSurveys;
921  theSurveyErrors = &*dtSurveyErrors;
922  std::vector<Alignable*> barrels = theAlignableMuon->DTBarrel();
923  for (std::vector<Alignable*>::const_iterator iter = barrels.begin(); iter != barrels.end(); ++iter) {
924  addSurveyInfo_(*iter);
925  }
926 
927  theSurveyIndex = 0;
928  theSurveyValues = &*cscSurveys;
929  theSurveyErrors = &*cscSurveyErrors;
930  std::vector<Alignable*> endcaps = theAlignableMuon->CSCEndcaps();
931  for (std::vector<Alignable*>::const_iterator iter = endcaps.begin(); iter != endcaps.end(); ++iter) {
932  addSurveyInfo_(*iter);
933  }
934  }
935  }
936 
937 }
938 
939 
941 // a templated method - but private, so not accessible from outside
942 // ==> does not have to be in header file
943 template<class G, class Rcd, class ErrRcd>
945  const AlignTransform &globalCoordinates) const
946 {
947  // 'G' is the geometry class for that DB should be applied,
948  // 'Rcd' is the record class for its Alignments
949  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
950  // 'globalCoordinates' are global transformation for this geometry
951 
952  const Rcd & record = iSetup.get<Rcd>();
954  const edm::ValidityInterval & validity = record.validityInterval();
955  const edm::IOVSyncValue first = validity.first();
956  const edm::IOVSyncValue last = validity.last();
957  if (first!=edm::IOVSyncValue::beginOfTime() ||
959  throw cms::Exception("DatabaseError")
960  << "@SUB=AlignmentProducer::applyDB"
961  << "\nTrying to apply "
962  << record.key().name()
963  << " with multiple IOVs in tag.\n"
964  << "Validity range is "
965  << first.eventID().run() << " - " << last.eventID().run();
966  }
967  }
968 
969  edm::ESHandle<Alignments> alignments;
970  record.get(alignments);
971 
973  iSetup.get<ErrRcd>().get(alignmentErrors);
974 
975  GeometryAligner aligner;
976  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrors),
977  globalCoordinates);
978 }
979 
980 
982 // a templated method - but private, so not accessible from outside
983 // ==> does not have to be in header file
984 template<class G, class DeformationRcd>
986 {
987  // 'G' is the geometry class for that DB should be applied,
988  // 'DeformationRcd' is the record class for its surface deformations
989 
990  const DeformationRcd & record = iSetup.get<DeformationRcd>();
992  const edm::ValidityInterval & validity = record.validityInterval();
993  const edm::IOVSyncValue first = validity.first();
994  const edm::IOVSyncValue last = validity.last();
995  if (first!=edm::IOVSyncValue::beginOfTime() ||
997  throw cms::Exception("DatabaseError")
998  << "@SUB=AlignmentProducer::applyDB"
999  << "\nTrying to apply "
1000  << record.key().name()
1001  << " with multiple IOVs in tag.\n"
1002  << "Validity range is "
1003  << first.eventID().run() << " - " << last.eventID().run();
1004  }
1005  }
1006  edm::ESHandle<AlignmentSurfaceDeformations> surfaceDeformations;
1007  record.get(surfaceDeformations);
1008 
1009  GeometryAligner aligner;
1010  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
1011 }
1012 
1015 {
1016  if ( doTracker_ ) { // first tracker
1017  const AlignTransform *trackerGlobal = 0; // will be 'removed' from constants
1018  if (globalPositions_) { // i.e. applied before in applyDB
1021  }
1022 
1023  Alignments *alignments = theAlignableTracker->alignments();
1025  this->writeDB(alignments, "TrackerAlignmentRcd",
1026  alignmentErrors, "TrackerAlignmentErrorExtendedRcd", trackerGlobal,
1027  time);
1028  }
1029 
1030  if ( doMuon_ ) { // now muon
1031  const AlignTransform *muonGlobal = 0; // will be 'removed' from constants
1032  if (globalPositions_) { // i.e. applied before in applyDB
1034  DetId(DetId::Muon));
1035  }
1036  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
1037  Alignments *alignments = theAlignableMuon->dtAlignments();
1039  this->writeDB(alignments, "DTAlignmentRcd",
1040  alignmentErrors, "DTAlignmentErrorExtendedRcd", muonGlobal,
1041  time);
1042 
1043  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
1044  alignments = theAlignableMuon->cscAlignments();
1045  alignmentErrors = theAlignableMuon->cscAlignmentErrorsExtended();
1046  this->writeDB(alignments, "CSCAlignmentRcd",
1047  alignmentErrors, "CSCAlignmentErrorExtendedRcd", muonGlobal,
1048  time);
1049  }
1050 
1051  // Save surface deformations to database
1053  AlignmentSurfaceDeformations *alignmentSurfaceDeformations = theAlignableTracker->surfaceDeformations();
1054  this->writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
1055  }
1056 }
1057 
1060  const std::string &alignRcd,
1061  AlignmentErrorsExtended *alignmentErrors,
1062  const std::string &errRcd,
1063  const AlignTransform *globalCoordinates,
1064  cond::Time_t time) const
1065 {
1066  Alignments * tempAlignments = alignments;
1067  AlignmentErrorsExtended * tempAlignmentErrorsExtended = alignmentErrors;
1068 
1069  // Call service
1071  if (!poolDb.isAvailable()) { // Die if not available
1072  delete tempAlignments; // promised to take over ownership...
1073  delete tempAlignmentErrorsExtended; // dito
1074  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1075  }
1076 
1077  if (globalCoordinates // happens only if (applyDbAlignment_ == true)
1078  && globalCoordinates->transform() != AlignTransform::Transform::Identity) {
1079 
1080  tempAlignments = new Alignments(); // temporary storage for
1081  tempAlignmentErrorsExtended = new AlignmentErrorsExtended(); // final alignments and errors
1082 
1083  GeometryAligner aligner;
1084  aligner.removeGlobalTransform(alignments, alignmentErrors,
1085  *globalCoordinates,
1086  tempAlignments, tempAlignmentErrorsExtended);
1087 
1088  delete alignments; // have to delete original alignments
1089  delete alignmentErrors; // same thing for the errors
1090 
1091  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::writeDB"
1092  << "globalCoordinates removed from alignments (" << alignRcd
1093  << ") and errors (" << alignRcd << ").";
1094  }
1095 
1096  if (saveToDB_) {
1097  edm::LogInfo("Alignment") << "Writing Alignments for run " << time
1098  << " to " << alignRcd << ".";
1099  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
1100  } else { // poolDb->writeOne(..) takes over 'alignments' ownership,...
1101  delete tempAlignments; // ...otherwise we have to delete, as promised!
1102  }
1103 
1104  if (saveApeToDB_) {
1105  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run " << time
1106  << " to " << errRcd << ".";
1107  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrorsExtended, time, errRcd);
1108  } else { // poolDb->writeOne(..) takes over 'alignmentErrors' ownership,...
1109  delete tempAlignmentErrorsExtended; // ...otherwise we have to delete, as promised!
1110  }
1111 }
1112 
1113 
1116  const std::string &surfaceDeformationRcd,
1117  cond::Time_t time) const
1118 {
1119  // Call service
1121  if (!poolDb.isAvailable()) { // Die if not available
1122  delete alignmentSurfaceDeformations; // promised to take over ownership...
1123  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1124  }
1125 
1126  if (saveDeformationsToDB_) {
1127  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run " << time
1128  << " to " << surfaceDeformationRcd << ".";
1129  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
1130  surfaceDeformationRcd);
1131  } else { // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
1132  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
1133  }
1134 }
1135 
1136 
RunNumber_t run() const
Definition: EventID.h:39
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
align::Scalar width() const
AlignmentProducer(const edm::ParameterSet &iConfig)
Constructor.
virtual void beginLuminosityBlock(const edm::EventSetup &setup)
called at begin of luminosity block (no lumi block info passed yet)
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:201
double z0() const
z coordinate
Definition: BeamSpot.h:68
T getUntrackedParameter(std::string const &, T const &) const
edm::ESWatcher< TrackerAlignmentErrorExtendedRcd > watchTrackerAlErrorExtRcd
int i
Definition: DBlmapReader.cc:9
virtual std::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &iRecord)
Produce the tracker geometry.
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:139
const bool doMisalignmentScenario_
RunID const & id() const
Definition: RunBase.h:39
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)=0
Run the algorithm (must be implemented in derived class)
virtual std::shared_ptr< DTGeometry > produceDT(const MuonGeometryRecord &iRecord)
Produce the muon DT geometry.
Builds a scenario from configuration and applies it to the alignable Muon.
AlignmentAlgorithmBase * theAlignmentAlgo
~AlignmentProducer()
Destructor.
virtual void terminate(const edm::EventSetup &iSetup)=0
Call at end of each loop (must be implemented in derived class)
edm::ESWatcher< CSCAlignmentErrorExtendedRcd > watchCSCAlErrExtRcd
def create(alignables, pedeDump, additionalData, outputFile, config)
const EventID & eventID() const
Definition: IOVSyncValue.h:42
void update(const DTGeometry *, const CSCGeometry *)
const_iterator end() const
last iterator over the map (read only)
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
void buildParameterStore()
Creates the , which manages all Alignables.
std::shared_ptr< TrackerGeometry > theTracker
void readInSurveyRcds(const edm::EventSetup &)
read in survey records
edm::ESWatcher< DTAlignmentErrorExtendedRcd > watchDTAlErrExtRcd
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
ErrorMatrix matrix() const
Definition: SurveyError.h:76
align::RunNumber RunNumber
void writeDB(Alignments *alignments, const std::string &alignRcd, AlignmentErrorsExtended *alignmentErrors, const std::string &errRcd, const AlignTransform *globalCoordinates, cond::Time_t time) const
void update(const TrackerGeometry *, const TrackerTopology *)
align::Alignables DTBarrel()
selection
main part
Definition: corrVsCorr.py:98
virtual void endLuminosityBlock(const edm::EventSetup &setup)
called at end of luminosity block (no lumi block info passed yet)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
virtual void beginRun(const edm::Run &run, const edm::EventSetup &setup)
Called at run start and calling algorithms beginRun.
std::vector< IntegratedCalibrationBase * > theCalibrations
#define DEFINE_FWK_LOOPER(type)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
virtual Status endOfLoop(const edm::EventSetup &, unsigned int iLoop)
Called at end of loop.
edm::ParameterSet theParameterSet
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
void setWidth(align::Scalar width)
Definition: config.py:1
TRandom random
Definition: MVATrainer.cc:138
const edm::InputTag tkLasBeamTag_
const Alignments * theSurveyValues
void addSurveyInfo_(Alignable *)
Add survey info to an alignable.
edm::ESWatcher< TrackerAlignmentRcd > watchTrackerAlRcd
uint8_t structureType() const
Definition: SurveyError.h:66
edm::ESWatcher< CSCAlignmentRcd > watchCSCAlRcd
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
std::string encode() const
Definition: InputTag.cc:165
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
std::shared_ptr< DTGeometry > theMuonDT
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
const bool applyDbAlignment_
define event information passed to algorithms
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd
void createAlignables(const TrackerTopology *, bool update=false)
const IOVSyncValue & last() const
virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup)
called at end of run - order of arguments like in EDProducer etc.
virtual bool addCalibrations(const Calibrations &)
void setLength(align::Scalar length)
const unsigned int theMaxLoops
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignableExtras * theAlignableExtras
double dydz() const
dydz slope
Definition: BeamSpot.h:84
virtual bool setParametersForRunRange(const RunRange &rr)
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
unsigned long long Time_t
Definition: Time.h:16
align::Alignables CSCEndcaps()
const bool checkDbAlignmentValidity_
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
static const IOVSyncValue & beginOfTime()
virtual Alignables components() const =0
Return vector of all direct components.
const edm::InputTag clusterValueMapTag_
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:263
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
virtual void beginRun(const edm::Run &, const edm::EventSetup &, bool changed)
called at begin of run
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrorsExtended *newAlignmentErrorsExtended)
edm::ESWatcher< TrackerSurfaceDeformationRcd > watchTrackerSurDeRcd
bool isAvailable() const
Definition: Service.h:46
unsigned int theSurveyIndex
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< AlignmentMonitorBase * > theMonitors
virtual void startingNewLoop(unsigned int iLoop)
Called at beginning of loop.
AlignmentParameterStore * theAlignmentParameterStore
align::ID rawId() const
Definition: SurveyError.h:71
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:264
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
virtual void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)=0
Call at beginning of job (must be implemented in derived class)
void applyAlignmentsToDB(const edm::EventSetup &)
void applyScenario(const edm::ParameterSet &scenario)
Apply misalignment scenario to the tracker.
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
const edm::InputTag beamSpotTag_
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
virtual void endRun(const edm::Run &run, const edm::EventSetup &setup)
Called at run end - currently reading TkFittedLasBeam if an InpuTag is given for that.
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
const SurveyErrors * theSurveyErrors
const edm::InputTag tjTkAssociationMapTag_
virtual Status duringLoop(const edm::Event &event, const edm::EventSetup &setup)
Called at each event.
Definition: DetId.h:18
AlignableMuon * theAlignableMuon
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
void createGeometries(const edm::EventSetup &, const TrackerTopology *)
Create tracker and muon geometries.
const bool saveDeformationsToDB_
virtual void endOfJob()
Called at end of job.
AlgebraicVector EulerAngles
Definition: Definitions.h:36
align::Scalar length() const
const double stRandomShift_
virtual void beginOfJob()
Definition: EDLooperBase.cc:88
Transform transform() const
edm::ESWatcher< DTAlignmentRcd > watchDTAlRcd
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd
const RunRanges uniqueRunRanges_
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:356
const T & get() const
Definition: EventSetup.h:56
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup)
Called at lumi block end, calling algorithm&#39;s endLuminosityBlock.
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
void build(std::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
align::Alignables Alignables
std::shared_ptr< CSCGeometry > theMuonCSC
void simpleMisalignment(const Alignables &alivec, const std::string &selection, float shift, float rot, bool local)
Apply random shifts and rotations to selected alignables, according to configuration.
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:58
Definition: plugin.cc:24
HLT enums.
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
#define update(a, b)
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
const bool enableAlignableUpdates_
AlignableTracker * theAlignableTracker
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:42
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup)
Called at lumi block start, calling algorithm&#39;s beginLuminosityBlock.
std::vector< char > convertParamSel(const std::string &selString) const
Converting std::string into std::vector<char>
double y0() const
y coordinate
Definition: BeamSpot.h:66
static unsigned int const shift
void applyDB(G *geometry, const edm::EventSetup &iSetup, const AlignTransform &globalPosition) const
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrRcd_
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
void writeForRunRange(cond::Time_t time)
virtual std::shared_ptr< CSCGeometry > produceCSC(const MuonGeometryRecord &iRecord)
Produce the muon CSC geometry.
const_iterator begin() const
first iterator over the map (read only)
eventInfo
add run, event number and lumi section
const IOVSyncValue & first() const
Alignments * alignments() const
Return alignments, sorted by DetId.
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:23
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void applyMisalignment()
Applies misalignment scenario to .
define run information passed to algorithms (in endRun)
void createAlignmentAlgorithm(const edm::ParameterSet &)
Creates the choosen alignment algorithm (specified in config-file)
Builds a scenario from configuration and applies it to the alignable tracker.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
T const * product() const
Definition: ESHandle.h:86
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.
void applyScenario(const edm::ParameterSet &scenario)
Apply misalignment scenario to the Muon.
T get(const Candidate &c)
Definition: component.h:55
const align::Alignables & alignables(void) const
get all alignables
const double stRandomRotation_
Definition: event.py:1
Definition: Run.h:42
double x0() const
x coordinate
Definition: BeamSpot.h:64