test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentProducer Class Reference

#include <AlignmentProducer.h>

Inheritance diagram for AlignmentProducer:
edm::ESProducerLooper edm::ESProducer edm::EventSetupRecordIntervalFinder edm::EDLooper edm::ESProxyFactoryProducer edm::EDLooperBase edm::eventsetup::DataProxyProvider

Public Types

typedef std::vector< Alignable * > Alignables
 
typedef std::pair< const
Trajectory *, const
reco::Track * > 
ConstTrajTrackPair
 
typedef std::vector
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 
typedef
AlignmentAlgorithmBase::RunNumber 
RunNumber
 
typedef
AlignmentAlgorithmBase::RunRange 
RunRange
 
typedef std::vector< RunRangeRunRanges
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Public Types inherited from edm::EDLooperBase
enum  Status { kContinue, kStop }
 

Public Member Functions

 AlignmentProducer (const edm::ParameterSet &iConfig)
 Constructor. More...
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup)
 Called at lumi block start, calling algorithm's beginLuminosityBlock. More...
 
virtual void beginOfJob (const edm::EventSetup &)
 Called at beginning of job. More...
 
virtual void beginRun (const edm::Run &run, const edm::EventSetup &setup)
 Called at run start and calling algorithms beginRun. More...
 
virtual Status duringLoop (const edm::Event &event, const edm::EventSetup &setup)
 Called at each event. More...
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &lumiBlock, const edm::EventSetup &setup)
 Called at lumi block end, calling algorithm's endLuminosityBlock. More...
 
virtual void endOfJob ()
 Called at end of job. More...
 
virtual Status endOfLoop (const edm::EventSetup &, unsigned int iLoop)
 Called at end of loop. More...
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &setup)
 Called at run end - currently reading TkFittedLasBeam if an InpuTag is given for that. More...
 
virtual std::shared_ptr
< CSCGeometry
produceCSC (const MuonGeometryRecord &iRecord)
 Produce the muon CSC geometry. More...
 
virtual std::shared_ptr
< DTGeometry
produceDT (const MuonGeometryRecord &iRecord)
 Produce the muon DT geometry. More...
 
virtual std::shared_ptr
< TrackerGeometry
produceTracker (const TrackerDigiGeometryRecord &iRecord)
 Produce the tracker geometry. More...
 
virtual void startingNewLoop (unsigned int iLoop)
 Called at beginning of loop. More...
 
 ~AlignmentProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::ESProducerLooper
 ESProducerLooper ()
 
virtual std::set
< eventsetup::EventSetupRecordKey
modifyingRecords () const
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 
- Public Member Functions inherited from edm::EDLooper
 EDLooper ()
 
 EDLooper (EDLooper const &)=delete
 
EDLooperoperator= (EDLooper const &)=delete
 
virtual ~EDLooper ()
 
- Public Member Functions inherited from edm::EDLooperBase
virtual void attachTo (ActivityRegistry &)
 Override this method if you need to monitor the state of the processing. More...
 
virtual void beginOfJob ()
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetup const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetup const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
 
Status doEndOfLoop (EventSetup const &es)
 
