CMS 3D CMS Logo

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

#include <PCLTrackerAlProducer.h>

Inheritance diagram for PCLTrackerAlProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endJob () override
 
virtual void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
 PCLTrackerAlProducer (const edm::ParameterSet &)
 Constructor. More...
 
virtual ~PCLTrackerAlProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

const bool applyDbAlignment_
 
const edm::InputTag beamSpotTag_
 BeamSpot. More...
 
const bool checkDbAlignmentValidity_
 
const edm::InputTag clusterValueMapTag_
 ValueMap containing associtaion cluster-flag. More...
 
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_
 
AlignmentAlgorithmBasetheAlignmentAlgo
 
AlignmentParameterStoretheAlignmentParameterStore
 
edm::Handle< reco::BeamSpottheBeamSpot
 
Calibrations theCalibrations
 
AlignableExtrastheExtraAlignables
 
cond::Time_t theFirstRun
 
AlignmentMonitors theMonitors
 
AlignableMuontheMuonAlignables
 
boost::shared_ptr< CSCGeometrytheMuonCSCGeometry
 
boost::shared_ptr< DTGeometrytheMuonDTGeometry
 
edm::ParameterSet theParameterSet
 
const SurveyErrorstheSurveyErrors
 
size_t theSurveyIndex
 
const AlignmentstheSurveyValues
 
AlignableTrackertheTrackerAlignables
 
boost::shared_ptr
< TrackerGeometry
theTrackerGeometry
 
const edm::InputTag tjTkAssociationMapTag_
 Map with tracks/trajectories. More...
 
const edm::InputTag tkLasBeamTag_
 LAS beams in edm::Run (ignore if empty) More...
 
const bool useExtras_
 
const bool useSurvey_
 
edm::ESWatcher
< CSCAlignmentErrorExtendedRcd
watchCSCAlErrExtRcd
 
edm::ESWatcher< CSCAlignmentRcdwatchCSCAlRcd
 
edm::ESWatcher
< CSCSurveyErrorExtendedRcd
watchCSCSurveyErrExtRcd
 
edm::ESWatcher< CSCSurveyRcdwatchCSCSurveyRcd
 
edm::ESWatcher
< DTAlignmentErrorExtendedRcd
watchDTAlErrExtRcd
 
edm::ESWatcher< DTAlignmentRcdwatchDTAlRcd
 
edm::ESWatcher
< DTSurveyErrorExtendedRcd
watchDTSurveyErrExtRcd
 
edm::ESWatcher< DTSurveyRcdwatchDTSurveyRcd
 
edm::ESWatcher< GlobalPositionRcdwatchGlobalPositionRcd
 
edm::ESWatcher
< IdealGeometryRecord
watchIdealGeometryRcd
 
edm::ESWatcher
< TrackerSurveyErrorExtendedRcd
watchTkSurveyErrExtRcd
 
edm::ESWatcher< TrackerSurveyRcdwatchTkSurveyRcd
 
edm::ESWatcher
< TrackerAlignmentErrorExtendedRcd
watchTrackerAlErrorExtRcd
 
edm::ESWatcher
< TrackerAlignmentRcd
watchTrackerAlRcd
 
edm::ESWatcher
< TrackerSurfaceDeformationRcd
watchTrackerSurDeRcd
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 82 of file PCLTrackerAlProducer.h.

Constructor & Destructor Documentation

PCLTrackerAlProducer::PCLTrackerAlProducer ( const edm::ParameterSet config)

Constructor.

Definition at line 61 of file PCLTrackerAlProducer.cc.

