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.";
263 for (
const auto& iCal:
calibrations_) iCal->beginRun(run, setup);
285 <<
"@SUB=AlignmentProducerBase::endRunImpl" 286 <<
"No Tk LAS beams to forward to algorithm.";
319 algoConfig.addUntrackedParameter(
"RunRangeSelection",
325 algoConfig.addUntrackedParameter(
"enableAlignableUpdates",
332 if (!alignmentAlgo_) {
334 <<
"Couldn't find the called alignment algorithm: " <<
algoName;
345 for (
const auto& miter: monitors) {
346 std::unique_ptr<AlignmentMonitorBase> newMonitor
348 ->create(miter,
monitorConfig.getUntrackedParameterSet(miter))};
351 throw cms::Exception(
"BadConfig") <<
"Couldn't find monitor named " << miter;
432 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 453 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 454 <<
"Initializing alignment algorithm.";
468 <<
"@SUB=AlignmentProducerBase::createCalibrations\n" 469 <<
"Configured " <<
calibrations_.size() <<
" calibration(s) " 470 <<
"for algorithm not supporting it.";
474 isAlgoInitialized_ =
true;
490 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 503 <<
"@SUB=AlignmentProducerBase::initBeamSpot" 504 <<
"Initializing AlignableBeamSpot";
530 (trackerBuilder.
build(&(*geometricDet), *ptp, tTopo));
628 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 629 <<
"Creating AlignmentParameterBuilder";
631 const auto& alParamBuildCfg =
633 const auto& alParamStoreCfg =
647 const auto& alignables = alignmentParameterBuilder.alignables();
649 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 650 <<
"got " << alignables.size() <<
" alignables";
656 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 657 <<
"AlignmentParameterStore created!";
670 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 671 <<
"Applying misalignment scenario to " 688 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 689 <<
"NOT applying misalignment scenario!";
693 const auto& sParSel =
707 std::ostringstream
output;
709 if (shift > 0. || rot > 0.) {
710 output <<
"Adding random flat shift of max size " << shift
711 <<
" and adding random flat rotation of max size " << rot <<
" to ";
713 std::vector<bool> commSel(0);
714 if (selection !=
"-1") {
719 <<
"[AlignmentProducerBase::simpleMisalignment_]\n" 720 <<
"Expect selection string '" << selection <<
"' to be at least of length " 722 <<
"(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
724 for (
const auto& cIter: cSel) {
725 commSel.push_back(cIter ==
'0' ?
false :
true);
727 output <<
"parameters defined by (" << selection
728 <<
"), representing (x,y,z,alpha,beta,gamma),";
730 output <<
"the active parameters of each alignable,";
732 output <<
" in " << (local ?
"local" :
"global") <<
" frame.";
734 for (
const auto& ali: alivec) {
735 std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
738 double s0 = 0., s1 = 0.,
s2 = 0.;
757 if (local) ali->rotateInLocalFrame(mrot);
758 else ali->rotateInGlobalFrame(mrot);
764 output <<
"No simple misalignment added!";
767 <<
"@SUB=AlignmentProducerBase::simpleMisalignment" << output.str();
776 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry" 777 <<
"Now physically apply alignments to geometry...";
785 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 786 <<
"Trying to apply tracker alignment before creating it.";
790 std::unique_ptr<AlignmentErrorsExtended>
792 std::unique_ptr<AlignmentSurfaceDeformations>
803 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 804 <<
"Trying to apply muon alignment before creating it.";
810 std::unique_ptr<AlignmentErrorsExtended>
812 std::unique_ptr<AlignmentErrorsExtended>
832 edm::LogInfo(
"Alignment") <<
"watcher tksurveyrcd: " << tkSurveyBool;
833 edm::LogInfo(
"Alignment") <<
"watcher tksurveyerrrcd: " << tkSurveyErrBool;
834 if ( tkSurveyBool || tkSurveyErrBool){
836 edm::LogInfo(
"Alignment") <<
"ADDING THE SURVEY INFORMATION";
856 if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
895 if ( ali->
id() != error.
rawId() ||
899 <<
"Error reading survey info from DB. Mismatched id!";
924 for (
const auto& monitor:
monitors_) monitor->endOfJob();
934 <<
"@SUB=AlignmentProducerBase::finish" 935 <<
"No payload to be stored!";
950 const auto runRangeSelectionVPSet =
954 const auto& uniqueRunRanges =
959 std::vector<AlgebraicVector> beamSpotParameters;
961 for (
const auto& iRunRange: uniqueRunRanges) {
974 auto beamSpotAliPars =
976 if (!beamSpotAliPars) {
978 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB\n" 979 <<
"First alignable of alignableExtras_ does not have " 980 <<
"'BeamSpotAlignmentParameters', while it should have.";
983 beamSpotParameters.push_back(beamSpotAliPars->parameters());
989 std::ostringstream bsOutput;
991 auto itPar = beamSpotParameters.cbegin();
992 for (
auto iRunRange = uniqueRunRanges.cbegin();
993 iRunRange != uniqueRunRanges.cend();
994 ++iRunRange, ++itPar) {
995 bsOutput <<
"Run range: " << (*iRunRange).first <<
" - " << (*iRunRange).second <<
"\n";
996 bsOutput <<
" Displacement: x=" << (*itPar)[0] <<
", y=" << (*itPar)[1] <<
"\n";
997 bsOutput <<
" Slope: dx/dz=" << (*itPar)[2] <<
", dy/dz=" << (*itPar)[3] <<
"\n";
1001 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB" 1002 <<
"Parameters for alignable beamspot:\n" << bsOutput.str();
1020 this->
writeDB(alignments,
"TrackerAlignmentRcd",
1021 alignmentErrors,
"TrackerAlignmentErrorExtendedRcd", trackerGlobal,
1027 this->
writeDB(alignmentSurfaceDeformations,
"TrackerSurfaceDeformationRcd", time);
1040 this->
writeDB(alignments,
"DTAlignmentRcd",
1041 alignmentErrors,
"DTAlignmentErrorExtendedRcd", muonGlobal,
1047 this->
writeDB(alignments,
"CSCAlignmentRcd",
1048 alignmentErrors,
"CSCAlignmentErrorExtendedRcd", muonGlobal,
1068 delete tempAlignments;
1069 delete tempAlignmentErrorsExtended;
1070 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1073 if (globalCoordinates
1074 && globalCoordinates->
transform() != AlignTransform::Transform::Identity) {
1082 tempAlignments, tempAlignmentErrorsExtended);
1085 delete alignmentErrors;
1088 <<
"@SUB=AlignmentProducerBase::writeDB" 1089 <<
"globalCoordinates removed from alignments (" << alignRcd
1090 <<
") and errors (" << alignRcd <<
").";
1094 edm::LogInfo(
"Alignment") <<
"Writing Alignments for run " << time
1095 <<
" to " << alignRcd <<
".";
1098 delete tempAlignments;
1102 edm::LogInfo(
"Alignment") <<
"Writing AlignmentErrorsExtended for run " << time
1103 <<
" to " << errRcd <<
".";
1106 delete tempAlignmentErrorsExtended;
1119 delete alignmentSurfaceDeformations;
1120 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1124 edm::LogInfo(
"Alignment") <<
"Writing AlignmentSurfaceDeformations for run " << time
1125 <<
" to " << surfaceDeformationRcd <<
".";
1127 surfaceDeformationRcd);
1129 delete alignmentSurfaceDeformations;
1135 template<
typename T>
1144 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)
virtual const Alignables & components() const =0
Return vector of all direct components.
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.
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.