CMS 3D CMS Logo

SurveyMisalignmentInput.cc
Go to the documentation of this file.
7 
10 
13 
16 
18 
20  : textFileName(cfg.getParameter<std::string>("textFileName")) {}
21 
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 }
52 
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 }
87 
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 }
103 
104 // Plug in to framework
105 
107 
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
void readFile(const std::string &textFileName)
Read given text file.
SurveyMisalignmentInput(const edm::ParameterSet &)
uint32_t ID
Definition: Definitions.h:26
SurveyInputTextReader::MapType uIdMap
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
virtual const Alignables & components() const =0
Return vector of all direct components.
static void addComponent(Alignable *)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
U second(std::pair< T, U > const &p)
edm::ESHandle< Alignments > alignments
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
std::vector< Scalar > Scalars
Definition: Utilities.h:27
static Alignable * detector()
Get alignable detector as read from input.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
const MapType & UniqueIdMap() const
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.
static int position[264][3]
Definition: ReadPGInfo.cc:509
T get() const
Definition: EventSetup.h:71
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
void analyze(const edm::Event &, const edm::EventSetup &) override
Read ideal tracker geometry from DB.
T const * product() const
Definition: ESHandle.h:86