59 edm::LogInfo(
"Alignment") <<
"@SUB=AlignmentProducerBase::AlignmentProducerBase";
62 if (hasParameter<bool>(
config_,
"runAtPCL")) {
66 if (hasParameter<bool>(
algoConfig,
"runAtPCL") &&
69 <<
"Inconsistent settings for 'runAtPCL' in configuration of the " 70 <<
"alignment producer and the alignment algorithm.";
73 }
else if (hasParameter<bool>(
algoConfig,
"runAtPCL")) {
108 <<
"@SUB=AlignmentProducerBase::startProcessing" 113 <<
"@SUB=AlignmentProducerBase::startProcessing\n" 114 <<
"Trying to start event processing before initializing the alignment " 124 for (
const auto& monitor:
monitors_) monitor->startingNewLoop();
138 <<
"@SUB=AlignmentProducerBase::terminateProcessing" 139 <<
"Terminating algorithm.";
148 for (
const auto& monitor:
monitors_) monitor->endOfLoop();
161 <<
"@SUB=AlignmentProducerBase::processEvent" 162 <<
"EventSetup-Record changed.";
180 <<
"@SUB=AlignmentProducerBase::processEvent" 181 <<
"Skipping event. The current configuration of the alignment algorithm " 182 <<
"does not need to process any events.";
190 for (
int i=10;
i<10000000;
i*=10 ) {
193 <<
"@SUB=AlignmentProducerBase::processEvent" 194 <<
"Events processed: " <<
nevent_;
206 for (
auto iter = handleTrajTracksCollection->
begin();
207 iter != handleTrajTracksCollection->
end();
217 clusterValueMapPtr = &(*clusterValueMap);
229 monitor->duringLoop(event, setup, trajTracks);
233 <<
"@SUB=AlignmentProducerBase::processEvent" 234 <<
"No track collection found: skipping event";
248 <<
"@SUB=AlignmentProducerBase::beginRunImpl" 249 <<
"EventSetup-Record changed.";
283 <<
"@SUB=AlignmentProducerBase::endRunImpl" 284 <<
"No Tk LAS beams to forward to algorithm.";
317 algoConfig.addUntrackedParameter(
"RunRangeSelection",
323 algoConfig.addUntrackedParameter(
"enableAlignableUpdates",
330 if (!alignmentAlgo_) {
332 <<
"Couldn't find the called alignment algorithm: " <<
algoName;
343 for (
const auto& miter: monitors) {
344 std::unique_ptr<AlignmentMonitorBase> newMonitor
346 ->create(miter,
monitorConfig.getUntrackedParameterSet(miter))};
349 throw cms::Exception(
"BadConfig") <<
"Couldn't find monitor named " << miter;
375 <<
"@SUB=AlignmentProducerBase::createCalibrations\n" 376 <<
"Configured " <<
calibrations_.size() <<
" calibration(s) " 377 <<
"for algorithm not supporting it.";
444 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 465 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 466 <<
"Initializing alignment algorithm.";
472 isAlgoInitialized_ =
true;
488 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 501 <<
"@SUB=AlignmentProducerBase::initBeamSpot" 502 <<
"Initializing AlignableBeamSpot";
528 (trackerBuilder.
build(&(*geometricDet), *ptp, tTopo));
626 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 627 <<
"Creating AlignmentParameterBuilder";
629 const auto& alParamBuildCfg =
631 const auto& alParamStoreCfg =
645 const auto& alignables = alignmentParameterBuilder.alignables();
647 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 648 <<
"got " << alignables.size() <<
" alignables";
654 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 655 <<
"AlignmentParameterStore created!";
668 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 669 <<
"Applying misalignment scenario to " 686 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 687 <<
"NOT applying misalignment scenario!";
691 const auto& sParSel =
705 std::ostringstream
output;
707 if (shift > 0. || rot > 0.) {
708 output <<
"Adding random flat shift of max size " << shift
709 <<
" and adding random flat rotation of max size " << rot <<
" to ";
711 std::vector<bool> commSel(0);
712 if (selection !=
"-1") {
717 <<
"[AlignmentProducerBase::simpleMisalignment_]\n" 718 <<
"Expect selection string '" << selection <<
"' to be at least of length " 720 <<
"(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
722 for (
const auto& cIter: cSel) {
723 commSel.push_back(cIter ==
'0' ?
false :
true);
725 output <<
"parameters defined by (" << selection
726 <<
"), representing (x,y,z,alpha,beta,gamma),";
728 output <<
"the active parameters of each alignable,";
730 output <<
" in " << (local ?
"local" :
"global") <<
" frame.";
732 for (
const auto& ali: alivec) {
733 std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
736 double s0 = 0., s1 = 0.,
s2 = 0.;
755 if (local) ali->rotateInLocalFrame(mrot);
756 else ali->rotateInGlobalFrame(mrot);
762 output <<
"No simple misalignment added!";
765 <<
"@SUB=AlignmentProducerBase::simpleMisalignment" << output.str();
774 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry" 775 <<
"Now physically apply alignments to geometry...";
783 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 784 <<
"Trying to apply tracker alignment before creating it.";
788 std::unique_ptr<AlignmentErrorsExtended>
790 std::unique_ptr<AlignmentSurfaceDeformations>
801 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 802 <<
"Trying to apply muon alignment before creating it.";
808 std::unique_ptr<AlignmentErrorsExtended>
810 std::unique_ptr<AlignmentErrorsExtended>
830 edm::LogInfo(
"Alignment") <<
"watcher tksurveyrcd: " << tkSurveyBool;
831 edm::LogInfo(
"Alignment") <<
"watcher tksurveyerrrcd: " << tkSurveyErrBool;
832 if ( tkSurveyBool || tkSurveyErrBool){
834 edm::LogInfo(
"Alignment") <<
"ADDING THE SURVEY INFORMATION";
854 if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
893 if ( ali->
id() != error.
rawId() ||
897 <<
"Error reading survey info from DB. Mismatched id!";
922 for (
const auto& monitor:
monitors_) monitor->endOfJob();
934 <<
"@SUB=AlignmentProducerBase::finish" 935 <<
"No payload to be stored!";
946 const auto runRangeSelectionVPSet =
950 const auto& uniqueRunRanges =
955 std::vector<AlgebraicVector> beamSpotParameters;
957 for (
const auto& iRunRange: uniqueRunRanges) {
970 auto beamSpotAliPars =
972 if (!beamSpotAliPars) {
974 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB\n" 975 <<
"First alignable of alignableExtras_ does not have " 976 <<
"'BeamSpotAlignmentParameters', while it should have.";
979 beamSpotParameters.push_back(beamSpotAliPars->parameters());
985 std::ostringstream bsOutput;
987 auto itPar = beamSpotParameters.cbegin();
988 for (
auto iRunRange = uniqueRunRanges.cbegin();
989 iRunRange != uniqueRunRanges.cend();
990 ++iRunRange, ++itPar) {
991 bsOutput <<
"Run range: " << (*iRunRange).first <<
" - " << (*iRunRange).second <<
"\n";
992 bsOutput <<
" Displacement: x=" << (*itPar)[0] <<
", y=" << (*itPar)[1] <<
"\n";
993 bsOutput <<
" Slope: dx/dz=" << (*itPar)[2] <<
", dy/dz=" << (*itPar)[3] <<
"\n";
997 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB" 998 <<
"Parameters for alignable beamspot:\n" << bsOutput.str();
1016 this->
writeDB(alignments,
"TrackerAlignmentRcd",
1017 alignmentErrors,
"TrackerAlignmentErrorExtendedRcd", trackerGlobal,
1023 this->
writeDB(alignmentSurfaceDeformations,
"TrackerSurfaceDeformationRcd", time);
1036 this->
writeDB(alignments,
"DTAlignmentRcd",
1037 alignmentErrors,
"DTAlignmentErrorExtendedRcd", muonGlobal,
1043 this->
writeDB(alignments,
"CSCAlignmentRcd",
1044 alignmentErrors,
"CSCAlignmentErrorExtendedRcd", muonGlobal,
1064 delete tempAlignments;
1065 delete tempAlignmentErrorsExtended;
1066 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1069 if (globalCoordinates
1070 && globalCoordinates->
transform() != AlignTransform::Transform::Identity) {
1078 tempAlignments, tempAlignmentErrorsExtended);
1081 delete alignmentErrors;
1084 <<
"@SUB=AlignmentProducerBase::writeDB" 1085 <<
"globalCoordinates removed from alignments (" << alignRcd
1086 <<
") and errors (" << alignRcd <<
").";
1090 edm::LogInfo(
"Alignment") <<
"Writing Alignments for run " << time
1091 <<
" to " << alignRcd <<
".";
1094 delete tempAlignments;
1098 edm::LogInfo(
"Alignment") <<
"Writing AlignmentErrorsExtended for run " << time
1099 <<
" to " << errRcd <<
".";
1102 delete tempAlignmentErrorsExtended;
1115 delete alignmentSurfaceDeformations;
1116 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1120 edm::LogInfo(
"Alignment") <<
"Writing AlignmentSurfaceDeformations for run " << time
1121 <<
" to " << surfaceDeformationRcd <<
".";
1123 surfaceDeformationRcd);
1125 delete alignmentSurfaceDeformations;
1131 template<
typename T>
1140 if (e.
message().find(
"MissingParameter") != std::string::npos) {
Code categoryCode() const
const TimeTypeSpecs timeTypeSpecs[]
align::Scalar width() const
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
double z0() const
z coordinate
T getUntrackedParameter(std::string const &, T const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
const edm::InputTag tjTkAssociationMapTag_
Map with tracks/trajectories.
void readInSurveyRcds(const edm::EventSetup &)
Reads in survey records.
const bool applyDbAlignment_
void applyAlignmentsToDB(const edm::EventSetup &)
void createGeometries(const edm::EventSetup &, const TrackerTopology *)
Creates ideal geometry from IdealGeometryRecord.
void writeDB(Alignments *, const std::string &, AlignmentErrorsExtended *, const std::string &, const AlignTransform *, cond::Time_t) const
std::shared_ptr< CSCGeometry > muonCSCGeometry_
Builds a scenario from configuration and applies it to the alignable Muon.
AlignmentMonitors monitors_
Alignment producer base class.
def create(alignables, pedeDump, additionalData, outputFile, config)
edm::ESWatcher< DTAlignmentErrorExtendedRcd > watchDTAlErrExtRcd_
void update(const DTGeometry *, const CSCGeometry *)
const_iterator end() const
last iterator over the map (read only)
edm::ESWatcher< DTAlignmentRcd > watchDTAlRcd_
Class to update a given geometry with a set of alignments.
bool processEvent(const edm::Event &, const edm::EventSetup &)
Process event.
void initAlignmentAlgorithm(const edm::EventSetup &, bool update=false)
void terminateProcessing(const edm::EventSetup *=0)
Terminate processing of events.
std::vector< ParameterSet > VParameterSet
ErrorMatrix matrix() const
AlignableExtras * alignableExtras_
AlignmentProducerBase(const edm::ParameterSet &)
const bool enableAlignableUpdates_
void update(const TrackerGeometry *, const TrackerTopology *)
align::Alignables DTBarrel()
void buildParameterStore()
Creates the , which manages all Alignables.
virtual bool getAliClusterValueMap(const edm::Event &, edm::Handle< AliClusterValueMap > &)=0
def setup(process, global_tag, zero_tesla=False)
std::string message() const
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
virtual ~AlignmentProducerBase()(false)
const Alignments * surveyValues_
void setWidth(align::Scalar width)
uint8_t structureType() const
const double stRandomShift_
AlignmentParameterStore * alignmentParameterStore_
std::vector< AlignTransform > m_align
virtual bool getTkFittedLasBeamCollection(const edm::Run &, edm::Handle< TkFittedLasBeamCollection > &)=0
define event information passed to algorithms
std::shared_ptr< TrackerGeometry > trackerGeometry_
void setLength(align::Scalar length)
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd_
virtual bool getTsosVectorCollection(const edm::Run &, edm::Handle< TsosVectorCollection > &)=0
double dydz() const
dydz slope
void writeForRunRange(cond::Time_t)
std::vector< ConstTrajTrackPair > ConstTrajTrackPairs
Alignments * dtAlignments()
Get DT alignments sorted by DetId.
unsigned long long Time_t
align::Alignables CSCEndcaps()
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual Alignables components() const =0
Return vector of all direct components.
RunRanges makeUniqueRunRanges(const edm::VParameterSet &runRanges, const RunNumber &defaultRun)
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
const edm::InputTag beamSpotTag_
BeamSpot.
void removeGlobalTransform(const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates, Alignments *newAlignments, AlignmentErrorsExtended *newAlignmentErrorsExtended)
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrExtRcd_
void endRunImpl(const edm::Run &, const edm::EventSetup &)
end run
void addSurveyInfo(Alignable *)
Adds survey info to an Alignable.
Abs< T >::type abs(const T &t)
void endLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
end lumi block
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void createAlignables(const TrackerTopology *, bool update=false)
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
std::unique_ptr< const Alignments > globalPositions_
GlobalPositions that might be read from DB, nullptr otherwise.
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
const bool doMisalignmentScenario_
bool hasParameter(const edm::ParameterSet &, const std::string &name)
void startProcessing()
Start processing of events.
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd_
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Get CSC alignment errors sorted by DetId.
double dxdz() const
dxdz slope
virtual bool getBeamSpot(const edm::Event &, edm::Handle< reco::BeamSpot > &)=0
AlignableMuon * alignableMuon_
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
edm::ESWatcher< CSCAlignmentErrorExtendedRcd > watchCSCAlErrExtRcd_
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
const int stNFixAlignables_
edm::ESWatcher< TrackerSurfaceDeformationRcd > watchTrackerSurDeRcd_
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
AlgebraicVector EulerAngles
align::Scalar length() const
AlignableTracker * alignableTracker_
edm::Handle< reco::BeamSpot > beamSpot_
ParameterSet const & getParameterSet(std::string const &) const
void applyMisalignment()
Applies misalignment scenario to .
void setSurvey(const SurveyDet *)
Set survey info.
void build(std::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
const align::RunRanges uniqueRunRanges_
Alignments * cscAlignments()
Get CSC alignments sorted by DetId.
void storeAlignmentsToDB()
Writes Alignments (i.e. Records) to database-file.
Calibrations calibrations_
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Get DT alignment errors sorted by DetId.
const bool checkDbAlignmentValidity_
virtual bool getTrajTrackAssociationCollection(const edm::Event &, edm::Handle< TrajTrackAssociationCollection > &)=0
bool check(const edm::EventSetup &iSetup)
std::vector< Alignable * > Alignables
std::shared_ptr< DTGeometry > muonDTGeometry_
const double stRandomRotation_
edm::ESWatcher< TrackerAlignmentRcd > watchTrackerAlRcd_
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the tracker.
void beginLuminosityBlockImpl(const edm::LuminosityBlock &, const edm::EventSetup &)
begin lumi block
edm::ESWatcher< TrackerAlignmentErrorExtendedRcd > watchTrackerAlErrorExtRcd_
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
Alignments * alignments() const override
Return alignments, sorted by DetId.
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
AlignmentErrorsExtended * alignmentErrors() const override
Return alignment errors, sorted by DetId.
void applyAlignmentsToGeometry()
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
void createCalibrations()
Creates the calibrations.
std::vector< char > convertParamSel(const std::string &selString) const
Converting std::string into std::vector<char>
double y0() const
y coordinate
static unsigned int const shift
void createAlignmentAlgorithm()
Creates the choosen alignment algorithm.
edm::ESWatcher< CSCAlignmentRcd > watchCSCAlRcd_
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
const edm::InputTag tkLasBeamTag_
LAS beams in edm::Run (ignore if empty)
const SurveyErrors * surveyErrors_
void initBeamSpot(const edm::Event &)
Initializes Beamspot of Alignables .
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the Muon.
const_iterator begin() const
first iterator over the map (read only)
eventInfo
add run, event number and lumi section
std::vector< SurveyError > m_surveyErrors
const bool saveDeformationsToDB_
Builds a scenario from configuration and applies it to the alignable tracker.
void beginRunImpl(const edm::Run &, const edm::EventSetup &)
begin run
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
T const * product() const
void simpleMisalignment(const align::Alignables &, const std::string &, float, float, bool)
Applies misalignment scenario to .
edm::ParameterSet config_
T get(const Candidate &c)
const align::Alignables & alignables(void) const
get all alignables
void applyDB(G *, const edm::EventSetup &, const AlignTransform &) const
cond::RealTimeType< cond::runnumber >::type RunNumber
std::unique_ptr< AlignmentAlgorithmBase > alignmentAlgo_
double x0() const
x coordinate
void createMonitors()
Creates the monitors.