CMS 3D CMS Logo

List of all members | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
AlignmentProducerBase Class Referenceabstract

#include <AlignmentProducerBase.h>

Inheritance diagram for AlignmentProducerBase:
AlignmentProducer AlignmentProducerAsAnalyzer

Protected Member Functions

 AlignmentProducerBase (const edm::ParameterSet &)
 
void beginLuminosityBlockImpl (const edm::LuminosityBlock &, const edm::EventSetup &)
 begin lumi block More...
 
void beginRunImpl (const edm::Run &, const edm::EventSetup &)
 begin run More...
 
void endLuminosityBlockImpl (const edm::LuminosityBlock &, const edm::EventSetup &)
 end lumi block More...
 
void endRunImpl (const edm::Run &, const edm::EventSetup &)
 end run More...
 
bool finish ()
 
virtual bool getAliClusterValueMap (const edm::Event &, edm::Handle< AliClusterValueMap > &)=0
 
virtual bool getBeamSpot (const edm::Event &, edm::Handle< reco::BeamSpot > &)=0
 
virtual bool getTkFittedLasBeamCollection (const edm::Run &, edm::Handle< TkFittedLasBeamCollection > &)=0
 
virtual bool getTrajTrackAssociationCollection (const edm::Event &, edm::Handle< TrajTrackAssociationCollection > &)=0
 
virtual bool getTsosVectorCollection (const edm::Run &, edm::Handle< TsosVectorCollection > &)=0
 
void initAlignmentAlgorithm (const edm::EventSetup &, bool update=false)
 
int nEvent () const
 
bool processEvent (const edm::Event &, const edm::EventSetup &)
 Process event. More...
 
void startProcessing ()
 Start processing of events. More...
 
void terminateProcessing (const edm::EventSetup *=0)
 Terminate processing of events. More...
 
virtual ~AlignmentProducerBase ()(false)
 

Protected Attributes

const edm::InputTag beamSpotTag_
 BeamSpot. More...
 
const edm::InputTag clusterValueMapTag_
 ValueMap containing associtaion cluster-flag. More...
 
const bool doMuon_
 
const bool doTracker_
 
std::shared_ptr< CSCGeometrymuonCSCGeometry_
 
std::shared_ptr< DTGeometrymuonDTGeometry_
 
const edm::InputTag tjTkAssociationMapTag_
 Map with tracks/trajectories. More...
 
const edm::InputTag tkLasBeamTag_
 LAS beams in edm::Run (ignore if empty) More...
 
std::shared_ptr< TrackerGeometrytrackerGeometry_
 
const bool useExtras_
 

Private Member Functions

void addSurveyInfo (Alignable *)
 Adds survey info to an Alignable. More...
 
void applyAlignmentsToDB (const edm::EventSetup &)
 
void applyAlignmentsToGeometry ()
 
template<class G , class Rcd , class ErrRcd >
void applyDB (G *, const edm::EventSetup &, const AlignTransform &) const
 
template<class G , class DeformationRcd >
void applyDB (G *, const edm::EventSetup &) const
 Applies DB constants for SurfaceDeformations. More...
 
void applyMisalignment ()
 Applies misalignment scenario to . More...
 
void buildParameterStore ()
 Creates the , which manages all Alignables. More...
 
void createAlignables (const TrackerTopology *, bool update=false)
 
void createAlignmentAlgorithm ()
 Creates the choosen alignment algorithm. More...
 
void createCalibrations ()
 Creates the calibrations. More...
 
void createGeometries (const edm::EventSetup &, const TrackerTopology *)
 Creates ideal geometry from IdealGeometryRecord. More...
 
void createMonitors ()
 Creates the monitors. More...
 
void initBeamSpot (const edm::Event &)
 Initializes Beamspot of Alignables . More...
 
void readInSurveyRcds (const edm::EventSetup &)
 Reads in survey records. More...
 
bool setupChanged (const edm::EventSetup &)
 Checks if one of the EventSetup-Records has changed. More...
 
void simpleMisalignment (const align::Alignables &, const std::string &, float, float, bool)
 Applies misalignment scenario to . More...
 
void storeAlignmentsToDB ()
 Writes Alignments (i.e. Records) to database-file. More...
 
void writeDB (Alignments *, const std::string &, AlignmentErrorsExtended *, const std::string &, const AlignTransform *, cond::Time_t) const
 
void writeDB (AlignmentSurfaceDeformations *, const std::string &, cond::Time_t) const
 
void writeForRunRange (cond::Time_t)
 

Private Attributes

std::unique_ptr< AlignableExtrasalignableExtras_
 
std::unique_ptr< AlignableMuonalignableMuon_
 
std::unique_ptr< AlignableTrackeralignableTracker_
 
std::unique_ptr< AlignmentAlgorithmBasealignmentAlgo_
 
std::unique_ptr< AlignmentParameterStorealignmentParameterStore_
 
const bool applyDbAlignment_
 
edm::Handle< reco::BeamSpotbeamSpot_
 
CalibrationsOwner calibrations_
 
const bool checkDbAlignmentValidity_
 
edm::ParameterSet config_
 
const bool doMisalignmentScenario_
 
const bool enableAlignableUpdates_
 
cond::Time_t firstRun_ {cond::timeTypeSpecs[cond::runnumber].endValue}
 
std::unique_ptr< const AlignmentsglobalPositions_
 GlobalPositions that might be read from DB, nullptr otherwise. More...
 
bool isAlgoInitialized_ {false}
 
bool isDuringLoop_ {false}
 
AlignmentMonitors monitors_
 
int nevent_ {0}
 
bool runAtPCL_ {false}
 
const bool saveApeToDB_
 
const bool saveDeformationsToDB_
 
const bool saveToDB_
 
const int stNFixAlignables_
 
const double stRandomRotation_
 
const double stRandomShift_
 
const SurveyErrorssurveyErrors_ { 0 }
 
size_t surveyIndex_ {0}
 
const AlignmentssurveyValues_ { 0 }
 
const align::RunRanges uniqueRunRanges_
 
const bool useSurvey_
 
edm::ESWatcher< CSCAlignmentErrorExtendedRcdwatchCSCAlErrExtRcd_
 
edm::ESWatcher< CSCAlignmentRcdwatchCSCAlRcd_
 
edm::ESWatcher< CSCSurveyErrorExtendedRcdwatchCSCSurveyErrExtRcd_
 
edm::ESWatcher< CSCSurveyRcdwatchCSCSurveyRcd_
 
edm::ESWatcher< DTAlignmentErrorExtendedRcdwatchDTAlErrExtRcd_
 
edm::ESWatcher< DTAlignmentRcdwatchDTAlRcd_
 
edm::ESWatcher< DTSurveyErrorExtendedRcdwatchDTSurveyErrExtRcd_
 
edm::ESWatcher< DTSurveyRcdwatchDTSurveyRcd_
 
edm::ESWatcher< GlobalPositionRcdwatchGlobalPositionRcd_
 
edm::ESWatcher< IdealGeometryRecordwatchIdealGeometryRcd_
 
edm::ESWatcher< TrackerSurveyErrorExtendedRcdwatchTkSurveyErrExtRcd_
 
edm::ESWatcher< TrackerSurveyRcdwatchTkSurveyRcd_
 
edm::ESWatcher< TrackerAlignmentErrorExtendedRcdwatchTrackerAlErrorExtRcd_
 
edm::ESWatcher< TrackerAlignmentRcdwatchTrackerAlRcd_
 
edm::ESWatcher< TrackerSurfaceDeformationRcdwatchTrackerSurDeRcd_
 

Detailed Description

Definition at line 69 of file AlignmentProducerBase.h.

Constructor & Destructor Documentation

AlignmentProducerBase::AlignmentProducerBase ( const edm::ParameterSet config)
protected

Definition at line 34 of file AlignmentProducerBase.cc.

References ALCARECOPromptCalibProdSiPixelAli0T_cff::algoConfig, applyDbAlignment_, beamSpotTag_, cond::TimeTypeSpecs::beginValue, checkDbAlignmentValidity_, clusterValueMapTag_, config_, createAlignmentAlgorithm(), createCalibrations(), createMonitors(), doMisalignmentScenario_, doMuon_, enableAlignableUpdates_, Exception, edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getUntrackedParameter(), align::makeUniqueRunRanges(), runAtPCL_, cond::runnumber, saveApeToDB_, saveDeformationsToDB_, saveToDB_, stNFixAlignables_, stRandomRotation_, stRandomShift_, cond::timeTypeSpecs, tjTkAssociationMapTag_, tkLasBeamTag_, uniqueRunRanges_, useExtras_, and useSurvey_.