void doEndRun (RunPrincipal &, EventSetup const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
virtual ~EDLooperBase () noexcept(false)
 

Private Member Functions

void addSurveyInfo_ (Alignable *)
 Add survey info to an alignable. More...
 
template<class G , class Rcd , class ErrRcd >
void applyDB (G *geometry, const edm::EventSetup &iSetup, const AlignTransform &globalPosition) const
 
template<class G , class DeformationRcd >
void applyDB (G *geometry, const edm::EventSetup &iSetup) const
 Apply DB constants for surface deformations. More...
 
void createGeometries_ (const edm::EventSetup &)
 Create tracker and muon geometries. More...
 
RunRanges makeNonOverlappingRunRanges (const edm::VParameterSet &RunRangeSelectionVPSet)
 
void readInSurveyRcds (const edm::EventSetup &)
 read in survey records More...
 
void simpleMisalignment_ (const Alignables &alivec, const std::string &selection, float shift, float rot, bool local)
 Apply random shifts and rotations to selected alignables, according to configuration. More...
 
void writeDB (Alignments *alignments, const std::string &alignRcd, AlignmentErrorsExtended *alignmentErrors, const std::string &errRcd, const AlignTransform *globalCoordinates, cond::Time_t time) const
 
void writeDB (AlignmentSurfaceDeformations *alignmentSurfaceDeformations, const std::string &surfaceDeformationRcd, cond::Time_t time) const
 
void writeForRunRange (cond::Time_t time)
 

Private Attributes

const bool applyDbAlignment_
 
const edm::InputTag beamSpotTag_
 
const bool checkDbAlignmentValidity_
 
const edm::InputTag clusterValueMapTag_
 
const bool doMisalignmentScenario_
 
const bool doMuon_
 
const bool doTracker_
 
const AlignmentsglobalPositions_
 GlobalPositions that might be read from DB, NULL otherwise. More...
 
int nevent_
 
const bool saveApeToDB_
 
const bool saveDeformationsToDB_
 
const bool saveToDB_
 
const int stNFixAlignables_
 
const double stRandomRotation_
 
const double stRandomShift_
 
AlignableExtrastheAlignableExtras
 
AlignableMuontheAlignableMuon
 
AlignableTrackertheAlignableTracker
 
AlignmentAlgorithmBasetheAlignmentAlgo
 
AlignmentParameterStoretheAlignmentParameterStore
 
std::vector
< IntegratedCalibrationBase * > 
theCalibrations
 
const unsigned int theMaxLoops
 
std::vector
< AlignmentMonitorBase * > 
theMonitors
 
std::shared_ptr< CSCGeometrytheMuonCSC
 
std::shared_ptr< DTGeometrytheMuonDT
 
edm::ParameterSet theParameterSet
 
const SurveyErrorstheSurveyErrors
 
unsigned int theSurveyIndex
 
const AlignmentstheSurveyValues
 
std::shared_ptr< TrackerGeometrytheTracker
 
const edm::InputTag tjTkAssociationMapTag_
 
const edm::InputTag tkLasBeamTag_
 
const bool useExtras_
 
const bool useSurvey_
 
edm::ESWatcher
< CSCSurveyErrorExtendedRcd
watchCSCSurveyErrRcd_
 
edm::ESWatcher< CSCSurveyRcdwatchCSCSurveyRcd_
 
edm::ESWatcher
< DTSurveyErrorExtendedRcd
watchDTSurveyErrRcd_
 
edm::ESWatcher< DTSurveyRcdwatchDTSurveyRcd_
 
edm::ESWatcher
< TrackerSurveyErrorExtendedRcd
watchTkSurveyErrRcd_
 
edm::ESWatcher< TrackerSurveyRcdwatchTkSurveyRcd_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducerLooper
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void setIntervalFor (const eventsetup::EventSetupRecordKey &iKey, const IOVSyncValue &iTime, ValidityInterval &oInterval)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EDLooperBase
ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 

Detailed Description

Package : Alignment/CommonAlignmentProducer Description : calls alignment algorithms

Author
: Frederic Ronga Revision :
Revision:
1.27

last update:

Date:
2012/06/13 16:23:30

by :

Author:
yana

Definition at line 56 of file AlignmentProducer.h.

Member Typedef Documentation

Definition at line 60 of file AlignmentProducer.h.

Definition at line 61 of file AlignmentProducer.h.

Definition at line 62 of file AlignmentProducer.h.

Definition at line 64 of file AlignmentProducer.h.

Definition at line 65 of file AlignmentProducer.h.

typedef std::vector<RunRange> AlignmentProducer::RunRanges

Definition at line 66 of file AlignmentProducer.h.

Constructor & Destructor Documentation

AlignmentProducer::AlignmentProducer ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 80 of file AlignmentProducer.cc.

References edm::ParameterSet::addUntrackedParameter(), beamerCreator::create(), doMuon_, doTracker_, Exception, reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::name, produceCSC(), produceDT(), produceTracker(), edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, theAlignmentAlgo, theCalibrations, and theMonitors.

80  :
84  nevent_(0), theParameterSet(iConfig),
85  theMaxLoops( iConfig.getUntrackedParameter<unsigned int>("maxLoops") ),
86  stNFixAlignables_(iConfig.getParameter<int>("nFixAlignables") ),
87  stRandomShift_(iConfig.getParameter<double>("randomShift")),
88  stRandomRotation_(iConfig.getParameter<double>("randomRotation")),
89  applyDbAlignment_( iConfig.getUntrackedParameter<bool>("applyDbAlignment")),
90  checkDbAlignmentValidity_( iConfig.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
91  doMisalignmentScenario_(iConfig.getParameter<bool>("doMisalignmentScenario")),
92  saveToDB_(iConfig.getParameter<bool>("saveToDB")),
93  saveApeToDB_(iConfig.getParameter<bool>("saveApeToDB")),
94  saveDeformationsToDB_(iConfig.getParameter<bool>("saveDeformationsToDB")),
95  doTracker_( iConfig.getUntrackedParameter<bool>("doTracker") ),
96  doMuon_( iConfig.getUntrackedParameter<bool>("doMuon") ),
97  useExtras_( iConfig.getUntrackedParameter<bool>("useExtras") ),
98  useSurvey_( iConfig.getParameter<bool>("useSurvey") ),
99  tjTkAssociationMapTag_(iConfig.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
100  beamSpotTag_(iConfig.getParameter<edm::InputTag>("beamSpotTag")),
101  tkLasBeamTag_(iConfig.getParameter<edm::InputTag>("tkLasBeamTag")),
102  clusterValueMapTag_(iConfig.getParameter<edm::InputTag>("hitPrescaleMapTag"))
103 {
104  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::AlignmentProducer";
105 
106  // Tell the framework what data is being produced
107  if (doTracker_) {
109  }
110  if (doMuon_) {
113  }
114 
115  // Create the alignment algorithm
116  edm::ParameterSet algoConfig = iConfig.getParameter<edm::ParameterSet>( "algoConfig" );
117  edm::VParameterSet iovSelection = iConfig.getParameter<edm::VParameterSet>( "RunRangeSelection" );
118  algoConfig.addUntrackedParameter<edm::VParameterSet>( "RunRangeSelection", iovSelection );
119  std::string algoName = algoConfig.getParameter<std::string>( "algoName" );
120  theAlignmentAlgo = AlignmentAlgorithmPluginFactory::get( )->create( algoName, algoConfig );
121 
122  // Check if found
123  if ( !theAlignmentAlgo )
124  throw cms::Exception("BadConfig") << "Couldn't find algorithm called " << algoName;
125 
126  // Now create monitors:
127  edm::ParameterSet monitorConfig = iConfig.getParameter<edm::ParameterSet>( "monitorConfig" );
128  std::vector<std::string> monitors = monitorConfig.getUntrackedParameter<std::vector<std::string> >( "monitors" );
129  for (std::vector<std::string>::const_iterator miter = monitors.begin(); miter != monitors.end(); ++miter) {
130  AlignmentMonitorBase* newMonitor = AlignmentMonitorPluginFactory::get()->create(*miter, monitorConfig.getUntrackedParameter<edm::ParameterSet>(*miter));
131 
132  if (!newMonitor) throw cms::Exception("BadConfig") << "Couldn't find monitor named " << *miter;
133 
134  theMonitors.push_back(newMonitor);
135  }
136 
137  // Finally create integrated calibrations:
138  edm::VParameterSet calibrations = iConfig.getParameter<edm::VParameterSet>("calibrations");
139  for (auto iCalib = calibrations.begin(); iCalib != calibrations.end(); ++iCalib) {
140  const std::string name(iCalib->getParameter<std::string>("calibrationName"));
142  // exception comes from line before: if (!theCalibrations.back()) throw cms::Exception(..) << ..;
143  }
144 
145 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual std::shared_ptr< TrackerGeometry > produceTracker(const TrackerDigiGeometryRecord &iRecord)
Produce the tracker geometry.
const bool doMisalignmentScenario_
virtual std::shared_ptr< DTGeometry > produceDT(const MuonGeometryRecord &iRecord)
Produce the muon DT geometry.
AlignmentAlgorithmBase * theAlignmentAlgo
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< IntegratedCalibrationBase * > theCalibrations
edm::ParameterSet theParameterSet
const edm::InputTag tkLasBeamTag_
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
const bool applyDbAlignment_
const unsigned int theMaxLoops
AlignableExtras * theAlignableExtras
const bool checkDbAlignmentValidity_
const edm::InputTag clusterValueMapTag_
std::vector< AlignmentMonitorBase * > theMonitors
AlignmentParameterStore * theAlignmentParameterStore
const edm::InputTag beamSpotTag_
const edm::InputTag tjTkAssociationMapTag_
AlignableMuon * theAlignableMuon
const bool saveDeformationsToDB_
const double stRandomShift_
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
AlignableTracker * theAlignableTracker
virtual std::shared_ptr< CSCGeometry > produceCSC(const MuonGeometryRecord &iRecord)
Produce the muon CSC geometry.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
T get(const Candidate &c)
Definition: component.h:55
const double stRandomRotation_
AlignmentProducer::~AlignmentProducer ( )

Destructor.

Definition at line 150 of file AlignmentProducer.cc.

References globalPositions_, theAlignableExtras, theAlignableMuon, theAlignableTracker, theAlignmentAlgo, theAlignmentParameterStore, and theCalibrations.

151 {
152  delete theAlignmentAlgo;
153 
154  // Delete monitors as well??
155 
156  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
157  delete *iCal; // delete integrated calibration pointed to by (*iCal)
158  }
159 
161  delete theAlignableExtras;
162  delete theAlignableTracker;
163  delete theAlignableMuon;
164 
165  delete globalPositions_;
166 }
AlignmentAlgorithmBase * theAlignmentAlgo
std::vector< IntegratedCalibrationBase * > theCalibrations
AlignableExtras * theAlignableExtras
AlignmentParameterStore * theAlignmentParameterStore
AlignableMuon * theAlignableMuon
AlignableTracker * theAlignableTracker
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.

Member Function Documentation

void AlignmentProducer::addSurveyInfo_ ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 678 of file AlignmentProducer.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), relativeConstraints::error, Exception, i, 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(), theSurveyErrors, theSurveyIndex, theSurveyValues, and AlignableSurface::width().

Referenced by readInSurveyRcds().

679 {
680  const std::vector<Alignable*>& comp = ali->components();
681 
682  unsigned int nComp = comp.size();
683 
684  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo_(comp[i]);
685 
687 
688  if ( ali->id() != error.rawId() ||
689  ali->alignableObjectId() != error.structureType() )
690  {
691  throw cms::Exception("DatabaseError")
692  << "Error reading survey info from DB. Mismatched id!";
693  }
694 
695  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
696  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
697 
698  AlignableSurface surf( align::PositionType( pos.x(), pos.y(), pos.z() ),
699  align::RotationType( rot.xx(), rot.xy(), rot.xz(),
700  rot.yx(), rot.yy(), rot.yz(),
701  rot.zx(), rot.zy(), rot.zz() ) );
702 
703  surf.setWidth( ali->surface().width() );
704  surf.setLength( ali->surface().length() );
705 
706  ali->setSurvey( new SurveyDet( surf, error.matrix() ) );
707 
708  ++theSurveyIndex;
709 }
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:185
int i
Definition: DBlmapReader.cc:9
ErrorMatrix matrix() const
Definition: SurveyError.h:76
const Alignments * theSurveyValues
void addSurveyInfo_(Alignable *)
Add survey info to an alignable.
uint8_t structureType() const
Definition: SurveyError.h:66
virtual Alignables components() const =0
Return vector of all direct components.
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
unsigned int theSurveyIndex
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
align::ID rawId() const
Definition: SurveyError.h:71
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
const SurveyErrors * theSurveyErrors
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:23
template<class G , class Rcd , class ErrRcd >
void AlignmentProducer::applyDB ( G *  geometry,
const edm::EventSetup iSetup,
const AlignTransform globalPosition 
) const
private

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

Definition at line 777 of file AlignmentProducer.cc.

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

779 {
780  // 'G' is the geometry class for that DB should be applied,
781  // 'Rcd' is the record class for its Alignments
782  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
783  // 'globalCoordinates' are global transformation for this geometry
784 
785  const Rcd & record = iSetup.get<Rcd>();
787  const edm::ValidityInterval & validity = record.validityInterval();
788  const edm::IOVSyncValue first = validity.first();
789  const edm::IOVSyncValue last = validity.last();
790  if (first!=edm::IOVSyncValue::beginOfTime() ||
792  throw cms::Exception("DatabaseError")
793  << "@SUB=AlignmentProducer::applyDB"
794  << "\nTrying to apply "
795  << record.key().name()
796  << " with multiple IOVs in tag.\n"
797  << "Validity range is "
798  << first.eventID().run() << " - " << last.eventID().run();
799  }
800  }
801 
802  edm::ESHandle<Alignments> alignments;
803  record.get(alignments);
804 
806  iSetup.get<ErrRcd>().get(alignmentErrors);
807 
808  GeometryAligner aligner;
809  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrors),
810  globalCoordinates);
811 }
RunNumber_t run() const
Definition: EventID.h:39
const EventID & eventID() const
Definition: IOVSyncValue.h:42
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:97
const IOVSyncValue & last() const
const bool checkDbAlignmentValidity_
static const IOVSyncValue & beginOfTime()
tuple G
Definition: callgraph.py:12
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
const T & get() const
Definition: EventSetup.h:56
ESHandle< TrackerGeometry > geometry
const IOVSyncValue & first() const
template<class G , class DeformationRcd >
void AlignmentProducer::applyDB ( G *  geometry,
const edm::EventSetup iSetup 
) const
private