61  :
68 
69  /* Steering parameters */
70  theParameterSet(config),
71  stNFixAlignables_ (config.getParameter<int> ("nFixAlignables")),
72  stRandomShift_ (config.getParameter<double> ("randomShift")),
73  stRandomRotation_ (config.getParameter<double> ("randomRotation")),
74  applyDbAlignment_ (config.getUntrackedParameter<bool>("applyDbAlignment")),
75  checkDbAlignmentValidity_(config.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
76  doMisalignmentScenario_ (config.getParameter<bool> ("doMisalignmentScenario")),
77  saveToDB_ (config.getParameter<bool> ("saveToDB")),
78  saveApeToDB_ (config.getParameter<bool> ("saveApeToDB")),
79  saveDeformationsToDB_ (config.getParameter<bool> ("saveDeformationsToDB")),
80  doTracker_ (config.getUntrackedParameter<bool>("doTracker") ),
81  doMuon_ (config.getUntrackedParameter<bool>("doMuon") ),
82  useExtras_ (config.getUntrackedParameter<bool>("useExtras")),
83  useSurvey_ (config.getParameter<bool> ("useSurvey")),
84 
85  /* Event input tags */
86  tjTkAssociationMapTag_ (config.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
87  beamSpotTag_ (config.getParameter<edm::InputTag>("beamSpotTag")),
88  tkLasBeamTag_ (config.getParameter<edm::InputTag>("tkLasBeamTag")),
89  clusterValueMapTag_ (config.getParameter<edm::InputTag>("hitPrescaleMapTag")),
91 {
93  createCalibrations (config);
94  createMonitors (config);
95 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
AlignableMuon * theMuonAlignables
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void createCalibrations(const edm::ParameterSet &)
Creates the calibrations (specified in config-file)
AlignableExtras * theExtraAlignables
AlignmentAlgorithmBase * theAlignmentAlgo
AlignmentParameterStore * theAlignmentParameterStore
const edm::InputTag beamSpotTag_
BeamSpot.
void createMonitors(const edm::ParameterSet &)
Creates the monitors (specified in config-file)
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
const edm::InputTag tjTkAssociationMapTag_
Map with tracks/trajectories.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
void createAlignmentAlgorithm(const edm::ParameterSet &)
Creates the choosen alignment algorithm (specified in config-file)
AlignableTracker * theTrackerAlignables
const edm::InputTag tkLasBeamTag_
LAS beams in edm::Run (ignore if empty)
edm::ParameterSet theParameterSet
PCLTrackerAlProducer::~PCLTrackerAlProducer ( )
virtual

Destructor.

Definition at line 99 of file PCLTrackerAlProducer.cc.

100 {
101  delete theAlignmentAlgo;
102 
103  for (auto iCal = theCalibrations.begin();
104  iCal != theCalibrations.end();
105  ++iCal) {
106  delete *iCal;
107  }
108 
109  // TODO: Delete monitors as well?
110 
112  delete theTrackerAlignables;
113  delete theMuonAlignables;
114  delete theExtraAlignables;
115  delete globalPositions_;
116 }
AlignableMuon * theMuonAlignables
AlignableExtras * theExtraAlignables
AlignmentAlgorithmBase * theAlignmentAlgo
AlignmentParameterStore * theAlignmentParameterStore
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
AlignableTracker * theTrackerAlignables

Member Function Documentation

void PCLTrackerAlProducer::addSurveyInfo ( Alignable alignable)
private

Adds survey info to an Alignable.

Definition at line 922 of file PCLTrackerAlProducer.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), relativeConstraints::error, Exception, i, Alignable::id(), AlignableSurface::length(), SurveyError::matrix(), SurveyError::rawId(), makeMuonMisalignmentScenario::rot, AlignableSurface::setLength(), Alignable::setSurvey(), AlignableSurface::setWidth(), SurveyError::structureType(), Alignable::surface(), and AlignableSurface::width().

923 {
924  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
925 
926  const std::vector<Alignable*>& comp = alignable->components();
927  for (size_t i = 0; i < comp.size(); ++i) {
928  addSurveyInfo(comp[i]);
929  }
930 
932 
933  if (alignable->id() != error.rawId() ||
934  alignable->alignableObjectId() != error.structureType()) {
935  throw cms::Exception("DatabaseError")
936  << "Error reading survey info from DB. Mismatched id!";
937  }
938 
939  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
940  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
941 
942  AlignableSurface surf(align::PositionType(pos.x(), pos.y(), pos.z()),
943  align::RotationType(rot.xx(), rot.xy(), rot.xz(),
944  rot.yx(), rot.yy(), rot.yz(),
945  rot.zx(), rot.zy(), rot.zz()));
946  surf.setWidth (alignable->surface().width());
947  surf.setLength(alignable->surface().length());
948 
949  alignable->setSurvey(new SurveyDet(surf, error.matrix()));
950 
951  ++theSurveyIndex;
952 }
align::Scalar width() const
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
const Alignments * theSurveyValues
int i
Definition: DBlmapReader.cc:9
ErrorMatrix matrix() const
Definition: SurveyError.h:76
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
const SurveyErrors * theSurveyErrors
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:126
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:277
void addSurveyInfo(Alignable *)
Adds survey info to an Alignable.
std::vector< SurveyError > m_surveyErrors
Definition: SurveyErrors.h:23
void PCLTrackerAlProducer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 233 of file PCLTrackerAlProducer.cc.

References ZMuMuCategoriesSequences_cff::eventInfo, edm::Event::getByLabel(), and edm::EventBase::id().

234 {
236  edm::LogWarning("BadConfig") << "@SUB=PCLTrackerAlProducer::analyze"
237  << "Skipping event. The current configuration "
238  << "of the alignment algorithm does not need "
239  << "to process any events.";
240  return;
241  }
242 
243  if (setupChanged(setup)) {
244  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::analyze"
245  << "EventSetup-Record changed.";
246  initAlignmentAlgorithm(setup);
247  }
248 
249  if (nevent_== 0 && theExtraAlignables) {
250  initBeamSpot(event);
251  }
252 
253  ++nevent_;
254 
255  // reading in survey records
256  readInSurveyRcds(setup);
257 
258  // Retrieve trajectories and tracks from the event
259  // -> merely skip if collection is empty
260  edm::Handle<TrajTrackAssociationCollection> handleTrajTracksCollection;
261 
262  if (event.getByLabel(tjTkAssociationMapTag_, handleTrajTracksCollection)) {
263  // Form pairs of trajectories and tracks
264  ConstTrajTrackPairs trajTracks;
265  for (auto iter = handleTrajTracksCollection->begin();
266  iter != handleTrajTracksCollection->end();
267  ++iter) {
268  trajTracks.push_back(ConstTrajTrackPair(&(*(*iter).key), &(*(*iter).val)));
269  }
270 
271  //check that the input tag is not empty
272  const AliClusterValueMap* clusterValueMapPtr = 0;
273  if (clusterValueMapTag_.encode().size()) {
274  edm::Handle<AliClusterValueMap> clusterValueMap;
275  event.getByLabel(clusterValueMapTag_, clusterValueMap);
276  clusterValueMapPtr = &(*clusterValueMap);
277  }
278 
279  const EventInfo eventInfo(event.id(),
280  trajTracks,
281  *theBeamSpot,
282  clusterValueMapPtr);
283 
284  // Run the alignment algorithm with its input
285  theAlignmentAlgo->run(setup, eventInfo);
286 
287  for (auto monitor = theMonitors.begin();
288  monitor != theMonitors.end();
289  ++monitor) {
290  (*monitor)->duringLoop(event, setup, trajTracks); // forward eventInfo?
291  }
292 
293  } else {
294  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::analyze"
295  << "No track collection found: skipping event";
296  }
297 }
virtual bool processesEvents()
Returns whether algorithm proccesses events in current configuration.
virtual void run(const edm::EventSetup &setup, const EventInfo &eventInfo)=0
Run the algorithm (must be implemented in derived class)
AlignableExtras * theExtraAlignables
AlignmentAlgorithmBase * theAlignmentAlgo
std::string encode() const
Definition: InputTag.cc:164
define event information passed to algorithms
std::vector< ConstTrajTrackPair > ConstTrajTrackPairs
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
void readInSurveyRcds(const edm::EventSetup &)
Reads in survey records.
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
const edm::InputTag tjTkAssociationMapTag_
Map with tracks/trajectories.
edm::EventID id() const
Definition: EventBase.h:60
void initBeamSpot(const edm::Event &)
Initializes Beamspot of Alignables .
AlignmentMonitors theMonitors
void initAlignmentAlgorithm(const edm::EventSetup &)
edm::Handle< reco::BeamSpot > theBeamSpot
void PCLTrackerAlProducer::applyAlignmentsToDB ( const edm::EventSetup setup)
private

Applies Alignments from Database (GlobalPositionRcd) to Geometry

Definition at line 524 of file PCLTrackerAlProducer.cc.

References align::DetectorGlobalPosition(), edm::EventSetup::get(), DetId::Muon, HcalObjRepresent::setup(), and DetId::Tracker.

525 {
526  // Retrieve and apply alignments, if requested (requires z setup)
527  if (applyDbAlignment_) {
528  // we need GlobalPositionRcd - and have to keep track for later removal
529  // before writing again to DB...
530 
531  edm::ESHandle<Alignments> globalAlignments;
532  setup.get<GlobalPositionRcd>().get(globalAlignments);
533  globalPositions_ = new Alignments(*globalAlignments);
534 
535  if (doTracker_) {
539  &(*theTrackerGeometry),
540  setup,
542  );
543 
544  applyDB<TrackerGeometry,
546  &(*theTrackerGeometry),
547  setup
548  );
549  }
550 
551  if (doMuon_) {
555  &(*theMuonDTGeometry),
556  setup,
558  );
559 
563  &(*theMuonCSCGeometry),
564  setup,
566  );
567  }
568  }
569 }
void applyDB(G *, const edm::EventSetup &, const AlignTransform &) const
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void PCLTrackerAlProducer::applyAlignmentsToGeometry ( )
private

Applies Alignments, AlignmentErrors and SurfaceDeformations to

Definition at line 733 of file PCLTrackerAlProducer.cc.

References GeometryAligner::applyAlignments(), and GeometryAligner::attachSurfaceDeformations().

734 {
735  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::startingNewLoop"
736  << "Now physically apply alignments to geometry...";
737 
738  // Propagate changes to reconstruction geometry (from initialisation or iteration)
739  GeometryAligner aligner;
740 
741  if (doTracker_) {
742  std::auto_ptr<Alignments> alignments( theTrackerAlignables->alignments());
743  std::auto_ptr<AlignmentErrorsExtended> alignmentErrExt(theTrackerAlignables->alignmentErrors());
744  std::auto_ptr<AlignmentSurfaceDeformations> aliDeforms( theTrackerAlignables->surfaceDeformations());
745 
747  &(*theTrackerGeometry),
748  &(*alignments),
749  &(*alignmentErrExt),
751  ); // don't apply global a second time!
752 
754  &(*theTrackerGeometry),
755  &(*aliDeforms)
756  );
757  }
758 
759  if (doMuon_) {
760  std::auto_ptr<Alignments> dtAlignments( theMuonAlignables->dtAlignments());
761  std::auto_ptr<Alignments> cscAlignments(theMuonAlignables->cscAlignments());
762 
763  std::auto_ptr<AlignmentErrorsExtended> dtAlignmentErrExt(
765  );
766  std::auto_ptr<AlignmentErrorsExtended> cscAlignmentErrExt(
768  );
769 
770  aligner.applyAlignments<DTGeometry>(
771  &(*theMuonDTGeometry),
772  &(*dtAlignments),
773  &(*dtAlignmentErrExt),
775  ); // don't apply global a second time!
776 
777  aligner.applyAlignments<CSCGeometry>(
778  &(*theMuonCSCGeometry),
779  &(*cscAlignments),
780  &(*cscAlignmentErrExt),
782  ); // nope!
783  }
784 }
AlignableMuon * theMuonAlignables
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
Class to update a given geometry with a set of alignments.
Alignments * dtAlignments()
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:216
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
void applyAlignments(C *geometry, const Alignments *alignments, const AlignmentErrorsExtended *alignmentErrors, const AlignTransform &globalCoordinates)
Alignments * cscAlignments()
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
Alignments * alignments() const
Return alignments, sorted by DetId.
AlignableTracker * theTrackerAlignables
template<class G , class Rcd , class ErrRcd >
void PCLTrackerAlProducer::applyDB ( G *  geometry,
const edm::EventSetup setup,
const AlignTransform globalCoordinates 
) const
private

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

