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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 &, const TrackerTopology *)
 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...
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
const bool checkDbAlignmentValidity_
 
const edm::InputTag clusterValueMapTag_
 ValueMap containing associtaion cluster-flag. More...
 
edm::EDGetTokenT
< AliClusterValueMap
clusterValueMapToken
 
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...
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
tjTkAssociationMapToken
 
const edm::InputTag tkLasBeamTag_
 LAS beams in edm::Run (ignore if empty) More...
 
edm::EDGetTokenT
< TkFittedLasBeamCollection
tkLasBeamToken
 
edm::EDGetTokenT
< TsosVectorCollection
tsosVectorToken
 
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 84 of file PCLTrackerAlProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 63 of file PCLTrackerAlProducer.cc.

63  :
70 
71  /* Steering parameters */
72  theParameterSet(config),
73  stNFixAlignables_ (config.getParameter<int> ("nFixAlignables")),
74  stRandomShift_ (config.getParameter<double> ("randomShift")),
75  stRandomRotation_ (config.getParameter<double> ("randomRotation")),
76  applyDbAlignment_ (config.getUntrackedParameter<bool>("applyDbAlignment")),
77  checkDbAlignmentValidity_(config.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
78  doMisalignmentScenario_ (config.getParameter<bool> ("doMisalignmentScenario")),
79  saveToDB_ (config.getParameter<bool> ("saveToDB")),
80  saveApeToDB_ (config.getParameter<bool> ("saveApeToDB")),
81  saveDeformationsToDB_ (config.getParameter<bool> ("saveDeformationsToDB")),
82  doTracker_ (config.getUntrackedParameter<bool>("doTracker") ),
83  doMuon_ (config.getUntrackedParameter<bool>("doMuon") ),
84  useExtras_ (config.getUntrackedParameter<bool>("useExtras")),
85  useSurvey_ (config.getParameter<bool> ("useSurvey")),
86 
87  /* Event input tags */
88  tjTkAssociationMapTag_ (config.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
89  beamSpotTag_ (config.getParameter<edm::InputTag>("beamSpotTag")),
90  tkLasBeamTag_ (config.getParameter<edm::InputTag>("tkLasBeamTag")),
91  clusterValueMapTag_ (config.getParameter<edm::InputTag>("hitPrescaleMapTag")),
93 {
94 
95  tjTkAssociationMapToken = consumes<TrajTrackAssociationCollection>(tjTkAssociationMapTag_);
96  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag_);
97  tkLasBeamToken = consumes<TkFittedLasBeamCollection>(tkLasBeamTag_);
98  tsosVectorToken = consumes<TsosVectorCollection>(tkLasBeamTag_);
99  clusterValueMapToken = consumes<AliClusterValueMap>(clusterValueMapTag_);
100 
101 
102  createAlignmentAlgorithm(config);
103  createCalibrations (config);
104  createMonitors (config);
105 }
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
edm::EDGetTokenT< TkFittedLasBeamCollection > tkLasBeamToken
AlignmentAlgorithmBase * theAlignmentAlgo
AlignmentParameterStore * theAlignmentParameterStore
edm::EDGetTokenT< TsosVectorCollection > tsosVectorToken
const edm::InputTag beamSpotTag_
BeamSpot.
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken
void createMonitors(const edm::ParameterSet &)
Creates the monitors (specified in config-file)
const edm::InputTag clusterValueMapTag_
ValueMap containing associtaion cluster-flag.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
const edm::InputTag tjTkAssociationMapTag_
Map with tracks/trajectories.
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
edm::EDGetTokenT< TrajTrackAssociationCollection > tjTkAssociationMapToken
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 109 of file PCLTrackerAlProducer.cc.

110 {
111  delete theAlignmentAlgo;
112 
113  for (auto iCal = theCalibrations.begin();
114  iCal != theCalibrations.end();
115  ++iCal) {
116  delete *iCal;
117  }
118 
119  // TODO: Delete monitors as well?
120 
122  delete theTrackerAlignables;
123  delete theMuonAlignables;
124  delete theExtraAlignables;
125  delete globalPositions_;
126 }
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 932 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().

933 {
934  edm::LogInfo("Alignment") << "ADDING THE SURVEY INFORMATION";
935 
936  const std::vector<Alignable*>& comp = alignable->components();
937  for (size_t i = 0; i < comp.size(); ++i) {
938  addSurveyInfo(comp[i]);
939  }
940 
942 
943  if (alignable->id() != error.rawId() ||
944  alignable->alignableObjectId() != error.structureType()) {
945  throw cms::Exception("DatabaseError")
946  << "Error reading survey info from DB. Mismatched id!";
947  }
948 
949  const CLHEP::Hep3Vector& pos = theSurveyValues->m_align[theSurveyIndex].translation();
950  const CLHEP::HepRotation& rot = theSurveyValues->m_align[theSurveyIndex].rotation();
951 
952  AlignableSurface surf(align::PositionType(pos.x(), pos.y(), pos.z()),
953  align::RotationType(rot.xx(), rot.xy(), rot.xz(),
954  rot.yx(), rot.yy(), rot.yz(),
955  rot.zx(), rot.zy(), rot.zz()));
956  surf.setWidth (alignable->surface().width());
957  surf.setLength(alignable->surface().length());
958 
959  alignable->setSurvey(new SurveyDet(surf, error.matrix()));
960 
961  ++theSurveyIndex;
962 }
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
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:131
align::Scalar length() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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 243 of file PCLTrackerAlProducer.cc.

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

244 {
246  edm::LogWarning("BadConfig") << "@SUB=PCLTrackerAlProducer::analyze"
247  << "Skipping event. The current configuration "
248  << "of the alignment algorithm does not need "
249  << "to process any events.";
250  return;
251  }
252 
253  if (setupChanged(setup)) {
254  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::analyze"
255  << "EventSetup-Record changed.";
256  initAlignmentAlgorithm(setup);
257  }
258 
259  if (nevent_== 0 && theExtraAlignables) {
260  initBeamSpot(event);
261  }
262 
263  ++nevent_;
264 
265  // reading in survey records
266  readInSurveyRcds(setup);
267 
268  // Retrieve trajectories and tracks from the event
269  // -> merely skip if collection is empty
270  edm::Handle<TrajTrackAssociationCollection> handleTrajTracksCollection;
271 
272  if (event.getByToken(tjTkAssociationMapToken, handleTrajTracksCollection)) {
273  // Form pairs of trajectories and tracks
274  ConstTrajTrackPairs trajTracks;
275  for (auto iter = handleTrajTracksCollection->begin();
276  iter != handleTrajTracksCollection->end();
277  ++iter) {
278  trajTracks.push_back(ConstTrajTrackPair(&(*(*iter).key), &(*(*iter).val)));
279  }
280 
281  //check that the input tag is not empty
282  const AliClusterValueMap* clusterValueMapPtr = 0;
283  if (clusterValueMapTag_.encode().size()) {
284  edm::Handle<AliClusterValueMap> clusterValueMap;
285  event.getByToken(clusterValueMapToken, clusterValueMap);
286  clusterValueMapPtr = &(*clusterValueMap);
287  }
288 
289  const EventInfo eventInfo(event.id(),
290  trajTracks,
291  *theBeamSpot,
292  clusterValueMapPtr);
293 
294  // Run the alignment algorithm with its input
295  theAlignmentAlgo->run(setup, eventInfo);
296 
297  for (auto monitor = theMonitors.begin();
298  monitor != theMonitors.end();
299  ++monitor) {
300  (*monitor)->duringLoop(event, setup, trajTracks); // forward eventInfo?
301  }
302 
303  } else {
304  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::analyze"
305  << "No track collection found: skipping event";
306  }
307 }
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
AlignmentAlgorithmBase * theAlignmentAlgo
std::string encode() const
Definition: InputTag.cc:164
define event information passed to algorithms
edm::EDGetTokenT< AliClusterValueMap > clusterValueMapToken
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.
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
edm::EventID id() const
Definition: EventBase.h:59
edm::EDGetTokenT< TrajTrackAssociationCollection > tjTkAssociationMapToken
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 534 of file PCLTrackerAlProducer.cc.

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

