CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SurveyInputTrackerFromDB Class Reference

#include <SurveyInputTrackerFromDB.h>

Inheritance diagram for SurveyInputTrackerFromDB:
SurveyInputBase edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Read ideal tracker geometry from DB. More...
 
 SurveyInputTrackerFromDB (const edm::ParameterSet &)
 
- Public Member Functions inherited from SurveyInputBase
void beginJob () override
 Read data from input. More...
 
 ~SurveyInputBase () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void addSurveyInfo (Alignable *)
 Add survey info to an alignable. More...
 

Private Attributes

const edm::ESGetToken< GeometricDet, IdealGeometryRecordgeomDetToken_
 
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcdptitpToken_
 
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcdptpToken_
 
std::string textFileName
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
SurveyInputTextReader::MapType uIdMap
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from SurveyInputBase
static void addComponent (Alignable *)
 
static Alignabledetector ()
 Get alignable detector as read from input. More...
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from SurveyInputBase
bool theFirstEvent
 

Detailed Description

Class to read ideal tracker from DB.

Date
2012/06/13 09:22:26
Revision
1.4
Author
Chung Khim Lae

Definition at line 20 of file SurveyInputTrackerFromDB.h.

Constructor & Destructor Documentation

◆ SurveyInputTrackerFromDB()

SurveyInputTrackerFromDB::SurveyInputTrackerFromDB ( const edm::ParameterSet cfg)

Definition at line 23 of file SurveyInputTrackerFromDB.cc.

28  textFileName(cfg.getParameter<std::string>("textFileName")) {}
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd > ptitpToken_
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_

Member Function Documentation

◆ addSurveyInfo()

void SurveyInputTrackerFromDB::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 69 of file SurveyInputTrackerFromDB.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), MillePedeFileConverter_cfg::e, relativeConstraints::error, mps_fire::i, Alignable::id(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, Basic3DVector< T >::mag(), Alignable::move(), Alignable::rotateInLocalFrame(), idealTransformation::rotation, edm::second(), Alignable::setSurvey(), Alignable::surface(), AlignableSurface::toGlobal(), and uIdMap.

Referenced by analyze().

69  {
70  const align::Alignables& comp = ali->components();
71  unsigned int nComp = comp.size();
72 
73  for (unsigned int i = 0; i < nComp; ++i)
75 
77 
78  SurveyInputTextReader::MapType::const_iterator it = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
79 
80  if (it != uIdMap.end()) {
81  const align::Scalars& parameters = (it)->second;
82 
83  //move the surface
84  //displacement
86  align::GlobalVector gvector = ali->surface().toGlobal(lvector);
87  ali->move(gvector);
88  //rotation
90  align::RotationType rotation(rot_aa, rot_aa.mag());
92 
93  //sets the errors for the hierarchy level
94  double* errorData = error.Array();
95  for (unsigned int i = 0; i < 21; ++i) {
96  errorData[i] = parameters[i + 6];
97  }
98 
99  ali->setSurvey(new SurveyDet(ali->surface(), error * (1e-6)));
100  } else {
101  error = ROOT::Math::SMatrixIdentity();
102  ali->setSurvey(new SurveyDet(ali->surface(), error * 1e-6));
103  }
104 }
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:129
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
U second(std::pair< T, U > const &p)
std::vector< Scalar > Scalars
Definition: Utilities.h:26
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual const Alignables & components() const =0
Return vector of all direct components.
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
SurveyInputTextReader::MapType uIdMap
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37

◆ analyze()

void SurveyInputTrackerFromDB::analyze ( const edm::Event ,
const edm::EventSetup setup 
)
overridevirtual

Read ideal tracker geometry from DB.

Implements SurveyInputBase.

Definition at line 30 of file SurveyInputTrackerFromDB.cc.

References SurveyInputBase::addComponent(), addSurveyInfo(), Alignable::alignmentErrors(), Alignable::alignments(), cond::service::PoolDBOutputService::beginOfTime(), TrackerGeomBuilderFromGeometricDet::build(), SurveyInputBase::detector(), relativeConstraints::geom, geomDetToken_, edm::Service< T >::isAvailable(), ptitpToken_, ptpToken_, SurveyInputTextReader::readFile(), singleTopDQM_cfi::setup, textFileName, SurveyInputBase::theFirstEvent, PbPb_ZMuSkimMuonDPG_cff::tracker, tTopoToken_, uIdMap, SurveyInputTextReader::UniqueIdMap(), and cond::service::PoolDBOutputService::writeOneIOV().

30  {
31  if (theFirstEvent) {
32  // std::cout << "***************ENTERING INITIALIZATION******************" << std::endl;
33 
34  //Retrieve tracker topology from geometry
35  const TrackerTopology* const tTopo = &setup.getData(tTopoToken_);
36 
37  //Get map from textreader
38  SurveyInputTextReader dataReader;
39  dataReader.readFile(textFileName);
40  uIdMap = dataReader.UniqueIdMap();
41 
42  const GeometricDet* geom = &setup.getData(geomDetToken_);
43  const PTrackerParameters& ptp = setup.getData(ptpToken_);
44  const PTrackerAdditionalParametersPerDet* ptitp = &setup.getData(ptitpToken_);
46 
49 
50  //write out to a DB ...
51  Alignments* myAlignments = detector()->alignments();
52  AlignmentErrorsExtended* myAlignmentErrorsExtended = detector()->alignmentErrors();
53 
54  // 2. Store alignment[Error]s to DB
56  // Call service
57 
58  if (!poolDbService.isAvailable()) // Die if not available
59  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
60 
61  poolDbService->writeOneIOV<Alignments>(*myAlignments, poolDbService->beginOfTime(), "TrackerAlignmentRcd");
62  poolDbService->writeOneIOV<AlignmentErrorsExtended>(
63  *myAlignmentErrorsExtended, poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
64 
65  theFirstEvent = false;
66  }
67 }
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd > ptitpToken_
void readFile(const std::string &textFileName)
Read given text file.
virtual AlignmentErrorsExtended * alignmentErrors() const =0
Return vector of alignment errors.
TrackerGeometry * build(const GeometricDet *gd, const PTrackerAdditionalParametersPerDet *ptitp, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
static void addComponent(Alignable *)
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
static Alignable * detector()
Get alignable detector as read from input.
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
SurveyInputTextReader::MapType uIdMap
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
bool isAvailable() const
Definition: Service.h:40
const MapType & UniqueIdMap() const
virtual Alignments * alignments() const =0
Return vector of alignment data.

Member Data Documentation

◆ geomDetToken_

const edm::ESGetToken<GeometricDet, IdealGeometryRecord> SurveyInputTrackerFromDB::geomDetToken_
private

Definition at line 31 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

◆ ptitpToken_

const edm::ESGetToken<PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd> SurveyInputTrackerFromDB::ptitpToken_
private

Definition at line 33 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

◆ ptpToken_

const edm::ESGetToken<PTrackerParameters, PTrackerParametersRcd> SurveyInputTrackerFromDB::ptpToken_
private

Definition at line 32 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

◆ textFileName

std::string SurveyInputTrackerFromDB::textFileName
private

Definition at line 35 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SurveyInputTrackerFromDB::tTopoToken_
private

Definition at line 30 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

◆ uIdMap

SurveyInputTextReader::MapType SurveyInputTrackerFromDB::uIdMap
private

Definition at line 28 of file SurveyInputTrackerFromDB.h.

Referenced by addSurveyInfo(), and analyze().