Definition at line 789 of file PCLTrackerAlProducer.cc.

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

791 {
792  // 'G' is the geometry class for that DB should be applied,
793  // 'Rcd' is the record class for its Alignments
794  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
795  // 'globalCoordinates' are global transformation for this geometry
796 
797  const Rcd& record = setup.get<Rcd>();
799  const edm::ValidityInterval & validity = record.validityInterval();
800  const edm::IOVSyncValue first = validity.first();
801  const edm::IOVSyncValue last = validity.last();
802 
803  if (first != edm::IOVSyncValue::beginOfTime() ||
804  last != edm::IOVSyncValue::endOfTime()) {
805  throw cms::Exception("DatabaseError")
806  << "@SUB=PCLTrackerAlProducer::applyDB"
807  << "\nTrying to apply " << record.key().name()
808  << " with multiple IOVs in tag.\nValidity range is "
809  << first.eventID().run() << " - " << last.eventID().run();
810  }
811  }
812 
813  edm::ESHandle<Alignments> alignments;
814  record.get(alignments);
815 
817  setup.get<ErrRcd>().get(alignmentErrExt);
818 
819  GeometryAligner aligner;
820  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrExt),
821  globalCoordinates);
822 }
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
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:55
ESHandle< TrackerGeometry > geometry
const IOVSyncValue & first() const
template<class G , class DeformationRcd >
void PCLTrackerAlProducer::applyDB ( G *  geometry,
const edm::EventSetup setup 
) const
private

Applies DB constants for SurfaceDeformations.

Definition at line 827 of file PCLTrackerAlProducer.cc.

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

828 {
829  // 'G' is the geometry class for that DB should be applied,
830  // 'DeformationRcd' is the record class for its surface deformations
831 
832  const DeformationRcd & record = setup.get<DeformationRcd>();
834  const edm::ValidityInterval & validity = record.validityInterval();
835  const edm::IOVSyncValue first = validity.first();
836  const edm::IOVSyncValue last = validity.last();
837 
838  if (first != edm::IOVSyncValue::beginOfTime() ||
839  last != edm::IOVSyncValue::endOfTime()) {
840  throw cms::Exception("DatabaseError")
841  << "@SUB=PCLTrackerAlProducer::applyDB"
842  << "\nTrying to apply " << record.key().name()
843  << " with multiple IOVs in tag.\nValidity range is "
844  << first.eventID().run() << " - " << last.eventID().run();
845  }
846  }
848  record.get(surfaceDeformations);
849 
850  GeometryAligner aligner;
851  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
852 }
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
static const IOVSyncValue & beginOfTime()
void attachSurfaceDeformations(C *geometry, const AlignmentSurfaceDeformations *surfaceDeformations)
tuple G
Definition: callgraph.py:12
const T & get() const
Definition: EventSetup.h:55
ESHandle< TrackerGeometry > geometry
const IOVSyncValue & first() const
void PCLTrackerAlProducer::applyMisalignment ( )
private

Applies misalignment scenario to .

Definition at line 622 of file PCLTrackerAlProducer.cc.

References MuonScenarioBuilder::applyScenario(), TrackerScenarioBuilder::applyScenario(), edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

623 {
624  // Apply misalignment scenario to alignable tracker and muon if requested
625  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
626 
628  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::beginOfJob"
629  << "Applying misalignment scenario to "
630  << (doTracker_ ? "tracker" : "")
631  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
632  edm::ParameterSet scenarioConfig = theParameterSet.getParameter<edm::ParameterSet>("MisalignmentScenario");
633 
634  if (doTracker_) {
636  scenarioBuilder.applyScenario(scenarioConfig);
637  }
638  if (doMuon_) {
639  MuonScenarioBuilder muonScenarioBuilder(theMuonAlignables);
640  muonScenarioBuilder.applyScenario(scenarioConfig);
641  }
642 
643  } else {
644  edm::LogInfo("Alignment") << "@SUB=TrackerAlignmentProducerForPCL::beginOfJob"
645  << "NOT applying misalignment scenario!";
646  }
647 
648  // Apply simple misalignment
649  const std::string sParSel(theParameterSet.getParameter<std::string>("parameterSelectorSimple"));
650  //simpleMisalignment(theAlignables, sParSel, stRandomShift_, stRandomRotation_, true);
652 }
AlignableMuon * theMuonAlignables
T getParameter(std::string const &) const
Builds a scenario from configuration and applies it to the alignable Muon.
AlignmentParameterStore * theAlignmentParameterStore
void simpleMisalignment(const Alignables &, const std::string &, float, float, bool)
Applies misalignment scenario to .
AlignableTracker * theTrackerAlignables
Builds a scenario from configuration and applies it to the alignable tracker.
const align::Alignables & alignables(void) const
get all alignables
edm::ParameterSet theParameterSet
void PCLTrackerAlProducer::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file PCLTrackerAlProducer.cc.