35  : doTracker_{config.getUntrackedParameter<bool>("doTracker")},
36  doMuon_{config.getUntrackedParameter<bool>("doMuon")},
37  useExtras_{config.getUntrackedParameter<bool>("useExtras")},
38  tjTkAssociationMapTag_{config.getParameter<edm::InputTag>("tjTkAssociationMapTag")},
39  beamSpotTag_{config.getParameter<edm::InputTag>("beamSpotTag")},
40  tkLasBeamTag_{config.getParameter<edm::InputTag>("tkLasBeamTag")},
41  clusterValueMapTag_{config.getParameter<edm::InputTag>("hitPrescaleMapTag")},
44  config_{config},
45  stNFixAlignables_{config.getParameter<int>("nFixAlignables")},
46  stRandomShift_{config.getParameter<double>("randomShift")},
47  stRandomRotation_{config.getParameter<double>("randomRotation")},
48  applyDbAlignment_{config.getUntrackedParameter<bool>("applyDbAlignment")},
49  checkDbAlignmentValidity_{config.getUntrackedParameter<bool>("checkDbAlignmentValidity")},
50  doMisalignmentScenario_{config.getParameter<bool>("doMisalignmentScenario")},
51  saveToDB_{config.getParameter<bool>("saveToDB")},
52  saveApeToDB_{config.getParameter<bool>("saveApeToDB")},
53  saveDeformationsToDB_{config.getParameter<bool>("saveDeformationsToDB")},
54  useSurvey_{config.getParameter<bool>("useSurvey")},
55  enableAlignableUpdates_{config.getParameter<bool>("enableAlignableUpdates")} {
56  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::AlignmentProducerBase";
57 
58  const auto& algoConfig = config_.getParameterSet("algoConfig");
59  if (config_.existsAs<bool>("runAtPCL")) {
60  // configured in main config?
61  runAtPCL_ = config_.getParameter<bool>("runAtPCL");
62 
63  if (algoConfig.existsAs<bool>("runAtPCL") && (runAtPCL_ != algoConfig.getParameter<bool>("runAtPCL"))) {
64  throw cms::Exception("BadConfig") << "Inconsistent settings for 'runAtPCL' in configuration of the "
65  << "alignment producer and the alignment algorithm.";
66  }
67 
68  } else if (algoConfig.existsAs<bool>("runAtPCL")) {
69  // configured in algo config?
70  runAtPCL_ = algoConfig.getParameter<bool>("runAtPCL");
71 
72  } else {
73  // assume 'false' if it was not configured
74  runAtPCL_ = false;
75  }
76 
80 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag tjTkAssociationMapTag_
Map with tracks/trajectories.
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
Time_t beginValue
Definition: Time.h:41
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:241
const edm::InputTag beamSpotTag_
BeamSpot.
ParameterSet const & getParameterSet(std::string const &) const
const align::RunRanges uniqueRunRanges_
void createCalibrations()
Creates the calibrations.
void createAlignmentAlgorithm()
Creates the choosen alignment algorithm.
const edm::InputTag tkLasBeamTag_
LAS beams in edm::Run (ignore if empty)
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
void createMonitors()
Creates the monitors.
AlignmentProducerBase::~AlignmentProducerBase ( )
protectedvirtual

Definition at line 83 of file AlignmentProducerBase.cc.

83 {}

Member Function Documentation

void AlignmentProducerBase::addSurveyInfo ( Alignable ali)
private

Adds survey info to an Alignable.

Definition at line 727 of file AlignmentProducerBase.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), relativeConstraints::error, Exception, Alignable::id(), AlignableSurface::length(), Alignments::m_align, SurveyErrors::m_surveyErrors, SurveyError::matrix(), SurveyError::rawId(), makeMuonMisalignmentScenario::rot, AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), surveyErrors_, surveyIndex_, surveyValues_, and AlignableSurface::width().

Referenced by readInSurveyRcds().

727  {
728  const auto& comps = ali->components();
729 
730  for (const auto& comp : comps)
732 
734 
735  if (ali->id() != error.rawId() || ali->alignableObjectId() != error.structureType()) {
736  throw cms::Exception("DatabaseError") << "Error reading survey info from DB. Mismatched id!";
737  }
738 
739  const auto& pos = surveyValues_->m_align[surveyIndex_].translation();
740  const auto& rot = surveyValues_->m_align[surveyIndex_].rotation();
741 
742  AlignableSurface surf(
743  align::PositionType(pos.x(), pos.y(), pos.z()),
744  align::RotationType(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
745 
746  surf.setWidth(ali->surface().width());
747  surf.setLength(ali->surface().length());
748 
749  ali->setSurvey(new SurveyDet(surf, error.matrix()));
750 
751  ++surveyIndex_;
752 }
align::Scalar width() const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
ErrorMatrix matrix() const
Definition: SurveyError.h:63
const Alignments * surveyValues_
virtual const Alignables & components() const =0
Return vector of all direct components.
uint8_t structureType() const
Definition: SurveyError.h:59
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void addSurveyInfo(Alignable *)
Adds survey info to an Alignable.
align::ID rawId() const
Definition: SurveyError.h:61
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
const SurveyErrors * surveyErrors_
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:22
void AlignmentProducerBase::applyAlignmentsToDB ( const edm::EventSetup setup)
private

Applies Alignments from Database (GlobalPositionRcd) to Geometry

Definition at line 443 of file AlignmentProducerBase.cc.

References applyDbAlignment_, align::DetectorGlobalPosition(), doMuon_, doTracker_, edm::EventSetup::get(), globalPositions_, DetId::Muon, muonCSCGeometry_, muonDTGeometry_, singleTopDQM_cfi::setup, DetId::Tracker, and trackerGeometry_.

Referenced by initAlignmentAlgorithm().

443  {
444  // Retrieve and apply alignments, if requested (requires z setup)
445  if (applyDbAlignment_) {
446  // we need GlobalPositionRcd - and have to keep track for later removal
447  // before writing again to DB...
448 
449  edm::ESHandle<Alignments> globalAlignments;
450  setup.get<GlobalPositionRcd>().get(globalAlignments);
451  globalPositions_ = std::make_unique<Alignments>(*globalAlignments);
452 
453  if (doTracker_) {
454  applyDB<TrackerGeometry, TrackerAlignmentRcd, TrackerAlignmentErrorExtendedRcd>(
456 
457  applyDB<TrackerGeometry, TrackerSurfaceDeformationRcd>(trackerGeometry_.get(), setup);
458  }
459 
460  if (doMuon_) {
461  applyDB<DTGeometry, DTAlignmentRcd, DTAlignmentErrorExtendedRcd>(
463 
464  applyDB<CSCGeometry, CSCAlignmentRcd, CSCAlignmentErrorExtendedRcd>(
466  }
467  }
468 }
std::shared_ptr< CSCGeometry > muonCSCGeometry_
std::shared_ptr< TrackerGeometry > trackerGeometry_
std::unique_ptr< const Alignments > globalPositions_
GlobalPositions that might be read from DB, nullptr otherwise.
Definition: DetId.h:17
std::shared_ptr< DTGeometry > muonDTGeometry_
T get() const
Definition: EventSetup.h:73
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
void AlignmentProducerBase::applyAlignmentsToGeometry ( )
private

Applies Alignments, AlignmentErrors and SurfaceDeformations to

Definition at line 631 of file AlignmentProducerBase.cc.

References alignableMuon_, alignableTracker_, GeometryAligner::applyAlignments(), GeometryAligner::attachSurfaceDeformations(), doMuon_, doTracker_, Exception, muonCSCGeometry_, muonDTGeometry_, and trackerGeometry_.

Referenced by initAlignmentAlgorithm(), and startProcessing().

631  {
632  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::applyAlignmentsToGeometry"
633  << "Now physically apply alignments to geometry...";
634 
635  // Propagate changes to reconstruction geometry (from initialisation or iteration)
636  GeometryAligner aligner;
637 
638  if (doTracker_) {
639  if (!alignableTracker_) {
640  throw cms::Exception("LogicError") << "@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n"
641  << "Trying to apply tracker alignment before creating it.";
642  }
643 
644  std::unique_ptr<Alignments> alignments{alignableTracker_->alignments()};
645  std::unique_ptr<AlignmentErrorsExtended> alignmentErrExt{alignableTracker_->alignmentErrors()};
646  std::unique_ptr<AlignmentSurfaceDeformations> aliDeforms{alignableTracker_->surfaceDeformations()};
647 
648  aligner.applyAlignments(trackerGeometry_.get(), alignments.get(), alignmentErrExt.get(), AlignTransform());
649  aligner.attachSurfaceDeformations(trackerGeometry_.get(), aliDeforms.get());
650  }
651 
652  if (doMuon_) {
653  if (!alignableMuon_) {
654  throw cms::Exception("LogicError") << "@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n"
655  << "Trying to apply muon alignment before creating it.";
656  }
657 
658  std::unique_ptr<Alignments> dtAlignments{alignableMuon_->dtAlignments()};
659  std::unique_ptr<Alignments> cscAlignments{alignableMuon_->cscAlignments()};
660 
661  std::unique_ptr<AlignmentErrorsExtended> dtAlignmentErrExt{alignableMuon_->dtAlignmentErrorsExtended()};
662  std::unique_ptr<AlignmentErrorsExtended> cscAlignmentErrExt{alignableMuon_->cscAlignmentErrorsExtended()};
663 
664  aligner.applyAlignments(muonDTGeometry_.get(), dtAlignments.get(), dtAlignmentErrExt.get(), AlignTransform());
665  aligner.applyAlignments(muonCSCGeometry_.get(), cscAlignments.get(), cscAlignmentErrExt.get(), AlignTransform());
666  }
667 }
std::shared_ptr< CSCGeometry > muonCSCGeometry_
Class to update a given geometry with a set of alignments.
std::unique_ptr< AlignableMuon > alignableMuon_
std::shared_ptr< TrackerGeometry > trackerGeometry_
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
std::unique_ptr< AlignableTracker > alignableTracker_
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
std::shared_ptr< DTGeometry > muonDTGeometry_
template<class G , class Rcd , class ErrRcd >
void AlignmentProducerBase::applyDB ( G *  geometry,
const edm::EventSetup iSetup,
const AlignTransform globalCoordinates 
) const
private

Applies DB constants belonging to (Err)Rcd to Geometry, taking into account 'globalPosition' correction.

Definition at line 277 of file AlignmentProducerBase.h.

References GeometryAligner::applyAlignments(), edm::IOVSyncValue::beginOfTime(), checkDbAlignmentValidity_, edm::IOVSyncValue::endOfTime(), edm::IOVSyncValue::eventID(), Exception, edm::ValidityInterval::first(), dqmdumpme::first, callgraph::G, geometry, edm::EventSetup::get(), edm::ValidityInterval::last(), dqmdumpme::last, record, and edm::EventID::run().

279  {
280  // 'G' is the geometry class for that DB should be applied,
281  // 'Rcd' is the record class for its Alignments
282  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
283  // 'globalCoordinates' are global transformation for this geometry
284 
285  const Rcd& record = iSetup.get<Rcd>();
287  const edm::ValidityInterval& validity = record.validityInterval();
288  const edm::IOVSyncValue first = validity.first();
289  const edm::IOVSyncValue last = validity.last();
290  if (first != edm::IOVSyncValue::beginOfTime() || last != edm::IOVSyncValue::endOfTime()) {
291  throw cms::Exception("DatabaseError")
292  << "@SUB=AlignmentProducerBase::applyDB"
293  << "\nTrying to apply " << record.key().name() << " with multiple IOVs in tag.\n"
294  << "Validity range is " << first.eventID().run() << " - " << last.eventID().run();
295  }
296  }
297 
298  edm::ESHandle<Alignments> alignments;
299  record.get(alignments);
300 
302  iSetup.get<ErrRcd>().get(alignmentErrors);
303 
304  GeometryAligner aligner;
305  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrors), globalCoordinates);
306 }
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
const IOVSyncValue & last() const
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
ESHandle< TrackerGeometry > geometry
T get() const
Definition: EventSetup.h:73
const IOVSyncValue & first() const
template<class G , class DeformationRcd >
void AlignmentProducerBase::applyDB ( G *  geometry,
const edm::EventSetup iSetup 
) const
private

Applies DB constants for SurfaceDeformations.

Definition at line 309 of file AlignmentProducerBase.h.

References GeometryAligner::attachSurfaceDeformations(), edm::IOVSyncValue::beginOfTime(), checkDbAlignmentValidity_, edm::IOVSyncValue::endOfTime(), edm::IOVSyncValue::eventID(), Exception, edm::ValidityInterval::first(), dqmdumpme::first, callgraph::G, geometry, edm::EventSetup::get(), edm::ValidityInterval::last(), dqmdumpme::last, record, and edm::EventID::run().

309  {
310  // 'G' is the geometry class for that DB should be applied,
311  // 'DeformationRcd' is the record class for its surface deformations
312 
313  const DeformationRcd& record = iSetup.get<DeformationRcd>();
315  const edm::ValidityInterval& validity = record.validityInterval();
316  const edm::IOVSyncValue first = validity.first();
317  const edm::IOVSyncValue last = validity.last();
318  if (first != edm::IOVSyncValue::beginOfTime() || last != edm::IOVSyncValue::endOfTime()) {
319  throw cms::Exception("DatabaseError")
320  << "@SUB=AlignmentProducerBase::applyDB"
321  << "\nTrying to apply " << record.key().name() << " with multiple IOVs in tag.\n"
322  << "Validity range is " << first.eventID().run() << " - " << last.eventID().run();
323  }
324  }
326  record.get(surfaceDeformations);
327 
328  GeometryAligner aligner;
329  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
330 }
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
Class to update a given geometry with a set of alignments.
JetCorrectorParameters::Record record
Definition: classes.h:7
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
const IOVSyncValue & last() const
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
ESHandle< TrackerGeometry > geometry
T get() const
Definition: EventSetup.h:73
const IOVSyncValue & first() const
void AlignmentProducerBase::applyMisalignment ( )
private

Applies misalignment scenario to .

Definition at line 526 of file AlignmentProducerBase.cc.

References alignableMuon_, alignableTracker_, alignmentParameterStore_, MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), config_, doMisalignmentScenario_, doMuon_, doTracker_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), simpleMisalignment(), stRandomRotation_, stRandomShift_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initAlignmentAlgorithm().