535 {
536  // Retrieve and apply alignments, if requested (requires z setup)
537  if (applyDbAlignment_) {
538  // we need GlobalPositionRcd - and have to keep track for later removal
539  // before writing again to DB...
540 
541  edm::ESHandle<Alignments> globalAlignments;
542  setup.get<GlobalPositionRcd>().get(globalAlignments);
543  globalPositions_ = new Alignments(*globalAlignments);
544 
545  if (doTracker_) {
549  &(*theTrackerGeometry),
550  setup,
552  );
553 
554  applyDB<TrackerGeometry,
556  &(*theTrackerGeometry),
557  setup
558  );
559  }
560 
561  if (doMuon_) {
565  &(*theMuonDTGeometry),
566  setup,
568  );
569 
573  &(*theMuonCSCGeometry),
574  setup,
576  );
577  }
578  }
579 }
void applyDB(G *, const edm::EventSetup &, const AlignTransform &) const
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:56
const Alignments * globalPositions_
GlobalPositions that might be read from DB, NULL otherwise.
const AlignTransform & DetectorGlobalPosition(const Alignments &allGlobals, const DetId &id)
void PCLTrackerAlProducer::applyAlignmentsToGeometry ( )
private

Applies Alignments, AlignmentErrors and SurfaceDeformations to

Definition at line 743 of file PCLTrackerAlProducer.cc.

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

744 {
745  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::startingNewLoop"
746  << "Now physically apply alignments to geometry...";
747 
748  // Propagate changes to reconstruction geometry (from initialisation or iteration)
749  GeometryAligner aligner;
750 
751  if (doTracker_) {
752  std::auto_ptr<Alignments> alignments( theTrackerAlignables->alignments());
753  std::auto_ptr<AlignmentErrorsExtended> alignmentErrExt(theTrackerAlignables->alignmentErrors());
754  std::auto_ptr<AlignmentSurfaceDeformations> aliDeforms( theTrackerAlignables->surfaceDeformations());
755 
757  &(*theTrackerGeometry),
758  &(*alignments),
759  &(*alignmentErrExt),
761  ); // don't apply global a second time!
762 
764  &(*theTrackerGeometry),
765  &(*aliDeforms)
766  );
767  }
768 
769  if (doMuon_) {
770  std::auto_ptr<Alignments> dtAlignments( theMuonAlignables->dtAlignments());
771  std::auto_ptr<Alignments> cscAlignments(theMuonAlignables->cscAlignments());
772 
773  std::auto_ptr<AlignmentErrorsExtended> dtAlignmentErrExt(
775  );
776  std::auto_ptr<AlignmentErrorsExtended> cscAlignmentErrExt(
778  );
779 
780  aligner.applyAlignments<DTGeometry>(
781  &(*theMuonDTGeometry),
782  &(*dtAlignments),
783  &(*dtAlignmentErrExt),
785  ); // don't apply global a second time!
786 
787  aligner.applyAlignments<CSCGeometry>(
788  &(*theMuonCSCGeometry),
789  &(*cscAlignments),
790  &(*cscAlignmentErrExt),
792  ); // nope!
793  }
794 }
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:245
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 799 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(), plotBeamSpotDB::last, record, and edm::EventID::run().