Apply DB constants for surface deformations.

Definition at line 818 of file AlignmentProducer.cc.

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

819 {
820  // 'G' is the geometry class for that DB should be applied,
821  // 'DeformationRcd' is the record class for its surface deformations
822 
823  const DeformationRcd & record = iSetup.get<DeformationRcd>();
825  const edm::ValidityInterval & validity = record.validityInterval();
826  const edm::IOVSyncValue first = validity.first();
827  const edm::IOVSyncValue last = validity.last();
828  if (first!=edm::IOVSyncValue::beginOfTime() ||
830  throw cms::Exception("DatabaseError")
831  << "@SUB=AlignmentProducer::applyDB"
832  << "\nTrying to apply "
833  << record.key().name()
834  << " with multiple IOVs in tag.\n"
835  << "Validity range is "
836  << first.eventID().run() << " - " << last.eventID().run();
837  }
838  }
840  record.get(surfaceDeformations);
841 
842  GeometryAligner aligner;
843  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
844 }
RunNumber_t run() const
Definition: EventID.h:39
const EventID & eventID() const
Definition: IOVSyncValue.h:42
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:97
const IOVSyncValue & last() const
const bool checkDbAlignmentValidity_
static const IOVSyncValue & beginOfTime()
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
tuple G
Definition: callgraph.py:12
const T & get() const
Definition: EventSetup.h:56
ESHandle< TrackerGeometry > geometry
const IOVSyncValue & first() const
void AlignmentProducer::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup setup 
)
virtual

Called at lumi block start, calling algorithm's beginLuminosityBlock.

Reimplemented from edm::EDLooperBase.

Definition at line 562 of file AlignmentProducer.cc.

References AlignmentAlgorithmBase::beginLuminosityBlock(), and theAlignmentAlgo.

564 {
565  theAlignmentAlgo->beginLuminosityBlock(setup); // do not forward edm::LuminosityBlock
566 }
virtual void beginLuminosityBlock(const edm::EventSetup &setup)
called at begin of luminosity block (no lumi block info passed yet)
AlignmentAlgorithmBase * theAlignmentAlgo
void AlignmentProducer::beginOfJob ( const edm::EventSetup iSetup)
virtual

Called at beginning of job.

Reimplemented from edm::EDLooperBase.

Definition at line 199 of file AlignmentProducer.cc.

References AlignmentAlgorithmBase::addCalibrations(), align::AlignableMuon, AlignmentParameterStore_cfi::AlignmentParameterStore, applyDbAlignment_, MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), createGeometries_(), align::DetectorGlobalPosition(), doMisalignmentScenario_, doMuon_, doTracker_, Exception, edm::EventSetup::get(), edm::ParameterSet::getParameter(), globalPositions_, AlignmentAlgorithmBase::initialize(), DetId::Muon, edm::ESHandle< class >::product(), simpleMisalignment_(), stNFixAlignables_, stRandomRotation_, stRandomShift_, AlCaHLTBitMon_QueryRunRegistry::string, theAlignableExtras, theAlignableMuon, theAlignableTracker, theAlignmentAlgo, theAlignmentParameterStore, theCalibrations, theMonitors, theMuonCSC, theMuonDT, theParameterSet, theTracker, DetId::Tracker, and useExtras_.

200 {
201  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob";
202 
203  //Retrieve tracker topology from geometry
204  edm::ESHandle<TrackerTopology> tTopoHandle;
205  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
206  const TrackerTopology* const tTopo = tTopoHandle.product();
207 
208  // Create the geometries from the ideal geometries (first time only)
209  this->createGeometries_( iSetup );
210 
211  // Retrieve and apply alignments, if requested (requires DB setup)
212  if ( applyDbAlignment_ ) {
213  // we need GlobalPositionRcd - and have to keep track for later removal
214  // before writing again to DB...
215  edm::ESHandle<Alignments> globalPositionRcd;
216  iSetup.get<GlobalPositionRcd>().get(globalPositionRcd);
217  globalPositions_ = new Alignments(*globalPositionRcd);
218 
219  if ( doTracker_ ) { // apply to tracker
220  this->applyDB<TrackerGeometry,TrackerAlignmentRcd,TrackerAlignmentErrorExtendedRcd>
221  (&(*theTracker), iSetup,
223  this->applyDB<TrackerGeometry,TrackerSurfaceDeformationRcd>(&(*theTracker), iSetup);
224  }
225 
226  if ( doMuon_ ) { // apply to tracker
227  this->applyDB<DTGeometry,DTAlignmentRcd,DTAlignmentErrorExtendedRcd>
228  (&(*theMuonDT), iSetup,
230  this->applyDB<CSCGeometry,CSCAlignmentRcd,CSCAlignmentErrorExtendedRcd>
231  (&(*theMuonCSC), iSetup,
233  }
234  }
235 
236  // Create alignable tracker and muon
237  if (doTracker_) {
238  theAlignableTracker = new AlignableTracker( &(*theTracker), tTopo );
239  }
240 
241  if (doMuon_) {
242  theAlignableMuon = new AlignableMuon( &(*theMuonDT), &(*theMuonCSC) );
243  }
244 
245  if (useExtras_) {
247  }
248 
249  // Create alignment parameter builder
250  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
251  << "Creating AlignmentParameterBuilder";
252  edm::ParameterSet aliParamBuildCfg =
253  theParameterSet.getParameter<edm::ParameterSet>("ParameterBuilder");
254  AlignmentParameterBuilder alignmentParameterBuilder(theAlignableTracker,
257  aliParamBuildCfg );
258  // Fix alignables if requested
259  if (stNFixAlignables_>0) alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
260 
261  // Get list of alignables
262  Alignables theAlignables = alignmentParameterBuilder.alignables();
263 
264  edm::LogInfo("Alignment") << "Constructed theAlignables calling alignmentParameterBuilder.alignables()";
265  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
266  << "got " << theAlignables.size() << " alignables";
267 
268  // Create AlignmentParameterStore
269  edm::ParameterSet aliParamStoreCfg =
271  theAlignmentParameterStore = new AlignmentParameterStore(theAlignables, aliParamStoreCfg);
272  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
273  << "AlignmentParameterStore created!";
274 
275  // Apply misalignment scenario to alignable tracker and muon if requested
276  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
278  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
279  << "Applying misalignment scenario to "
280  << (doTracker_ ? "tracker" : "")
281  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
282  edm::ParameterSet scenarioConfig
283  = theParameterSet.getParameter<edm::ParameterSet>( "MisalignmentScenario" );
284  if (doTracker_) {
285  TrackerScenarioBuilder scenarioBuilder( theAlignableTracker );
286  scenarioBuilder.applyScenario( scenarioConfig );
287  }
288  if (doMuon_) {
289  MuonScenarioBuilder muonScenarioBuilder( theAlignableMuon );
290  muonScenarioBuilder.applyScenario( scenarioConfig );
291  }
292  } else {
293  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::beginOfJob"
294  << "NOT applying misalignment scenario!";
295  }
296 
297  // Apply simple misalignment
298  const std::string sParSel(theParameterSet.getParameter<std::string>("parameterSelectorSimple"));
299  this->simpleMisalignment_(theAlignables, sParSel, stRandomShift_, stRandomRotation_, true);
300 
301  // Initialize alignment algorithm and integrated calibration and pass the latter to algorithm
302  theAlignmentAlgo->initialize( iSetup,
304  theAlignmentParameterStore );
305  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
307  }
308  // Not all algorithms support calibrations - so do not pass empty vector
309  // and throw if non-empty and not supported:
311  throw cms::Exception("BadConfig") << "[AlignmentProducer::beginOfJob]\n"
312  << "Configured " << theCalibrations.size() << " calibration(s) "
313  << "for algorithm not supporting it.";
314  }
315 
316  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
317  monitor != theMonitors.end(); ++monitor) {
318  (*monitor)->beginOfJob(theAlignableTracker, theAlignableMuon, theAlignmentParameterStore);
319  }
320 }
T getParameter(std::string const &) const
const bool doMisalignmentScenario_
Builds a scenario from configuration and applies it to the alignable Muon.
std::vector< Alignable * > Alignables
Definition: Alignable.h:251
AlignmentAlgorithmBase * theAlignmentAlgo
void simpleMisalignment_(const Alignables &alivec, const std::string &selection, float shift, float rot, bool local)
Apply random shifts and rotations to selected alignables, according to configuration.
std::vector< IntegratedCalibrationBase * > theCalibrations
edm::ParameterSet theParameterSet
void createGeometries_(const edm::EventSetup &)
Create tracker and muon geometries.
const bool applyDbAlignment_
virtual bool addCalibrations(const Calibrations &)
AlignableExtras * theAlignableExtras
std::vector< AlignmentMonitorBase * > theMonitors
AlignmentParameterStore * theAlignmentParameterStore
virtual void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)=0
Call at beginning of job (must be implemented in derived class)
Definition: DetId.h:18
AlignableMuon * theAlignableMuon
const double stRandomShift_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::shared_ptr< CSCGeometry > theMuonCSC
AlignableTracker * theAlignableTracker
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Builds a scenario from configuration and applies it to the alignable tracker.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
const double stRandomRotation_
void AlignmentProducer::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Called at run start and calling algorithms beginRun.