127 {
128  nevent_ = 0;
129 
130  for (auto iCal = theCalibrations.begin();
131  iCal != theCalibrations.end();
132  ++iCal) {
133  (*iCal)->beginOfJob(theTrackerAlignables,
136  }
137 
138  for (auto monitor = theMonitors.begin();
139  monitor != theMonitors.end();
140  ++monitor) {
141  (*monitor)->beginOfJob(theTrackerAlignables,
144  }
145 }
AlignableMuon * theMuonAlignables
AlignableExtras * theExtraAlignables
AlignmentParameterStore * theAlignmentParameterStore
AlignmentMonitors theMonitors
AlignableTracker * theTrackerAlignables
void PCLTrackerAlProducer::beginLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 215 of file PCLTrackerAlProducer.cc.

217 {
218  // Do not forward edm::LuminosityBlock
220 }
virtual void beginLuminosityBlock(const edm::EventSetup &setup)
called at begin of luminosity block (no lumi block info passed yet)
AlignmentAlgorithmBase * theAlignmentAlgo
void PCLTrackerAlProducer::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 168 of file PCLTrackerAlProducer.cc.

References edm::RunBase::id(), and edm::RunID::run().

169 {
170  if (setupChanged(setup)) {
171  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::beginRun"
172  << "EventSetup-Record changed.";
173  initAlignmentAlgorithm(setup);
174  }
175 
176  // Do not forward edm::Run
177  theAlignmentAlgo->beginRun(setup);
178 
179  if (setupChanged(setup)) {
180  initAlignmentAlgorithm(setup);
181  }
182 
183  //store the first run analyzed to be used for setting the IOV
184  if(theFirstRun > (cond::Time_t) run.id().run()) {
185  theFirstRun = (cond::Time_t) run.id().run();
186  }
187 
188 
189 }
virtual void beginRun(const edm::EventSetup &setup)
called at begin of run
RunID const & id() const
Definition: RunBase.h:41
RunNumber_t run() const
Definition: RunID.h:39
AlignmentAlgorithmBase * theAlignmentAlgo
unsigned long long Time_t
Definition: Time.h:16
bool setupChanged(const edm::EventSetup &)
Checks if one of the EventSetup-Records has changed.
void initAlignmentAlgorithm(const edm::EventSetup &)
void PCLTrackerAlProducer::buildParameterStore ( )
private

Creates the , which manages all Alignables.

Definition at line 590 of file PCLTrackerAlProducer.cc.

References AlignmentParameterStore_cfi::AlignmentParameterStore, and edm::ParameterSet::getParameter().

591 {
592  // Create alignment parameter builder
593  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
594  << "Creating AlignmentParameterBuilder";
595 
596  edm::ParameterSet alParamBuildCfg = theParameterSet.getParameter<edm::ParameterSet>("ParameterBuilder");
597  edm::ParameterSet alParamStoreCfg = theParameterSet.getParameter<edm::ParameterSet>("ParameterStore");
598 
599  AlignmentParameterBuilder alignmentParameterBuilder(theTrackerAlignables,
602  alParamBuildCfg);
603 
604  // Fix alignables if requested
605  if (stNFixAlignables_ > 0) {
606  alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
607  }
608 
609  // Get list of alignables
610  Alignables theAlignables = alignmentParameterBuilder.alignables();
611  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
612  << "got " << theAlignables.size() << " alignables";
613 
614  // Create AlignmentParameterStore
615  theAlignmentParameterStore = new AlignmentParameterStore(theAlignables, alParamStoreCfg);
616  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
617  << "AlignmentParameterStore created!";
618 }
AlignableMuon * theMuonAlignables
T getParameter(std::string const &) const
AlignableExtras * theExtraAlignables
std::vector< Alignable * > Alignables
Definition: Alignable.h:246
AlignmentParameterStore * theAlignmentParameterStore
AlignableTracker * theTrackerAlignables
edm::ParameterSet theParameterSet
void PCLTrackerAlProducer::createAlignables ( const TrackerTopology * const  tTopo)
private

Creates Alignables from the previously loaded Geometry

Definition at line 573 of file PCLTrackerAlProducer.cc.

References align::AlignableMuon.

574 {
575  if (doTracker_) {
577  }
578 
579  if (doMuon_) {
581  }
582 
583  if (useExtras_) {
585  }
586 }
AlignableMuon * theMuonAlignables
AlignableExtras * theExtraAlignables
boost::shared_ptr< DTGeometry > theMuonDTGeometry
boost::shared_ptr< TrackerGeometry > theTrackerGeometry
boost::shared_ptr< CSCGeometry > theMuonCSCGeometry
AlignableTracker * theTrackerAlignables
void PCLTrackerAlProducer::createAlignmentAlgorithm ( const edm::ParameterSet config)
private

Creates the choosen alignment algorithm (specified in config-file)

Definition at line 310 of file PCLTrackerAlProducer.cc.

References edm::ParameterSet::addUntrackedParameter(), Exception, reco::get(), edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

311 {
312  edm::ParameterSet algoConfig = config.getParameter<edm::ParameterSet>("algoConfig");
313  edm::VParameterSet iovSelection = config.getParameter<edm::VParameterSet>("RunRangeSelection");
314  algoConfig.addUntrackedParameter<edm::VParameterSet>("RunRangeSelection", iovSelection);
315 
316  std::string algoName = algoConfig.getParameter<std::string>("algoName");
317  theAlignmentAlgo = AlignmentAlgorithmPluginFactory::get()->create(algoName, algoConfig);
318 
319  if (!theAlignmentAlgo) {
320  throw cms::Exception("BadConfig")
321  << "Couldn't find the called alignment algorithm: " << algoName;
322  }
323 }
T getParameter(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
AlignmentAlgorithmBase * theAlignmentAlgo
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
T get(const Candidate &c)
Definition: component.h:55
void PCLTrackerAlProducer::createCalibrations ( const edm::ParameterSet config)
private

Creates the calibrations (specified in config-file)

Definition at line 350 of file PCLTrackerAlProducer.cc.

References SurfaceDeformationFactory::create(), Exception, reco::get(), edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

351 {
352  edm::VParameterSet calibrations = config.getParameter<edm::VParameterSet>("calibrations");
353 
354  for (auto iCalib = calibrations.begin();
355  iCalib != calibrations.end();
356  ++iCalib) {
357  theCalibrations.push_back(
359  iCalib->getParameter<std::string>("calibrationName"), *iCalib
360  )
361  );
362  }
363 
364  // Not all algorithms support calibrations - so do not pass empty vector
365  // and throw if non-empty and not supported:
366  if (!theCalibrations.empty()) {
369 
370  } else {
371  throw cms::Exception("BadConfig")
372  << "[TrackerAlignmentProducerForPCL::init]\n"
373  << "Configured " << theCalibrations.size() << " calibration(s) "
374  << "for algorithm not supporting it.";
375  }
376  }
377 }
T getParameter(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
AlignmentAlgorithmBase * theAlignmentAlgo
virtual bool addCalibrations(const Calibrations &)
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:55
void PCLTrackerAlProducer::createGeometries ( const edm::EventSetup setup)
private

Creates ideal geometry from IdealGeometryRecord.

Definition at line 489 of file PCLTrackerAlProducer.cc.

References TrackerGeomBuilderFromGeometricDet::build(), CSCGeometryBuilderFromDDD::build(), CSCGeometryBuilder::build(), and edm::EventSetup::get().

490 {
491  if (doTracker_) {
492  edm::ESHandle<GeometricDet> geometricDet;
493  setup.get<IdealGeometryRecord>().get(geometricDet);
494 
495  TrackerGeomBuilderFromGeometricDet trackerBuilder;
496 
498  setup.get<PTrackerParametersRcd>().get( ptp );
499 
500  theTrackerGeometry = boost::shared_ptr<TrackerGeometry>(
501  trackerBuilder.build(&(*geometricDet), *ptp )
502  );
503  }
504 
505  if (doMuon_) {
508 
509  setup.get<IdealGeometryRecord>().get(cpv);
510  setup.get<MuonNumberingRecord>().get(mdc);
511 
512  theMuonDTGeometry = boost::shared_ptr<DTGeometry> (new DTGeometry);
513  theMuonCSCGeometry = boost::shared_ptr<CSCGeometry>(new CSCGeometry);
514 
515  DTGeometryBuilderFromDDD DTGeometryBuilder;
517  DTGeometryBuilder.build (theMuonDTGeometry, &(*cpv), *mdc);
518  CSCGeometryBuilder.build(theMuonCSCGeometry, &(*cpv), *mdc);
519  }
520 }
boost::shared_ptr< DTGeometry > theMuonDTGeometry
boost::shared_ptr< TrackerGeometry > theTrackerGeometry
void build(boost::shared_ptr< CSCGeometry > geom, const DDCompactView *fv, const MuonDDDConstants &muonConstants)
Build the geometry.
boost::shared_ptr< CSCGeometry > theMuonCSCGeometry
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp)
void build(boost::shared_ptr< CSCGeometry > theGeometry, const RecoIdealGeometry &rig, const CSCRecoDigiParameters &cscpars)
Build the geometry.
void PCLTrackerAlProducer::createMonitors ( const edm::ParameterSet config)
private

Creates the monitors (specified in config-file)

Definition at line 327 of file PCLTrackerAlProducer.cc.

References Exception, reco::get(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

328 {
329  edm::ParameterSet monitorConfig = config.getParameter<edm::ParameterSet>("monitorConfig");
330  std::vector<std::string> monitors = monitorConfig.getUntrackedParameter<std::vector<std::string>>("monitors");
331 
332  for (auto miter = monitors.begin();
333  miter != monitors.end();
334  ++miter) {
336  *miter, monitorConfig.getUntrackedParameter<edm::ParameterSet>(*miter)
337  );
338 
339  if (!newMonitor) {
340  throw cms::Exception("BadConfig") << "Couldn't find monitor named "
341  << *miter;
342  }
343 
344  theMonitors.push_back(newMonitor);
345  }
346 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
AlignmentMonitors theMonitors
T get(const Candidate &c)
Definition: component.h:55
void PCLTrackerAlProducer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file PCLTrackerAlProducer.cc.

150 {
151  finish();
152 
153  for (auto monitor = theMonitors.begin();
154  monitor != theMonitors.end();
155  ++monitor) {
156  (*monitor)->endOfJob();
157  }
158 
159  for (auto iCal = theCalibrations.begin();
160  iCal != theCalibrations.end();
161  ++iCal) {
162  (*iCal)->endOfJob();
163  }
164 }
AlignmentMonitors theMonitors
void PCLTrackerAlProducer::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 224 of file PCLTrackerAlProducer.cc.

226 {
227  // Do not forward edm::LuminosityBlock
229 }
virtual void endLuminosityBlock(const edm::EventSetup &setup)
called at end of luminosity block (no lumi block info passed yet)
AlignmentAlgorithmBase * theAlignmentAlgo
void PCLTrackerAlProducer::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file PCLTrackerAlProducer.cc.

References edm::Run::getByLabel(), and edm::RunBase::id().

194 {
195  // TODO: Either MP nor HIP is implementing the endRun() method... so this
196  // seems to be useless?
197 
198  if (tkLasBeamTag_.encode().size()) {
201  run.getByLabel(tkLasBeamTag_, lasBeams);
202  run.getByLabel(tkLasBeamTag_, tsoses);
203 
204  theAlignmentAlgo->endRun(EndRunInfo(run.id(), &(*lasBeams),
205  &(*tsoses)), setup);
206  } else {
207  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::endRun"
208  << "No Tk LAS beams to forward to algorithm.";
209  theAlignmentAlgo->endRun(EndRunInfo(run.id(), 0, 0), setup);
210  }
211 }
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:216
RunID const & id() const
Definition: RunBase.h:41
AlignmentAlgorithmBase * theAlignmentAlgo
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
const edm::InputTag tkLasBeamTag_
LAS beams in edm::Run (ignore if empty)
void PCLTrackerAlProducer::finish ( )
private

Steers activities after end of job, terminates the AlignmentAlgorithm

Definition at line 961 of file PCLTrackerAlProducer.cc.

Referenced by progressbar.ProgressBar::__next__().

962 {
963  if (theAlignmentAlgo->processesEvents() && nevent_ == 0) {
964  // beginOfJob is usually called by the framework in the first event of the first loop
965  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
966  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
967  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
968  // some geometry information that is not defined either without having seen an event.
969  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
970  << "Did not process any events, stop "
971  << "without terminating algorithm.";
972  return;
973  }
974 
975  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
976  << "Terminating algorithm.";
978 
980 }
virtual bool processesEvents()
Returns whether algorithm proccesses events in current configuration.
virtual void terminate(const edm::EventSetup &iSetup)=0
Call at end of each loop (must be implemented in derived class)
void storeAlignmentsToDB()
Writes Alignments (i.e. Records) to database-file.
AlignmentAlgorithmBase * theAlignmentAlgo
void PCLTrackerAlProducer::initAlignmentAlgorithm ( const edm::EventSetup setup)
private

Creates Geometry and Alignables of the Tracker and initializes the AlignmentAlgorithm

Definition at line 440 of file PCLTrackerAlProducer.cc.

References edm::EventSetup::get(), and edm::ESHandle< class >::product().

441 {
442  // Retrieve tracker topology from geometry
443  edm::ESHandle<TrackerTopology> tTopoHandle;
444  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
445  const TrackerTopology* const tTopo = tTopoHandle.product();
446 
447  // Create the geometries from the ideal geometries (first time only)
448  //std::shared_ptr<TrackingGeometry> theTrackerGeometry;
449  createGeometries(setup);
450 
451  applyAlignmentsToDB(setup);
452  createAlignables(tTopo);
455 
456  // Initialize alignment algorithm and integrated calibration and pass the
457  // latter to algorithm
458  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::initAlignmentAlgorithm"
459  << "Initializing alignment algorithm.";
465 
467 }
AlignableMuon * theMuonAlignables
void buildParameterStore()
Creates the , which manages all Alignables.
AlignableExtras * theExtraAlignables
void applyMisalignment()
Applies misalignment scenario to .
AlignmentAlgorithmBase * theAlignmentAlgo
void applyAlignmentsToDB(const edm::EventSetup &)
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)
void createGeometries(const edm::EventSetup &)
Creates ideal geometry from IdealGeometryRecord.
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
AlignableTracker * theTrackerAlignables
void createAlignables(const TrackerTopology *const)
void PCLTrackerAlProducer::initBeamSpot ( const edm::Event event)
private

Initializes Beamspot of Alignables .

Definition at line 471 of file PCLTrackerAlProducer.cc.

472 {
473  event.getByLabel(beamSpotTag_, theBeamSpot);
474 
475  if (theExtraAlignables) {
476  edm::LogInfo("Alignment") << "@SUB=TrackerAlignmentProducerForPCL::initBeamSpot"
477  << "Initializing AlignableBeamSpot";
478 
480  theBeamSpot->y0(),
481  theBeamSpot->z0(),
482  theBeamSpot->dxdz(),
483  theBeamSpot->dydz());
484  }
485 }
AlignableExtras * theExtraAlignables
const edm::InputTag beamSpotTag_
BeamSpot.
void initializeBeamSpot(double x, double y, double z, double dxdz, double dydz)
Initialize the alignable beam spot with the given parameters.
edm::Handle< reco::BeamSpot > theBeamSpot
RunRanges PCLTrackerAlProducer::makeNonOverlappingRunRanges ( const edm::VParameterSet RunRangeSelectionVPSet)
private