526  {
527  // Apply misalignment scenario to alignable tracker and muon if requested
528  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
529 
531  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::applyMisalignment"
532  << "Applying misalignment scenario to " << (doTracker_ ? "tracker" : "")
533  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
534 
535  const auto& scenarioConfig = config_.getParameterSet("MisalignmentScenario");
536 
537  if (doTracker_) {
538  TrackerScenarioBuilder scenarioBuilder(alignableTracker_.get());
539  scenarioBuilder.applyScenario(scenarioConfig);
540  }
541  if (doMuon_) {
542  MuonScenarioBuilder muonScenarioBuilder(alignableMuon_.get());
543  muonScenarioBuilder.applyScenario(scenarioConfig);
544  }
545 
546  } else {
547  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::applyMisalignment"
548  << "NOT applying misalignment scenario!";
549  }
550 
551  // Apply simple misalignment
552  const auto& sParSel = config_.getParameter<std::string>("parameterSelectorSimple");
554 }
T getParameter(std::string const &) const
Builds a scenario from configuration and applies it to the alignable Muon.
std::unique_ptr< AlignableMuon > alignableMuon_
std::unique_ptr< AlignmentParameterStore > alignmentParameterStore_
std::unique_ptr< AlignableTracker > alignableTracker_
ParameterSet const & getParameterSet(std::string const &) const
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the tracker.
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
Builds a scenario from configuration and applies it to the alignable tracker.
void simpleMisalignment(const align::Alignables &, const std::string &, float, float, bool)
Applies misalignment scenario to .
void AlignmentProducerBase::beginLuminosityBlockImpl ( const edm::LuminosityBlock ,
const edm::EventSetup setup 
)
protected

begin lumi block

Definition at line 250 of file AlignmentProducerBase.cc.

References alignmentAlgo_.

Referenced by AlignmentProducerAsAnalyzer::beginLuminosityBlock(), and AlignmentProducer::beginLuminosityBlock().

250  {
251  // Do not forward edm::LuminosityBlock
252  alignmentAlgo_->beginLuminosityBlock(setup);
253 }
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::beginRunImpl ( const edm::Run run,
const edm::EventSetup setup 
)
protected

begin run

Definition at line 207 of file AlignmentProducerBase.cc.

References alignmentAlgo_, calibrations_, enableAlignableUpdates_, firstRun_, edm::RunBase::id(), initAlignmentAlgorithm(), edm::RunID::run(), runAtPCL_, and setupChanged().

Referenced by AlignmentProducerAsAnalyzer::beginRun(), and AlignmentProducer::beginRun().

207  {
208  const bool changed{setupChanged(setup)};
209  if (changed) {
210  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::beginRunImpl"
211  << "EventSetup-Record changed.";
212 
213  // updatable alignables are currently not used at PCL, but event setup
214  // changes require a complete re-initialization
215  if (runAtPCL_) {
216  initAlignmentAlgorithm(setup, /* update = */ false);
217  } else if (enableAlignableUpdates_) {
218  initAlignmentAlgorithm(setup, /* update = */ true);
219  }
220  }
221 
222  alignmentAlgo_->beginRun(run, setup, changed && (runAtPCL_ || enableAlignableUpdates_));
223 
224  for (const auto& iCal : calibrations_)
225  iCal->beginRun(run, setup);
226 
227  //store the first run analyzed to be used for setting the IOV (for PCL)
228  if (firstRun_ > static_cast<cond::Time_t>(run.id().run())) {
229  firstRun_ = static_cast<cond::Time_t>(run.id().run());
230  }
231 }
RunID const & id() const
Definition: RunBase.h:39
RunNumber_t run() const
Definition: RunID.h:36
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
unsigned long long Time_t
Definition: Time.h:14
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
CalibrationsOwner calibrations_
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::buildParameterStore ( )
private

Creates the , which manages all Alignables.

Definition at line 498 of file AlignmentProducerBase.cc.

References alignableExtras_, alignableMuon_, alignableTracker_, alignmentParameterStore_, config_, edm::ParameterSet::getParameter(), and stNFixAlignables_.

Referenced by initAlignmentAlgorithm().

498  {
499  // Create alignment parameter builder
500  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::buildParameterStore"
501  << "Creating AlignmentParameterBuilder";
502 
503  const auto& alParamBuildCfg = config_.getParameter<edm::ParameterSet>("ParameterBuilder");
504  const auto& alParamStoreCfg = config_.getParameter<edm::ParameterSet>("ParameterStore");
505 
506  AlignmentParameterBuilder alignmentParameterBuilder{
507  alignableTracker_.get(), alignableMuon_.get(), alignableExtras_.get(), alParamBuildCfg};
508 
509  // Fix alignables if requested
510  if (stNFixAlignables_ > 0) {
511  alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
512  }
513 
514  // Get list of alignables
515  const auto& alignables = alignmentParameterBuilder.alignables();
516  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::buildParameterStore"
517  << "got " << alignables.size() << " alignables";
518 
519  // Create AlignmentParameterStore
520  alignmentParameterStore_ = std::make_unique<AlignmentParameterStore>(alignables, alParamStoreCfg);
521  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::buildParameterStore"
522  << "AlignmentParameterStore created!";
523 }
T getParameter(std::string const &) const
std::unique_ptr< AlignableMuon > alignableMuon_
std::unique_ptr< AlignmentParameterStore > alignmentParameterStore_
std::unique_ptr< AlignableExtras > alignableExtras_
std::unique_ptr< AlignableTracker > alignableTracker_
void AlignmentProducerBase::createAlignables ( const TrackerTopology tTopo,
bool  update = false 
)
private

Creates Alignables from the previously loaded Geometry

Definition at line 471 of file AlignmentProducerBase.cc.

References alignableExtras_, alignableMuon_, alignableTracker_, doMuon_, doTracker_, muonCSCGeometry_, muonDTGeometry_, trackerGeometry_, and useExtras_.

