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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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
 
SurveyInputTextReader::MapType uIdMap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 09:22:26
Revision:
1.5
Author
Chung Khim Lae

Definition at line 21 of file SurveyMisalignmentInput.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file SurveyMisalignmentInput.cc.

19  :
20  textFileName( cfg.getParameter<std::string>("textFileName") )
21 {}
T getParameter(std::string const &) const

Member Function Documentation

void SurveyMisalignmentInput::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 56 of file SurveyMisalignmentInput.cc.

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

Referenced by analyze().

57 {
58 
59  const align::Alignables& comp = ali->components();
60  unsigned int nComp = comp.size();
61  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
62 
63  SurveyInputTextReader::MapType::const_iterator it
64  = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
65 
67 
68  if (it != uIdMap.end()){
69  //survey error values
70  const align::Scalars& parameters = (it)->second;
71  //sets the errors for the hierarchy level
72  double* errorData = error.Array();
73  for (unsigned int i = 0; i < 21; ++i){errorData[i] = parameters[i+6];}
74 
75  //because record only needs global value of modules
77  // fill survey values
78  ali->setSurvey( new SurveyDet(getAlignableSurface(ali->id()), error) );
79  }
80  else{
81  ali->setSurvey( new SurveyDet(ali->surface(), error) );
82  }
83  }
84  else{
85  //fill
86  error = ROOT::Math::SMatrixIdentity();
87  ali->setSurvey( new SurveyDet(ali->surface(), error*(1e-6)) );
88  }
89  //std::cout << "UniqueId: " << id.first << ", " << id.second << std::endl;
90  //std::cout << error << std::endl;
91 
92 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:185
int i
Definition: DBlmapReader.cc:9
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:131
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:306
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 23 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, patCandidatesForDimuonsSequences_cff::tracker, uIdMap, and SurveyInputTextReader::UniqueIdMap().

24 {
25  if (theFirstEvent) {
26  //Retrieve tracker topology from geometry
28  setup.get<TrackerTopologyRcd>().get(tTopoHandle);
29  const TrackerTopology* const tTopo = tTopoHandle.product();
30 
32  setup.get<IdealGeometryRecord>().get(geom);
33 
35  setup.get<PTrackerParametersRcd>().get( ptp );
37 
38  addComponent(new AlignableTracker( tracker, tTopo ));
39 
40  edm::LogInfo("SurveyMisalignmentInput") << "Starting!";
41  // Retrieve alignment[Error]s from DBase
42  setup.get<TrackerAlignmentRcd>().get( alignments );
43 
44  //Get map from textreader
45  SurveyInputTextReader dataReader;
46  dataReader.readFile( textFileName );
47  uIdMap = dataReader.UniqueIdMap();
48 
50 
51  theFirstEvent = false;
52  }
53 }
void readFile(const std::string &textFileName)
Read given text file.
SurveyInputTextReader::MapType uIdMap
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
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:56
T const * product() const
Definition: ESHandle.h:86
AlignableSurface SurveyMisalignmentInput::getAlignableSurface ( align::ID  id)
private

Get alignable surface from misalignments.db.

Definition at line 94 of file SurveyMisalignmentInput.cc.

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

Referenced by addSurveyInfo().

95 {
96  std::vector<AlignTransform>::const_iterator it;
97 
98  for (it = alignments->m_align.begin(); it != alignments->m_align.end(); ++it)
99  {
100  if (id == (*it).rawId())
101  {
102  align::PositionType position( (*it).translation().x(), (*it).translation().y(), (*it).translation().z() );
103  CLHEP::HepRotation rot( (*it).rotation() );
104  align::RotationType rotation( rot.xx(), rot.xy(), rot.xz(),
105  rot.yx(), rot.yy(), rot.yz(),
106  rot.zx(), rot.zy(), rot.zz() );
108  }
109  }
110 
111  return AlignableSurface();
112 }
edm::ESHandle< Alignments > alignments
static int position[264][3]
Definition: ReadPGInfo.cc:509

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