Reimplemented from edm::EDLooperBase.

Definition at line 537 of file AlignmentProducer.cc.

References AlignmentAlgorithmBase::beginRun(), and theAlignmentAlgo.

538 {
539  theAlignmentAlgo->beginRun(setup); // do not forward edm::Run...
540 }
virtual void beginRun(const edm::EventSetup &setup)
called at begin of run
AlignmentAlgorithmBase * theAlignmentAlgo
void AlignmentProducer::createGeometries_ ( const edm::EventSetup iSetup)
private

Create tracker and muon geometries.

Definition at line 646 of file AlignmentProducer.cc.

References TrackerGeomBuilderFromGeometricDet::build(), CSCGeometryBuilderFromDDD::build(), DTGeometryBuilderFromDDD::build(), doMuon_, doTracker_, edm::EventSetup::get(), edm::ESHandle< class >::product(), theMuonCSC, theMuonDT, and theTracker.

Referenced by beginOfJob().

647 {
649  iSetup.get<IdealGeometryRecord>().get( cpv );
650 
651  if (doTracker_) {
652  edm::ESHandle<GeometricDet> geometricDet;
653  iSetup.get<IdealGeometryRecord>().get( geometricDet );
654 
656  iSetup.get<PTrackerParametersRcd>().get( ptp );
657 
658  edm::ESHandle<TrackerTopology> tTopoHandle;
659  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
660  const TrackerTopology* const tTopo = tTopoHandle.product();
661 
662  TrackerGeomBuilderFromGeometricDet trackerBuilder;
663  theTracker = std::shared_ptr<TrackerGeometry>( trackerBuilder.build(&(*geometricDet), *ptp, tTopo ));
664  }
665 
666  if (doMuon_) {
668  iSetup.get<MuonNumberingRecord>().get(mdc);
669  DTGeometryBuilderFromDDD DTGeometryBuilder;
671  theMuonDT = std::make_shared<DTGeometry>();
672  DTGeometryBuilder.build( theMuonDT, &(*cpv), *mdc);
673  theMuonCSC = std::make_shared<CSCGeometry>();
674  CSCGeometryBuilder.build( theMuonCSC, &(*cpv), *mdc );
675  }
676 }
std::shared_ptr< TrackerGeometry > theTracker
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
std::shared_ptr< DTGeometry > theMuonDT
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void build(std::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
std::shared_ptr< CSCGeometry > theMuonCSC
void build(std::shared_ptr< DTGeometry > theGeometry, const DDCompactView *cview, const MuonDDDConstants &muonConstants)
edm::EDLooper::Status AlignmentProducer::duringLoop ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Called at each event.

Implements edm::EDLooper.

Definition at line 475 of file AlignmentProducer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotTag_, clusterValueMapTag_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::InputTag::encode(), ZMuMuCategoriesSequences_cff::eventInfo, edm::Event::getByLabel(), i, edm::EventBase::id(), AlignableExtras::initializeBeamSpot(), edm::EDLooperBase::kContinue, nevent_, readInSurveyRcds(), AlignmentAlgorithmBase::run(), theAlignableExtras, theAlignmentAlgo, theMonitors, and tjTkAssociationMapTag_.

477 {
478  ++nevent_;
479 
480  // reading in survey records
481  this->readInSurveyRcds(setup);
482 
483  // Printout event number
484  for ( int i=10; i<10000000; i*=10 )
485  if ( nevent_<10*i && (nevent_%i)==0 )
486  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
487  << "Events processed: " << nevent_;
488 
489  // Retrieve trajectories and tracks from the event
490  // -> merely skip if collection is empty
492  if (event.getByLabel(tjTkAssociationMapTag_, m_TrajTracksMap)) {
493 
494  // Form pairs of trajectories and tracks
495  ConstTrajTrackPairCollection trajTracks;
496  for ( TrajTrackAssociationCollection::const_iterator iPair = m_TrajTracksMap->begin();
497  iPair != m_TrajTracksMap->end(); ++iPair) {
498  trajTracks.push_back( ConstTrajTrackPair( &(*(*iPair).key), &(*(*iPair).val) ) );
499  }
501  event.getByLabel(beamSpotTag_, beamSpot);
502 
503  if (nevent_==1 && theAlignableExtras) {
504  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::duringLoop"
505  << "initializing AlignableBeamSpot" << std::endl;
506  theAlignableExtras->initializeBeamSpot(beamSpot->x0(), beamSpot->y0(), beamSpot->z0(),
507  beamSpot->dxdz(), beamSpot->dydz());
508  }
509 
510  // Run the alignment algorithm with its input
511  const AliClusterValueMap *clusterValueMapPtr = 0;
512  if(clusterValueMapTag_.encode().size()){//check that the input tag is not empty
513  edm::Handle<AliClusterValueMap> clusterValueMap;
514  event.getByLabel(clusterValueMapTag_, clusterValueMap);
515  clusterValueMapPtr = &(*clusterValueMap);
516  }
517 
518  const AlignmentAlgorithmBase::EventInfo eventInfo(event.id(), trajTracks, *beamSpot,
519  clusterValueMapPtr);
520  theAlignmentAlgo->run(setup, eventInfo);
521 
522 
523  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin();
524  monitor != theMonitors.end(); ++monitor) {
525  (*monitor)->duringLoop(event, setup, trajTracks); // forward eventInfo?
526  }
527  } else {
528  edm::LogError("Alignment") << "@SUB=AlignmentProducer::duringLoop"
529  << "No track collection found: skipping event";
530  }
531 
532 
533  return kContinue;
534 }
int i
Definition: DBlmapReader.cc:9
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)=0
Run the algorithm (must be implemented in derived class)
AlignmentAlgorithmBase * theAlignmentAlgo
void readInSurveyRcds(const edm::EventSetup &)
read in survey records
std::string encode() const
Definition: InputTag.cc:164
define event information passed to algorithms
AlignableExtras * theAlignableExtras
const edm::InputTag clusterValueMapTag_
std::vector< AlignmentMonitorBase * > theMonitors
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
const edm::InputTag beamSpotTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
const edm::InputTag tjTkAssociationMapTag_
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
edm::EventID id() const
Definition: EventBase.h:58
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void AlignmentProducer::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup setup 
)
virtual

Called at lumi block end, calling algorithm's endLuminosityBlock.

Reimplemented from edm::EDLooperBase.

Definition at line 569 of file AlignmentProducer.cc.

References AlignmentAlgorithmBase::endLuminosityBlock(), and theAlignmentAlgo.

571 {
572  theAlignmentAlgo->endLuminosityBlock(setup); // do not forward edm::LuminosityBlock
573 }
AlignmentAlgorithmBase * theAlignmentAlgo
virtual void endLuminosityBlock(const edm::EventSetup &setup)
called at end of luminosity block (no lumi block info passed yet)
void AlignmentProducer::endOfJob ( )
virtual

Called at end of job.

Reimplemented from edm::EDLooperBase.

Definition at line 324 of file AlignmentProducer.cc.

References AlignableExtras::beamSpot(), edm::ParameterSet::getParameter(), makeNonOverlappingRunRanges(), nevent_, AlignmentParameters::parameters(), cond::runnumber, saveApeToDB_, saveDeformationsToDB_, saveToDB_, AlignmentAlgorithmBase::setParametersForRunRange(), theAlignableExtras, theAlignmentAlgo, theCalibrations, theMonitors, theParameterSet, cond::timeTypeSpecs, and writeForRunRange().

