CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SurveyMisalignmentInput.cc
Go to the documentation of this file.
4 
7 
10 
13 
15 
17  textFileName( cfg.getParameter<std::string>("textFileName") ),
18  theParameterSet( cfg )
19 {}
20 
22 {
23  if (theFirstEvent) {
24  //Retrieve tracker topology from geometry
26  setup.get<IdealGeometryRecord>().get(tTopoHandle);
27  const TrackerTopology* const tTopo = tTopoHandle.product();
28 
30  setup.get<IdealGeometryRecord>().get(geom);
32 
33  addComponent(new AlignableTracker( tracker, tTopo ));
34 
35  edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
36  // Retrieve alignment[Error]s from DBase
37  setup.get<TrackerAlignmentRcd>().get( alignments );
38 
39  //Get map from textreader
40  SurveyInputTextReader dataReader;
41  dataReader.readFile( textFileName );
42  uIdMap = dataReader.UniqueIdMap();
43 
45 
46  theFirstEvent = false;
47  }
48 }
49 
50 
52 {
53 
54  const align::Alignables& comp = ali->components();
55  unsigned int nComp = comp.size();
56  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
57 
58  SurveyInputTextReader::MapType::const_iterator it
59  = 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){errorData[i] = parameters[i+6];}
69 
70  //because record only needs global value of modules
72  // fill survey values
73  ali->setSurvey( new SurveyDet(getAlignableSurface(ali->id()), error) );
74  }
75  else{
76  ali->setSurvey( new SurveyDet(ali->surface(), error) );
77  }
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 }
88 
90 {
91  std::vector<AlignTransform>::const_iterator it;
92 
93  for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it)
94  {
95  if (id == (*it).rawId())
96  {
97  align::PositionType position( (*it).translation().x(), (*it).translation().y(), (*it).translation().z() );
98  CLHEP::HepRotation rot( (*it).rotation() );
99  align::RotationType rotation( rot.xx(), rot.xy(), rot.xz(),
100  rot.yx(), rot.yy(), rot.yz(),
101  rot.zx(), rot.zy(), rot.zz() );
103  }
104  }
105 
106  return AlignableSurface();
107 }
108 
109 // Plug in to framework
110 
112 
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
void readFile(const std::string &textFileName)
Read given text file.
tuple cfg
Definition: looper.py:237
SurveyMisalignmentInput(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
uint32_t ID
Definition: Definitions.h:26
SurveyInputTextReader::MapType uIdMap
static void addComponent(Alignable *)
virtual 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)
edm::ESHandle< Alignments > alignments
std::vector< Scalar > Scalars
Definition: Utilities.h:22
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const edm::ParameterSet theParameterSet
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:126
const MapType & UniqueIdMap() const
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
AlignableSurface getAlignableSurface(align::ID)
Get alignable surface from misalignments.db.
static int position[264][3]
Definition: ReadPGInfo.cc:509
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Read ideal tracker geometry from DB.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")