801 {
802  // 'G' is the geometry class for that DB should be applied,
803  // 'Rcd' is the record class for its Alignments
804  // 'ErrRcd' is the record class for its AlignmentErrorsExtended
805  // 'globalCoordinates' are global transformation for this geometry
806 
807  const Rcd& record = setup.get<Rcd>();
809  const edm::ValidityInterval & validity = record.validityInterval();
810  const edm::IOVSyncValue first = validity.first();
811  const edm::IOVSyncValue last = validity.last();
812 
813  if (first != edm::IOVSyncValue::beginOfTime() ||
814  last != edm::IOVSyncValue::endOfTime()) {
815  throw cms::Exception("DatabaseError")
816  << "@SUB=PCLTrackerAlProducer::applyDB"
817  << "\nTrying to apply " << record.key().name()
818  << " with multiple IOVs in tag.\nValidity range is "
819  << first.eventID().run() << " - " << last.eventID().run();
820  }
821  }
822 
823  edm::ESHandle<Alignments> alignments;
824  record.get(alignments);
825 
827  setup.get<ErrRcd>().get(alignmentErrExt);
828 
829  GeometryAligner aligner;
830  aligner.applyAlignments<G>(geometry, &(*alignments), &(*alignmentErrExt),
831  globalCoordinates);
832 }
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:56
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 837 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(), plotBeamSpotDB::last, record, and edm::EventID::run().

838 {
839  // 'G' is the geometry class for that DB should be applied,
840  // 'DeformationRcd' is the record class for its surface deformations
841 
842  const DeformationRcd & record = setup.get<DeformationRcd>();
844  const edm::ValidityInterval & validity = record.validityInterval();
845  const edm::IOVSyncValue first = validity.first();
846  const edm::IOVSyncValue last = validity.last();
847 
848  if (first != edm::IOVSyncValue::beginOfTime() ||
849  last != edm::IOVSyncValue::endOfTime()) {
850  throw cms::Exception("DatabaseError")
851  << "@SUB=PCLTrackerAlProducer::applyDB"
852  << "\nTrying to apply " << record.key().name()
853  << " with multiple IOVs in tag.\nValidity range is "
854  << first.eventID().run() << " - " << last.eventID().run();
855  }
856  }
858  record.get(surfaceDeformations);
859 
860  GeometryAligner aligner;
861  aligner.attachSurfaceDeformations<G>(geometry, &(*surfaceDeformations));
862 }
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:56
ESHandle< TrackerGeometry > geometry
const IOVSyncValue & first() const
void PCLTrackerAlProducer::applyMisalignment ( )
private

Applies misalignment scenario to .

Definition at line 632 of file PCLTrackerAlProducer.cc.

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

633 {
634  // Apply misalignment scenario to alignable tracker and muon if requested
635  // WARNING: this assumes scenarioConfig can be passed to both muon and tracker
636 
638  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::beginOfJob"
639  << "Applying misalignment scenario to "
640  << (doTracker_ ? "tracker" : "")
641  << (doMuon_ ? (doTracker_ ? " and muon" : "muon") : ".");
642  edm::ParameterSet scenarioConfig = theParameterSet.getParameter<edm::ParameterSet>("MisalignmentScenario");
643 
644  if (doTracker_) {
646  scenarioBuilder.applyScenario(scenarioConfig);
647  }
648  if (doMuon_) {
649  MuonScenarioBuilder muonScenarioBuilder(theMuonAlignables);
650  muonScenarioBuilder.applyScenario(scenarioConfig);
651  }
652 
653  } else {
654  edm::LogInfo("Alignment") << "@SUB=TrackerAlignmentProducerForPCL::beginOfJob"
655  << "NOT applying misalignment scenario!";
656  }
657 
658  // Apply simple misalignment
659  const std::string sParSel(theParameterSet.getParameter<std::string>("parameterSelectorSimple"));
660  //simpleMisalignment(theAlignables, sParSel, stRandomShift_, stRandomRotation_, true);
662 }
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 136 of file PCLTrackerAlProducer.cc.

