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 edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
const edm::ParameterSet theParameterSet
 
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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 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 16:23:31
Revision:
1.6
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  theParameterSet( cfg )
19 {}
T getParameter(std::string const &) const
const edm::ParameterSet theParameterSet

Member Function Documentation

void SurveyMisalignmentInput::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 51 of file SurveyMisalignmentInput.cc.

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

Referenced by analyze().

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 }
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(), edm::ESHandle< class >::product(), SurveyInputTextReader::readFile(), textFileName, SurveyInputBase::theFirstEvent, theParameterSet, patCandidatesForDimuonsSequences_cff::tracker, uIdMap, and SurveyInputTextReader::UniqueIdMap().

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 }
void readFile(const std::string &textFileName)
Read given text file.
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
SurveyInputTextReader::MapType uIdMap
static void addComponent(Alignable *)
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
edm::ESHandle< Alignments > alignments
const edm::ParameterSet theParameterSet
static Alignable * detector()
Get alignable detector as read from input.
const MapType & UniqueIdMap() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id)
private

Get alignable surface from misalignments.db.

Definition at line 89 of file SurveyMisalignmentInput.cc.

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

Referenced by addSurveyInfo().

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 }
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().

const edm::ParameterSet SurveyMisalignmentInput::theParameterSet
private

Definition at line 50 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().