Referenced by initAlignmentAlgorithm().

471  {
472  if (doTracker_) {
473  if (update) {
474  alignableTracker_->update(trackerGeometry_.get(), tTopo);
475  } else {
476  alignableTracker_ = std::make_unique<AlignableTracker>(trackerGeometry_.get(), tTopo);
477  }
478  }
479 
480  if (doMuon_) {
481  if (update) {
482  alignableMuon_->update(muonDTGeometry_.get(), muonCSCGeometry_.get());
483  } else {
484  alignableMuon_ = std::make_unique<AlignableMuon>(muonDTGeometry_.get(), muonCSCGeometry_.get());
485  }
486  }
487 
488  if (useExtras_) {
489  if (update) {
490  // FIXME: Requires further code changes to track beam spot condition changes
491  } else {
492  alignableExtras_ = std::make_unique<AlignableExtras>();
493  }
494  }
495 }
std::shared_ptr< CSCGeometry > muonCSCGeometry_
std::unique_ptr< AlignableMuon > alignableMuon_
std::shared_ptr< TrackerGeometry > trackerGeometry_
std::unique_ptr< AlignableExtras > alignableExtras_
std::unique_ptr< AlignableTracker > alignableTracker_
std::shared_ptr< DTGeometry > muonDTGeometry_
#define update(a, b)
void AlignmentProducerBase::createAlignmentAlgorithm ( )
private

Creates the choosen alignment algorithm.

Definition at line 262 of file AlignmentProducerBase.cc.

References ALCARECOPromptCalibProdSiPixelAli0T_cff::algoConfig, HIPAlignmentAlgorithm_cfi::algoName, alignmentAlgo_, config_, enableAlignableUpdates_, timingPdfMaker::get, edm::ParameterSet::getParameter(), runAtPCL_, AlCaHLTBitMon_QueryRunRegistry::string, and uniqueRunRanges_.

Referenced by AlignmentProducerBase().