137 {
138  nevent_ = 0;
139 
140  for (auto iCal = theCalibrations.begin();
141  iCal != theCalibrations.end();
142  ++iCal) {
143  (*iCal)->beginOfJob(theTrackerAlignables,
146  }
147 
148  for (auto monitor = theMonitors.begin();
149  monitor != theMonitors.end();
150  ++monitor) {
151  (*monitor)->beginOfJob(theTrackerAlignables,
154  }
155 }
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 225 of file PCLTrackerAlProducer.cc.

227 {
228  // Do not forward edm::LuminosityBlock
230 }
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 178 of file PCLTrackerAlProducer.cc.

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

179 {
180  if (setupChanged(setup)) {
181  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::beginRun"
182  << "EventSetup-Record changed.";
183  initAlignmentAlgorithm(setup);
184  }
185 
186  // Do not forward edm::Run
187  theAlignmentAlgo->beginRun(setup);
188 
189  if (setupChanged(setup)) {
190  initAlignmentAlgorithm(setup);
191  }
192 
193  //store the first run analyzed to be used for setting the IOV
194  if(theFirstRun > (cond::Time_t) run.id().run()) {
195  theFirstRun = (cond::Time_t) run.id().run();
196  }
197 
198 
199 }
virtual void beginRun(const edm::EventSetup &setup)
called at begin of run
RunID const & id() const
Definition: RunBase.h:39
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 600 of file PCLTrackerAlProducer.cc.

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

601 {
602  // Create alignment parameter builder
603  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
604  << "Creating AlignmentParameterBuilder";
605 
606  edm::ParameterSet alParamBuildCfg = theParameterSet.getParameter<edm::ParameterSet>("ParameterBuilder");
607  edm::ParameterSet alParamStoreCfg = theParameterSet.getParameter<edm::ParameterSet>("ParameterStore");
608 
609  AlignmentParameterBuilder alignmentParameterBuilder(theTrackerAlignables,
612  alParamBuildCfg);
613 
614  // Fix alignables if requested
615  if (stNFixAlignables_ > 0) {
616  alignmentParameterBuilder.fixAlignables(stNFixAlignables_);
617  }
618 
619  // Get list of alignables
620  Alignables theAlignables = alignmentParameterBuilder.alignables();
621  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
622  << "got " << theAlignables.size() << " alignables";
623 
624  // Create AlignmentParameterStore
625  theAlignmentParameterStore = new AlignmentParameterStore(theAlignables, alParamStoreCfg);
626  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::buildParameterStore"
627  << "AlignmentParameterStore created!";
628 }
AlignableMuon * theMuonAlignables
T getParameter(std::string const &) const
AlignableExtras * theExtraAlignables
std::vector< Alignable * > Alignables
Definition: Alignable.h:251
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 583 of file PCLTrackerAlProducer.cc.

References align::AlignableMuon.

584 {
585  if (doTracker_) {
587  }
588 
589  if (doMuon_) {
591  }
592 
593  if (useExtras_) {
595  }
596 }
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 320 of file PCLTrackerAlProducer.cc.

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

321 {
322  edm::ParameterSet algoConfig = config.getParameter<edm::ParameterSet>("algoConfig");
323  edm::VParameterSet iovSelection = config.getParameter<edm::VParameterSet>("RunRangeSelection");
324  algoConfig.addUntrackedParameter<edm::VParameterSet>("RunRangeSelection", iovSelection);
325 
326  std::string algoName = algoConfig.getParameter<std::string>("algoName");
327  theAlignmentAlgo = AlignmentAlgorithmPluginFactory::get()->create(algoName, algoConfig);
328 
329  if (!theAlignmentAlgo) {
330  throw cms::Exception("BadConfig")
331  << "Couldn't find the called alignment algorithm: " << algoName;
332  }
333 }
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 360 of file PCLTrackerAlProducer.cc.

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

361 {
362  edm::VParameterSet calibrations = config.getParameter<edm::VParameterSet>("calibrations");
363 
364  for (auto iCalib = calibrations.begin();
365  iCalib != calibrations.end();
366  ++iCalib) {
367  theCalibrations.push_back(
369  iCalib->getParameter<std::string>("calibrationName"), *iCalib
370  )
371  );
372  }
373 
374  // Not all algorithms support calibrations - so do not pass empty vector
375  // and throw if non-empty and not supported:
376  if (!theCalibrations.empty()) {
379 
380  } else {
381  throw cms::Exception("BadConfig")
382  << "[TrackerAlignmentProducerForPCL::init]\n"
383  << "Configured " << theCalibrations.size() << " calibration(s) "
384  << "for algorithm not supporting it.";
385  }
386  }
387 }
T getParameter(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
AlignmentAlgorithmBase * theAlignmentAlgo
virtual bool addCalibrations(const Calibrations &)
T get(const Candidate &c)
Definition: component.h:55
void PCLTrackerAlProducer::createGeometries ( const edm::EventSetup setup,
const TrackerTopology tTopo 
)
private

Creates ideal geometry from IdealGeometryRecord.

Definition at line 499 of file PCLTrackerAlProducer.cc.

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

500 {
501  if (doTracker_) {
502  edm::ESHandle<GeometricDet> geometricDet;
503  setup.get<IdealGeometryRecord>().get(geometricDet);
504 
505  TrackerGeomBuilderFromGeometricDet trackerBuilder;
506 
508  setup.get<PTrackerParametersRcd>().get( ptp );
509 
510  theTrackerGeometry = boost::shared_ptr<TrackerGeometry>(
511  trackerBuilder.build(&(*geometricDet), *ptp, tTopo )
512  );
513  }
514 
515  if (doMuon_) {
518 
519  setup.get<IdealGeometryRecord>().get(cpv);
520  setup.get<MuonNumberingRecord>().get(mdc);
521 
522  theMuonDTGeometry = boost::shared_ptr<DTGeometry> (new DTGeometry);
523  theMuonCSCGeometry = boost::shared_ptr<CSCGeometry>(new CSCGeometry);
524 
525  DTGeometryBuilderFromDDD DTGeometryBuilder;
527  DTGeometryBuilder.build (theMuonDTGeometry, &(*cpv), *mdc);
528  CSCGeometryBuilder.build(theMuonCSCGeometry, &(*cpv), *mdc);
529  }
530 }
boost::shared_ptr< DTGeometry > theMuonDTGeometry
boost::shared_ptr< TrackerGeometry > theTrackerGeometry
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
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:56
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 337 of file PCLTrackerAlProducer.cc.

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

338 {
339  edm::ParameterSet monitorConfig = config.getParameter<edm::ParameterSet>("monitorConfig");
340  std::vector<std::string> monitors = monitorConfig.getUntrackedParameter<std::vector<std::string>>("monitors");
341 
342  for (auto miter = monitors.begin();
343  miter != monitors.end();
344  ++miter) {
346  *miter, monitorConfig.getUntrackedParameter<edm::ParameterSet>(*miter)
347  );
348 
349  if (!newMonitor) {
350  throw cms::Exception("BadConfig") << "Couldn't find monitor named "
351  << *miter;
352  }
353 
354  theMonitors.push_back(newMonitor);
355  }
356 }
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 159 of file PCLTrackerAlProducer.cc.

Referenced by o2o.O2ORunMgr::executeJob().

