CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 Read ideal tracker geometry from DB. More...
 
 SurveyMisalignmentInput (const edm::ParameterSet &)
 
- Public Member Functions inherited from SurveyInputBase
virtual void beginJob ()
 Read data from input. More...
 
virtual ~SurveyInputBase ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 
- Protected Attributes inherited from SurveyInputBase
bool theFirstEvent
 

Detailed Description

Class to misaligned tracker from DB.

Date:
2010/01/07 14:36:23
Revision:
1.4
Author
Chung Khim Lae

Definition at line 21 of file SurveyMisalignmentInput.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file SurveyMisalignmentInput.cc.

16  :
17  textFileName( cfg.getParameter<std::string>("textFileName") )
18 {
19 }
T getParameter(std::string const &) const

Member Function Documentation

void SurveyMisalignmentInput::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 45 of file SurveyMisalignmentInput.cc.

References align::AlignableDetUnit, Alignable::alignableObjectId(), Alignable::components(), alignCSCRings::e, error, getAlignableSurface(), i, Alignable::id(), Parameters::parameters, edm::second(), Alignable::setSurvey(), Alignable::surface(), and uIdMap.

Referenced by analyze().

46 {
47 
48  const align::Alignables& comp = ali->components();
49  unsigned int nComp = comp.size();
50  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
51 
52  SurveyInputTextReader::MapType::const_iterator it
53  = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
54 
56 
57  if (it != uIdMap.end()){
58  //survey error values
59  const align::Scalars& parameters = (it)->second;
60  //sets the errors for the hierarchy level
61  double* errorData = error.Array();
62  for (unsigned int i = 0; i < 21; ++i){errorData[i] = parameters[i+6];}
63 
64  //because record only needs global value of modules
66  // fill survey values
67  ali->setSurvey( new SurveyDet(getAlignableSurface(ali->id()), error) );
68  }
69  else{
70  ali->setSurvey( new SurveyDet(ali->surface(), error) );
71  }
72  }
73  else{
74  //fill
75  error = ROOT::Math::SMatrixIdentity();
76  ali->setSurvey( new SurveyDet(ali->surface(), error*(1e-6)) );
77  }
78  //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
79  //std::cout << error << std::endl;
80 
81 }
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
SurveyInputTextReader::MapType uIdMap
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)
std::vector< Scalar > Scalars
Definition: Utilities.h:22
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:126
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
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 
)
virtual

Read ideal tracker geometry from DB.

Implements SurveyInputBase.

Definition at line 21 of file SurveyMisalignmentInput.cc.

References SurveyInputBase::addComponent(), addSurveyInfo(), alignments, TrackerGeomBuilderFromGeometricDet::build(), SurveyInputBase::detector(), relativeConstraints::geom, edm::EventSetup::get(), SurveyInputTextReader::readFile(), textFileName, SurveyInputBase::theFirstEvent, patCandidatesForDimuonsSequences_cff::tracker, uIdMap, and SurveyInputTextReader::UniqueIdMap().

22 {
23  if (theFirstEvent) {
25  setup.get<IdealGeometryRecord>().get(geom);
27  addComponent(new AlignableTracker( tracker ) );
28 
29  edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
30  // Retrieve alignment[Error]s from DBase
31  setup.get<TrackerAlignmentRcd>().get( alignments );
32 
33  //Get map from textreader
34  SurveyInputTextReader dataReader;
35  dataReader.readFile( textFileName );
36  uIdMap = dataReader.UniqueIdMap();
37 
39 
40  theFirstEvent = false;
41  }
42 }
void readFile(const std::string &textFileName)
Read given text file.
SurveyInputTextReader::MapType uIdMap
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
const T & get() const
Definition: EventSetup.h:55
TrackerGeometry * build(const GeometricDet *gd)
AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id)
private

Get alignable surface from misalignments.db.

Definition at line 83 of file SurveyMisalignmentInput.cc.

References alignments, position, makeMuonMisalignmentScenario::rot, and idealTransformation::rotation.

Referenced by addSurveyInfo().

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

Member Data Documentation

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

Definition at line 42 of file SurveyMisalignmentInput.h.

Referenced by analyze(), and getAlignableSurface().

std::string SurveyMisalignmentInput::textFileName
private

Definition at line 40 of file SurveyMisalignmentInput.h.

Referenced by analyze().

SurveyInputTextReader::MapType SurveyMisalignmentInput::uIdMap
private

Definition at line 38 of file SurveyMisalignmentInput.h.

Referenced by addSurveyInfo(), and analyze().