325 {
326  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob";
327 
328  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
329  (*monitor)->endOfJob();
330  }
331 
332  if (0 == nevent_) {
333  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfJob" << "Did not process any "
334  << "events in last loop, do not dare to store to DB.";
335  } else {
336 
337  // Expand run ranges and make them unique
338  edm::VParameterSet runRangeSelectionVPSet(theParameterSet.getParameter<edm::VParameterSet>("RunRangeSelection"));
339  RunRanges uniqueRunRanges(this->makeNonOverlappingRunRanges(runRangeSelectionVPSet));
340  if (uniqueRunRanges.empty()) { // create dummy IOV
341  const RunRange runRange(cond::timeTypeSpecs[cond::runnumber].beginValue,
343  uniqueRunRanges.push_back(runRange);
344  }
345 
346  std::vector<AlgebraicVector> beamSpotParameters;
347 
348  for (RunRanges::const_iterator iRunRange = uniqueRunRanges.begin();
349  iRunRange != uniqueRunRanges.end();
350  ++iRunRange) {
351 
353 
354  // Save alignments to database
356  this->writeForRunRange((*iRunRange).first);
357 
358  // Deal with extra alignables, e.g. beam spot
359  if (theAlignableExtras) {
361  if (!alis.empty()) {
362  BeamSpotAlignmentParameters *beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
363  beamSpotParameters.push_back(beamSpotAliPars->parameters());
364  }
365  }
366  }
367 
368  if (theAlignableExtras) {
369  std::ostringstream bsOutput;
370 
371  std::vector<AlgebraicVector>::const_iterator itPar = beamSpotParameters.begin();
372  for (RunRanges::const_iterator iRunRange = uniqueRunRanges.begin();
373  iRunRange != uniqueRunRanges.end();
374  ++iRunRange, ++itPar) {
375  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
376  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
377  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
378  }
379 
380  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfJob"
381  << "Parameters for alignable beamspot:\n"
382  << bsOutput.str();
383  }
384 
385  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
386  (*iCal)->endOfJob();
387  }
388 
389  }
390 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
T getParameter(std::string const &) const
std::vector< Alignable * > Alignables
Definition: Alignable.h:251
AlignmentAlgorithmBase * theAlignmentAlgo
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
std::vector< IntegratedCalibrationBase * > theCalibrations
edm::ParameterSet theParameterSet
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignableExtras * theAlignableExtras
virtual bool setParametersForRunRange(const RunRange &rr)
std::pair< RunNumber, RunNumber > RunRange
std::vector< AlignmentMonitorBase * > theMonitors
RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet &RunRangeSelectionVPSet)
std::vector< RunRange > RunRanges
const bool saveDeformationsToDB_
void writeForRunRange(cond::Time_t time)
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.
edm::EDLooper::Status AlignmentProducer::endOfLoop ( const edm::EventSetup iSetup,
unsigned int  iLoop 
)
virtual

Called at end of loop.

Implements edm::EDLooperBase.

Definition at line 440 of file AlignmentProducer.cc.

References edm::EDLooperBase::kContinue, edm::EDLooperBase::kStop, nevent_, AlignmentAlgorithmBase::terminate(), theAlignmentAlgo, theCalibrations, theMaxLoops, and theMonitors.

441 {
442 
443  if (0 == nevent_) {
444  // beginOfJob is usually called by the framework in the first event of the first loop
445  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
446  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
447  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
448  // some geometry information that is not defined either without having seen an event.
449  edm::LogError("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
450  << "Did not process any events in loop " << iLoop
451  << ", stop processing without terminating algorithm.";
452  return kStop;
453  }
454 
455  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endOfLoop"
456  << "Ending loop " << iLoop << ", terminating algorithm.";
457 
458  theAlignmentAlgo->terminate(iSetup);
459  // FIXME: Should this be done in algorithm::terminate(const edm::EventSetup& iSetup)??
460  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
461  (*iCal)->endOfLoop();
462  }
463 
464  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
465  (*monitor)->endOfLoop(iSetup);
466  }
467 
468  if ( iLoop == theMaxLoops-1 || iLoop >= theMaxLoops ) return kStop;
469  else return kContinue;
470 }
AlignmentAlgorithmBase * theAlignmentAlgo
virtual void terminate(const edm::EventSetup &iSetup)=0
Call at end of each loop (must be implemented in derived class)
std::vector< IntegratedCalibrationBase * > theCalibrations
const unsigned int theMaxLoops
std::vector< AlignmentMonitorBase * > theMonitors
void AlignmentProducer::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

Called at run end - currently reading TkFittedLasBeam if an InpuTag is given for that.

Reimplemented from edm::EDLooperBase.

Definition at line 543 of file AlignmentProducer.cc.

References edm::InputTag::encode(), AlignmentAlgorithmBase::endRun(), edm::Run::getByLabel(), edm::RunBase::id(), theAlignmentAlgo, and tkLasBeamTag_.

544 {
545  // call with or without las beam info...
547  if (tkLasBeamTag_.encode().size()) { // non-empty InputTag
550  run.getByLabel(tkLasBeamTag_, lasBeams);
551  run.getByLabel(tkLasBeamTag_, tsoses);
552 
553  theAlignmentAlgo->endRun(EndRunInfo(run.id(), &(*lasBeams), &(*tsoses)), setup);
554  } else {
555  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::endRun"
556  << "No Tk LAS beams to forward to algorithm.";
557  theAlignmentAlgo->endRun(EndRunInfo(run.id(), 0, 0), setup);
558  }
559 }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:201
RunID const & id() const
Definition: RunBase.h:39
AlignmentAlgorithmBase * theAlignmentAlgo
const edm::InputTag tkLasBeamTag_
std::string encode() const
Definition: InputTag.cc:164
virtual void endRun(const EndRunInfo &runInfo, const edm::EventSetup &setup)
called at end of run - order of arguments like in EDProducer etc.
AlignmentAlgorithmBase::EndRunInfo EndRunInfo
define run information passed to algorithms (in endRun)
AlignmentProducer::RunRanges AlignmentProducer::makeNonOverlappingRunRanges ( const edm::VParameterSet RunRangeSelectionVPSet)
private

Definition at line 970 of file AlignmentProducer.cc.

References cond::TimeTypeSpecs::beginValue, cond::TimeTypeSpecs::endValue, plotBeamSpotDB::first, i, cond::runnumber, groupFilesInBlocks::temp, cond::timeTypeSpecs, and edm::tokenize().

Referenced by endOfJob().

971 {
972  static bool oldRunRangeSelectionWarning = false;
973 
976 
977  RunRanges uniqueRunRanges;
978  if (!RunRangeSelectionVPSet.empty()) {
979 
980  std::map<RunNumber,RunNumber> uniqueFirstRunNumbers;
981 
982  for (std::vector<edm::ParameterSet>::const_iterator ipset = RunRangeSelectionVPSet.begin();
983  ipset != RunRangeSelectionVPSet.end();
984  ++ipset) {
985  const std::vector<std::string> RunRangeStrings = (*ipset).getParameter<std::vector<std::string> >("RunRanges");
986  for (std::vector<std::string>::const_iterator irange = RunRangeStrings.begin();
987  irange != RunRangeStrings.end();
988  ++irange) {
989 
990  if ((*irange).find(':')==std::string::npos) {
991 
992  RunNumber first = beginValue;
993  long int temp = strtol((*irange).c_str(), 0, 0);
994  if (temp!=-1) first = temp;
995  uniqueFirstRunNumbers[first] = first;
996 
997  } else {
998 
999  if (!oldRunRangeSelectionWarning) {
1000  edm::LogWarning("BadConfig") << "@SUB=AlignmentProducer::makeNonOverlappingRunRanges"
1001  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
1002  << "number is used internally. The number of the last run is ignored and can be\n"
1003  << "safely removed from the config file.\n";
1004  oldRunRangeSelectionWarning = true;
1005  }
1006 
1007  std::vector<std::string> tokens = edm::tokenize(*irange, ":");
1008  long int temp;
1009  RunNumber first = beginValue;
1010  temp = strtol(tokens[0].c_str(), 0, 0);
1011  if (temp!=-1) first = temp;
1012  uniqueFirstRunNumbers[first] = first;
1013  }
1014  }
1015  }
1016 
1017  for (std::map<RunNumber,RunNumber>::iterator iFirst = uniqueFirstRunNumbers.begin();
1018  iFirst!=uniqueFirstRunNumbers.end();
1019  ++iFirst) {
1020  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>((*iFirst).first, endValue));
1021  }
1022  for (unsigned int i = 0;i<uniqueRunRanges.size()-1;++i) {
1023  uniqueRunRanges[i].second = uniqueRunRanges[i+1].first - 1;
1024  }
1025 
1026  } else {
1027 
1028  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>(beginValue, endValue));
1029 
1030  }
1031 
1032  return uniqueRunRanges;
1033 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
int i
Definition: DBlmapReader.cc:9
Time_t beginValue
Definition: Time.h:45
std::vector< RunRange > RunRanges
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
Definition: Parse.cc:57
Time_t endValue
Definition: Time.h:46
cond::RealTimeType< cond::runnumber >::type RunNumber
std::shared_ptr< CSCGeometry > AlignmentProducer::produceCSC ( const MuonGeometryRecord iRecord)
virtual