160 {
161  finish();
162 
163  for (auto monitor = theMonitors.begin();
164  monitor != theMonitors.end();
165  ++monitor) {
166  (*monitor)->endOfJob();
167  }
168 
169  for (auto iCal = theCalibrations.begin();
170  iCal != theCalibrations.end();
171  ++iCal) {
172  (*iCal)->endOfJob();
173  }
174 }
AlignmentMonitors theMonitors
void PCLTrackerAlProducer::endLuminosityBlock ( const edm::LuminosityBlock lumiBlock,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 234 of file PCLTrackerAlProducer.cc.

236 {
237  // Do not forward edm::LuminosityBlock
239 }
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 203 of file PCLTrackerAlProducer.cc.

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

204 {
205  // TODO: Either MP nor HIP is implementing the endRun() method... so this
206  // seems to be useless?
207 
208  if (tkLasBeamTag_.encode().size()) {
211  run.getByToken(tkLasBeamToken, lasBeams);
212  run.getByToken(tsosVectorToken, tsoses);
213 
214  theAlignmentAlgo->endRun(EndRunInfo(run.id(), &(*lasBeams),
215  &(*tsoses)), setup);
216  } else {
217  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::endRun"
218  << "No Tk LAS beams to forward to algorithm.";
219  theAlignmentAlgo->endRun(EndRunInfo(run.id(), 0, 0), setup);
220  }
221 }
RunID const & id() const
Definition: RunBase.h:39
edm::EDGetTokenT< TkFittedLasBeamCollection > tkLasBeamToken
AlignmentAlgorithmBase * theAlignmentAlgo
edm::EDGetTokenT< TsosVectorCollection > tsosVectorToken
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.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:258
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 971 of file PCLTrackerAlProducer.cc.

References MillePedeFileReader::read(), and MillePedeFileReader::storeAlignments().

Referenced by progressbar.ProgressBar::__next__().

972 {
973  if (theAlignmentAlgo->processesEvents() && nevent_ == 0) {
974  // beginOfJob is usually called by the framework in the first event of the first loop
975  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
976  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
977  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
978  // some geometry information that is not defined either without having seen an event.
979  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
980  << "Did not process any events, stop "
981  << "without terminating algorithm.";
982  return;
983  }
984 
985  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
986  << "Terminating algorithm.";
988 
990  // if this is not the harvesting step there is no reason to look for the PEDE log and res files and to call the storeAlignmentsToDB method
991  MillePedeFileReader mpReader(theParameterSet.getParameter<edm::ParameterSet>("MillePedeFileReader"));
992  mpReader.read();
993  if (mpReader.storeAlignments()) {
995  }
996  } else {
997  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
998  << "no payload to be stored!";
999 
1000  }
1001 }
virtual bool processesEvents()
Returns whether algorithm proccesses events in current configuration.
T getParameter(std::string const &) const
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
edm::ParameterSet theParameterSet
void PCLTrackerAlProducer::initAlignmentAlgorithm ( const edm::EventSetup setup)
private

Creates Geometry and Alignables of the Tracker and initializes the AlignmentAlgorithm

Definition at line 450 of file PCLTrackerAlProducer.cc.

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

451 {
452  // Retrieve tracker topology from geometry
453  edm::ESHandle<TrackerTopology> tTopoHandle;
454  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
455  const TrackerTopology* const tTopo = tTopoHandle.product();
456 
457  // Create the geometries from the ideal geometries (first time only)
458  //std::shared_ptr<TrackingGeometry> theTrackerGeometry;
459  createGeometries(setup, tTopo);
460 
461  applyAlignmentsToDB(setup);
462  createAlignables(tTopo);
465 
466  // Initialize alignment algorithm and integrated calibration and pass the
467  // latter to algorithm
468  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::initAlignmentAlgorithm"
469  << "Initializing alignment algorithm.";
475 
477 }
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 &, const TrackerTopology *)
Creates ideal geometry from IdealGeometryRecord.
const T & get() const
Definition: EventSetup.h:56
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 481 of file PCLTrackerAlProducer.cc.

482 {
483  event.getByToken(beamSpotToken, theBeamSpot);
484 
485  if (theExtraAlignables) {
486  edm::LogInfo("Alignment") << "@SUB=TrackerAlignmentProducerForPCL::initBeamSpot"
487  << "Initializing AlignableBeamSpot";
488 
490  theBeamSpot->y0(),
491  theBeamSpot->z0(),
492  theBeamSpot->dxdz(),
493  theBeamSpot->dydz());
494  }
495 }
AlignableExtras * theExtraAlignables
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
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 1068 of file PCLTrackerAlProducer.cc.

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

1069 {
1070  static bool oldRunRangeSelectionWarning = false;
1071 
1074 
1075  RunRanges uniqueRunRanges;
1076  if (!RunRangeSelectionVPSet.empty()) {
1077 
1078  std::map<RunNumber,RunNumber> uniqueFirstRunNumbers;
1079 
1080  for (auto ipset = RunRangeSelectionVPSet.begin();
1081  ipset != RunRangeSelectionVPSet.end();
1082  ++ipset) {
1083  const std::vector<std::string> RunRangeStrings = (*ipset).getParameter<std::vector<std::string> >("RunRanges");
1084 
1085  for (auto irange = RunRangeStrings.begin();
1086  irange != RunRangeStrings.end();
1087  ++irange) {
1088 
1089  if ((*irange).find(':') == std::string::npos) {
1090 
1091  RunNumber first = beginValue;
1092  long int temp = strtol((*irange).c_str(), 0, 0);
1093  if (temp!=-1) first = temp;
1094  uniqueFirstRunNumbers[first] = first;
1095 
1096  } else {
1097  if (!oldRunRangeSelectionWarning) {
1098  edm::LogWarning("BadConfig") << "@SUB=PCLTrackerAlProducer::makeNonOverlappingRunRanges"
1099  << "Config file contains old format for 'RunRangeSelection'. Only the start run\n"
1100  << "number is used internally. The number of the last run is ignored and can be\n"
1101  << "safely removed from the config file.\n";
1102  oldRunRangeSelectionWarning = true;
1103  }
1104 
1105  std::vector<std::string> tokens = edm::tokenize(*irange, ":");
1106  long int temp;
1107  RunNumber first = beginValue;
1108  temp = strtol(tokens[0].c_str(), 0, 0);
1109  if (temp!=-1) first = temp;
1110  uniqueFirstRunNumbers[first] = first;
1111  }
1112  }
1113  }
1114 
1115  for (auto iFirst = uniqueFirstRunNumbers.begin();
1116  iFirst != uniqueFirstRunNumbers.end();
1117  ++iFirst) {
1118  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>((*iFirst).first, endValue));
1119  }
1120 
1121  for (size_t i = 0; i < uniqueRunRanges.size()-1; ++i) {
1122  uniqueRunRanges[i].second = uniqueRunRanges[i+1].first - 1;
1123  }
1124 
1125  } else {
1126  uniqueRunRanges.push_back(std::pair<RunNumber,RunNumber>(theFirstRun, endValue));
1127  }
1128 
1129  return uniqueRunRanges;
1130 }
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 866 of file PCLTrackerAlProducer.cc.