Makes unique RunRanges (specified in config-file)

Definition at line 1047 of file PCLTrackerAlProducer.cc.

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

1048 {
1049  static bool oldRunRangeSelectionWarning = false;
1050 
1053 
1054  RunRanges uniqueRunRanges;
1055  if (!RunRangeSelectionVPSet.empty()) {
1056 
1057  std::map<RunNumber,RunNumber> uniqueFirstRunNumbers;
1058 
1059  for (auto ipset = RunRangeSelectionVPSet.begin();
1060  ipset != RunRangeSelectionVPSet.end();
1061  ++ipset) {
1062  const std::vector<std::string> RunRangeStrings = (*ipset).getParameter<std::vector<std::string> >("RunRanges");
1063 
1064  for (auto irange = RunRangeStrings.begin();
1065  irange != RunRangeStrings.end();
1066  ++irange) {
1067 
1068  if ((*irange).find(':') == std::string::npos) {
1069 
1070  RunNumber first = beginValue;
1071  long int temp = strtol((*irange).c_str(), 0, 0);
1072  if (temp!=-1) first = temp;
1073  uniqueFirstRunNumbers[first] = first;
1074 
1075  } else {
1076  if (!oldRunRangeSelectionWarning) {
1077  edm::LogWarning("BadConfig") << "@SUB=PCLTrackerAlProducer::makeNonOverlappingRunRanges"
1078  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
1079  << "number is used internally. The number of the last run is ignored and can be\n"
1080  << "safely removed from the config file.\n";
1081  oldRunRangeSelectionWarning = true;
1082  }
1083 
1084  std::vector<std::string> tokens = edm::tokenize(*irange, ":");
1085  long int temp;
1086  RunNumber first = beginValue;
1087  temp = strtol(tokens[0].c_str(), 0, 0);
1088  if (temp!=-1) first = temp;
1089  uniqueFirstRunNumbers[first] = first;
1090  }
1091  }
1092  }
1093 
1094  for (auto iFirst = uniqueFirstRunNumbers.begin();
1095  iFirst != uniqueFirstRunNumbers.end();
1096  ++iFirst) {
1097  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>((*iFirst).first, endValue));
1098  }
1099 
1100  for (size_t i = 0; i < uniqueRunRanges.size()-1; ++i) {
1101  uniqueRunRanges[i].second = uniqueRunRanges[i+1].first - 1;
1102  }
1103 
1104  } else {
1105  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>(theFirstRun, endValue));
1106  }
1107 
1108  return uniqueRunRanges;
1109 }
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
void PCLTrackerAlProducer::readInSurveyRcds ( const edm::EventSetup setup)
private

Reads in survey records.

Definition at line 856 of file PCLTrackerAlProducer.cc.

References edm::EventSetup::get().

