CMS 3D CMS Logo

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

#include <SurveyMisalignmentInput.h>

Inheritance diagram for SurveyMisalignmentInput:
SurveyInputBase edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 Read ideal tracker geometry from DB. More...
 
 SurveyMisalignmentInput (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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void addSurveyInfo (Alignable *)
 Add survey info to an alignable. More...
 
AlignableSurface getAlignableSurface (align::ID)
 Get alignable surface from misalignments.db. More...
 

Private Attributes

edm::ESHandle< Alignmentsalignments
 
std::string textFileName
 
SurveyInputTextReader::MapType uIdMap
 

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 SurveyInputBase
static void addComponent (Alignable *)
 
static Alignabledetector ()
 Get alignable detector as read from input. More...
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from SurveyInputBase
bool theFirstEvent
 

Detailed Description

Class to misaligned tracker from DB.

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

Definition at line 21 of file SurveyMisalignmentInput.h.

Constructor & Destructor Documentation

SurveyMisalignmentInput::SurveyMisalignmentInput ( const edm::ParameterSet cfg)

Definition at line 19 of file SurveyMisalignmentInput.cc.

Member Function Documentation

void SurveyMisalignmentInput::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 53 of file SurveyMisalignmentInput.cc.

References align::AlignableDetUnit, Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), MillePedeFileConverter_cfg::e, relativeConstraints::error, getAlignableSurface(), mps_fire::i, Alignable::id(), edm::second(), Alignable::setSurvey(), Alignable::surface(), and uIdMap.

Referenced by analyze().

53  {
54  const align::Alignables& comp = ali->components();
55  unsigned int nComp = comp.size();
56  for (unsigned int i = 0; i < nComp; ++i)
57  addSurveyInfo(comp[i]);
58 
59  SurveyInputTextReader::MapType::const_iterator it = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
60 
62 
63  if (it != uIdMap.end()) {
64  //survey error values
65  const align::Scalars& parameters = (it)->second;
66  //sets the errors for the hierarchy level
67  double* errorData = error.Array();
68  for (unsigned int i = 0; i < 21; ++i) {
69  errorData[i] = parameters[i + 6];
70  }
71 
72  //because record only needs global value of modules
74  // fill survey values
75  ali->setSurvey(new SurveyDet(getAlignableSurface(ali->id()), error));
76  } else {
77  ali->setSurvey(new SurveyDet(ali->surface(), error));
78  }
79  } else {
80  //fill
81  error = ROOT::Math::SMatrixIdentity();
82  ali->setSurvey(new SurveyDet(ali->surface(), error * (1e-6)));
83  }
84  //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
85  //std::cout << error << std::endl;
86 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
SurveyInputTextReader::MapType uIdMap
virtual const Alignables & components() const =0
Return vector of all direct components.
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
U second(std::pair< T, U > const &p)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
std::vector< Scalar > Scalars
Definition: Utilities.h:27
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:340
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
AlignableSurface getAlignableSurface(align::ID)
Get alignable surface from misalignments.db.
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
void SurveyMisalignmentInput::analyze ( const edm::Event ,
const edm::EventSetup setup 
)
overridevirtual

Read ideal tracker geometry from DB.

Implements SurveyInputBase.

Definition at line 22 of file SurveyMisalignmentInput.cc.

References SurveyInputBase::addComponent(), addSurveyInfo(), alignments, TrackerGeomBuilderFromGeometricDet::build(), SurveyInputBase::detector(), relativeConstraints::geom, edm::EventSetup::get(), edm::ESHandle< T >::product(), SurveyInputTextReader::readFile(), textFileName, SurveyInputBase::theFirstEvent, trackingTruthProducer_cfi::tracker, uIdMap, and SurveyInputTextReader::UniqueIdMap().

22  {
23  if (theFirstEvent) {
24  //Retrieve tracker topology from geometry
26  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
27  const TrackerTopology* const tTopo = tTopoHandle.product();
28 
30  setup.get<IdealGeometryRecord>().get(geom);
31 
33  setup.get<PTrackerParametersRcd>().get(ptp);
35 
36  addComponent(new AlignableTracker(tracker, tTopo));
37 
38  edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
39  // Retrieve alignment[Error]s from DBase
40  setup.get<TrackerAlignmentRcd>().get(alignments);
41 
42  //Get map from textreader
43  SurveyInputTextReader dataReader;
44  dataReader.readFile(textFileName);
45  uIdMap = dataReader.UniqueIdMap();
46 
48 
49  theFirstEvent = false;
50  }
51 }
void readFile(const std::string &textFileName)
Read given text file.
SurveyInputTextReader::MapType uIdMap
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
static void addComponent(Alignable *)
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
edm::ESHandle< Alignments > alignments
static Alignable * detector()
Get alignable detector as read from input.
const MapType & UniqueIdMap() const
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86
AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id)
private

Get alignable surface from misalignments.db.

Definition at line 88 of file SurveyMisalignmentInput.cc.

References alignments, DEFINE_FWK_MODULE, Alignments::m_align, position, makeMuonMisalignmentScenario::rot, and idealTransformation::rotation.

Referenced by addSurveyInfo().

88  {
89  std::vector<AlignTransform>::const_iterator it;
90 
91  for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it) {
92  if (id == (*it).rawId()) {
93  align::PositionType position((*it).translation().x(), (*it).translation().y(), (*it).translation().z());
94  CLHEP::HepRotation rot((*it).rotation());
96  rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz());
98  }
99  }
100 
101  return AlignableSurface();
102 }
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
edm::ESHandle< Alignments > alignments
static int position[264][3]
Definition: ReadPGInfo.cc:509

Member Data Documentation

edm::ESHandle<Alignments> SurveyMisalignmentInput::alignments
private

Definition at line 33 of file SurveyMisalignmentInput.h.

Referenced by analyze(), and getAlignableSurface().

std::string SurveyMisalignmentInput::textFileName
private

Definition at line 31 of file SurveyMisalignmentInput.h.

Referenced by analyze().

SurveyInputTextReader::MapType SurveyMisalignmentInput::uIdMap
private

Definition at line 29 of file SurveyMisalignmentInput.h.

Referenced by addSurveyInfo(), and analyze().