Produce the muon CSC geometry.

Definition at line 190 of file AlignmentProducer.cc.

References theMuonCSC.

Referenced by AlignmentProducer().

191 {
192  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceCSC";
193  return theMuonCSC;
194 }
std::shared_ptr< CSCGeometry > theMuonCSC
std::shared_ptr< DTGeometry > AlignmentProducer::produceDT ( const MuonGeometryRecord iRecord)
virtual

Produce the muon DT geometry.

Definition at line 181 of file AlignmentProducer.cc.

References theMuonDT.

Referenced by AlignmentProducer().

182 {
183  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceDT";
184  return theMuonDT;
185 }
std::shared_ptr< DTGeometry > theMuonDT
std::shared_ptr< TrackerGeometry > AlignmentProducer::produceTracker ( const TrackerDigiGeometryRecord iRecord)
virtual

Produce the tracker geometry.

Definition at line 172 of file AlignmentProducer.cc.

References theTracker.

Referenced by AlignmentProducer().

173 {
174  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::produceTracker";
175  return theTracker;
176 }
std::shared_ptr< TrackerGeometry > theTracker
void AlignmentProducer::readInSurveyRcds ( const edm::EventSetup iSetup)
private

read in survey records

Definition at line 711 of file AlignmentProducer.cc.

References addSurveyInfo_(), edm::ESWatcher< T >::check(), AlignableMuon::CSCEndcaps(), doMuon_, doTracker_, AlignableMuon::DTBarrel(), edm::EventSetup::get(), theAlignableMuon, theAlignableTracker, theSurveyErrors, theSurveyIndex, theSurveyValues, useSurvey_, watchTkSurveyErrRcd_, and watchTkSurveyRcd_.

Referenced by duringLoop().

711  {
712 
713  // Get Survey Rcds and add Survey Info
714  if ( doTracker_ && useSurvey_ ){
715  bool tkSurveyBool = watchTkSurveyRcd_.check(iSetup);
716  bool tkSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
717  edm::LogInfo("Alignment") << "watcher tksurveyrcd: " << tkSurveyBool;
718  edm::LogInfo("Alignment") << "watcher tksurveyerrrcd: " << tkSurveyErrBool;
719  if ( tkSurveyBool || tkSurveyErrBool){
720 
721  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
723  edm::ESHandle<SurveyErrors> surveyErrors;
724 
725  iSetup.get<TrackerSurveyRcd>().get(surveys);
726  iSetup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
727 
728  theSurveyIndex = 0;
729  theSurveyValues = &*surveys;
730  theSurveyErrors = &*surveyErrors;
732  }
733  }
734 
735  if ( doMuon_ && useSurvey_) {
736  bool DTSurveyBool = watchTkSurveyRcd_.check(iSetup);
737  bool DTSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
738  bool CSCSurveyBool = watchTkSurveyRcd_.check(iSetup);
739  bool CSCSurveyErrBool = watchTkSurveyErrRcd_.check(iSetup);
740 
741  if ( DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool ){
742  edm::ESHandle<Alignments> dtSurveys;
743  edm::ESHandle<SurveyErrors> dtSurveyErrors;
744  edm::ESHandle<Alignments> cscSurveys;
745  edm::ESHandle<SurveyErrors> cscSurveyErrors;
746 
747  iSetup.get<DTSurveyRcd>().get(dtSurveys);
748  iSetup.get<DTSurveyErrorExtendedRcd>().get(dtSurveyErrors);
749  iSetup.get<CSCSurveyRcd>().get(cscSurveys);
750  iSetup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
751 
752  theSurveyIndex = 0;
753  theSurveyValues = &*dtSurveys;
754  theSurveyErrors = &*dtSurveyErrors;
755  std::vector<Alignable*> barrels = theAlignableMuon->DTBarrel();
756  for (std::vector<Alignable*>::const_iterator iter = barrels.begin(); iter != barrels.end(); ++iter) {
757  addSurveyInfo_(*iter);
758  }
759 
760  theSurveyIndex = 0;
761  theSurveyValues = &*cscSurveys;
762  theSurveyErrors = &*cscSurveyErrors;
763  std::vector<Alignable*> endcaps = theAlignableMuon->CSCEndcaps();
764  for (std::vector<Alignable*>::const_iterator iter = endcaps.begin(); iter != endcaps.end(); ++iter) {
765  addSurveyInfo_(*iter);
766  }
767  }
768  }
769 
770 }
align::Alignables DTBarrel()
const Alignments * theSurveyValues
void addSurveyInfo_(Alignable *)
Add survey info to an alignable.
align::Alignables CSCEndcaps()
unsigned int theSurveyIndex
const SurveyErrors * theSurveyErrors
AlignableMuon * theAlignableMuon
const T & get() const
Definition: EventSetup.h:56
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd_
AlignableTracker * theAlignableTracker
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrRcd_
void AlignmentProducer::simpleMisalignment_ ( const Alignables alivec,
const std::string &  selection,
float  shift,
float  rot,
bool  local 
)
private

Apply random shifts and rotations to selected alignables, according to configuration.

Definition at line 577 of file AlignmentProducer.cc.

References funct::abs(), Alignable::alignmentParameters(), AlignmentParameterSelector::convertParamSel(), RigidBodyAlignmentParameters::dalpha, RigidBodyAlignmentParameters::dbeta, RigidBodyAlignmentParameters::dgamma, RigidBodyAlignmentParameters::dx, RigidBodyAlignmentParameters::dy, RigidBodyAlignmentParameters::dz, Exception, Alignable::move(), RigidBodyAlignmentParameters::N_PARAM, convertSQLitetoXML_cfg::output, alignCSCRings::r, random, Alignable::rotateInGlobalFrame(), Alignable::rotateInLocalFrame(), indexGen::s2, AlignmentParameters::selector(), Alignable::surface(), AlignableSurface::toGlobal(), and align::toMatrix().

Referenced by beginOfJob().

579 {
580 
581  std::ostringstream output; // collecting output
582 
583  if (shift > 0. || rot > 0.) {
584  output << "Adding random flat shift of max size " << shift
585  << " and adding random flat rotation of max size " << rot <<" to ";
586 
587  std::vector<bool> commSel(0);
588  if (selection != "-1") {
589  AlignmentParameterSelector aSelector(0,0); // no alignable needed here...
590  const std::vector<char> cSel(aSelector.convertParamSel(selection));
591  if (cSel.size() < RigidBodyAlignmentParameters::N_PARAM) {
592  throw cms::Exception("BadConfig")
593  << "[AlignmentProducer::simpleMisalignment_]\n"
594  << "Expect selection string '" << selection << "' to be at least of length "
595  << RigidBodyAlignmentParameters::N_PARAM << " or to be '-1'.\n"
596  << "(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
597  }
598  for (std::vector<char>::const_iterator cIter = cSel.begin(); cIter != cSel.end(); ++cIter) {
599  commSel.push_back(*cIter == '0' ? false : true);
600  }
601  output << "parameters defined by (" << selection
602  << "), representing (x,y,z,alpha,beta,gamma),";
603  } else {
604  output << "the active parameters of each alignable,";
605  }
606  output << " in " << (local ? "local" : "global") << " frame.";
607 
608  for (std::vector<Alignable*>::const_iterator it = alivec.begin(); it != alivec.end(); ++it) {
609  Alignable* ali=(*it);
610  std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
611 
612  if (std::abs(shift)>0.00001) {
613  double s0 = 0., s1 = 0., s2 = 0.;
614  if (mysel[RigidBodyAlignmentParameters::dx]) s0 = shift * double(random()%1000-500)/500.;
615  if (mysel[RigidBodyAlignmentParameters::dy]) s1 = shift * double(random()%1000-500)/500.;
616  if (mysel[RigidBodyAlignmentParameters::dz]) s2 = shift * double(random()%1000-500)/500.;
617 
618  if (local) ali->move( ali->surface().toGlobal(align::LocalVector(s0,s1,s2)) );
619  else ali->move( align::GlobalVector(s0,s1,s2) );
620 
621  //AlignmentPositionError ape(dx,dy,dz);
622  //ali->addAlignmentPositionError(ape);
623  }
624 
625  if (std::abs(rot)>0.00001) {
627  if (mysel[RigidBodyAlignmentParameters::dalpha]) r(1)=rot*double(random()%1000-500)/500.;
628  if (mysel[RigidBodyAlignmentParameters::dbeta]) r(2)=rot*double(random()%1000-500)/500.;
629  if (mysel[RigidBodyAlignmentParameters::dgamma]) r(3)=rot*double(random()%1000-500)/500.;
630 
631  const align::RotationType mrot = align::toMatrix(r);
632  if (local) ali->rotateInLocalFrame(mrot);
633  else ali->rotateInGlobalFrame(mrot);
634 
635  //ali->addAlignmentPositionErrorFromRotation(mrot);
636  }
637  } // end loop on alignables
638  } else {
639  output << "No simple misalignment added!";
640  }
641  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::simpleMisalignment_" << output.str();
642 }
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:120
selection
main part
Definition: corrVsCorr.py:98
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
TRandom random
Definition: MVATrainer.cc:138
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
tuple s2
Definition: indexGen.py:106
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
AlgebraicVector EulerAngles
Definition: Definitions.h:36
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
static unsigned int const shift
void AlignmentProducer::startingNewLoop ( unsigned int  iLoop)
virtual