262  {
263  auto algoConfig = config_.getParameter<edm::ParameterSet>("algoConfig");
264  algoConfig.addUntrackedParameter("RunRangeSelection", config_.getParameter<edm::VParameterSet>("RunRangeSelection"));
265  algoConfig.addUntrackedParameter<align::RunNumber>("firstIOV", runAtPCL_ ? 1 : uniqueRunRanges_.front().first);
266  algoConfig.addUntrackedParameter("enableAlignableUpdates", enableAlignableUpdates_);
267 
268  const auto& algoName = algoConfig.getParameter<std::string>("algoName");
270 }
T getParameter(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
const align::RunRanges uniqueRunRanges_
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::createCalibrations ( )
private

Creates the calibrations.

Definition at line 283 of file AlignmentProducerBase.cc.

References AlignmentProducer_cff::calibrations, calibrations_, config_, beamerCreator::create(), timingPdfMaker::get, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AlignmentProducerBase().

283  {
284  const auto& calibrations = config_.getParameter<edm::VParameterSet>("calibrations");
285  for (const auto& iCalib : calibrations) {
286  calibrations_.emplace_back(
287  IntegratedCalibrationPluginFactory::get()->create(iCalib.getParameter<std::string>("calibrationName"), iCalib));
288  }
289 }
T getParameter(std::string const &) const
def create(alignables, pedeDump, additionalData, outputFile, config)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
CalibrationsOwner calibrations_
void AlignmentProducerBase::createGeometries ( const edm::EventSetup iSetup,
const TrackerTopology tTopo 
)
private

Creates ideal geometry from IdealGeometryRecord.

Definition at line 415 of file AlignmentProducerBase.cc.

References TrackerGeomBuilderFromGeometricDet::build(), CSCGeometryBuilderFromDDD::build(), DTGeometryBuilderFromDDD::build(), doMuon_, doTracker_, edm::EventSetup::get(), muonCSCGeometry_, muonDTGeometry_, and trackerGeometry_.

Referenced by initAlignmentAlgorithm().

415  {
416  if (doTracker_) {
417  edm::ESHandle<GeometricDet> geometricDet;
418  iSetup.get<IdealGeometryRecord>().get(geometricDet);
419 
421  iSetup.get<PTrackerParametersRcd>().get(ptp);
422 
423  TrackerGeomBuilderFromGeometricDet trackerBuilder;
424 
425  trackerGeometry_ = std::shared_ptr<TrackerGeometry>(trackerBuilder.build(&(*geometricDet), *ptp, tTopo));
426  }
427 
428  if (doMuon_) {
430  iSetup.get<IdealGeometryRecord>().get(cpv);
432  iSetup.get<MuonNumberingRecord>().get(mdc);
435  muonDTGeometry_ = std::make_shared<DTGeometry>();
436  DTGeometryBuilder.build(*muonDTGeometry_, &(*cpv), *mdc);
437  muonCSCGeometry_ = std::make_shared<CSCGeometry>();
438  CSCGeometryBuilder.build(*muonCSCGeometry_, &(*cpv), *mdc);
439  }
440 }
std::shared_ptr< CSCGeometry > muonCSCGeometry_
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
std::shared_ptr< TrackerGeometry > trackerGeometry_
void build(CSCGeometry &geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
void build(DTGeometry &theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
std::shared_ptr< DTGeometry > muonDTGeometry_
T get() const
Definition: EventSetup.h:73
void AlignmentProducerBase::createMonitors ( )
private

Creates the monitors.

Definition at line 273 of file AlignmentProducerBase.cc.

References config_, beamerCreator::create(), timingPdfMaker::get, edm::ParameterSet::getParameter(), AlignmentProducer_cff::monitorConfig, gather_cfg::monitors, and monitors_.

Referenced by AlignmentProducerBase().

273  {
274  const auto& monitorConfig = config_.getParameter<edm::ParameterSet>("monitorConfig");
275  auto monitors = monitorConfig.getUntrackedParameter<std::vector<std::string> >("monitors");
276  for (const auto& miter : monitors) {
277  monitors_.emplace_back(
278  AlignmentMonitorPluginFactory::get()->create(miter, monitorConfig.getUntrackedParameterSet(miter)));
279  }
280 }
T getParameter(std::string const &) const
def create(alignables, pedeDump, additionalData, outputFile, config)
void AlignmentProducerBase::endLuminosityBlockImpl ( const edm::LuminosityBlock ,
const edm::EventSetup setup 
)
protected

end lumi block

Definition at line 256 of file AlignmentProducerBase.cc.

References alignmentAlgo_.

Referenced by AlignmentProducerAsAnalyzer::endLuminosityBlock(), and AlignmentProducer::endLuminosityBlock().

256  {
257  // Do not forward edm::LuminosityBlock
258  alignmentAlgo_->endLuminosityBlock(setup);
259 }
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::endRunImpl ( const edm::Run run,
const edm::EventSetup setup 
)
protected

end run

Definition at line 234 of file AlignmentProducerBase.cc.

References alignmentAlgo_, edm::InputTag::encode(), getTkFittedLasBeamCollection(), getTsosVectorCollection(), edm::RunBase::id(), and tkLasBeamTag_.

Referenced by AlignmentProducerAsAnalyzer::endRun(), and AlignmentProducer::endRun().

234  {
235  if (!tkLasBeamTag_.encode().empty()) {
238  getTkFittedLasBeamCollection(run, lasBeams);
239  getTsosVectorCollection(run, tsoses);
240 
241  alignmentAlgo_->endRun(EndRunInfo(run.id(), &(*lasBeams), &(*tsoses)), setup);
242  } else {
243  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::endRunImpl"
244  << "No Tk LAS beams to forward to algorithm.";
245  alignmentAlgo_->endRun(EndRunInfo(run.id(), nullptr, nullptr), setup);
246  }
247 }
RunID const & id() const
Definition: RunBase.h:39
std::string encode() const
Definition: InputTag.cc:159
virtual bool getTkFittedLasBeamCollection(const edm::Run &, edm::Handle< TkFittedLasBeamCollection > &)=0
virtual bool getTsosVectorCollection(const edm::Run &, edm::Handle< TsosVectorCollection > &)=0
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
const edm::InputTag tkLasBeamTag_
LAS beams in edm::Run (ignore if empty)
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
bool AlignmentProducerBase::finish ( )
protected

Steers activities after end of job, terminates the AlignmentAlgorithm

Definition at line 755 of file AlignmentProducerBase.cc.

References alignmentAlgo_, calibrations_, beam_dqm_sourceclient-live_cfg::monitor, monitors_, nevent_, saveApeToDB_, saveDeformationsToDB_, saveToDB_, and storeAlignmentsToDB().

Referenced by progressbar.ProgressBar::__next__(), AlignmentProducerAsAnalyzer::endJob(), AlignmentProducer::endOfJob(), and nEvent().

755  {
756  for (const auto& monitor : monitors_)
757  monitor->endOfJob();
758 
759  if (alignmentAlgo_->processesEvents() && nevent_ == 0) {
760  return false;
761  }
762 
764  if (alignmentAlgo_->storeAlignments())
766  } else {
767  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::finish"
768  << "No payload to be stored!";
769  }
770 
771  // takes care of storing output of calibrations, but needs to be called only
772  // after 'storeAlignmentsToDB()'
773  for (const auto& iCal : calibrations_)
774  iCal->endOfJob();
775 
776  return true;
777 }
void storeAlignmentsToDB()
Writes Alignments (i.e. Records) to database-file.
CalibrationsOwner calibrations_
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
virtual bool AlignmentProducerBase::getAliClusterValueMap ( const edm::Event ,
edm::Handle< AliClusterValueMap > &   
)
protectedpure virtual

Implemented in AlignmentProducer, and AlignmentProducerAsAnalyzer.

Referenced by nEvent(), and processEvent().

virtual bool AlignmentProducerBase::getBeamSpot ( const edm::Event ,
edm::Handle< reco::BeamSpot > &   
)
protectedpure virtual

Implemented in AlignmentProducer, and AlignmentProducerAsAnalyzer.

Referenced by initBeamSpot(), and nEvent().

virtual bool AlignmentProducerBase::getTkFittedLasBeamCollection ( const edm::Run ,
edm::Handle< TkFittedLasBeamCollection > &   
)
protectedpure virtual

Implemented in AlignmentProducer, and AlignmentProducerAsAnalyzer.

Referenced by endRunImpl(), and nEvent().

virtual bool AlignmentProducerBase::getTrajTrackAssociationCollection ( const edm::Event ,
edm::Handle< TrajTrackAssociationCollection > &   
)
protectedpure virtual

Implemented in AlignmentProducer, and AlignmentProducerAsAnalyzer.

Referenced by nEvent(), and processEvent().

virtual bool AlignmentProducerBase::getTsosVectorCollection ( const edm::Run ,
edm::Handle< TsosVectorCollection > &   
)
protectedpure virtual

Implemented in AlignmentProducer, and AlignmentProducerAsAnalyzer.

Referenced by endRunImpl(), and nEvent().

void AlignmentProducerBase::initAlignmentAlgorithm ( const edm::EventSetup setup,
bool  update = false 
)
protected

Creates Geometry and Alignables of the Tracker and initializes the AlignmentAlgorithm

Definition at line 344 of file AlignmentProducerBase.cc.

References alignableExtras_, alignableMuon_, alignableTracker_, alignmentAlgo_, alignmentParameterStore_, applyAlignmentsToDB(), applyAlignmentsToGeometry(), applyMisalignment(), buildParameterStore(), calibrations_, createAlignables(), createGeometries(), Exception, edm::EventSetup::get(), isAlgoInitialized_, beam_dqm_sourceclient-live_cfg::monitor, monitors_, edm::ESHandle< T >::product(), and startProcessing().

Referenced by AlignmentProducer::beginOfJob(), beginRunImpl(), nEvent(), and processEvent().

344  {
345  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::initAlignmentAlgorithm"
346  << "Begin";
347 
348  auto isTrueUpdate = update && isAlgoInitialized_;
349 
350  // Retrieve tracker topology from geometry
351  edm::ESHandle<TrackerTopology> tTopoHandle;
352  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
353  const TrackerTopology* const tTopo = tTopoHandle.product();
354 
355  // Create the geometries from the ideal geometries
356  createGeometries(setup, tTopo);
357 
358  applyAlignmentsToDB(setup);
359  createAlignables(tTopo, isTrueUpdate);
362 
363  // Initialize alignment algorithm and integrated calibration and pass the
364  // latter to algorithm
365  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::initAlignmentAlgorithm"
366  << "Initializing alignment algorithm.";
367  alignmentAlgo_->initialize(
369 
370  // Not all algorithms support calibrations - so do not pass empty vector
371  // and throw if non-empty and not supported:
372  if (!calibrations_.empty()) {
373  if (alignmentAlgo_->supportsCalibrations()) {
374  alignmentAlgo_->addCalibrations(calibrations_);
375  } else {
376  throw cms::Exception("BadConfig") << "@SUB=AlignmentProducerBase::createCalibrations\n"
377  << "Configured " << calibrations_.size() << " calibration(s) "
378  << "for algorithm not supporting it.";
379  }
380  }
381 
382  isAlgoInitialized_ = true;
383 
385 
386  if (!isTrueUpdate) { // only needed the first time
387  for (const auto& iCal : calibrations_) {
388  iCal->beginOfJob(alignableTracker_.get(), alignableMuon_.get(), alignableExtras_.get());
389  }
390  for (const auto& monitor : monitors_) {
391  monitor->beginOfJob(alignableTracker_.get(), alignableMuon_.get(), alignmentParameterStore_.get());
392  }
393  }
394  startProcessing(); // needed if derived class is non-EDLooper-based
395  // has no effect, if called during loop
396 
397  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::initAlignmentAlgorithm"
398  << "End";
399 }
void applyAlignmentsToDB(const edm::EventSetup &)
void createGeometries(const edm::EventSetup &, const TrackerTopology *)
Creates ideal geometry from IdealGeometryRecord.
void buildParameterStore()
Creates the , which manages all Alignables.
std::unique_ptr< AlignableMuon > alignableMuon_
std::unique_ptr< AlignmentParameterStore > alignmentParameterStore_
std::unique_ptr< AlignableExtras > alignableExtras_
std::unique_ptr< AlignableTracker > alignableTracker_
void createAlignables(const TrackerTopology *, bool update=false)
void startProcessing()
Start processing of events.
void applyMisalignment()
Applies misalignment scenario to .
#define update(a, b)
T get() const
Definition: EventSetup.h:73
CalibrationsOwner calibrations_
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::initBeamSpot ( const edm::Event event)
private

Initializes Beamspot of Alignables .

Definition at line 402 of file AlignmentProducerBase.cc.

References alignableExtras_, beamSpot_, reco::BeamSpot::dxdz(), reco::BeamSpot::dydz(), getBeamSpot(), nevent_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

Referenced by processEvent().

402  {
403  getBeamSpot(event, beamSpot_);
404 
405  if (nevent_ == 0 && alignableExtras_) {
406  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::initBeamSpot"
407  << "Initializing AlignableBeamSpot";
408 
409  alignableExtras_->initializeBeamSpot(
411  }
412 }
double z0() const
z coordinate
Definition: BeamSpot.h:65
double dydz() const
dydz slope
Definition: BeamSpot.h:80
std::unique_ptr< AlignableExtras > alignableExtras_
double dxdz() const
dxdz slope
Definition: BeamSpot.h:78
virtual bool getBeamSpot(const edm::Event &, edm::Handle< reco::BeamSpot > &)=0
edm::Handle< reco::BeamSpot > beamSpot_
double y0() const
y coordinate
Definition: BeamSpot.h:63
double x0() const
x coordinate
Definition: BeamSpot.h:61
int AlignmentProducerBase::nEvent ( ) const
inlineprotected
bool AlignmentProducerBase::processEvent ( const edm::Event event,
const edm::EventSetup setup 
)
protected

Process event.

Definition at line 136 of file AlignmentProducerBase.cc.

References alignmentAlgo_, beamSpot_, edm::AssociationMap< Tag >::begin(), clusterValueMapTag_, enableAlignableUpdates_, edm::InputTag::encode(), edm::AssociationMap< Tag >::end(), ZMuMuAnalysisNtupler_cff::eventInfo, getAliClusterValueMap(), getTrajTrackAssociationCollection(), mps_fire::i, initAlignmentAlgorithm(), initBeamSpot(), beam_dqm_sourceclient-live_cfg::monitor, monitors_, nevent_, readInSurveyRcds(), runAtPCL_, and setupChanged().

Referenced by AlignmentProducerAsAnalyzer::analyze(), and AlignmentProducer::duringLoop().

136  {
137  if (setupChanged(setup)) {
138  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::processEvent"
139  << "EventSetup-Record changed.";
140 
141  // updatable alignables are currently not used at PCL, but event setup
142  // changes require a complete re-initialization
143  if (runAtPCL_) {
144  initAlignmentAlgorithm(setup, /* update = */ false);
145  } else if (enableAlignableUpdates_) {
146  initAlignmentAlgorithm(setup, /* update = */ true);
147  }
148  }
149 
150  initBeamSpot(event); // must happen every event and before incrementing 'nevent_'
151 
152  ++nevent_; // must happen before the check below;
153  // otherwise subsequent checks fail for "EmptySource"
154 
155  if (!alignmentAlgo_->processesEvents()) {
156  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::processEvent"
157  << "Skipping event. The current configuration of the alignment algorithm "
158  << "does not need to process any events.";
159  return false;
160  }
161 
162  // reading in survey records
163  readInSurveyRcds(setup);
164 
165  // Printout event number
166  for (int i = 10; i < 10000000; i *= 10) {
167  if (nevent_ < 10 * i && (nevent_ % i) == 0) {
168  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::processEvent"
169  << "Events processed: " << nevent_;
170  }
171  }
172 
173  // Retrieve trajectories and tracks from the event
174  // -> merely skip if collection is empty
175  edm::Handle<TrajTrackAssociationCollection> handleTrajTracksCollection;
176 
177  if (getTrajTrackAssociationCollection(event, handleTrajTracksCollection)) {
178  // Form pairs of trajectories and tracks
179  ConstTrajTrackPairs trajTracks;
180  for (auto iter = handleTrajTracksCollection->begin(); iter != handleTrajTracksCollection->end(); ++iter) {
181  trajTracks.push_back(ConstTrajTrackPair(&(*(*iter).key), &(*(*iter).val)));
182  }
183 
184  // Run the alignment algorithm with its input
185  const AliClusterValueMap* clusterValueMapPtr{nullptr};
186  if (!clusterValueMapTag_.encode().empty()) {
187  edm::Handle<AliClusterValueMap> clusterValueMap;
188  getAliClusterValueMap(event, clusterValueMap);
189  clusterValueMapPtr = &(*clusterValueMap);
190  }
191 
192  const AlignmentAlgorithmBase::EventInfo eventInfo{event.id(), trajTracks, *beamSpot_, clusterValueMapPtr};
193  alignmentAlgo_->run(setup, eventInfo);
194 
195  for (const auto& monitor : monitors_) {
196  monitor->duringLoop(event, setup, trajTracks); // forward eventInfo?
197  }
198  } else {
199  edm::LogError("Alignment") << "@SUB=AlignmentProducerBase::processEvent"
200  << "No track collection found: skipping event";
201  }
202 
203  return true;
204 }
void readInSurveyRcds(const edm::EventSetup &)
Reads in survey records.
std::vector< ConstTrajTrackPair > ConstTrajTrackPairs
const_iterator end() const
last iterator over the map (read only)
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
virtual bool getAliClusterValueMap(const edm::Event &, edm::Handle< AliClusterValueMap > &)=0
std::string encode() const
Definition: InputTag.cc:159
define event information passed to algorithms
edm::Handle< reco::BeamSpot > beamSpot_
virtual bool getTrajTrackAssociationCollection(const edm::Event &, edm::Handle< TrajTrackAssociationCollection > &)=0
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
void initBeamSpot(const edm::Event &)
Initializes Beamspot of Alignables .
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
const_iterator begin() const
first iterator over the map (read only)
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::readInSurveyRcds ( const edm::EventSetup iSetup)
private

Reads in survey records.

Definition at line 670 of file AlignmentProducerBase.cc.

References addSurveyInfo(), alignableMuon_, alignableTracker_, Reference_intrackfit_cff::barrel, edm::ESWatcher< T >::check(), doMuon_, doTracker_, makeMuonMisalignmentScenario::endcap, edm::EventSetup::get(), surveyErrors_, surveyIndex_, surveyValues_, useSurvey_, watchTkSurveyErrExtRcd_, and watchTkSurveyRcd_.

Referenced by processEvent().

670  {
671  // Get Survey Rcds and add Survey Info
672  if (doTracker_ && useSurvey_) {
673  bool tkSurveyBool = watchTkSurveyRcd_.check(iSetup);
674  bool tkSurveyErrBool = watchTkSurveyErrExtRcd_.check(iSetup);
675  edm::LogInfo("Alignment") << "watcher tksurveyrcd: " << tkSurveyBool;
676  edm::LogInfo("Alignment") << "watcher tksurveyerrrcd: " << tkSurveyErrBool;
677  if (tkSurveyBool || tkSurveyErrBool) {
678  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
680  edm::ESHandle<SurveyErrors> surveyErrors;
681 
682  iSetup.get<TrackerSurveyRcd>().get(surveys);
683  iSetup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
684 
685  surveyIndex_ = 0;
686  surveyValues_ = &*surveys;
687  surveyErrors_ = &*surveyErrors;
689  }
690  }
691 
692  if (doMuon_ && useSurvey_) {
693  bool DTSurveyBool = watchTkSurveyRcd_.check(iSetup);
694  bool DTSurveyErrBool = watchTkSurveyErrExtRcd_.check(iSetup);
695  bool CSCSurveyBool = watchTkSurveyRcd_.check(iSetup);
696  bool CSCSurveyErrBool = watchTkSurveyErrExtRcd_.check(iSetup);
697 
698  if (DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool) {
699  edm::ESHandle<Alignments> dtSurveys;
700  edm::ESHandle<SurveyErrors> dtSurveyErrors;
701  edm::ESHandle<Alignments> cscSurveys;
702  edm::ESHandle<SurveyErrors> cscSurveyErrors;
703 
704  iSetup.get<DTSurveyRcd>().get(dtSurveys);
705  iSetup.get<DTSurveyErrorExtendedRcd>().get(dtSurveyErrors);
706  iSetup.get<CSCSurveyRcd>().get(cscSurveys);
707  iSetup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
708 
709  surveyIndex_ = 0;
710  surveyValues_ = &*dtSurveys;
711  surveyErrors_ = &*dtSurveyErrors;
712  const auto& barrels = alignableMuon_->DTBarrel();
713  for (const auto& barrel : barrels)
715 
716  surveyIndex_ = 0;
717  surveyValues_ = &*cscSurveys;
718  surveyErrors_ = &*cscSurveyErrors;
719  const auto& endcaps = alignableMuon_->CSCEndcaps();
720  for (const auto& endcap : endcaps)
722  }
723  }
724 }
std::unique_ptr< AlignableMuon > alignableMuon_
const Alignments * surveyValues_
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrExtRcd_
void addSurveyInfo(Alignable *)
Adds survey info to an Alignable.
std::unique_ptr< AlignableTracker > alignableTracker_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
T get() const
Definition: EventSetup.h:73
const SurveyErrors * surveyErrors_
bool AlignmentProducerBase::setupChanged ( const edm::EventSetup setup)
private

Checks if one of the EventSetup-Records has changed.

Definition at line 292 of file AlignmentProducerBase.cc.

References edm::ESWatcher< T >::check(), doMuon_, doTracker_, watchCSCAlErrExtRcd_, watchCSCAlRcd_, watchDTAlErrExtRcd_, watchDTAlRcd_, watchGlobalPositionRcd_, watchIdealGeometryRcd_, watchTrackerAlErrorExtRcd_, watchTrackerAlRcd_, and watchTrackerSurDeRcd_.

Referenced by beginRunImpl(), and processEvent().

292  {
293  bool changed{false};
294 
295  if (watchIdealGeometryRcd_.check(setup)) {
296  changed = true;
297  }
298 
299  if (watchGlobalPositionRcd_.check(setup)) {
300  changed = true;
301  }
302 
303  if (doTracker_) {
304  if (watchTrackerAlRcd_.check(setup)) {
305  changed = true;
306  }
307 
308  if (watchTrackerAlErrorExtRcd_.check(setup)) {
309  changed = true;
310  }
311 
312  if (watchTrackerSurDeRcd_.check(setup)) {
313  changed = true;
314  }
315  }
316 
317  if (doMuon_) {
318  if (watchDTAlRcd_.check(setup)) {
319  changed = true;
320  }
321 
322  if (watchDTAlErrExtRcd_.check(setup)) {
323  changed = true;
324  }
325 
326  if (watchCSCAlRcd_.check(setup)) {
327  changed = true;
328  }
329 
330  if (watchCSCAlErrExtRcd_.check(setup)) {
331  changed = true;
332  }
333  }
334 
335  /* TODO: ExtraAlignables: Which record(s) to check?
336  *
337  if (useExtras_) {}
338  */
339 
340  return changed;
341 }
edm::ESWatcher< DTAlignmentErrorExtendedRcd > watchDTAlErrExtRcd_
edm::ESWatcher< DTAlignmentRcd > watchDTAlRcd_
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd_
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd_
edm::ESWatcher< CSCAlignmentErrorExtendedRcd > watchCSCAlErrExtRcd_
edm::ESWatcher< TrackerSurfaceDeformationRcd > watchTrackerSurDeRcd_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESWatcher< TrackerAlignmentRcd > watchTrackerAlRcd_
edm::ESWatcher< TrackerAlignmentErrorExtendedRcd > watchTrackerAlErrorExtRcd_
edm::ESWatcher< CSCAlignmentRcd > watchCSCAlRcd_
void AlignmentProducerBase::simpleMisalignment ( const align::Alignables alivec,
const std::string &  selection,
float  shift,
float  rot,
bool  local 
)
private

Applies misalignment scenario to .

Definition at line 557 of file AlignmentProducerBase.cc.

References funct::abs(), AlignmentParameterSelector::convertParamSel(), RigidBodyAlignmentParameters::dalpha, RigidBodyAlignmentParameters::dbeta, RigidBodyAlignmentParameters::dgamma, RigidBodyAlignmentParameters::dx, RigidBodyAlignmentParameters::dy, RigidBodyAlignmentParameters::dz, Exception, RigidBodyAlignmentParameters::N_PARAM, convertSQLitetoXML_cfg::output, alignCSCRings::r, indexGen::s2, and align::toMatrix().

Referenced by applyMisalignment().

558  {
559  std::ostringstream output; // collecting output
560 
561  if (shift > 0. || rot > 0.) {
562  output << "Adding random flat shift of max size " << shift << " and adding random flat rotation of max size " << rot
563  << " to ";
564 
565  std::vector<bool> commSel(0);
566  if (selection != "-1") {
567  AlignmentParameterSelector aSelector(nullptr, nullptr); // no alignable needed here...
568  const std::vector<char> cSel(aSelector.convertParamSel(selection));
569  if (cSel.size() < RigidBodyAlignmentParameters::N_PARAM) {
570  throw cms::Exception("BadConfig")
571  << "[AlignmentProducerBase::simpleMisalignment_]\n"
572  << "Expect selection string '" << selection << "' to be at least of length "
573  << RigidBodyAlignmentParameters::N_PARAM << " or to be '-1'.\n"
574  << "(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
575  }
576  for (const auto& cIter : cSel) {
577  commSel.push_back(cIter == '0' ? false : true);
578  }
579  output << "parameters defined by (" << selection << "), representing (x,y,z,alpha,beta,gamma),";
580  } else {
581  output << "the active parameters of each alignable,";
582  }
583  output << " in " << (local ? "local" : "global") << " frame.";
584 
585  for (const auto& ali : alivec) {
586  std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
587 
588  if (std::abs(shift) > 0.00001) {
589  double s0 = 0., s1 = 0., s2 = 0.;
591  s0 = shift * double(random() % 1000 - 500) / 500.;
593  s1 = shift * double(random() % 1000 - 500) / 500.;
595  s2 = shift * double(random() % 1000 - 500) / 500.;
596 
597  if (local)
598  ali->move(ali->surface().toGlobal(align::LocalVector(s0, s1, s2)));
599  else
600  ali->move(align::GlobalVector(s0, s1, s2));
601 
602  //AlignmentPositionError ape(dx,dy,dz);
603  //ali->addAlignmentPositionError(ape);
604  }
605 
606  if (std::abs(rot) > 0.00001) {
609  r(1) = rot * double(random() % 1000 - 500) / 500.;
611  r(2) = rot * double(random() % 1000 - 500) / 500.;
613  r(3) = rot * double(random() % 1000 - 500) / 500.;
614 
615  const align::RotationType mrot = align::toMatrix(r);
616  if (local)
617  ali->rotateInLocalFrame(mrot);
618  else
619  ali->rotateInGlobalFrame(mrot);
620 
621  //ali->addAlignmentPositionErrorFromRotation(mrot);
622  }
623  } // end loop on alignables
624  } else {
625  output << "No simple misalignment added!";
626  }
627  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::simpleMisalignment" << output.str();
628 }
selection
main part
Definition: corrVsCorr.py:100
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
AlgebraicVector EulerAngles
Definition: Definitions.h:34
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
static unsigned int const shift
void AlignmentProducerBase::startProcessing ( )
protected

Start processing of events.

Definition at line 86 of file AlignmentProducerBase.cc.

References alignmentAlgo_, applyAlignmentsToGeometry(), calibrations_, Exception, isAlgoInitialized_, isDuringLoop_, beam_dqm_sourceclient-live_cfg::monitor, monitors_, and nevent_.

Referenced by initAlignmentAlgorithm(), and AlignmentProducer::startingNewLoop().

86  {
87  if (isDuringLoop_)
88  return;
89 
90  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::startProcessing"
91  << "Begin";
92 
93  if (!isAlgoInitialized_) {
94  throw cms::Exception("LogicError") << "@SUB=AlignmentProducerBase::startProcessing\n"
95  << "Trying to start event processing before initializing the alignment "
96  << "algorithm.";
97  }
98 
99  nevent_ = 0;
100 
101  alignmentAlgo_->startNewLoop();
102 
103  // FIXME: Should this be done in algorithm::startNewLoop()??
104  for (const auto& iCal : calibrations_)
105  iCal->startNewLoop();
106  for (const auto& monitor : monitors_)
107  monitor->startingNewLoop();
108 
110  isDuringLoop_ = true;
111 }
CalibrationsOwner calibrations_
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::storeAlignmentsToDB ( )
private

Writes Alignments (i.e. Records) to database-file.

Definition at line 780 of file AlignmentProducerBase.cc.

References alignableExtras_, alignmentAlgo_, config_, Exception, firstRun_, edm::ParameterSet::getParameterSetVector(), align::makeUniqueRunRanges(), runAtPCL_, saveApeToDB_, saveDeformationsToDB_, saveToDB_, uniqueRunRanges_, and writeForRunRange().

Referenced by finish().

780  {
781  const auto runRangeSelectionVPSet = config_.getParameterSetVector("RunRangeSelection");
782 
783  // handle PCL use case
784  const auto& uniqueRunRanges =
785  (runAtPCL_ ? align::makeUniqueRunRanges(runRangeSelectionVPSet, firstRun_) : uniqueRunRanges_);
786 
787  std::vector<AlgebraicVector> beamSpotParameters;
788 
789  for (const auto& iRunRange : uniqueRunRanges) {
790  alignmentAlgo_->setParametersForRunRange(iRunRange);
791 
792  // Save alignments to database
794  writeForRunRange(iRunRange.first);
795  }
796 
797  // Deal with extra alignables, e.g. beam spot
798  if (alignableExtras_) {
799  auto& alis = alignableExtras_->beamSpot();
800  if (!alis.empty()) {
801  auto beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
802  if (!beamSpotAliPars) {
803  throw cms::Exception("LogicError") << "@SUB=AlignmentProducerBase::storeAlignmentsToDB\n"
804  << "First alignable of alignableExtras_ does not have "
805  << "'BeamSpotAlignmentParameters', while it should have.";
806  }
807 
808  beamSpotParameters.push_back(beamSpotAliPars->parameters());
809  }
810  }
811  }
812 
813  if (alignableExtras_) {
814  std::ostringstream bsOutput;
815 
816  auto itPar = beamSpotParameters.cbegin();
817  for (auto iRunRange = uniqueRunRanges.cbegin(); iRunRange != uniqueRunRanges.cend(); ++iRunRange, ++itPar) {
818  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
819  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
820  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
821  }
822 
823  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::storeAlignmentsToDB"
824  << "Parameters for alignable beamspot:\n"
825  << bsOutput.str();
826  }
827 }
VParameterSet const & getParameterSetVector(std::string const &name) const
void writeForRunRange(cond::Time_t)
std::unique_ptr< AlignableExtras > alignableExtras_
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
Definition: Utilities.cc:241
const align::RunRanges uniqueRunRanges_
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::terminateProcessing ( const edm::EventSetup setup = 0)
protected

Terminate processing of events.

Definition at line 114 of file AlignmentProducerBase.cc.

References alignmentAlgo_, calibrations_, isDuringLoop_, beam_dqm_sourceclient-live_cfg::monitor, and monitors_.

Referenced by AlignmentProducerAsAnalyzer::endJob(), and AlignmentProducer::endOfLoop().

114  {
115  if (!isDuringLoop_)
116  return;
117 
118  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::terminateProcessing"
119  << "Terminating algorithm.";
120  if (setup) {
121  alignmentAlgo_->terminate(*setup);
122  } else {
123  alignmentAlgo_->terminate();
124  }
125 
126  // FIXME: Should this be done in algorithm::terminate()??
127  for (const auto& iCal : calibrations_)
128  iCal->endOfLoop();
129  for (const auto& monitor : monitors_)
130  monitor->endOfLoop();
131 
132  isDuringLoop_ = false;
133 }
CalibrationsOwner calibrations_
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
void AlignmentProducerBase::writeDB ( Alignments alignments,
const std::string &  alignRcd,
AlignmentErrorsExtended alignmentErrors,
const std::string &  errRcd,
const AlignTransform globalCoordinates,
cond::Time_t  time 
) const
private

Writes Alignments and/or AlignmentErrors to DB for record names (removes *globalCoordinates before writing if non-null...). Takes over ownership of Alignments and AlignmentErrors.

Definition at line 867 of file AlignmentProducerBase.cc.

References Exception, edm::Service< T >::isAvailable(), GeometryAligner::removeGlobalTransform(), saveApeToDB_, saveToDB_, ntuplemaker::time, AlignTransform::transform(), and cond::service::PoolDBOutputService::writeOne().

Referenced by writeForRunRange().

872  {
873  Alignments* tempAlignments = alignments;
874  AlignmentErrorsExtended* tempAlignmentErrorsExtended = alignmentErrors;
875 
876  // Call service
878  if (!poolDb.isAvailable()) { // Die if not available
879  delete tempAlignments; // promised to take over ownership...
880  delete tempAlignmentErrorsExtended; // dito
881  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
882  }
883 
884  if (globalCoordinates // happens only if (applyDbAlignment_ == true)
885  && globalCoordinates->transform() != AlignTransform::Transform::Identity) {
886  tempAlignments = new Alignments(); // temporary storage for
887  tempAlignmentErrorsExtended = new AlignmentErrorsExtended(); // final alignments and errors
888 
889  GeometryAligner aligner;
890  aligner.removeGlobalTransform(
891  alignments, alignmentErrors, *globalCoordinates, tempAlignments, tempAlignmentErrorsExtended);
892 
893  delete alignments; // have to delete original alignments
894  delete alignmentErrors; // same thing for the errors
895 
896  edm::LogInfo("Alignment") << "@SUB=AlignmentProducerBase::writeDB"
897  << "globalCoordinates removed from alignments (" << alignRcd << ") and errors ("
898  << alignRcd << ").";
899  }
900 
901  if (saveToDB_) {
902  edm::LogInfo("Alignment") << "Writing Alignments for run " << time << " to " << alignRcd << ".";
903  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
904  } else { // poolDb->writeOne(..) takes over 'alignments' ownership,...
905  delete tempAlignments; // ...otherwise we have to delete, as promised!
906  }
907 
908  if (saveApeToDB_) {
909  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run " << time << " to " << errRcd << ".";
910  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrorsExtended, time, errRcd);
911  } else { // poolDb->writeOne(..) takes over 'alignmentErrors' ownership,...
912  delete tempAlignmentErrorsExtended; // ...otherwise we have to delete, as promised!
913  }
914 }
Class to update a given geometry with a set of alignments.
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrorsExtended *newAlignmentErrorsExtended)
bool isAvailable() const
Definition: Service.h:40
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
Transform transform() const
void AlignmentProducerBase::writeDB ( AlignmentSurfaceDeformations alignmentSurfaceDeformations,
const std::string &  surfaceDeformationRcd,
cond::Time_t  time 
) const
private

Writes SurfaceDeformations (bows & kinks) to DB for given record name Takes over ownership of AlignmentSurfaceDeformations.

Definition at line 917 of file AlignmentProducerBase.cc.

References Exception, edm::Service< T >::isAvailable(), saveDeformationsToDB_, ntuplemaker::time, and cond::service::PoolDBOutputService::writeOne().

919  {
920  // Call service
922  if (!poolDb.isAvailable()) { // Die if not available
923  delete alignmentSurfaceDeformations; // promised to take over ownership...
924  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
925  }
926 
927  if (saveDeformationsToDB_) {
928  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run " << time << " to "
929  << surfaceDeformationRcd << ".";
930  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time, surfaceDeformationRcd);
931  } else { // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
932  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
933  }
934 }
bool isAvailable() const
Definition: Service.h:40
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void AlignmentProducerBase::writeForRunRange ( cond::Time_t  time)
private

