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\n" 109 <<
"Trying to start event processing before initializing the alignment " 119 for (
const auto& monitor:
monitors_) monitor->startingNewLoop();
133 <<
"@SUB=AlignmentProducerBase::terminateProcessing" 134 <<
"Terminating algorithm.";
143 for (
const auto& monitor:
monitors_) monitor->endOfLoop();
156 <<
"@SUB=AlignmentProducerBase::processEvent" 157 <<
"EventSetup-Record changed.";
172 <<
"@SUB=AlignmentProducerBase::processEvent" 173 <<
"Skipping event. The current configuration of the alignment algorithm " 174 <<
"does not need to process any events.";
184 for (
int i=10;
i<10000000;
i*=10 ) {
187 <<
"@SUB=AlignmentProducerBase::processEvent" 188 <<
"Events processed: " <<
nevent_;
200 for (
auto iter = handleTrajTracksCollection->
begin();
201 iter != handleTrajTracksCollection->
end();
211 clusterValueMapPtr = &(*clusterValueMap);
223 monitor->duringLoop(event, setup, trajTracks);
227 <<
"@SUB=AlignmentProducerBase::processEvent" 228 <<
"No track collection found: skipping event";
242 <<
"@SUB=AlignmentProducerBase::beginRunImpl" 243 <<
"EventSetup-Record changed.";
277 <<
"@SUB=AlignmentProducerBase::endRunImpl" 278 <<
"No Tk LAS beams to forward to algorithm.";
311 algoConfig.addUntrackedParameter(
"RunRangeSelection",
317 algoConfig.addUntrackedParameter(
"enableAlignableUpdates",
324 if (!alignmentAlgo_) {
326 <<
"Couldn't find the called alignment algorithm: " <<
algoName;
337 for (
const auto& miter: monitors) {
338 std::unique_ptr<AlignmentMonitorBase> newMonitor
340 ->create(miter,
monitorConfig.getUntrackedParameterSet(miter))};
343 throw cms::Exception(
"BadConfig") <<
"Couldn't find monitor named " << miter;
369 <<
"@SUB=AlignmentProducerBase::createCalibrations\n" 370 <<
"Configured " <<
calibrations_.size() <<
" calibration(s) " 371 <<
"for algorithm not supporting it.";
455 <<
"@SUB=AlignmentProducerBase::initAlignmentAlgorithm" 456 <<
"Initializing alignment algorithm.";
462 isAlgoInitialized_ =
true;
487 <<
"@SUB=AlignmentProducerBase::initBeamSpot" 488 <<
"Initializing AlignableBeamSpot";
514 (trackerBuilder.
build(&(*geometricDet), *ptp, tTopo));
612 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 613 <<
"Creating AlignmentParameterBuilder";
615 const auto& alParamBuildCfg =
617 const auto& alParamStoreCfg =
631 const auto& alignables = alignmentParameterBuilder.alignables();
633 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 634 <<
"got " << alignables.size() <<
" alignables";
640 <<
"@SUB=AlignmentProducerBase::buildParameterStore" 641 <<
"AlignmentParameterStore created!";
654 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 655 <<
"Applying misalignment scenario to " 672 <<
"@SUB=AlignmentProducerBase::applyMisalignment" 673 <<
"NOT applying misalignment scenario!";
677 const auto& sParSel =
691 std::ostringstream
output;
693 if (shift > 0. || rot > 0.) {
694 output <<
"Adding random flat shift of max size " << shift
695 <<
" and adding random flat rotation of max size " << rot <<
" to ";
697 std::vector<bool> commSel(0);
698 if (selection !=
"-1") {
703 <<
"[AlignmentProducerBase::simpleMisalignment_]\n" 704 <<
"Expect selection string '" << selection <<
"' to be at least of length " 706 <<
"(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
708 for (
const auto& cIter: cSel) {
709 commSel.push_back(cIter ==
'0' ?
false :
true);
711 output <<
"parameters defined by (" << selection
712 <<
"), representing (x,y,z,alpha,beta,gamma),";
714 output <<
"the active parameters of each alignable,";
716 output <<
" in " << (local ?
"local" :
"global") <<
" frame.";
718 for (
const auto& ali: alivec) {
719 std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
722 double s0 = 0., s1 = 0.,
s2 = 0.;
741 if (local) ali->rotateInLocalFrame(mrot);
742 else ali->rotateInGlobalFrame(mrot);
748 output <<
"No simple misalignment added!";
751 <<
"@SUB=AlignmentProducerBase::simpleMisalignment" << output.str();
760 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry" 761 <<
"Now physically apply alignments to geometry...";
769 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 770 <<
"Trying to apply tracker alignment before creating it.";
774 std::unique_ptr<AlignmentErrorsExtended>
776 std::unique_ptr<AlignmentSurfaceDeformations>
787 <<
"@SUB=AlignmentProducerBase::applyAlignmentsToGeometry\n" 788 <<
"Trying to apply muon alignment before creating it.";
794 std::unique_ptr<AlignmentErrorsExtended>
796 std::unique_ptr<AlignmentErrorsExtended>
816 edm::LogInfo(
"Alignment") <<
"watcher tksurveyrcd: " << tkSurveyBool;
817 edm::LogInfo(
"Alignment") <<
"watcher tksurveyerrrcd: " << tkSurveyErrBool;
818 if ( tkSurveyBool || tkSurveyErrBool){
820 edm::LogInfo(
"Alignment") <<
"ADDING THE SURVEY INFORMATION";
840 if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
879 if ( ali->
id() != error.
rawId() ||
883 <<
"Error reading survey info from DB. Mismatched id!";
909 <<
"@SUB=AlignmentProducerBase::finish\n" 910 <<
"Trying to finish before terminating event processing.";
913 for (
const auto& monitor:
monitors_) monitor->endOfJob();
925 <<
"@SUB=AlignmentProducerBase::finish" 926 <<
"No payload to be stored!";
937 const auto runRangeSelectionVPSet =
941 const auto& uniqueRunRanges =
946 std::vector<AlgebraicVector> beamSpotParameters;
948 for (
const auto& iRunRange: uniqueRunRanges) {
961 auto beamSpotAliPars =
963 if (!beamSpotAliPars) {
965 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB\n" 966 <<
"First alignable of alignableExtras_ does not have " 967 <<
"'BeamSpotAlignmentParameters', while it should have.";
970 beamSpotParameters.push_back(beamSpotAliPars->parameters());
976 std::ostringstream bsOutput;
978 auto itPar = beamSpotParameters.cbegin();
979 for (
auto iRunRange = uniqueRunRanges.cbegin();
980 iRunRange != uniqueRunRanges.cend();
981 ++iRunRange, ++itPar) {
982 bsOutput <<
"Run range: " << (*iRunRange).first <<
" - " << (*iRunRange).second <<
"\n";
983 bsOutput <<
" Displacement: x=" << (*itPar)[0] <<
", y=" << (*itPar)[1] <<
"\n";
984 bsOutput <<
" Slope: dx/dz=" << (*itPar)[2] <<
", dy/dz=" << (*itPar)[3] <<
"\n";
988 <<
"@SUB=AlignmentProducerBase::storeAlignmentsToDB" 989 <<
"Parameters for alignable beamspot:\n" << bsOutput.str();
1007 this->
writeDB(alignments,
"TrackerAlignmentRcd",
1008 alignmentErrors,
"TrackerAlignmentErrorExtendedRcd", trackerGlobal,
1014 this->
writeDB(alignmentSurfaceDeformations,
"TrackerSurfaceDeformationRcd", time);
1027 this->
writeDB(alignments,
"DTAlignmentRcd",
1028 alignmentErrors,
"DTAlignmentErrorExtendedRcd", muonGlobal,
1034 this->
writeDB(alignments,
"CSCAlignmentRcd",
1035 alignmentErrors,
"CSCAlignmentErrorExtendedRcd", muonGlobal,
1055 delete tempAlignments;
1056 delete tempAlignmentErrorsExtended;
1057 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1060 if (globalCoordinates
1061 && globalCoordinates->
transform() != AlignTransform::Transform::Identity) {
1069 tempAlignments, tempAlignmentErrorsExtended);
1072 delete alignmentErrors;
1075 <<
"@SUB=AlignmentProducerBase::writeDB" 1076 <<
"globalCoordinates removed from alignments (" << alignRcd
1077 <<
") and errors (" << alignRcd <<
").";
1081 edm::LogInfo(
"Alignment") <<
"Writing Alignments for run " << time
1082 <<
" to " << alignRcd <<
".";
1085 delete tempAlignments;
1089 edm::LogInfo(
"Alignment") <<
"Writing AlignmentErrorsExtended for run " << time
1090 <<
" to " << errRcd <<
".";
1093 delete tempAlignmentErrorsExtended;
1106 delete alignmentSurfaceDeformations;
1107 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
1111 edm::LogInfo(
"Alignment") <<
"Writing AlignmentSurfaceDeformations for run " << time
1112 <<
" to " << surfaceDeformationRcd <<
".";
1114 surfaceDeformationRcd);
1116 delete alignmentSurfaceDeformations;
1122 template<
typename T>
1131 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_
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
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
void applyScenario(const edm::ParameterSet &scenario)
Apply misalignment scenario to the tracker.
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 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.
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
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 .
const_iterator begin() const
first iterator over the map (read only)
eventInfo
add run, event number and lumi section
Alignments * alignments() const
Return alignments, sorted by DetId.
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_
void applyScenario(const edm::ParameterSet &scenario)
Apply misalignment scenario to the Muon.
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.