Called at beginning of loop.

Implements edm::EDLooperBase.

Definition at line 394 of file AlignmentProducer.cc.

References AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), GeometryAligner::applyAlignments(), GeometryAligner::attachSurfaceDeformations(), AlignableMuon::cscAlignmentErrorsExtended(), AlignableMuon::cscAlignments(), doMuon_, doTracker_, AlignableMuon::dtAlignmentErrorsExtended(), AlignableMuon::dtAlignments(), nevent_, AlignmentAlgorithmBase::startNewLoop(), Alignable::surfaceDeformations(), theAlignableMuon, theAlignableTracker, theAlignmentAlgo, theCalibrations, and theMonitors.

395 {
396  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
397  << "Starting loop number " << iLoop;
398 
399  nevent_ = 0;
400 
402  // FIXME: Should this be done in algorithm::startNewLoop()??
403  for (auto iCal = theCalibrations.begin(); iCal != theCalibrations.end(); ++iCal) {
404  (*iCal)->startNewLoop();
405  }
406 
407  for (std::vector<AlignmentMonitorBase*>::const_iterator monitor = theMonitors.begin(); monitor != theMonitors.end(); ++monitor) {
408  (*monitor)->startingNewLoop();
409  }
410 
411  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::startingNewLoop"
412  << "Now physically apply alignments to geometry...";
413 
414 
415  // Propagate changes to reconstruction geometry (from initialisation or iteration)
416  GeometryAligner aligner;
417  if ( doTracker_ ) {
418  std::auto_ptr<Alignments> alignments(theAlignableTracker->alignments());
419  std::auto_ptr<AlignmentErrorsExtended> alignmentErrors(theAlignableTracker->alignmentErrors());
420  aligner.applyAlignments<TrackerGeometry>( &(*theTracker),&(*alignments),&(*alignmentErrors), AlignTransform() ); // don't apply global a second time!
421  std::auto_ptr<AlignmentSurfaceDeformations> aliDeforms(theAlignableTracker->surfaceDeformations());
422  aligner.attachSurfaceDeformations<TrackerGeometry>(&(*theTracker), &(*aliDeforms));
423 
424  }
425  if ( doMuon_ ) {
426  std::auto_ptr<Alignments> dtAlignments( theAlignableMuon->dtAlignments());
427  std::auto_ptr<AlignmentErrorsExtended> dtAlignmentErrorsExtended( theAlignableMuon->dtAlignmentErrorsExtended());
428  std::auto_ptr<Alignments> cscAlignments( theAlignableMuon->cscAlignments());
429  std::auto_ptr<AlignmentErrorsExtended> cscAlignmentErrorsExtended( theAlignableMuon->cscAlignmentErrorsExtended());
430 
431  aligner.applyAlignments<DTGeometry>( &(*theMuonDT), &(*dtAlignments), &(*dtAlignmentErrorsExtended), AlignTransform() ); // don't apply global a second time!
432  aligner.applyAlignments<CSCGeometry>( &(*theMuonCSC), &(*cscAlignments), &(*cscAlignmentErrorsExtended), AlignTransform() ); // nope!
433  }
434 }
AlignmentAlgorithmBase * theAlignmentAlgo
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Class to update a given geometry with a set of alignments.
std::vector< IntegratedCalibrationBase * > theCalibrations
Alignments * dtAlignments()
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
std::vector< AlignmentMonitorBase * > theMonitors
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:245
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
AlignableMuon * theAlignableMuon
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Alignments * cscAlignments()
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
AlignableTracker * theAlignableTracker
Alignments * alignments() const
Return alignments, sorted by DetId.
void AlignmentProducer::writeDB ( Alignments alignments,
const std::string &  alignRcd,
AlignmentErrorsExtended alignmentErrors,
const std::string &  errRcd,
const AlignTransform globalCoordinates,
cond::Time_t  time 
) const
private

Write alignment and/or errors to DB for record names (removes *globalCoordinates before writing if non-null...). Takes over ownership of alignments and alignmentErrrors.

Definition at line 892 of file AlignmentProducer.cc.

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

Referenced by writeForRunRange().

898 {
899  Alignments * tempAlignments = alignments;
900  AlignmentErrorsExtended * tempAlignmentErrorsExtended = alignmentErrors;
901 
902  // Call service
904  if (!poolDb.isAvailable()) { // Die if not available
905  delete tempAlignments; // promised to take over ownership...
906  delete tempAlignmentErrorsExtended; // dito
907  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
908  }
909 
910  if (globalCoordinates // happens only if (applyDbAlignment_ == true)
911  && globalCoordinates->transform() != AlignTransform::Transform::Identity) {
912 
913  tempAlignments = new Alignments(); // temporary storage for
914  tempAlignmentErrorsExtended = new AlignmentErrorsExtended(); // final alignments and errors
915 
916  GeometryAligner aligner;
917  aligner.removeGlobalTransform(alignments, alignmentErrors,
918  *globalCoordinates,
919  tempAlignments, tempAlignmentErrorsExtended);
920 
921  delete alignments; // have to delete original alignments
922  delete alignmentErrors; // same thing for the errors
923 
924  edm::LogInfo("Alignment") << "@SUB=AlignmentProducer::writeDB"
925  << "globalCoordinates removed from alignments (" << alignRcd
926  << ") and errors (" << alignRcd << ").";
927  }
928 
929  if (saveToDB_) {
930  edm::LogInfo("Alignment") << "Writing Alignments for run " << time
931  << " to " << alignRcd << ".";
932  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
933  } else { // poolDb->writeOne(..) takes over 'alignments' ownership,...
934  delete tempAlignments; // ...otherwise we have to delete, as promised!
935  }
936 
937  if (saveApeToDB_) {
938  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run " << time
939  << " to " << errRcd << ".";
940  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrorsExtended, time, errRcd);
941  } else { // poolDb->writeOne(..) takes over 'alignmentErrors' ownership,...
942  delete tempAlignmentErrorsExtended; // ...otherwise we have to delete, as promised!
943  }
944 }
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:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
Transform transform() const
void AlignmentProducer::writeDB ( AlignmentSurfaceDeformations alignmentSurfaceDeformations,
const std::string &  surfaceDeformationRcd,
cond::Time_t  time 
) const
private

Write surface deformations (bows & kinks) to DB for given record name Takes over ownership of alignmentsurfaceDeformations.

Definition at line 948 of file AlignmentProducer.cc.

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

951 {
952  // Call service
954  if (!poolDb.isAvailable()) { // Die if not available
955  delete alignmentSurfaceDeformations; // promised to take over ownership...
956  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
957  }
958 
959  if (saveDeformationsToDB_) {
960  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run " << time
961  << " to " << surfaceDeformationRcd << ".";
962  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
963  surfaceDeformationRcd);
964  } else { // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
965  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
966  }
967 }
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
const bool saveDeformationsToDB_
void AlignmentProducer::writeForRunRange ( cond::Time_t  time)
private

Definition at line 847 of file AlignmentProducer.cc.