Writes Alignments and AlignmentErrors for all sub detectors and the given run number

Definition at line 830 of file AlignmentProducerBase.cc.

References alignableMuon_, alignableTracker_, align::DetectorGlobalPosition(), doMuon_, doTracker_, globalPositions_, DetId::Muon, saveDeformationsToDB_, DetId::Tracker, and writeDB().

Referenced by storeAlignmentsToDB().

830  {
831  if (doTracker_) { // first tracker
832  const AlignTransform* trackerGlobal{nullptr}; // will be 'removed' from constants
833  if (globalPositions_) { // i.e. applied before in applyDB
835  }
836 
837  auto alignments = alignableTracker_->alignments();
838  auto alignmentErrors = alignableTracker_->alignmentErrors();
839  this->writeDB(
840  alignments, "TrackerAlignmentRcd", alignmentErrors, "TrackerAlignmentErrorExtendedRcd", trackerGlobal, time);
841 
842  // Save surface deformations to database
843  if (saveDeformationsToDB_) {
844  auto alignmentSurfaceDeformations = alignableTracker_->surfaceDeformations();
845  this->writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
846  }
847  }
848 
849  if (doMuon_) { // now muon
850  const AlignTransform* muonGlobal{nullptr}; // will be 'removed' from constants
851  if (globalPositions_) { // i.e. applied before in applyDB
853  }
854  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
855  auto alignments = alignableMuon_->dtAlignments();
856  auto alignmentErrors = alignableMuon_->dtAlignmentErrorsExtended();
857  this->writeDB(alignments, "DTAlignmentRcd", alignmentErrors, "DTAlignmentErrorExtendedRcd", muonGlobal, time);
858 
859  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
860  alignments = alignableMuon_->cscAlignments();
861  alignmentErrors = alignableMuon_->cscAlignmentErrorsExtended();
862  this->writeDB(alignments, "CSCAlignmentRcd", alignmentErrors, "CSCAlignmentErrorExtendedRcd", muonGlobal, time);
863  }
864 }
void writeDB(Alignments *, const std::string &, AlignmentErrorsExtended *, const std::string &, const AlignTransform *, cond::Time_t) const
std::unique_ptr< AlignableMuon > alignableMuon_
std::unique_ptr< AlignableTracker > alignableTracker_
std::unique_ptr< const Alignments > globalPositions_
GlobalPositions that might be read from DB, nullptr otherwise.
Definition: DetId.h:17
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)