References edm::EventSetup::get().

867 {
868 
869  // Get Survey Rcds and add Survey Info
870  if (doTracker_ && useSurvey_) {
871  bool tkSurveyBool = watchTkSurveyRcd.check(setup);
872  bool tkSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
873 
874  if (tkSurveyBool || tkSurveyErrBool) {
876  edm::ESHandle<SurveyErrors> surveyErrors;
877  setup.get<TrackerSurveyRcd>(). get(surveys);
878  setup.get<TrackerSurveyErrorExtendedRcd>().get(surveyErrors);
879 
880  theSurveyIndex = 0;
881  theSurveyValues = &(*surveys);
882  theSurveyErrors = &(*surveyErrors);
883 
885  }
886  }
887 
888  if (doMuon_ && useSurvey_) {
889  bool DTSurveyBool = watchTkSurveyRcd.check(setup);
890  bool DTSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
891  bool CSCSurveyBool = watchTkSurveyRcd.check(setup);
892  bool CSCSurveyErrBool = watchTkSurveyErrExtRcd.check(setup);
893 
894  if (DTSurveyBool || DTSurveyErrBool || CSCSurveyBool || CSCSurveyErrBool) {
895  edm::ESHandle<Alignments> dtSurveys;
896  edm::ESHandle<SurveyErrors> dtSurveyErrors;
897  edm::ESHandle<Alignments> cscSurveys;
898  edm::ESHandle<SurveyErrors> cscSurveyErrors;
899  setup.get<DTSurveyRcd>(). get(dtSurveys);
900  setup.get<DTSurveyErrorExtendedRcd>(). get(dtSurveyErrors);
901  setup.get<CSCSurveyRcd>(). get(cscSurveys);
902  setup.get<CSCSurveyErrorExtendedRcd>().get(cscSurveyErrors);
903 
904  theSurveyIndex = 0;
905  theSurveyValues = &(*dtSurveys);
906  theSurveyErrors = &(*dtSurveyErrors);
907 
909  for (auto iter = barrels.begin();
910  iter != barrels.end();
911  ++iter) {
912  addSurveyInfo(*iter);
913  }
914 
915  theSurveyIndex = 0;
916  theSurveyValues = &(*cscSurveys);
917  theSurveyErrors = &(*cscSurveyErrors);
918 
920  for (auto iter = endcaps.begin();
921  iter != endcaps.end();
922  ++iter) {
923  addSurveyInfo(*iter);
924  }
925  }
926  }
927 
928 }
AlignableMuon * theMuonAlignables
const Alignments * theSurveyValues
std::vector< Alignable * > Alignables
Definition: Alignable.h:251
edm::ESWatcher< TrackerSurveyErrorExtendedRcd > watchTkSurveyErrExtRcd
align::Alignables DTBarrel()
const SurveyErrors * theSurveyErrors
align::Alignables CSCEndcaps()
const T & get() const
Definition: EventSetup.h:56
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 396 of file PCLTrackerAlProducer.cc.

397 {
398  bool changed = false;
399 
400  if (watchIdealGeometryRcd.check(setup)) {
401  changed = true;
402  }
403 
404  if (watchGlobalPositionRcd.check(setup)) {
405  changed = true;
406  }
407 
408  if (doTracker_) {
409  if (watchTrackerAlRcd.check(setup)) {
410  changed = true;
411  }
412 
413  if (watchTrackerAlErrorExtRcd.check(setup)) {
414  changed = true;
415  }
416 
417  if (watchTrackerSurDeRcd.check(setup)) {
418  changed = true;
419  }
420  }
421 
422  if (doMuon_) {
423  if (watchDTAlRcd.check(setup)) {
424  changed = true;
425  }
426 
427  if (watchDTAlErrExtRcd.check(setup)) {
428  changed = true;
429  }
430 
431  if (watchCSCAlRcd.check(setup)) {
432  changed = true;
433  }
434 
435  if (watchCSCAlErrExtRcd.check(setup)) {
436  changed = true;
437  }
438  }
439 
440  /* TODO: ExtraAlignables: Which record(s) to check?
441  *
442  if (useExtras_) {}
443  */
444 
445  return changed;
446 }
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 666 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().

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

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

Definition at line 1005 of file PCLTrackerAlProducer.cc.

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