857 {
858 
859  // Get Survey Rcds and add Survey Info
860  if (doTracker_ && useSurvey_) {
861  bool tkSurveyBool = watchTkSurveyRcd.check(setup);
862  bool tkSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
863 
864  if (tkSurveyBool || tkSurveyErrBool) {
866  edm::ESHandle<SurveyErrors> surveyErrors;
867  setup.get<TrackerSurveyRcd>(). get(surveys);
868  setup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
869 
870  theSurveyIndex = 0;
871  theSurveyValues = &(*surveys);
872  theSurveyErrors = &(*surveyErrors);
873 
875  }
876  }
877 
878  if (doMuon_ && useSurvey_) {
879  bool DTSurveyBool = watchTkSurveyRcd.check(setup);
880  bool DTSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
881  bool CSCSurveyBool = watchTkSurveyRcd.check(setup);
882  bool CSCSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
883 
884  if (DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool) {
885  edm::ESHandle<Alignments> dtSurveys;
886  edm::ESHandle<SurveyErrors> dtSurveyErrors;
887  edm::ESHandle<Alignments> cscSurveys;
888  edm::ESHandle<SurveyErrors> cscSurveyErrors;
889  setup.get<DTSurveyRcd>(). get(dtSurveys);
890  setup.get<DTSurveyErrorExtendedRcd>(). get(dtSurveyErrors);
891  setup.get<CSCSurveyRcd>(). get(cscSurveys);
892  setup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
893 
894  theSurveyIndex = 0;
895  theSurveyValues = &(*dtSurveys);
896  theSurveyErrors = &(*dtSurveyErrors);
897 
899  for (auto iter = barrels.begin();
900  iter != barrels.end();
901  ++iter) {
902  addSurveyInfo(*iter);
903  }
904 
905  theSurveyIndex = 0;
906  theSurveyValues = &(*cscSurveys);
907  theSurveyErrors = &(*cscSurveyErrors);
908 
910  for (auto iter = endcaps.begin();
911  iter != endcaps.end();
912  ++iter) {
913  addSurveyInfo(*iter);
914  }
915  }
916  }
917 
918 }
AlignableMuon * theMuonAlignables
const Alignments * theSurveyValues
std::vector< Alignable * > Alignables
Definition: Alignable.h:246
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrExtRcd
align::Alignables DTBarrel()
const SurveyErrors * theSurveyErrors
align::Alignables CSCEndcaps()
const T & get() const
Definition: EventSetup.h:55
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< TrackerSurveyRcd > watchTkSurveyRcd
void addSurveyInfo(Alignable *)
Adds survey info to an Alignable.
AlignableTracker * theTrackerAlignables
bool PCLTrackerAlProducer::setupChanged ( const edm::EventSetup setup)
private

Checks if one of the EventSetup-Records has changed.

Definition at line 386 of file PCLTrackerAlProducer.cc.

387 {
388  bool changed = false;
389 
390  if (watchIdealGeometryRcd.check(setup)) {
391  changed = true;
392  }
393 
394  if (watchGlobalPositionRcd.check(setup)) {
395  changed = true;
396  }
397 
398  if (doTracker_) {
399  if (watchTrackerAlRcd.check(setup)) {
400  changed = true;
401  }
402 
403  if (watchTrackerAlErrorExtRcd.check(setup)) {
404  changed = true;
405  }
406 
407  if (watchTrackerSurDeRcd.check(setup)) {
408  changed = true;
409  }
410  }
411 
412  if (doMuon_) {
413  if (watchDTAlRcd.check(setup)) {
414  changed = true;
415  }
416 
417  if (watchDTAlErrExtRcd.check(setup)) {
418  changed = true;
419  }
420 
421  if (watchCSCAlRcd.check(setup)) {
422  changed = true;
423  }
424 
425  if (watchCSCAlErrExtRcd.check(setup)) {
426  changed = true;
427  }
428  }
429 
430  /* TODO: ExtraAlignables: Which record(s) to check?
431  *
432  if (useExtras_) {}
433  */
434 
435  return changed;
436 }
edm::ESWatcher< TrackerAlignmentRcd > watchTrackerAlRcd
edm::ESWatcher< DTAlignmentRcd > watchDTAlRcd
edm::ESWatcher< TrackerAlignmentErrorExtendedRcd > watchTrackerAlErrorExtRcd
edm::ESWatcher< IdealGeometryRecord > watchIdealGeometryRcd
edm::ESWatcher< DTAlignmentErrorExtendedRcd > watchDTAlErrExtRcd
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< CSCAlignmentRcd > watchCSCAlRcd
edm::ESWatcher< CSCAlignmentErrorExtendedRcd > watchCSCAlErrExtRcd
edm::ESWatcher< TrackerSurfaceDeformationRcd > watchTrackerSurDeRcd
edm::ESWatcher< GlobalPositionRcd > watchGlobalPositionRcd
void PCLTrackerAlProducer::simpleMisalignment ( const Alignables alivec,
const std::string &  selection,
float  shift,
float  rot,
bool  local 
)
private

Applies misalignment scenario to .

Definition at line 656 of file PCLTrackerAlProducer.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().

658 {
659  std::ostringstream output; // collecting output
660 
661  if (shift > 0. || rot > 0.) {
662  output << "Adding random flat shift of max size " << shift
663  << " and adding random flat rotation of max size " << rot <<" to ";
664 
665  std::vector<bool> commSel(0);
666  if (selection != "-1") {
667  AlignmentParameterSelector aSelector(0,0); // no alignable needed here...
668  const std::vector<char> cSel(aSelector.convertParamSel(selection));
669 
670  if (cSel.size() < RigidBodyAlignmentParameters::N_PARAM) {
671  throw cms::Exception("BadConfig")
672  << "[PCLTrackerAlProducer::simpleMisalignment_]\n"
673  << "Expect selection string '" << selection << "' to be at least of length "
674  << RigidBodyAlignmentParameters::N_PARAM << " or to be '-1'.\n"
675  << "(Most probably you have to adjust the parameter 'parameterSelectorSimple'.)";
676  }
677 
678  for (auto cIter = cSel.begin();
679  cIter != cSel.end();
680  ++cIter) {
681  commSel.push_back(*cIter == '0' ? false : true);
682  }
683  output << "parameters defined by (" << selection
684  << "), representing (x,y,z,alpha,beta,gamma),";
685 
686  } else {
687  output << "the active parameters of each alignable,";
688  }
689  output << " in " << (local ? "local" : "global") << " frame.";
690 
691  for (auto it = alivec.begin();
692  it != alivec.end();
693  ++it) {
694  Alignable* ali = (*it);
695  std::vector<bool> mysel(commSel.empty() ? ali->alignmentParameters()->selector() : commSel);
696 
697  if (std::abs(shift)>0.00001) {
698  double s0 = 0., s1 = 0., s2 = 0.;
699 
700  if (mysel[RigidBodyAlignmentParameters::dx]) s0 = shift * double(random()%1000-500)/500.;
701  if (mysel[RigidBodyAlignmentParameters::dy]) s1 = shift * double(random()%1000-500)/500.;
702  if (mysel[RigidBodyAlignmentParameters::dz]) s2 = shift * double(random()%1000-500)/500.;
703 
704  if (local) ali->move( ali->surface().toGlobal(align::LocalVector(s0,s1,s2)) );
705  else ali->move( align::GlobalVector(s0,s1,s2) );
706 
707  //AlignmentPositionError ape(dx,dy,dz);
708  //ali->addAlignmentPositionError(ape);
709  }
710 
711  if (std::abs(rot)>0.00001) {
713  if (mysel[RigidBodyAlignmentParameters::dalpha]) r(1)=rot*double(random()%1000-500)/500.;
714  if (mysel[RigidBodyAlignmentParameters::dbeta]) r(2)=rot*double(random()%1000-500)/500.;
715  if (mysel[RigidBodyAlignmentParameters::dgamma]) r(3)=rot*double(random()%1000-500)/500.;
716 
717  const align::RotationType mrot = align::toMatrix(r);
718  if (local) ali->rotateInLocalFrame(mrot);
719  else ali->rotateInGlobalFrame(mrot);
720  //ali->addAlignmentPositionErrorFromRotation(mrot);
721  }
722  }
723 
724  } else {
725  output << "No simple misalignment added!";
726  }
727 
728  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::simpleMisalignment_" << output.str();
729 }
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:91
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:126
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 PCLTrackerAlProducer::storeAlignmentsToDB ( )
private

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