Member Data Documentation

std::unique_ptr<AlignableExtras> AlignmentProducerBase::alignableExtras_
private
std::unique_ptr<AlignableMuon> AlignmentProducerBase::alignableMuon_
private
std::unique_ptr<AlignableTracker> AlignmentProducerBase::alignableTracker_
private
std::unique_ptr<AlignmentAlgorithmBase> AlignmentProducerBase::alignmentAlgo_
private
std::unique_ptr<AlignmentParameterStore> AlignmentProducerBase::alignmentParameterStore_
private
const bool AlignmentProducerBase::applyDbAlignment_
private

Definition at line 235 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and applyAlignmentsToDB().

edm::Handle<reco::BeamSpot> AlignmentProducerBase::beamSpot_
private

Definition at line 221 of file AlignmentProducerBase.h.

Referenced by initBeamSpot(), and processEvent().

const edm::InputTag AlignmentProducerBase::beamSpotTag_
protected
CalibrationsOwner AlignmentProducerBase::calibrations_
private
const bool AlignmentProducerBase::checkDbAlignmentValidity_
private

Definition at line 235 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and applyDB().

const edm::InputTag AlignmentProducerBase::clusterValueMapTag_
protected
edm::ParameterSet AlignmentProducerBase::config_
private
const bool AlignmentProducerBase::doMisalignmentScenario_
private

