CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SurveyMisalignmentInput.cc
Go to the documentation of this file.
8 
11 
14 
17 
19 
22  geomDetToken_(esConsumes()),
23  ptpToken_(esConsumes()),
24  ptitpToken_(esConsumes()),
25  aliToken_(esConsumes()),
26  textFileName(cfg.getParameter<std::string>("textFileName")) {}
27 
29  if (theFirstEvent) {
30  //Retrieve tracker topology from geometry
31  const TrackerTopology* const tTopo = &setup.getData(tTopoToken_);
32  const GeometricDet* geom = &setup.getData(geomDetToken_);
33  const PTrackerParameters& ptp = setup.getData(ptpToken_);
35  TrackerGeometry* tracker = TrackerGeomBuilderFromGeometricDet().build(geom, ptitp, ptp, tTopo);
36 
37  addComponent(new AlignableTracker(tracker, tTopo));
38 
39  edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
40  // Retrieve alignment[Error]s from DBase
42 
43  //Get map from textreader
44  SurveyInputTextReader dataReader;
45  dataReader.readFile(textFileName);
46  uIdMap = dataReader.UniqueIdMap();
47 
49 
50  theFirstEvent = false;
51  }
52 }
53 
55  const align::Alignables& comp = ali->components();
56  unsigned int nComp = comp.size();
57  for (unsigned int i = 0; i < nComp; ++i)
58  addSurveyInfo(comp[i]);
59 
60  SurveyInputTextReader::MapType::const_iterator it = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
61 
63 
64  if (it != uIdMap.end()) {
65  //survey error values
66  const align::Scalars& parameters = (it)->second;
67  //sets the errors for the hierarchy level
68  double* errorData = error.Array();
69  for (unsigned int i = 0; i < 21; ++i) {
70  errorData[i] = parameters[i + 6];
71  }
72 
73  //because record only needs global value of modules
75  // fill survey values
76  ali->setSurvey(new SurveyDet(getAlignableSurface(ali->id()), error));
77  } else {
78  ali->setSurvey(new SurveyDet(ali->surface(), error));
79  }
80  } else {
81  //fill
82  error = ROOT::Math::SMatrixIdentity();
83  ali->setSurvey(new SurveyDet(ali->surface(), error * (1e-6)));
84  }
85  //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
86  //std::cout << error << std::endl;
87 }
88 
90  std::vector<AlignTransform>::const_iterator it;
91 
92  for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it) {
93  if (id == (*it).rawId()) {
94  align::PositionType position((*it).translation().x(), (*it).translation().y(), (*it).translation().z());
95  CLHEP::HepRotation rot((*it).rotation());
97  rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz());
99  }
100  }
101 
102  return AlignableSurface();
103 }
104 
105 // Plug in to framework
106 
108 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
void readFile(const std::string &textFileName)
Read given text file.
tuple cfg
Definition: looper.py:296
SurveyMisalignmentInput(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd > ptitpToken_
TrackerGeometry * build(const GeometricDet *gd, const PTrackerAdditionalParametersPerDet *ptitp, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
uint32_t ID
Definition: Definitions.h:24
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
SurveyInputTextReader::MapType uIdMap
static void addComponent(Alignable *)
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
bool getData(T &iHolder) const
Definition: EventSetup.h:122
U second(std::pair< T, U > const &p)
edm::ESHandle< Alignments > alignments
std::vector< Scalar > Scalars
Definition: Utilities.h:26
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
static Alignable * detector()
Get alignable detector as read from input.
virtual const Alignables & components() const =0
Return vector of all direct components.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Log< level::Info, false > LogInfo
const MapType & UniqueIdMap() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
AlignableSurface getAlignableSurface(align::ID)
Get alignable surface from misalignments.db.
static int position[264][3]
Definition: ReadPGInfo.cc:289
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > aliToken_
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void analyze(const edm::Event &, const edm::EventSetup &) override
Read ideal tracker geometry from DB.
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
tTopoToken_