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...
 
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 85 of file PCLTrackerAlProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 62 of file PCLTrackerAlProducer.cc.

62  :
69 
70  /* Steering parameters */
71  theParameterSet(config),
72  stNFixAlignables_ (config.getParameter<int> ("nFixAlignables")),
73  stRandomShift_ (config.getParameter<double> ("randomShift")),
74  stRandomRotation_ (config.getParameter<double> ("randomRotation")),
75  applyDbAlignment_ (config.getUntrackedParameter<bool>("applyDbAlignment")),
76  checkDbAlignmentValidity_(config.getUntrackedParameter<bool>("checkDbAlignmentValidity")),
77  doMisalignmentScenario_ (config.getParameter<bool> ("doMisalignmentScenario")),
78  saveToDB_ (config.getParameter<bool> ("saveToDB")),
79  saveApeToDB_ (config.getParameter<bool> ("saveApeToDB")),
80  saveDeformationsToDB_ (config.getParameter<bool> ("saveDeformationsToDB")),
81  doTracker_ (config.getUntrackedParameter<bool>("doTracker") ),
82  doMuon_ (config.getUntrackedParameter<bool>("doMuon") ),
83  useExtras_ (config.getUntrackedParameter<bool>("useExtras")),
84  useSurvey_ (config.getParameter<bool> ("useSurvey")),
85 
86  /* Event input tags */
87  tjTkAssociationMapTag_ (config.getParameter<edm::InputTag>("tjTkAssociationMapTag")),
88  beamSpotTag_ (config.getParameter<edm::InputTag>("beamSpotTag")),
89  tkLasBeamTag_ (config.getParameter<edm::InputTag>("tkLasBeamTag")),
90  clusterValueMapTag_ (config.getParameter<edm::InputTag>("hitPrescaleMapTag")),
92 {
93 
94  tjTkAssociationMapToken = consumes<TrajTrackAssociationCollection>(tjTkAssociationMapTag_);
95  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag_);
96  tkLasBeamToken = consumes<TkFittedLasBeamCollection>(tkLasBeamTag_);
97  tsosVectorToken = consumes<TsosVectorCollection>(tkLasBeamTag_);
98  clusterValueMapToken = consumes<AliClusterValueMap>(clusterValueMapTag_);
99 
100 
101  createAlignmentAlgorithm(config);
102  createCalibrations (config);
103  createMonitors (config);
104 }
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 108 of file PCLTrackerAlProducer.cc.

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

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

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

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

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

534 {
535  // Retrieve and apply alignments, if requested (requires z setup)
536  if (applyDbAlignment_) {
537  // we need GlobalPositionRcd - and have to keep track for later removal
538  // before writing again to DB...
539 
540  edm::ESHandle<Alignments> globalAlignments;
541  setup.get<GlobalPositionRcd>().get(globalAlignments);
542  globalPositions_ = new Alignments(*globalAlignments);
543 
544  if (doTracker_) {
548  &(*theTrackerGeometry),
549  setup,
551  );
552 
553  applyDB<TrackerGeometry,
555  &(*theTrackerGeometry),
556  setup
557  );
558  }
559 
560  if (doMuon_) {
564  &(*theMuonDTGeometry),
565  setup,
567  );
568 
572  &(*theMuonCSCGeometry),
573  setup,
575  );
576  }
577  }
578 }
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 setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void PCLTrackerAlProducer::applyAlignmentsToGeometry ( )
private

Applies Alignments, AlignmentErrors and SurfaceDeformations to

Definition at line 742 of file PCLTrackerAlProducer.cc.

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

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

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

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

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

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

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

226 {
227  // Do not forward edm::LuminosityBlock
229 }
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 177 of file PCLTrackerAlProducer.cc.

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

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

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

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

References align::AlignableMuon.

583 {
584  if (doTracker_) {
586  }
587 
588  if (doMuon_) {
590  }
591 
592  if (useExtras_) {
594  }
595 }
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 319 of file PCLTrackerAlProducer.cc.

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

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

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

360 {
361  edm::VParameterSet calibrations = config.getParameter<edm::VParameterSet>("calibrations");
362 
363  for (auto iCalib = calibrations.begin();
364  iCalib != calibrations.end();
365  ++iCalib) {
366  theCalibrations.push_back(
368  iCalib->getParameter<std::string>("calibrationName"), *iCalib
369  )
370  );
371  }
372 
373  // Not all algorithms support calibrations - so do not pass empty vector
374  // and throw if non-empty and not supported:
375  if (!theCalibrations.empty()) {
378 
379  } else {
380  throw cms::Exception("BadConfig")
381  << "[TrackerAlignmentProducerForPCL::init]\n"
382  << "Configured " << theCalibrations.size() << " calibration(s) "
383  << "for algorithm not supporting it.";
384  }
385  }
386 }
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 498 of file PCLTrackerAlProducer.cc.

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

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

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

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file PCLTrackerAlProducer.cc.