1006 {
1007  if (theAlignmentAlgo->processesEvents() && nevent_ == 0) {
1008  // TODO: If this is the case, it would be already caught in finish()
1009  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::endOfJob"
1010  << "Did not process any events in last loop, "
1011  << "do not dare to store to DB.";
1012  } else {
1013  // Expand run ranges and make them unique
1014  edm::VParameterSet runRangeSelectionVPSet(theParameterSet.getParameter<edm::VParameterSet>("RunRangeSelection"));
1015  RunRanges uniqueRunRanges(makeNonOverlappingRunRanges(runRangeSelectionVPSet));
1016 
1017  // create dummy IOV
1018  if (uniqueRunRanges.empty()) {
1019  const RunRange runRange(cond::timeTypeSpecs[cond::runnumber].beginValue,
1021  uniqueRunRanges.push_back(runRange);
1022  }
1023 
1024  std::vector<AlgebraicVector> beamSpotParameters;
1025 
1026  for (auto iRunRange = uniqueRunRanges.begin();
1027  iRunRange != uniqueRunRanges.end();
1028  ++iRunRange) {
1029 
1031 
1032  // Save alignments to database
1034  writeForRunRange((*iRunRange).first);
1035  }
1036 
1037  // Deal with extra alignables, e.g. beam spot
1038  if (theExtraAlignables) {
1040  if (!alis.empty()) {
1041  BeamSpotAlignmentParameters *beamSpotAliPars = dynamic_cast<BeamSpotAlignmentParameters*>(alis[0]->alignmentParameters());
1042  beamSpotParameters.push_back(beamSpotAliPars->parameters());
1043  }
1044  }
1045  }
1046 
1047  if (theExtraAlignables) {
1048  std::ostringstream bsOutput;
1049 
1050  auto itPar = beamSpotParameters.begin();
1051  for (auto iRunRange = uniqueRunRanges.begin();
1052  iRunRange != uniqueRunRanges.end();
1053  ++iRunRange, ++itPar) {
1054  bsOutput << "Run range: " << (*iRunRange).first << " - " << (*iRunRange).second << "\n";
1055  bsOutput << " Displacement: x=" << (*itPar)[0] << ", y=" << (*itPar)[1] << "\n";
1056  bsOutput << " Slope: dx/dz=" << (*itPar)[2] << ", dy/dz=" << (*itPar)[3] << "\n";
1057  }
1058 
1059  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::endOfJob"
1060  << "Parameters for alignable beamspot:\n"
1061  << bsOutput.str();
1062  }
1063  }
1064 }
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:251
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 1190 of file PCLTrackerAlProducer.cc.

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

1194 {
1195  Alignments* tempAlignments = alignments;
1196  AlignmentErrorsExtended* tempAlignmentErrExt = alignmentErrExt;
1197 
1198  // Call service
1200  if (!poolDb.isAvailable()) { // Die if not available
1201  delete tempAlignments; // promised to take over ownership...
1202  delete tempAlignmentErrExt; // dito
1203 
1204  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1205  }
1206 
1207  if (globalCoordinates && // happens only if (applyDbAlignment_ == true)
1208  globalCoordinates->transform() != AlignTransform::Transform::Identity) {
1209 
1210  tempAlignments = new Alignments(); // temporary storage for
1211  tempAlignmentErrExt = new AlignmentErrorsExtended(); // final alignments and errors
1212 
1213  GeometryAligner aligner;
1214  aligner.removeGlobalTransform(alignments, alignmentErrExt,
1215  *globalCoordinates,
1216  tempAlignments, tempAlignmentErrExt);
1217 
1218  delete alignments; // have to delete original alignments
1219  delete alignmentErrExt; // same thing for the errors
1220 
1221  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::writeDB"
1222  << "globalCoordinates removed from alignments ("
1223  << alignRcd << ") and errors (" << alignRcd << ").";
1224  }
1225 
1226  if (saveToDB_) {
1227  edm::LogInfo("Alignment") << "Writing Alignments for run " << time
1228  << " to " << alignRcd << ".";
1229  poolDb->writeOne<Alignments>(tempAlignments, time, alignRcd);
1230 
1231  } else {
1232  // poolDb->writeOne(..) takes over 'alignments' ownership, ...
1233  delete tempAlignments; // ...otherwise we have to delete, as promised!
1234  }
1235 
1236  if (saveApeToDB_) {
1237  edm::LogInfo("Alignment") << "Writing AlignmentErrorsExtended for run "
1238  << time << " to " << errRcd << ".";
1239  poolDb->writeOne<AlignmentErrorsExtended>(tempAlignmentErrExt, time, errRcd);
1240 
1241  } else {
1242  // poolDb->writeOne(..) takes over 'alignmentErrors' ownership, ...
1243  delete tempAlignmentErrExt; // ...otherwise we have to delete, as promised!
1244  }
1245 }
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 1249 of file PCLTrackerAlProducer.cc.

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

1252 {
1253  // Call service
1255  if (!poolDb.isAvailable()) { // Die if not available
1256  delete alignmentSurfaceDeformations; // promised to take over ownership...
1257  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1258  }
1259 
1260  if (saveDeformationsToDB_) {
1261  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run "
1262  << time << " to " << surfaceDeformationRcd << ".";
1263  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
1264  surfaceDeformationRcd);
1265 
1266  } else {
1267  // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
1268  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
1269  }
1270 }
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 1134 of file PCLTrackerAlProducer.cc.

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

1135 {
1136  // first tracker
1137  if (doTracker_) {
1138  const AlignTransform* trackerGlobal = 0; // will be 'removed' from constants
1139  if (globalPositions_) { // i.e. applied before in applyDB
1142  }
1143 
1144  // theTrackerAlignables->alignments calls new
1145  Alignments* alignments = theTrackerAlignables->alignments();
1147 
1148  writeDB(alignments, "TrackerAlignmentRcd",
1149  alignmentErrExt, "TrackerAlignmentErrorExtendedRcd",
1150  trackerGlobal,
1151  time);
1152  }
1153 
1154  // Save surface deformations to database
1156  AlignmentSurfaceDeformations* alignmentSurfaceDeformations = theTrackerAlignables->surfaceDeformations();
1157  writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
1158  }
1159 
1160  // now muon
1161  if (doMuon_) {
1162  const AlignTransform* muonGlobal = 0; // will be 'removed' from constants
1163  if (globalPositions_) { // i.e. applied before in applyDB
1165  DetId(DetId::Muon));
1166  }
1167 
1168  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
1169  Alignments* alignments = theMuonAlignables->dtAlignments();
1171 
1172  writeDB(alignments, "DTAlignmentRcd",
1173  alignmentErrExt, "DTAlignmentErrorExtendedRcd",
1174  muonGlobal,
1175  time);
1176 
1177  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
1178  alignments = theMuonAlignables->cscAlignments();
1179  alignmentErrExt = theMuonAlignables->cscAlignmentErrorsExtended();
1180 
1181  writeDB(alignments, "CSCAlignmentRcd",
1182  alignmentErrExt, "CSCAlignmentErrorExtendedRcd",
1183  muonGlobal,
1184  time);
1185  }
1186 }
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:245
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 246 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::beamSpotTag_
private