Definition at line 236 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and applyMisalignment().

const bool AlignmentProducerBase::doMuon_
protected
const bool AlignmentProducerBase::doTracker_
protected
const bool AlignmentProducerBase::enableAlignableUpdates_
private
cond::Time_t AlignmentProducerBase::firstRun_ {cond::timeTypeSpecs[cond::runnumber].endValue}
private

Definition at line 273 of file AlignmentProducerBase.h.

Referenced by beginRunImpl(), and storeAlignmentsToDB().

std::unique_ptr<const Alignments> AlignmentProducerBase::globalPositions_
private

GlobalPositions that might be read from DB, nullptr otherwise.

Definition at line 223 of file AlignmentProducerBase.h.

Referenced by applyAlignmentsToDB(), and writeForRunRange().

bool AlignmentProducerBase::isAlgoInitialized_ {false}
private

Definition at line 269 of file AlignmentProducerBase.h.

Referenced by initAlignmentAlgorithm(), and startProcessing().

bool AlignmentProducerBase::isDuringLoop_ {false}
private

Definition at line 270 of file AlignmentProducerBase.h.

Referenced by startProcessing(), and terminateProcessing().

AlignmentMonitors AlignmentProducerBase::monitors_
private
std::shared_ptr<CSCGeometry> AlignmentProducerBase::muonCSCGeometry_
protected
std::shared_ptr<DTGeometry> AlignmentProducerBase::muonDTGeometry_
protected
int AlignmentProducerBase::nevent_ {0}
private

Definition at line 226 of file AlignmentProducerBase.h.

Referenced by finish(), initBeamSpot(), nEvent(), processEvent(), and startProcessing().

bool AlignmentProducerBase::runAtPCL_ {false}
private
const bool AlignmentProducerBase::saveApeToDB_
private
const bool AlignmentProducerBase::saveDeformationsToDB_
private
const bool AlignmentProducerBase::saveToDB_
private
const int AlignmentProducerBase::stNFixAlignables_
private

Definition at line 233 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and buildParameterStore().

const double AlignmentProducerBase::stRandomRotation_
private

Definition at line 234 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and applyMisalignment().

const double AlignmentProducerBase::stRandomShift_
private

Definition at line 234 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and applyMisalignment().

const SurveyErrors* AlignmentProducerBase::surveyErrors_ { 0 }
private

Definition at line 266 of file AlignmentProducerBase.h.

Referenced by addSurveyInfo(), and readInSurveyRcds().

size_t AlignmentProducerBase::surveyIndex_ {0}
private

Definition at line 264 of file AlignmentProducerBase.h.

Referenced by addSurveyInfo(), and readInSurveyRcds().

const Alignments* AlignmentProducerBase::surveyValues_ { 0 }
private

Definition at line 265 of file AlignmentProducerBase.h.

Referenced by addSurveyInfo(), and readInSurveyRcds().

const edm::InputTag AlignmentProducerBase::tjTkAssociationMapTag_
protected
const edm::InputTag AlignmentProducerBase::tkLasBeamTag_
protected
std::shared_ptr<TrackerGeometry> AlignmentProducerBase::trackerGeometry_
protected
const align::RunRanges AlignmentProducerBase::uniqueRunRanges_
private
const bool AlignmentProducerBase::useExtras_
protected

Definition at line 117 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and createAlignables().

const bool AlignmentProducerBase::useSurvey_
private

Definition at line 238 of file AlignmentProducerBase.h.

Referenced by AlignmentProducerBase(), and readInSurveyRcds().

edm::ESWatcher<CSCAlignmentErrorExtendedRcd> AlignmentProducerBase::watchCSCAlErrExtRcd_
private

Definition at line 253 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<CSCAlignmentRcd> AlignmentProducerBase::watchCSCAlRcd_
private

Definition at line 252 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<CSCSurveyErrorExtendedRcd> AlignmentProducerBase::watchCSCSurveyErrExtRcd_
private

Definition at line 260 of file AlignmentProducerBase.h.

edm::ESWatcher<CSCSurveyRcd> AlignmentProducerBase::watchCSCSurveyRcd_
private

Definition at line 259 of file AlignmentProducerBase.h.

edm::ESWatcher<DTAlignmentErrorExtendedRcd> AlignmentProducerBase::watchDTAlErrExtRcd_
private

Definition at line 251 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<DTAlignmentRcd> AlignmentProducerBase::watchDTAlRcd_
private

Definition at line 250 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<DTSurveyErrorExtendedRcd> AlignmentProducerBase::watchDTSurveyErrExtRcd_
private

Definition at line 258 of file AlignmentProducerBase.h.

edm::ESWatcher<DTSurveyRcd> AlignmentProducerBase::watchDTSurveyRcd_
private

Definition at line 257 of file AlignmentProducerBase.h.

edm::ESWatcher<GlobalPositionRcd> AlignmentProducerBase::watchGlobalPositionRcd_
private

Definition at line 244 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<IdealGeometryRecord> AlignmentProducerBase::watchIdealGeometryRcd_
private

Definition at line 243 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<TrackerSurveyErrorExtendedRcd> AlignmentProducerBase::watchTkSurveyErrExtRcd_
private

Definition at line 256 of file AlignmentProducerBase.h.

Referenced by readInSurveyRcds().

edm::ESWatcher<TrackerSurveyRcd> AlignmentProducerBase::watchTkSurveyRcd_
private

Definition at line 255 of file AlignmentProducerBase.h.

Referenced by readInSurveyRcds().

edm::ESWatcher<TrackerAlignmentErrorExtendedRcd> AlignmentProducerBase::watchTrackerAlErrorExtRcd_
private

Definition at line 247 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<TrackerAlignmentRcd> AlignmentProducerBase::watchTrackerAlRcd_
private

Definition at line 246 of file AlignmentProducerBase.h.

Referenced by setupChanged().

edm::ESWatcher<TrackerSurfaceDeformationRcd> AlignmentProducerBase::watchTrackerSurDeRcd_
private

Definition at line 248 of file AlignmentProducerBase.h.

Referenced by setupChanged().