235 {
236  // Do not forward edm::LuminosityBlock
238 }
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 202 of file PCLTrackerAlProducer.cc.

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

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

Referenced by progressbar.ProgressBar::__next__().

971 {
972  if (theAlignmentAlgo->processesEvents() && nevent_ == 0) {
973  // beginOfJob is usually called by the framework in the first event of the first loop
974  // (a hack: beginOfJob needs the EventSetup that is not well defined without an event)
975  // and the algorithms rely on the initialisations done in beginOfJob. We cannot call
976  // this->beginOfJob(iSetup); here either since that will access the EventSetup to get
977  // some geometry information that is not defined either without having seen an event.
978  edm::LogError("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
979  << "Did not process any events, stop "
980  << "without terminating algorithm.";
981  return;
982  }
983 
984  edm::LogInfo("Alignment") << "@SUB=PCLTrackerAlProducer::finish"
985  << "Terminating algorithm.";
987 
989 }
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 449 of file PCLTrackerAlProducer.cc.

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

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

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

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

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

References edm::EventSetup::get().

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

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

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

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

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

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

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

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

1240 {
1241  // Call service
1243  if (!poolDb.isAvailable()) { // Die if not available
1244  delete alignmentSurfaceDeformations; // promised to take over ownership...
1245  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
1246  }
1247 
1248  if (saveDeformationsToDB_) {
1249  edm::LogInfo("Alignment") << "Writing AlignmentSurfaceDeformations for run "
1250  << time << " to " << surfaceDeformationRcd << ".";
1251  poolDb->writeOne<AlignmentSurfaceDeformations>(alignmentSurfaceDeformations, time,
1252  surfaceDeformationRcd);
1253 
1254  } else {
1255  // poolDb->writeOne(..) takes over 'surfaceDeformation' ownership,...
1256  delete alignmentSurfaceDeformations; // ...otherwise we have to delete, as promised!
1257  }
1258 }
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 1122 of file PCLTrackerAlProducer.cc.

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

1123 {
1124  // first tracker
1125  if (doTracker_) {
1126  const AlignTransform* trackerGlobal = 0; // will be 'removed' from constants
1127  if (globalPositions_) { // i.e. applied before in applyDB
1130  }
1131 
1132  // theTrackerAlignables->alignments calls new
1133  Alignments* alignments = theTrackerAlignables->alignments();
1135 
1136  writeDB(alignments, "TrackerAlignmentRcd",
1137  alignmentErrExt, "TrackerAlignmentErrorExtendedRcd",
1138  trackerGlobal,
1139  time);
1140  }
1141 
1142  // Save surface deformations to database
1144  AlignmentSurfaceDeformations* alignmentSurfaceDeformations = theTrackerAlignables->surfaceDeformations();
1145  writeDB(alignmentSurfaceDeformations, "TrackerSurfaceDeformationRcd", time);
1146  }
1147 
1148  // now muon
1149  if (doMuon_) {
1150  const AlignTransform* muonGlobal = 0; // will be 'removed' from constants
1151  if (globalPositions_) { // i.e. applied before in applyDB
1153  DetId(DetId::Muon));
1154  }
1155 
1156  // Get alignments+errors, first DT - ownership taken over by writeDB(..), so no delete
1157  Alignments* alignments = theMuonAlignables->dtAlignments();
1159 
1160  writeDB(alignments, "DTAlignmentRcd",
1161  alignmentErrExt, "DTAlignmentErrorExtendedRcd",
1162  muonGlobal,
1163  time);
1164 
1165  // Get alignments+errors, now CSC - ownership taken over by writeDB(..), so no delete
1166  alignments = theMuonAlignables->cscAlignments();
1167  alignmentErrExt = theMuonAlignables->cscAlignmentErrorsExtended();
1168 
1169  writeDB(alignments, "CSCAlignmentRcd",
1170  alignmentErrExt, "CSCAlignmentErrorExtendedRcd",
1171  muonGlobal,
1172  time);
1173  }
1174 }
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 247 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::beamSpotTag_
private

BeamSpot.

Definition at line 256 of file PCLTrackerAlProducer.h.

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

Definition at line 263 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::checkDbAlignmentValidity_
private

Definition at line 247 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::clusterValueMapTag_
private