Definition at line 984 of file PCLTrackerAlProducer.cc.

References AlignmentParameters::parameters(), cond::runnumber, and cond::timeTypeSpecs.

985 {
986  if (theAlignmentAlgo->processesEvents() && nevent_ == 0) {
987  // TODO: If this is the case, it would be already caught in finish()
988  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::endOfJob"
989  << "Did not process any events in last loop, "
990  << "do not dare to store to DB.";
991  } else {
992  // Expand run ranges and make them unique
993  edm::VParameterSet runRangeSelectionVPSet(theParameterSet.getParameter<edm::VParameterSet>("RunRangeSelection"));
994  RunRanges uniqueRunRanges(makeNonOverlappingRunRanges(runRangeSelectionVPSet));
995 
996  // create dummy IOV
997  if (uniqueRunRanges.empty()) {
998  const RunRange runRange(cond::timeTypeSpecs[cond::runnumber].beginValue,
1000  uniqueRunRanges.push_back(runRange);
1001  }
1002 
1003  std::vector<AlgebraicVector> beamSpotParameters;
1004 
1005  for (auto iRunRange = uniqueRunRanges.begin();
1006  iRunRange != uniqueRunRanges.end();
1007  ++iRunRange) {
1008 
1010 
1011  // Save alignments to database
1013  writeForRunRange((*iRunRange).first);
1014  }
1015 
1016  // Deal with extra alignables, e.g. beam spot
1017  if (theExtraAlignables) {
1019  if (!alis.empty()) {
1020  BeamSpotAlignmentParameters *beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
1021  beamSpotParameters.push_back(beamSpotAliPars->parameters());
1022  }
1023  }
1024  }
1025 
1026  if (theExtraAlignables) {
1027  std::ostringstream bsOutput;
1028 
1029  auto itPar = beamSpotParameters.begin();
1030  for (auto iRunRange = uniqueRunRanges.begin();
1031  iRunRange != uniqueRunRanges.end();
1032  ++iRunRange, ++itPar) {
1033  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
1034  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
1035  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
1036  }
1037 
1038  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::endOfJob"
1039  << "Parameters for alignable beamspot:\n"
1040  << bsOutput.str();
1041  }
1042  }
1043 }
virtual bool processesEvents()
Returns whether algorithm proccesses events in current configuration.
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
T getParameter(std::string const &) const
AlignableExtras * theExtraAlignables
std::vector< Alignable * > Alignables
Definition: Alignable.h:246
RunRanges makeNonOverlappingRunRanges(const edm::VParameterSet &)
Makes unique RunRanges (specified in config-file)
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
AlignmentAlgorithmBase * theAlignmentAlgo
const AlgebraicVector & parameters(void) const
Get alignment parameters.
virtual bool setParametersForRunRange(const RunRange &rr)
std::pair< RunNumber, RunNumber > RunRange
std::vector< RunRange > RunRanges
void writeForRunRange(cond::Time_t)
Alignables & beamSpot()
Return beam spot alignable as a vector with one element.
edm::ParameterSet theParameterSet
void PCLTrackerAlProducer::writeDB ( Alignments alignments,
const std::string &  alignRcd,
AlignmentErrorsExtended alignmentErrExt,
const std::string &  errRcd,
const AlignTransform globalCoordinates,
cond::Time_t  time 
) const
private

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

Definition at line 1169 of file PCLTrackerAlProducer.cc.

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

1173 {
1174  Alignments* tempAlignments = alignments;
1175  AlignmentErrorsExtended* tempAlignmentErrExt = alignmentErrExt;
1176 
1177  // Call service
1179  if (!poolDb.isAvailable()) { // Die if not available
1180  delete tempAlignments; // promised to take over ownership...
1181  delete tempAlignmentErrExt; // dito
1182 
1183  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1184  }
1185 
1186  if (globalCoordinates && // happens only if (applyDbAlignment_ == true)
1187  globalCoordinates->transform() != AlignTransform::Transform::Identity) {
1188 
1189  tempAlignments = new Alignments(); // temporary storage for
1190  tempAlignmentErrExt = new AlignmentErrorsExtended(); // final alignments and errors
1191 
1192  GeometryAligner aligner;
1193  aligner.removeGlobalTransform(alignments, alignmentErrExt,
1194  *globalCoordinates,
1195  tempAlignments, tempAlignmentErrExt);
1196 
1197  delete alignments; // have to delete original alignments
1198  delete alignmentErrExt; // same thing for the errors
1199 
1200  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::writeDB"
1201  << "globalCoordinates removed from alignments ("
1202  << alignRcd << ") and errors (" << alignRcd << ").";
1203  }
1204 
1205  if (saveToDB_) {
1206  edm::LogInfo("Alignment") << "Writing Alignments for run " << time
1207  << " to " << alignRcd << ".";
1208  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
1209 
1210  } else {
1211  // poolDb->writeOne(..) takes over 'alignments' ownership, ...
1212  delete tempAlignments; // ...otherwise we have to delete, as promised!
1213  }
1214 
1215  if (saveApeToDB_) {
1216  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run "
1217  << time << " to " << errRcd << ".";
1218  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrExt, time, errRcd);
1219 
1220  } else {
1221  // poolDb->writeOne(..) takes over 'alignmentErrors' ownership, ...
1222  delete tempAlignmentErrExt; // ...otherwise we have to delete, as promised!
1223  }
1224 }
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 PCLTrackerAlProducer::writeDB ( AlignmentSurfaceDeformations alignmentSurfaceDeformations,
const std::string &  surfaceDeformationRcd,
cond::Time_t  time 
) const
private

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

Definition at line 1228 of file PCLTrackerAlProducer.cc.

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

1231 {
1232  // Call service
1234  if (!poolDb.isAvailable()) { // Die if not available
1235  delete alignmentSurfaceDeformations; // promised to take over ownership...
1236  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1237  }
1238 
1239  if (saveDeformationsToDB_) {
1240  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run "
1241  << time << " to " << surfaceDeformationRcd << ".";
1242  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
1243  surfaceDeformationRcd);
1244 
1245  } else {
1246  // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
1247  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
1248  }
1249 }
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void PCLTrackerAlProducer::writeForRunRange ( cond::Time_t  time)
private

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

Definition at line 1113 of file PCLTrackerAlProducer.cc.

References align::DetectorGlobalPosition(), DetId::Muon, and DetId::Tracker.