References AlignableTracker::alignmentErrors(), AlignableTracker::alignments(), AlignableMuon::cscAlignmentErrorsExtended(), AlignableMuon::cscAlignments(), align::DetectorGlobalPosition(), doMuon_, doTracker_, AlignableMuon::dtAlignmentErrorsExtended(), AlignableMuon::dtAlignments(), globalPositions_, DetId::Muon, saveDeformationsToDB_, Alignable::surfaceDeformations(), theAlignableMuon, theAlignableTracker, DetId::Tracker, and writeDB().

Referenced by endOfJob().

848 {
849  if ( doTracker_ ) { // first tracker
850  const AlignTransform *trackerGlobal = 0; // will be 'removed' from constants
851  if (globalPositions_) { // i.e. applied before in applyDB
854  }
855 
856  Alignments *alignments = theAlignableTracker->alignments();
858  this->writeDB(alignments, "TrackerAlignmentRcd",
859  alignmentErrors, "TrackerAlignmentErrorExtendedRcd", trackerGlobal,
860  time);
861  }
862 
863  if ( doMuon_ ) { // now muon
864  const AlignTransform *muonGlobal = 0; // will be 'removed' from constants
865  if (globalPositions_) { // i.e. applied before in applyDB
867  DetId(DetId::Muon));
868  }
869  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
870  Alignments *alignments = theAlignableMuon->dtAlignments();
872  this->writeDB(alignments, "DTAlignmentRcd",
873  alignmentErrors, "DTAlignmentErrorExtendedRcd", muonGlobal,
874  time);
875 
876  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
877  alignments = theAlignableMuon->cscAlignments();
878  alignmentErrors = theAlignableMuon->cscAlignmentErrorsExtended();
879  this->writeDB(alignments, "CSCAlignmentRcd",
880  alignmentErrors, "CSCAlignmentErrorExtendedRcd", muonGlobal,
881  time);
882  }
883 
884  // Save surface deformations to database
886  AlignmentSurfaceDeformations *alignmentSurfaceDeformations = theAlignableTracker->surfaceDeformations();
887  this->writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
888  }
889 }
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
void writeDB(Alignments *alignments, const std::string &alignRcd, AlignmentErrorsExtended *alignmentErrors, const std::string &errRcd, const AlignTransform *globalCoordinates, cond::Time_t time) const
Alignments * dtAlignments()
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:245
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Definition: DetId.h:18
AlignableMuon * theAlignableMuon
const bool saveDeformationsToDB_
Alignments * cscAlignments()
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
AlignableTracker * theAlignableTracker
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Alignments * alignments() const
Return alignments, sorted by DetId.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.

Member Data Documentation

const bool AlignmentProducer::applyDbAlignment_
private

Definition at line 182 of file AlignmentProducer.h.

Referenced by beginOfJob().

const edm::InputTag AlignmentProducer::beamSpotTag_
private

Definition at line 190 of file AlignmentProducer.h.

Referenced by duringLoop().

const bool AlignmentProducer::checkDbAlignmentValidity_
private

Definition at line 182 of file AlignmentProducer.h.

Referenced by applyDB().

const edm::InputTag AlignmentProducer::clusterValueMapTag_
private

Definition at line 192 of file AlignmentProducer.h.

Referenced by duringLoop().

const bool AlignmentProducer::doMisalignmentScenario_
private

Definition at line 183 of file AlignmentProducer.h.

Referenced by beginOfJob().

const bool AlignmentProducer::doMuon_
private
const bool AlignmentProducer::doTracker_
private
const Alignments* AlignmentProducer::globalPositions_
private

GlobalPositions that might be read from DB, NULL otherwise.

Definition at line 171 of file AlignmentProducer.h.

Referenced by beginOfJob(), writeForRunRange(), and ~AlignmentProducer().

int AlignmentProducer::nevent_
private

Definition at line 173 of file AlignmentProducer.h.

Referenced by duringLoop(), endOfJob(), endOfLoop(), and startingNewLoop().

const bool AlignmentProducer::saveApeToDB_
private

Definition at line 184 of file AlignmentProducer.h.

Referenced by endOfJob(), and writeDB().

const bool AlignmentProducer::saveDeformationsToDB_
private

Definition at line 184 of file AlignmentProducer.h.

Referenced by endOfJob(), writeDB(), and writeForRunRange().

const bool AlignmentProducer::saveToDB_
private

Definition at line 184 of file AlignmentProducer.h.

Referenced by endOfJob(), and writeDB().

const int AlignmentProducer::stNFixAlignables_
private

Definition at line 180 of file AlignmentProducer.h.

Referenced by beginOfJob().

const double AlignmentProducer::stRandomRotation_
private

Definition at line 181 of file AlignmentProducer.h.

Referenced by beginOfJob().

const double AlignmentProducer::stRandomShift_
private

Definition at line 181 of file AlignmentProducer.h.

Referenced by beginOfJob().

AlignableExtras* AlignmentProducer::theAlignableExtras
private

Definition at line 163 of file AlignmentProducer.h.

Referenced by beginOfJob(), duringLoop(), endOfJob(), and ~AlignmentProducer().

AlignableMuon* AlignmentProducer::theAlignableMuon
private
AlignableTracker* AlignmentProducer::theAlignableTracker
private
AlignmentAlgorithmBase* AlignmentProducer::theAlignmentAlgo
private
AlignmentParameterStore* AlignmentProducer::theAlignmentParameterStore
private

Definition at line 159 of file AlignmentProducer.h.

Referenced by beginOfJob(), and ~AlignmentProducer().

std::vector<IntegratedCalibrationBase*> AlignmentProducer::theCalibrations
private
const unsigned int AlignmentProducer::theMaxLoops
private

Definition at line 178 of file AlignmentProducer.h.

Referenced by endOfLoop().

std::vector<AlignmentMonitorBase*> AlignmentProducer::theMonitors
private
std::shared_ptr<CSCGeometry> AlignmentProducer::theMuonCSC
private

Definition at line 169 of file AlignmentProducer.h.

Referenced by beginOfJob(), createGeometries_(), and produceCSC().

std::shared_ptr<DTGeometry> AlignmentProducer::theMuonDT
private

Definition at line 168 of file AlignmentProducer.h.

Referenced by beginOfJob(), createGeometries_(), and produceDT().

edm::ParameterSet AlignmentProducer::theParameterSet
private

Definition at line 174 of file AlignmentProducer.h.

Referenced by beginOfJob(), and endOfJob().

const SurveyErrors* AlignmentProducer::theSurveyErrors
private

Definition at line 156 of file AlignmentProducer.h.

Referenced by addSurveyInfo_(), and readInSurveyRcds().

unsigned int AlignmentProducer::theSurveyIndex
private

Definition at line 154 of file AlignmentProducer.h.

Referenced by addSurveyInfo_(), and readInSurveyRcds().

const Alignments* AlignmentProducer::theSurveyValues
private

Definition at line 155 of file AlignmentProducer.h.

Referenced by addSurveyInfo_(), and readInSurveyRcds().

std::shared_ptr<TrackerGeometry> AlignmentProducer::theTracker
private

Definition at line 167 of file AlignmentProducer.h.

Referenced by beginOfJob(), createGeometries_(), and produceTracker().

const edm::InputTag AlignmentProducer::tjTkAssociationMapTag_
private

Definition at line 189 of file AlignmentProducer.h.

Referenced by duringLoop().

const edm::InputTag AlignmentProducer::tkLasBeamTag_
private

Definition at line 191 of file AlignmentProducer.h.

Referenced by endRun().

const bool AlignmentProducer::useExtras_
private

Definition at line 185 of file AlignmentProducer.h.

Referenced by beginOfJob().

const bool AlignmentProducer::useSurvey_
private

Definition at line 186 of file AlignmentProducer.h.

Referenced by readInSurveyRcds().

edm::ESWatcher<CSCSurveyErrorExtendedRcd> AlignmentProducer::watchCSCSurveyErrRcd_
private

Definition at line 200 of file AlignmentProducer.h.

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

Definition at line 199 of file AlignmentProducer.h.

edm::ESWatcher<DTSurveyErrorExtendedRcd> AlignmentProducer::watchDTSurveyErrRcd_
private

Definition at line 198 of file AlignmentProducer.h.

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

Definition at line 197 of file AlignmentProducer.h.

edm::ESWatcher<TrackerSurveyErrorExtendedRcd> AlignmentProducer::watchTkSurveyErrRcd_
private

Definition at line 196 of file AlignmentProducer.h.

Referenced by readInSurveyRcds().

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

Definition at line 195 of file AlignmentProducer.h.

Referenced by readInSurveyRcds().