ValueMap containing associtaion cluster-flag.

Definition at line 260 of file PCLTrackerAlProducer.h.

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

Definition at line 266 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMisalignmentScenario_
private

Definition at line 248 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doMuon_
private

Definition at line 250 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::doTracker_
private

Definition at line 250 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::globalPositions_
private

GlobalPositions that might be read from DB, NULL otherwise.

Definition at line 230 of file PCLTrackerAlProducer.h.

int PCLTrackerAlProducer::nevent_
private

Definition at line 237 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveApeToDB_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveDeformationsToDB_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::saveToDB_
private

Definition at line 249 of file PCLTrackerAlProducer.h.

const int PCLTrackerAlProducer::stNFixAlignables_
private

Definition at line 245 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomRotation_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

const double PCLTrackerAlProducer::stRandomShift_
private

Definition at line 246 of file PCLTrackerAlProducer.h.

AlignmentAlgorithmBase* PCLTrackerAlProducer::theAlignmentAlgo
private

Definition at line 219 of file PCLTrackerAlProducer.h.

AlignmentParameterStore* PCLTrackerAlProducer::theAlignmentParameterStore
private

Definition at line 223 of file PCLTrackerAlProducer.h.

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

Definition at line 228 of file PCLTrackerAlProducer.h.

Calibrations PCLTrackerAlProducer::theCalibrations
private

Definition at line 220 of file PCLTrackerAlProducer.h.

AlignableExtras* PCLTrackerAlProducer::theExtraAlignables
private

Definition at line 226 of file PCLTrackerAlProducer.h.

cond::Time_t PCLTrackerAlProducer::theFirstRun
private

Definition at line 291 of file PCLTrackerAlProducer.h.

AlignmentMonitors PCLTrackerAlProducer::theMonitors
private

Definition at line 221 of file PCLTrackerAlProducer.h.

AlignableMuon* PCLTrackerAlProducer::theMuonAlignables
private

Definition at line 225 of file PCLTrackerAlProducer.h.

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

Definition at line 235 of file PCLTrackerAlProducer.h.

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

Definition at line 234 of file PCLTrackerAlProducer.h.

edm::ParameterSet PCLTrackerAlProducer::theParameterSet
private

Definition at line 243 of file PCLTrackerAlProducer.h.

const SurveyErrors* PCLTrackerAlProducer::theSurveyErrors
private

Definition at line 297 of file PCLTrackerAlProducer.h.

size_t PCLTrackerAlProducer::theSurveyIndex
private

Definition at line 295 of file PCLTrackerAlProducer.h.

const Alignments* PCLTrackerAlProducer::theSurveyValues
private

Definition at line 296 of file PCLTrackerAlProducer.h.

AlignableTracker* PCLTrackerAlProducer::theTrackerAlignables
private

Definition at line 224 of file PCLTrackerAlProducer.h.

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

Definition at line 233 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tjTkAssociationMapTag_
private

Map with tracks/trajectories.

Definition at line 254 of file PCLTrackerAlProducer.h.

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

Definition at line 262 of file PCLTrackerAlProducer.h.

const edm::InputTag PCLTrackerAlProducer::tkLasBeamTag_
private

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

Definition at line 258 of file PCLTrackerAlProducer.h.

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

Definition at line 264 of file PCLTrackerAlProducer.h.

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

Definition at line 265 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useExtras_
private

Definition at line 250 of file PCLTrackerAlProducer.h.

const bool PCLTrackerAlProducer::useSurvey_
private

Definition at line 251 of file PCLTrackerAlProducer.h.

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

Definition at line 281 of file PCLTrackerAlProducer.h.

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

Definition at line 280 of file PCLTrackerAlProducer.h.

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

Definition at line 288 of file PCLTrackerAlProducer.h.

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

Definition at line 287 of file PCLTrackerAlProducer.h.

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

Definition at line 279 of file PCLTrackerAlProducer.h.

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

Definition at line 278 of file PCLTrackerAlProducer.h.

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

Definition at line 286 of file PCLTrackerAlProducer.h.

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

Definition at line 285 of file PCLTrackerAlProducer.h.

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

Definition at line 272 of file PCLTrackerAlProducer.h.

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

Definition at line 271 of file PCLTrackerAlProducer.h.

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

Definition at line 284 of file PCLTrackerAlProducer.h.

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

Definition at line 283 of file PCLTrackerAlProducer.h.

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

Definition at line 275 of file PCLTrackerAlProducer.h.

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

Definition at line 274 of file PCLTrackerAlProducer.h.

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

Definition at line 276 of file PCLTrackerAlProducer.h.