BeamSpot.

Definition at line 255 of file PCLTrackerAlProducer.h.

edm::EDGetTokenT<reco::BeamSpot> PCLTrackerAlProducer::beamSpotToken
private

Definition at line 262 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::checkDbAlignmentValidity_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::clusterValueMapTag_
private

ValueMap containing associtaion cluster-flag.

Definition at line 259 of file PCLTrackerAlProducer.h.

edm::EDGetTokenT<AliClusterValueMap> PCLTrackerAlProducer::clusterValueMapToken
private

Definition at line 265 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMisalignmentScenario_
private

Definition at line 247 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMuon_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doTracker_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::globalPositions_
private

GlobalPositions that might be read from DB, NULL otherwise.

Definition at line 229 of file PCLTrackerAlProducer.h.

int PCLTrackerAlProducer::nevent_
private

Definition at line 236 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveApeToDB_
private

Definition at line 248 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveDeformationsToDB_
private

Definition at line 248 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveToDB_
private

Definition at line 248 of file PCLTrackerAlProducer.h.

const int PCLTrackerAlProducer::stNFixAlignables_
private

Definition at line 244 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomRotation_
private

Definition at line 245 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomShift_
private

Definition at line 245 of file PCLTrackerAlProducer.h.

AlignmentAlgorithmBase* PCLTrackerAlProducer::theAlignmentAlgo
private

Definition at line 218 of file PCLTrackerAlProducer.h.

AlignmentParameterStore* PCLTrackerAlProducer::theAlignmentParameterStore
private

Definition at line 222 of file PCLTrackerAlProducer.h.

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

Definition at line 227 of file PCLTrackerAlProducer.h.

Calibrations PCLTrackerAlProducer::theCalibrations
private

Definition at line 219 of file PCLTrackerAlProducer.h.

AlignableExtras* PCLTrackerAlProducer::theExtraAlignables
private

Definition at line 225 of file PCLTrackerAlProducer.h.

cond::Time_t PCLTrackerAlProducer::theFirstRun
private

Definition at line 266 of file PCLTrackerAlProducer.h.

AlignmentMonitors PCLTrackerAlProducer::theMonitors
private

Definition at line 220 of file PCLTrackerAlProducer.h.

AlignableMuon* PCLTrackerAlProducer::theMuonAlignables
private

Definition at line 224 of file PCLTrackerAlProducer.h.

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

Definition at line 234 of file PCLTrackerAlProducer.h.

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

Definition at line 233 of file PCLTrackerAlProducer.h.

edm::ParameterSet PCLTrackerAlProducer::theParameterSet
private

Definition at line 242 of file PCLTrackerAlProducer.h.

const SurveyErrors* PCLTrackerAlProducer::theSurveyErrors
private

Definition at line 300 of file PCLTrackerAlProducer.h.

size_t PCLTrackerAlProducer::theSurveyIndex
private

Definition at line 298 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::theSurveyValues
private

Definition at line 299 of file PCLTrackerAlProducer.h.

AlignableTracker* PCLTrackerAlProducer::theTrackerAlignables
private

Definition at line 223 of file PCLTrackerAlProducer.h.

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

Definition at line 232 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tjTkAssociationMapTag_
private

Map with tracks/trajectories.

Definition at line 253 of file PCLTrackerAlProducer.h.

edm::EDGetTokenT<TrajTrackAssociationCollection> PCLTrackerAlProducer::tjTkAssociationMapToken
private

Definition at line 261 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tkLasBeamTag_
private

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

Definition at line 257 of file PCLTrackerAlProducer.h.

edm::EDGetTokenT<TkFittedLasBeamCollection> PCLTrackerAlProducer::tkLasBeamToken
private

Definition at line 263 of file PCLTrackerAlProducer.h.

edm::EDGetTokenT<TsosVectorCollection> PCLTrackerAlProducer::tsosVectorToken
private

Definition at line 264 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useExtras_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useSurvey_
private

Definition at line 250 of file PCLTrackerAlProducer.h.

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

Definition at line 285 of file PCLTrackerAlProducer.h.

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

Definition at line 284 of file PCLTrackerAlProducer.h.

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

Definition at line 292 of file PCLTrackerAlProducer.h.

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

Definition at line 291 of file PCLTrackerAlProducer.h.

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

Definition at line 283 of file PCLTrackerAlProducer.h.

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

Definition at line 282 of file PCLTrackerAlProducer.h.

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

Definition at line 290 of file PCLTrackerAlProducer.h.

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

Definition at line 289 of file PCLTrackerAlProducer.h.

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

Definition at line 276 of file PCLTrackerAlProducer.h.

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

Definition at line 275 of file PCLTrackerAlProducer.h.

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

Definition at line 288 of file PCLTrackerAlProducer.h.

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

Definition at line 287 of file PCLTrackerAlProducer.h.

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

Definition at line 279 of file PCLTrackerAlProducer.h.

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

Definition at line 278 of file PCLTrackerAlProducer.h.

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

Definition at line 280 of file PCLTrackerAlProducer.h.