1114 {
1115  // first tracker
1116  if (doTracker_) {
1117  const AlignTransform* trackerGlobal = 0; // will be 'removed' from constants
1118  if (globalPositions_) { // i.e. applied before in applyDB
1121  }
1122 
1123  // theTrackerAlignables->alignments calls new
1124  Alignments* alignments = theTrackerAlignables->alignments();
1126 
1127  writeDB(alignments, "TrackerAlignmentRcd",
1128  alignmentErrExt, "TrackerAlignmentErrorExtendedRcd",
1129  trackerGlobal,
1130  time);
1131  }
1132 
1133  // Save surface deformations to database
1135  AlignmentSurfaceDeformations* alignmentSurfaceDeformations = theTrackerAlignables->surfaceDeformations();
1136  writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
1137  }
1138 
1139  // now muon
1140  if (doMuon_) {
1141  const AlignTransform* muonGlobal = 0; // will be 'removed' from constants
1142  if (globalPositions_) { // i.e. applied before in applyDB
1144  DetId(DetId::Muon));
1145  }
1146 
1147  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
1148  Alignments* alignments = theMuonAlignables->dtAlignments();
1150 
1151  writeDB(alignments, "DTAlignmentRcd",
1152  alignmentErrExt, "DTAlignmentErrorExtendedRcd",
1153  muonGlobal,
1154  time);
1155 
1156  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
1157  alignments = theMuonAlignables->cscAlignments();
1158  alignmentErrExt = theMuonAlignables->cscAlignmentErrorsExtended();
1159 
1160  writeDB(alignments, "CSCAlignmentRcd",
1161  alignmentErrExt, "CSCAlignmentErrorExtendedRcd",
1162  muonGlobal,
1163  time);
1164  }
1165 }
AlignableMuon * theMuonAlignables
AlignmentErrorsExtended * alignmentErrors() const
Return alignment errors, sorted by DetId.
void writeDB(Alignments *, const std::string &, AlignmentErrorsExtended *, const std::string &, const AlignTransform *, cond::Time_t) const
Alignments * dtAlignments()
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:216
AlignmentErrorsExtended * cscAlignmentErrorsExtended()
Definition: DetId.h:18
Alignments * cscAlignments()
AlignmentErrorsExtended * dtAlignmentErrorsExtended()
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
Alignments * alignments() const
Return alignments, sorted by DetId.
AlignableTracker * theTrackerAlignables

Member Data Documentation

const bool PCLTrackerAlProducer::applyDbAlignment_
private

Definition at line 244 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::beamSpotTag_
private

BeamSpot.

Definition at line 253 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::checkDbAlignmentValidity_
private

Definition at line 244 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::clusterValueMapTag_
private

ValueMap containing associtaion cluster-flag.

Definition at line 257 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMisalignmentScenario_
private

Definition at line 245 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMuon_
private

Definition at line 247 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doTracker_
private

Definition at line 247 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::globalPositions_
private

GlobalPositions that might be read from DB, NULL otherwise.

Definition at line 227 of file PCLTrackerAlProducer.h.

int PCLTrackerAlProducer::nevent_
private

Definition at line 234 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveApeToDB_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveDeformationsToDB_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveToDB_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

const int PCLTrackerAlProducer::stNFixAlignables_
private

Definition at line 242 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomRotation_
private

Definition at line 243 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomShift_
private

Definition at line 243 of file PCLTrackerAlProducer.h.

AlignmentAlgorithmBase* PCLTrackerAlProducer::theAlignmentAlgo
private

Definition at line 216 of file PCLTrackerAlProducer.h.

AlignmentParameterStore* PCLTrackerAlProducer::theAlignmentParameterStore
private

Definition at line 220 of file PCLTrackerAlProducer.h.

edm::Handle<reco::BeamSpot> PCLTrackerAlProducer::theBeamSpot
private

Definition at line 225 of file PCLTrackerAlProducer.h.

Calibrations PCLTrackerAlProducer::theCalibrations
private

Definition at line 217 of file PCLTrackerAlProducer.h.

AlignableExtras* PCLTrackerAlProducer::theExtraAlignables
private

Definition at line 223 of file PCLTrackerAlProducer.h.

cond::Time_t PCLTrackerAlProducer::theFirstRun
private

Definition at line 283 of file PCLTrackerAlProducer.h.

AlignmentMonitors PCLTrackerAlProducer::theMonitors
private

Definition at line 218 of file PCLTrackerAlProducer.h.

AlignableMuon* PCLTrackerAlProducer::theMuonAlignables
private

Definition at line 222 of file PCLTrackerAlProducer.h.

boost::shared_ptr<CSCGeometry> PCLTrackerAlProducer::theMuonCSCGeometry
private

Definition at line 232 of file PCLTrackerAlProducer.h.

boost::shared_ptr<DTGeometry> PCLTrackerAlProducer::theMuonDTGeometry
private

Definition at line 231 of file PCLTrackerAlProducer.h.

edm::ParameterSet PCLTrackerAlProducer::theParameterSet
private

Definition at line 240 of file PCLTrackerAlProducer.h.

const SurveyErrors* PCLTrackerAlProducer::theSurveyErrors
private

Definition at line 289 of file PCLTrackerAlProducer.h.

size_t PCLTrackerAlProducer::theSurveyIndex
private

Definition at line 287 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::theSurveyValues
private

Definition at line 288 of file PCLTrackerAlProducer.h.

AlignableTracker* PCLTrackerAlProducer::theTrackerAlignables
private

Definition at line 221 of file PCLTrackerAlProducer.h.

boost::shared_ptr<TrackerGeometry> PCLTrackerAlProducer::theTrackerGeometry
private

Definition at line 230 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tjTkAssociationMapTag_
private

Map with tracks/trajectories.

Definition at line 251 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tkLasBeamTag_
private

LAS beams in edm::Run (ignore if empty)

Definition at line 255 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useExtras_
private

Definition at line 247 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useSurvey_
private

Definition at line 248 of file PCLTrackerAlProducer.h.

edm::ESWatcher<CSCAlignmentErrorExtendedRcd> PCLTrackerAlProducer::watchCSCAlErrExtRcd
private

Definition at line 273 of file PCLTrackerAlProducer.h.

edm::ESWatcher<CSCAlignmentRcd> PCLTrackerAlProducer::watchCSCAlRcd
private

Definition at line 272 of file PCLTrackerAlProducer.h.

edm::ESWatcher<CSCSurveyErrorExtendedRcd> PCLTrackerAlProducer::watchCSCSurveyErrExtRcd
private

Definition at line 280 of file PCLTrackerAlProducer.h.

edm::ESWatcher<CSCSurveyRcd> PCLTrackerAlProducer::watchCSCSurveyRcd
private

Definition at line 279 of file PCLTrackerAlProducer.h.

edm::ESWatcher<DTAlignmentErrorExtendedRcd> PCLTrackerAlProducer::watchDTAlErrExtRcd
private

Definition at line 271 of file PCLTrackerAlProducer.h.

edm::ESWatcher<DTAlignmentRcd> PCLTrackerAlProducer::watchDTAlRcd
private

Definition at line 270 of file PCLTrackerAlProducer.h.

edm::ESWatcher<DTSurveyErrorExtendedRcd> PCLTrackerAlProducer::watchDTSurveyErrExtRcd
private

Definition at line 278 of file PCLTrackerAlProducer.h.

edm::ESWatcher<DTSurveyRcd> PCLTrackerAlProducer::watchDTSurveyRcd
private

Definition at line 277 of file PCLTrackerAlProducer.h.

edm::ESWatcher<GlobalPositionRcd> PCLTrackerAlProducer::watchGlobalPositionRcd
private

Definition at line 264 of file PCLTrackerAlProducer.h.

edm::ESWatcher<IdealGeometryRecord> PCLTrackerAlProducer::watchIdealGeometryRcd
private

Definition at line 263 of file PCLTrackerAlProducer.h.

edm::ESWatcher<TrackerSurveyErrorExtendedRcd> PCLTrackerAlProducer::watchTkSurveyErrExtRcd
private

Definition at line 276 of file PCLTrackerAlProducer.h.

edm::ESWatcher<TrackerSurveyRcd> PCLTrackerAlProducer::watchTkSurveyRcd
private

Definition at line 275 of file PCLTrackerAlProducer.h.

edm::ESWatcher<TrackerAlignmentErrorExtendedRcd> PCLTrackerAlProducer::watchTrackerAlErrorExtRcd
private

Definition at line 267 of file PCLTrackerAlProducer.h.

edm::ESWatcher<TrackerAlignmentRcd> PCLTrackerAlProducer::watchTrackerAlRcd
private

Definition at line 266 of file PCLTrackerAlProducer.h.

edm::ESWatcher<TrackerSurfaceDeformationRcd> PCLTrackerAlProducer::watchTrackerSurDeRcd
private

Definition at line 268 of file PCLTrackerAlProducer.h.