CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
28 
29 // Conditions database
32 
33 // Geometry
60 
61 // Tracking, LAS and cluster flag map (fwd is enough!)
66 
67 // Alignment
78 
79 //_____________________________________________________________________________
81  theAlignmentAlgo(0), theAlignmentParameterStore(0),
82  theAlignableExtras(0), theAlignableTracker(0), theAlignableMuon(0),
83  globalPositions_(0),
84  nevent_(0), theParameterSet(iConfig),
85  theMaxLoops( iConfig.getUntrackedParameter<unsigned int>("maxLoops") ),
86  stNFixAlignables_(iConfig.getParameter<int>("nFixAlignables") ),
87  stRandomShift_(iConfig.getParameter<double>("randomShift")),
88  stRandomRotation_(iConfig.getParameter<double>("randomRotation")),
89  applyDbAlignment_( iConfig.getUntrackedParameter<bool>("applyDbAlignment")),
90  checkDbAlignmentValidity_( iConfig.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
91  doMisalignmentScenario_(iConfig.getParameter<bool>("doMisalignmentScenario")),
92  saveToDB_(iConfig.getParameter<bool>("saveToDB")),
93  saveApeToDB_(iConfig.getParameter<bool>("saveApeToDB")),
94  saveDeformationsToDB_(iConfig.getParameter<bool>("saveDeformationsToDB")),
95  doTracker_( iConfig.getUntrackedParameter<bool>("doTracker") ),
96  doMuon_( iConfig.getUntrackedParameter<bool>("doMuon") ),
97  useExtras_( iConfig.getUntrackedParameter<bool>("useExtras") ),
98  useSurvey_( iConfig.getParameter<bool>("useSurvey") ),
99  tjTkAssociationMapTag_(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
100  beamSpotTag_(iConfig.getParameter<edm::InputTag>("beamSpotTag")),
101  tkLasBeamTag_(iConfig.getParameter<edm::InputTag>("tkLasBeamTag")),
102  clusterValueMapTag_(iConfig.getParameter<edm::InputTag>("hitPrescaleMapTag"))
103 {
104  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
105 
106  // Tell the framework what data is being produced
107  if (doTracker_) {
109  }
110  if (doMuon_) {
113  }
114 
115  // Create the alignment algorithm
116  edm::ParameterSet algoConfig = iConfig.getParameter<edm::ParameterSet>( "algoConfig" );
117  edm::VParameterSet iovSelection = iConfig.getParameter<edm::VParameterSet>( "RunRangeSelection" );
118  algoConfig.addUntrackedParameter<edm::VParameterSet>( "RunRangeSelection", iovSelection );
119  std::string algoName = algoConfig.getParameter<std::string>( "algoName" );
120  theAlignmentAlgo = AlignmentAlgorithmPluginFactory::get( )->create( algoName, algoConfig );
121 
122  // Check if found
123  if ( !theAlignmentAlgo )
124  throw cms::Exception("BadConfig") << "Couldn't find algorithm called " << algoName;
125 
126  // Now create monitors:
127  edm::ParameterSet monitorConfig = iConfig.getParameter<edm::ParameterSet>( "monitorConfig" );
128  std::vector<std::string> monitors = monitorConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
129  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
130  AlignmentMonitorBase* newMonitor = AlignmentMonitorPluginFactory::get()->create(*miter, monitorConfig.getUntrackedParameter<edm::ParameterSet>(*miter));
131 
132  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
133 
134  theMonitors.push_back(newMonitor);
135  }
136 
137  // Finally create integrated calibrations:
138  edm::VParameterSet calibrations = iConfig.getParameter<edm::VParameterSet>("calibrations");
139  for (auto iCalib = calibrations.begin(); iCalib != calibrations.end(); ++iCalib) {
140  const std::string name(iCalib->getParameter<std::string>("calibrationName"));
142  // exception comes from line before: if (!theCalibrations.back()) throw cms::Exception(..) << ..;
143  }
144 
145 }
146 
147 
148 //_____________________________________________________________________________
149 // Delete new objects
151 {
152  delete theAlignmentAlgo;
153 
154  // Delete monitors as well??
155 
156  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
157  delete *iCal; // delete integrated calibration pointed to by (*iCal)
158  }
159 
161  delete theAlignableExtras;
162  delete theAlignableTracker;
163  delete theAlignableMuon;
164 
165  delete globalPositions_;
166 }
167 
168 
169 //_____________________________________________________________________________
170 // Produce tracker geometry
171 boost::shared_ptr<TrackerGeometry>
173 {
174  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
175  return theTracker;
176 }
177 
178 //_____________________________________________________________________________
179 // Produce muonDT geometry
180 boost::shared_ptr<DTGeometry>
182 {
183  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceDT";
184  return theMuonDT;
185 }
186 
187 //_____________________________________________________________________________
188 // Produce muonCSC geometry
189 boost::shared_ptr<CSCGeometry>
191 {
192  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceCSC";
193  return theMuonCSC;
194 }
195 
196 
197 //_____________________________________________________________________________
198 // Initialize algorithm
200 {
201  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
202 
203  //Retrieve tracker topology from geometry
204  edm::ESHandle<TrackerTopology> tTopoHandle;
205  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
206  const TrackerTopology* const tTopo = tTopoHandle.product();
207 
208  // Create the geometries from the ideal geometries (first time only)
209  this->createGeometries_( iSetup );
210 
211  // Retrieve and apply alignments, if requested (requires DB setup)
212  if ( applyDbAlignment_ ) {
213  // we need GlobalPositionRcd - and have to keep track for later removal
214  // before writing again to DB...
215  edm::ESHandle<Alignments> globalPositionRcd;
216  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
217  globalPositions_ = new Alignments(*globalPositionRcd);
218 
219  if ( doTracker_ ) { // apply to tracker
220  this->applyDB<TrackerGeometry,TrackerAlignmentRcd,TrackerAlignmentErrorExtendedRcd>
221  (&(*theTracker), iSetup,
223  this->applyDB<TrackerGeometry,TrackerSurfaceDeformationRcd>(&(*theTracker), iSetup);
224  }
225 
226  if ( doMuon_ ) { // apply to tracker
227  this->applyDB<DTGeometry,DTAlignmentRcd,DTAlignmentErrorExtendedRcd>
228  (&(*theMuonDT), iSetup,
230  this->applyDB<CSCGeometry,CSCAlignmentRcd,CSCAlignmentErrorExtendedRcd>
231  (&(*theMuonCSC), iSetup,
233  }
234  }
235 
236  // Create alignable tracker and muon
237  if (doTracker_) {
238  theAlignableTracker = new AlignableTracker( &(*theTracker), tTopo );
239  }
240 
241  if (doMuon_) {
243  }
244 
245  if (useExtras_) {
247  }
248 
249  // Create alignment parameter builder
250  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
251  << "Creating AlignmentParameterBuilder";
252  edm::ParameterSet aliParamBuildCfg =
253  theParameterSet.getParameter<edm::ParameterSet>("ParameterBuilder");
254  AlignmentParameterBuilder alignmentParameterBuilder(theAlignableTracker,
257  aliParamBuildCfg );
258  // Fix alignables if requested
259  if (stNFixAlignables_>0) alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
260 
261  // Get list of alignables
262  Alignables theAlignables = alignmentParameterBuilder.alignables();
263  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
264  << "got " << theAlignables.size() << " alignables";
265 
266  // Create AlignmentParameterStore
267  edm::ParameterSet aliParamStoreCfg =
269  theAlignmentParameterStore = new AlignmentParameterStore(theAlignables, aliParamStoreCfg);
270  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
271  << "AlignmentParameterStore created!";
272 
273  // Apply misalignment scenario to alignable tracker and muon if requested
274  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
276  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
277  << "Applying misalignment scenario to "
278  << (doTracker_ ? "tracker" : "")
279  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
280  edm::ParameterSet scenarioConfig
281  = theParameterSet.getParameter<edm::ParameterSet>( "MisalignmentScenario" );
282  if (doTracker_) {
283  TrackerScenarioBuilder scenarioBuilder( theAlignableTracker );
284  scenarioBuilder.applyScenario( scenarioConfig );
285  }
286  if (doMuon_) {
287  MuonScenarioBuilder muonScenarioBuilder( theAlignableMuon );
288  muonScenarioBuilder.applyScenario( scenarioConfig );
289  }
290  } else {
291  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
292  << "NOT applying misalignment scenario!";
293  }
294 
295  // Apply simple misalignment
296  const std::string sParSel(theParameterSet.getParameter<std::string>("parameterSelectorSimple"));
297  this->simpleMisalignment_(theAlignables, sParSel, stRandomShift_, stRandomRotation_, true);
298 
299  // Initialize alignment algorithm and integrated calibration and pass the latter to algorithm
300  theAlignmentAlgo->initialize( iSetup,
302  theAlignmentParameterStore );
303  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
305  }
306  // Not all algorithms support calibrations - so do not pass empty vector
307  // and throw if non-empty and not supported:
309  throw cms::Exception("BadConfig") << "[AlignmentProducer::beginOfJob]\n"
310  << "Configured " << theCalibrations.size() << " calibration(s) "
311  << "for algorithm not supporting it.";
312  }
313 
314  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
315  monitor != theMonitors.end(); ++monitor) {
316  (*monitor)->beginOfJob(theAlignableTracker, theAlignableMuon, theAlignmentParameterStore);
317  }
318 }
319 
320 //_____________________________________________________________________________
321 // Terminate algorithm
323 {
324  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
325 
326  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
327  (*monitor)->endOfJob();
328  }
329 
330  if (0 == nevent_) {
331  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob" << "Did not process any "
332  << "events in last loop, do not dare to store to DB.";
333  } else {
334 
335  // Expand run ranges and make them unique
336  edm::VParameterSet runRangeSelectionVPSet(theParameterSet.getParameter<edm::VParameterSet>("RunRangeSelection"));
337  RunRanges uniqueRunRanges(this->makeNonOverlappingRunRanges(runRangeSelectionVPSet));
338  if (uniqueRunRanges.empty()) { // create dummy IOV
339  const RunRange runRange(cond::timeTypeSpecs[cond::runnumber].beginValue,
341  uniqueRunRanges.push_back(runRange);
342  }
343 
344  std::vector<AlgebraicVector> beamSpotParameters;
345 
346  for (RunRanges::const_iterator iRunRange = uniqueRunRanges.begin();
347  iRunRange != uniqueRunRanges.end();
348  ++iRunRange) {
349 
351 
352  // Save alignments to database
354  this->writeForRunRange((*iRunRange).first);
355 
356  // Deal with extra alignables, e.g. beam spot
357  if (theAlignableExtras) {
359  if (!alis.empty()) {
360  BeamSpotAlignmentParameters *beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
361  beamSpotParameters.push_back(beamSpotAliPars->parameters());
362  }
363  }
364  }
365 
366  if (theAlignableExtras) {
367  std::ostringstream bsOutput;
368 
369  std::vector<AlgebraicVector>::const_iterator itPar = beamSpotParameters.begin();
370  for (RunRanges::const_iterator iRunRange = uniqueRunRanges.begin();
371  iRunRange != uniqueRunRanges.end();
372  ++iRunRange, ++itPar) {
373  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
374  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
375  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
376  }
377 
378  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob"
379  << "Parameters for alignable beamspot:\n"
380  << bsOutput.str();
381  }
382 
383  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
384  (*iCal)->endOfJob();
385  }
386 
387  }
388 }
389 
390 //_____________________________________________________________________________
391 // Called at beginning of loop
392 void AlignmentProducer::startingNewLoop(unsigned int iLoop )
393 {
394  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
395  << "Starting loop number " << iLoop;
396 
397  nevent_ = 0;
398 
400  // FIXME: Should this be done in algorithm::startNewLoop()??
401  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
402  (*iCal)->startNewLoop();
403  }
404 
405  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
406  (*monitor)->startingNewLoop();
407  }
408 
409  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
410  << "Now physically apply alignments to geometry...";
411 
412 
413  // Propagate changes to reconstruction geometry (from initialisation or iteration)
414  GeometryAligner aligner;
415  if ( doTracker_ ) {
416  std::auto_ptr<Alignments> alignments(theAlignableTracker->alignments());
417  std::auto_ptr<AlignmentErrorsExtended> alignmentErrors(theAlignableTracker->alignmentErrors());
418  aligner.applyAlignments<TrackerGeometry>( &(*theTracker),&(*alignments),&(*alignmentErrors), AlignTransform() ); // don't apply global a second time!
419  std::auto_ptr<AlignmentSurfaceDeformations> aliDeforms(theAlignableTracker->surfaceDeformations());
420  aligner.attachSurfaceDeformations<TrackerGeometry>(&(*theTracker), &(*aliDeforms));
421 
422  }
423  if ( doMuon_ ) {
424  std::auto_ptr<Alignments> dtAlignments( theAlignableMuon->dtAlignments());
425  std::auto_ptr<AlignmentErrorsExtended> dtAlignmentErrorsExtended( theAlignableMuon->dtAlignmentErrorsExtended());
426  std::auto_ptr<Alignments> cscAlignments( theAlignableMuon->cscAlignments());
427  std::auto_ptr<AlignmentErrorsExtended> cscAlignmentErrorsExtended( theAlignableMuon->cscAlignmentErrorsExtended());
428 
429  aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrorsExtended), AlignTransform() ); // don't apply global a second time!
430  aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrorsExtended), AlignTransform() ); // nope!
431  }
432 }
433 
434 
435 //_____________________________________________________________________________
436 // Called at end of loop
438 AlignmentProducer::endOfLoop(const edm::EventSetup& iSetup, unsigned int iLoop)
439 {
440 
441  if (0 == nevent_) {
442  // beginOfJob is usually called by the framework in the first event of the first loop
443  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
444  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
445  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
446  // some geometry information that is not defined either without having seen an event.
447  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
448  << "Did not process any events in loop " << iLoop
449  << ", stop processing without terminating algorithm.";
450  return kStop;
451  }
452 
453  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
454  << "Ending loop " << iLoop << ", terminating algorithm.";
455 
456  theAlignmentAlgo->terminate(iSetup);
457  // FIXME: Should this be done in algorithm::terminate(const edm::EventSetup& iSetup)??
458  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
459  (*iCal)->endOfLoop();
460  }
461 
462  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
463  (*monitor)->endOfLoop(iSetup);
464  }
465 
466  if ( iLoop == theMaxLoops-1 || iLoop >= theMaxLoops ) return kStop;
467  else return kContinue;
468 }
469 
470 //_____________________________________________________________________________
471 // Called at each event
474  const edm::EventSetup& setup )
475 {
476  ++nevent_;
477 
478  // reading in survey records
479  this->readInSurveyRcds(setup);
480 
481  // Printout event number
482  for ( int i=10; i<10000000; i*=10 )
483  if ( nevent_<10*i && (nevent_%i)==0 )
484  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
485  << "Events processed: " << nevent_;
486 
487  // Retrieve trajectories and tracks from the event
488  // -> merely skip if collection is empty
490  if (event.getByLabel(tjTkAssociationMapTag_, m_TrajTracksMap)) {
491 
492  // Form pairs of trajectories and tracks
493  ConstTrajTrackPairCollection trajTracks;
494  for ( TrajTrackAssociationCollection::const_iterator iPair = m_TrajTracksMap->begin();
495  iPair != m_TrajTracksMap->end(); ++iPair) {
496  trajTracks.push_back( ConstTrajTrackPair( &(*(*iPair).key), &(*(*iPair).val) ) );
497  }
499  event.getByLabel(beamSpotTag_, beamSpot);
500 
501  if (nevent_==1 && theAlignableExtras) {
502  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
503  << "initializing AlignableBeamSpot" << std::endl;
504  theAlignableExtras->initializeBeamSpot(beamSpot->x0(), beamSpot->y0(), beamSpot->z0(),
505  beamSpot->dxdz(), beamSpot->dydz());
506  }
507 
508  // Run the alignment algorithm with its input
509  const AliClusterValueMap *clusterValueMapPtr = 0;
510  if(clusterValueMapTag_.encode().size()){//check that the input tag is not empty
511  edm::Handle<AliClusterValueMap> clusterValueMap;
512  event.getByLabel(clusterValueMapTag_, clusterValueMap);
513  clusterValueMapPtr = &(*clusterValueMap);
514  }
515 
516  const AlignmentAlgorithmBase::EventInfo eventInfo(event.id(), trajTracks, *beamSpot,
517  clusterValueMapPtr);
518  theAlignmentAlgo->run(setup, eventInfo);
519 
520 
521  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
522  monitor != theMonitors.end(); ++monitor) {
523  (*monitor)->duringLoop(event, setup, trajTracks); // forward eventInfo?
524  }
525  } else {
526  edm::LogError("Alignment") << "@SUB=AlignmentProducer::duringLoop"
527  << "No track collection found: skipping event";
528  }
529 
530 
531  return kContinue;
532 }
533 
534 // ----------------------------------------------------------------------------
536 {
537  theAlignmentAlgo->beginRun(setup); // do not forward edm::Run...
538 }
539 
540 // ----------------------------------------------------------------------------
542 {
543  // call with or without las beam info...
545  if (tkLasBeamTag_.encode().size()) { // non-empty InputTag
548  run.getByLabel(tkLasBeamTag_, lasBeams);
549  run.getByLabel(tkLasBeamTag_, tsoses);
550 
551  theAlignmentAlgo->endRun(EndRunInfo(run.id(), &(*lasBeams), &(*tsoses)), setup);
552  } else {
553  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endRun"
554  << "No Tk LAS beams to forward to algorithm.";
555  theAlignmentAlgo->endRun(EndRunInfo(run.id(), 0, 0), setup);
556  }
557 }
558 
559 // ----------------------------------------------------------------------------
561  const edm::EventSetup &setup)
562 {
563  theAlignmentAlgo->beginLuminosityBlock(setup); // do not forward edm::LuminosityBlock
564 }
565 
566 // ----------------------------------------------------------------------------
568  const edm::EventSetup &setup)
569 {
570  theAlignmentAlgo->endLuminosityBlock(setup); // do not forward edm::LuminosityBlock
571 }
572 
573 // ----------------------------------------------------------------------------
574 
576  float shift, float rot, bool local)
577 {
578 
579  std::ostringstream output; // collecting output
580 
581  if (shift > 0. || rot > 0.) {
582  output << "Adding random flat shift of max size " << shift
583  << " and adding random flat rotation of max size " << rot <<" to ";
584 
585  std::vector<bool> commSel(0);
586  if (selection != "-1") {
587  AlignmentParameterSelector aSelector(0,0); // no alignable needed here...
588  const std::vector<char> cSel(aSelector.convertParamSel(selection));
589  if (cSel.size() < RigidBodyAlignmentParameters::N_PARAM) {
590  throw cms::Exception("BadConfig")
591  << "[AlignmentProducer::simpleMisalignment_]\n"
592  << "Expect selection string '" << selection << "' to be at least of length "
593  << RigidBodyAlignmentParameters::N_PARAM << " or to be '-1'.\n"
594  << "(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
595  }
596  for (std::vector<char>::const_iterator cIter = cSel.begin(); cIter != cSel.end(); ++cIter) {
597  commSel.push_back(*cIter == '0' ? false : true);
598  }
599  output << "parameters defined by (" << selection
600  << "), representing (x,y,z,alpha,beta,gamma),";
601  } else {
602  output << "the active parameters of each alignable,";
603  }
604  output << " in " << (local ? "local" : "global") << " frame.";
605 
606  for (std::vector<Alignable*>::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
607  Alignable* ali=(*it);
608  std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
609 
610  if (std::abs(shift)>0.00001) {
611  double s0 = 0., s1 = 0., s2 = 0.;
612  if (mysel[RigidBodyAlignmentParameters::dx]) s0 = shift * double(random()%1000-500)/500.;
613  if (mysel[RigidBodyAlignmentParameters::dy]) s1 = shift * double(random()%1000-500)/500.;
614  if (mysel[RigidBodyAlignmentParameters::dz]) s2 = shift * double(random()%1000-500)/500.;
615 
616  if (local) ali->move( ali->surface().toGlobal(align::LocalVector(s0,s1,s2)) );
617  else ali->move( align::GlobalVector(s0,s1,s2) );
618 
619  //AlignmentPositionError ape(dx,dy,dz);
620  //ali->addAlignmentPositionError(ape);
621  }
622 
623  if (std::abs(rot)>0.00001) {
625  if (mysel[RigidBodyAlignmentParameters::dalpha]) r(1)=rot*double(random()%1000-500)/500.;
626  if (mysel[RigidBodyAlignmentParameters::dbeta]) r(2)=rot*double(random()%1000-500)/500.;
627  if (mysel[RigidBodyAlignmentParameters::dgamma]) r(3)=rot*double(random()%1000-500)/500.;
628 
629  const align::RotationType mrot = align::toMatrix(r);
630  if (local) ali->rotateInLocalFrame(mrot);
631  else ali->rotateInGlobalFrame(mrot);
632 
633  //ali->addAlignmentPositionErrorFromRotation(mrot);
634  }
635  } // end loop on alignables
636  } else {
637  output << "No simple misalignment added!";
638  }
639  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::simpleMisalignment_" << output.str();
640 }
641 
642 
643 //__________________________________________________________________________________________________
645 {
647  iSetup.get<IdealGeometryRecord>().get( cpv );
648 
649  if (doTracker_) {
650  edm::ESHandle<GeometricDet> geometricDet;
651  iSetup.get<IdealGeometryRecord>().get( geometricDet );
653  iSetup.get<PTrackerParametersRcd>().get( ptp );
654  TrackerGeomBuilderFromGeometricDet trackerBuilder;
655  theTracker = boost::shared_ptr<TrackerGeometry>( trackerBuilder.build(&(*geometricDet), *ptp ));
656  }
657 
658  if (doMuon_) {
660  iSetup.get<MuonNumberingRecord>().get(mdc);
661  DTGeometryBuilderFromDDD DTGeometryBuilder;
663  theMuonDT = boost::shared_ptr<DTGeometry>(new DTGeometry );
664  DTGeometryBuilder.build( theMuonDT, &(*cpv), *mdc);
665  theMuonCSC = boost::shared_ptr<CSCGeometry>( new CSCGeometry );
666  CSCGeometryBuilder.build( theMuonCSC, &(*cpv), *mdc );
667  }
668 }
669 
671 {
672  const std::vector<Alignable*>& comp = ali->components();
673 
674  unsigned int nComp = comp.size();
675 
676  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo_(comp[i]);
677 
679 
680  if ( ali->id() != error.rawId() ||
681  ali->alignableObjectId() != error.structureType() )
682  {
683  throw cms::Exception("DatabaseError")
684  << "Error reading survey info from DB. Mismatched id!";
685  }
686 
687  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
688  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
689 
690  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
691  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
692  rot.yx(), rot.yy(), rot.yz(),
693  rot.zx(), rot.zy(), rot.zz() ) );
694 
695  surf.setWidth( ali->surface().width() );
696  surf.setLength( ali->surface().length() );
697 
698  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
699 
700  ++theSurveyIndex;
701 }
702 
704 
705  // Get Survey Rcds and add Survey Info
706  if ( doTracker_ && useSurvey_ ){
707  bool tkSurveyBool = watchTkSurveyRcd_.check(iSetup);
708  bool tkSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
709  edm::LogInfo("Alignment") << "watcher tksurveyrcd: " << tkSurveyBool;
710  edm::LogInfo("Alignment") << "watcher tksurveyerrrcd: " << tkSurveyErrBool;
711  if ( tkSurveyBool || tkSurveyErrBool){
712 
713  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
715  edm::ESHandle<SurveyErrors> surveyErrors;
716 
717  iSetup.get<TrackerSurveyRcd>().get(surveys);
718  iSetup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
719 
720  theSurveyIndex = 0;
721  theSurveyValues = &*surveys;
722  theSurveyErrors = &*surveyErrors;
724  }
725  }
726 
727  if ( doMuon_ && useSurvey_) {
728  bool DTSurveyBool = watchTkSurveyRcd_.check(iSetup);
729  bool DTSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
730  bool CSCSurveyBool = watchTkSurveyRcd_.check(iSetup);
731  bool CSCSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
732 
733  if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
734  edm::ESHandle<Alignments> dtSurveys;
735  edm::ESHandle<SurveyErrors> dtSurveyErrors;
736  edm::ESHandle<Alignments> cscSurveys;
737  edm::ESHandle<SurveyErrors> cscSurveyErrors;
738 
739  iSetup.get<DTSurveyRcd>().get(dtSurveys);
740  iSetup.get<DTSurveyErrorExtendedRcd>().get(dtSurveyErrors);
741  iSetup.get<CSCSurveyRcd>().get(cscSurveys);
742  iSetup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
743 
744  theSurveyIndex = 0;
745  theSurveyValues = &*dtSurveys;
746  theSurveyErrors = &*dtSurveyErrors;
747  std::vector<Alignable*> barrels = theAlignableMuon->DTBarrel();
748  for (std::vector<Alignable*>::const_iterator iter = barrels.begin(); iter != barrels.end(); ++iter) {
749  addSurveyInfo_(*iter);
750  }
751 
752  theSurveyIndex = 0;
753  theSurveyValues = &*cscSurveys;
754  theSurveyErrors = &*cscSurveyErrors;
755  std::vector<Alignable*> endcaps = theAlignableMuon->CSCEndcaps();
756  for (std::vector<Alignable*>::const_iterator iter = endcaps.begin(); iter != endcaps.end(); ++iter) {
757  addSurveyInfo_(*iter);
758  }
759  }
760  }
761 
762 }
763 
764 
766 // a templated method - but private, so not accessible from outside
767 // ==> does not have to be in header file
768 template<class G, class Rcd, class ErrRcd>
770  const AlignTransform &globalCoordinates) const
771 {
772  // 'G' is the geometry class for that DB should be applied,
773  // 'Rcd' is the record class for its Alignments
774  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
775  // 'globalCoordinates' are global transformation for this geometry
776 
777  const Rcd & record = iSetup.get<Rcd>();
779  const edm::ValidityInterval & validity = record.validityInterval();
780  const edm::IOVSyncValue first = validity.first();
781  const edm::IOVSyncValue last = validity.last();
782  if (first!=edm::IOVSyncValue::beginOfTime() ||
784  throw cms::Exception("DatabaseError")
785  << "@SUB=AlignmentProducer::applyDB"
786  << "\nTrying to apply "
787  << record.key().name()
788  << " with multiple IOVs in tag.\n"
789  << "Validity range is "
790  << first.eventID().run() << " - " << last.eventID().run();
791  }
792  }
793 
794  edm::ESHandle<Alignments> alignments;
795  record.get(alignments);
796 
798  iSetup.get<ErrRcd>().get(alignmentErrors);
799 
800  GeometryAligner aligner;
801  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrors),
802  globalCoordinates);
803 }
804 
805 
807 // a templated method - but private, so not accessible from outside
808 // ==> does not have to be in header file
809 template<class G, class DeformationRcd>
811 {
812  // 'G' is the geometry class for that DB should be applied,
813  // 'DeformationRcd' is the record class for its surface deformations
814 
815  const DeformationRcd & record = iSetup.get<DeformationRcd>();
817  const edm::ValidityInterval & validity = record.validityInterval();
818  const edm::IOVSyncValue first = validity.first();
819  const edm::IOVSyncValue last = validity.last();
820  if (first!=edm::IOVSyncValue::beginOfTime() ||
822  throw cms::Exception("DatabaseError")
823  << "@SUB=AlignmentProducer::applyDB"
824  << "\nTrying to apply "
825  << record.key().name()
826  << " with multiple IOVs in tag.\n"
827  << "Validity range is "
828  << first.eventID().run() << " - " << last.eventID().run();
829  }
830  }
832  record.get(surfaceDeformations);
833 
834  GeometryAligner aligner;
835  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
836 }
837 
840 {
841  if ( doTracker_ ) { // first tracker
842  const AlignTransform *trackerGlobal = 0; // will be 'removed' from constants
843  if (globalPositions_) { // i.e. applied before in applyDB
846  }
847 
848  Alignments *alignments = theAlignableTracker->alignments();
850  this->writeDB(alignments, "TrackerAlignmentRcd",
851  alignmentErrors, "TrackerAlignmentErrorExtendedRcd", trackerGlobal,
852  time);
853  }
854 
855  if ( doMuon_ ) { // now muon
856  const AlignTransform *muonGlobal = 0; // will be 'removed' from constants
857  if (globalPositions_) { // i.e. applied before in applyDB
859  DetId(DetId::Muon));
860  }
861  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
862  Alignments *alignments = theAlignableMuon->dtAlignments();
864  this->writeDB(alignments, "DTAlignmentRcd",
865  alignmentErrors, "DTAlignmentErrorExtendedRcd", muonGlobal,
866  time);
867 
868  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
869  alignments = theAlignableMuon->cscAlignments();
870  alignmentErrors = theAlignableMuon->cscAlignmentErrorsExtended();
871  this->writeDB(alignments, "CSCAlignmentRcd",
872  alignmentErrors, "CSCAlignmentErrorExtendedRcd", muonGlobal,
873  time);
874  }
875 
876  // Save surface deformations to database
878  AlignmentSurfaceDeformations *alignmentSurfaceDeformations = theAlignableTracker->surfaceDeformations();
879  this->writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
880  }
881 }
882 
885  const std::string &alignRcd,
886  AlignmentErrorsExtended *alignmentErrors,
887  const std::string &errRcd,
888  const AlignTransform *globalCoordinates,
889  cond::Time_t time) const
890 {
891  Alignments * tempAlignments = alignments;
892  AlignmentErrorsExtended * tempAlignmentErrorsExtended = alignmentErrors;
893 
894  // Call service
896  if (!poolDb.isAvailable()) { // Die if not available
897  delete tempAlignments; // promised to take over ownership...
898  delete tempAlignmentErrorsExtended; // dito
899  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
900  }
901 
902  if (globalCoordinates // happens only if (applyDbAlignment_ == true)
903  && globalCoordinates->transform() != AlignTransform::Transform::Identity) {
904 
905  tempAlignments = new Alignments(); // temporary storage for
906  tempAlignmentErrorsExtended = new AlignmentErrorsExtended(); // final alignments and errors
907 
908  GeometryAligner aligner;
909  aligner.removeGlobalTransform(alignments, alignmentErrors,
910  *globalCoordinates,
911  tempAlignments, tempAlignmentErrorsExtended);
912 
913  delete alignments; // have to delete original alignments
914  delete alignmentErrors; // same thing for the errors
915 
916  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::writeDB"
917  << "globalCoordinates removed from alignments (" << alignRcd
918  << ") and errors (" << alignRcd << ").";
919  }
920 
921  if (saveToDB_) {
922  edm::LogInfo("Alignment") << "Writing Alignments for run " << time
923  << " to " << alignRcd << ".";
924  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
925  } else { // poolDb->writeOne(..) takes over 'alignments' ownership,...
926  delete tempAlignments; // ...otherwise we have to delete, as promised!
927  }
928 
929  if (saveApeToDB_) {
930  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run " << time
931  << " to " << errRcd << ".";
932  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrorsExtended, time, errRcd);
933  } else { // poolDb->writeOne(..) takes over 'alignmentErrors' ownership,...
934  delete tempAlignmentErrorsExtended; // ...otherwise we have to delete, as promised!
935  }
936 }
937 
938 
940 void AlignmentProducer::writeDB(AlignmentSurfaceDeformations *alignmentSurfaceDeformations,
941  const std::string &surfaceDeformationRcd,
942  cond::Time_t time) const
943 {
944  // Call service
946  if (!poolDb.isAvailable()) { // Die if not available
947  delete alignmentSurfaceDeformations; // promised to take over ownership...
948  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
949  }
950 
951  if (saveDeformationsToDB_) {
952  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run " << time
953  << " to " << surfaceDeformationRcd << ".";
954  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
955  surfaceDeformationRcd);
956  } else { // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
957  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
958  }
959 }
960 
963 {
964  static bool oldRunRangeSelectionWarning = false;
965 
968 
969  RunRanges uniqueRunRanges;
970  if (!RunRangeSelectionVPSet.empty()) {
971 
972  std::map<RunNumber,RunNumber> uniqueFirstRunNumbers;
973 
974  for (std::vector<edm::ParameterSet>::const_iterator ipset = RunRangeSelectionVPSet.begin();
975  ipset != RunRangeSelectionVPSet.end();
976  ++ipset) {
977  const std::vector<std::string> RunRangeStrings = (*ipset).getParameter<std::vector<std::string> >("RunRanges");
978  for (std::vector<std::string>::const_iterator irange = RunRangeStrings.begin();
979  irange != RunRangeStrings.end();
980  ++irange) {
981 
982  if ((*irange).find(':')==std::string::npos) {
983 
984  RunNumber first = beginValue;
985  long int temp = strtol((*irange).c_str(), 0, 0);
986  if (temp!=-1) first = temp;
987  uniqueFirstRunNumbers[first] = first;
988 
989  } else {
990 
991  if (!oldRunRangeSelectionWarning) {
992  edm::LogWarning("BadConfig") << "@SUB=AlignmentProducer::makeNonOverlappingRunRanges"
993  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
994  << "number is used internally. The number of the last run is ignored and can be\n"
995  << "safely removed from the config file.\n";
996  oldRunRangeSelectionWarning = true;
997  }
998 
999  std::vector<std::string> tokens = edm::tokenize(*irange, ":");
1000  long int temp;
1001  RunNumber first = beginValue;
1002  temp = strtol(tokens[0].c_str(), 0, 0);
1003  if (temp!=-1) first = temp;
1004  uniqueFirstRunNumbers[first] = first;
1005  }
1006  }
1007  }
1008 
1009  for (std::map<RunNumber,RunNumber>::iterator iFirst = uniqueFirstRunNumbers.begin();
1010  iFirst!=uniqueFirstRunNumbers.end();
1011  ++iFirst) {
1012  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>((*iFirst).first, endValue));
1013  }
1014  for (unsigned int i = 0;i<uniqueRunRanges.size()-1;++i) {
1015  uniqueRunRanges[i].second = uniqueRunRanges[i+1].first - 1;
1016  }
1017 
1018  } else {
1019 
1020  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>(beginValue, endValue));
1021 
1022  }
1023 
1024  return uniqueRunRanges;
1025 }
1026 
RunNumber_t run() const
Definition: EventID.h:39
std::vector< Alignable * > Alignables
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)
virtual void beginRun(const edm::EventSetup &setup)
called at begin of run
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:180
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:216
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< TrackerGeometry > theTracker
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:91
const bool doMisalignmentScenario_
RunID const & id() const
Definition: RunBase.h:41
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)=0
Run the algorithm (must be implemented in derived class)
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)
const EventID & eventID() const
Definition: IOVSyncValue.h:42
virtual boost::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &iRecord)
Produce the tracker geometry.
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Time_t beginValue
Definition: Time.h:45
Class to update a given geometry with a set of alignments.
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.
JetCorrectorParameters::Record record
Definition: classes.h:7
void readInSurveyRcds(const edm::EventSetup &)
read in survey records
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
ErrorMatrix matrix() const
Definition: SurveyError.h:76
void writeDB(Alignments *alignments, const std::string &alignRcd, AlignmentErrorsExtended *alignmentErrors, const std::string &errRcd, const AlignTransform *globalCoordinates, cond::Time_t time) const
virtual boost::shared_ptr< DTGeometry > produceDT(const MuonGeometryRecord &iRecord)
Produce the muon DT geometry.
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)
virtual Status endOfLoop(const edm::EventSetup &, unsigned int iLoop)
Called at end of loop.
edm::ParameterSet theParameterSet
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)
TRandom random
Definition: MVATrainer.cc:138
const edm::InputTag tkLasBeamTag_
const Alignments * theSurveyValues
void addSurveyInfo_(Alignable *)
Add survey info to an alignable.
uint8_t structureType() const
Definition: SurveyError.h:66
void createGeometries_(const edm::EventSetup &)
Create tracker and muon geometries.
virtual Alignables components() const =0
Return vector of all direct components.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
std::string encode() const
Definition: InputTag.cc:164
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
const bool applyDbAlignment_
define event information passed to algorithms
tuple s2
Definition: indexGen.py:106
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.
AlignmentAlgorithmBase::RunNumber RunNumber
void build(boost::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
virtual bool addCalibrations(const Calibrations &)
void setLength(align::Scalar length)
const unsigned int theMaxLoops
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignableExtras * theAlignableExtras
virtual bool setParametersForRunRange(const RunRange &rr)
Alignments * dtAlignments()
unsigned long long Time_t
Definition: Time.h:16
align::Alignables CSCEndcaps()
const bool checkDbAlignmentValidity_
boost::shared_ptr< CSCGeometry > theMuonCSC
static const IOVSyncValue & beginOfTime()
const edm::InputTag clusterValueMapTag_
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrorsExtended *newAlignmentErrorsExtended)
bool isAvailable() const
Definition: Service.h:46
unsigned int theSurveyIndex
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
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.
RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet &RunRangeSelectionVPSet)
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:216
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 applyScenario(const edm::ParameterSet &scenario)
Apply misalignment scenario to the tracker.
boost::shared_ptr< DTGeometry > theMuonDT
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const edm::InputTag beamSpotTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
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()
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
const SurveyErrors * theSurveyErrors
tuple G
Definition: callgraph.py:12
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)
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
void build(boost::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
const T & get() const
Definition: EventSetup.h:55
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup)
Called at lumi block end, calling algorithm&#39;s endLuminosityBlock.
T const * product() const
Definition: ESHandle.h:86
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
Alignments * cscAlignments()
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp)
ESHandle< TrackerGeometry > geometry
edm::EventID id() const
Definition: EventBase.h:60
virtual boost::shared_ptr< CSCGeometry > produceCSC(const MuonGeometryRecord &iRecord)
Produce the muon CSC geometry.
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
AlignableTracker * theAlignableTracker
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
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&lt;char&gt;
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)
const IOVSyncValue & first() const
Alignments * alignments() const
Return alignments, sorted by DetId.
Time_t endValue
Definition: Time.h:46
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:23
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
define run information passed to algorithms (in endRun)
Builds a scenario from configuration and applies it to the alignable tracker.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
SurfaceDeformation * create(int type, const std::vector< double > &params)
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
AlignmentAlgorithmBase::RunRange RunRange
const double stRandomRotation_
Definition: Run.h:41
std::vector< RunRange > RunRanges