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
SurveyInputTrackerFromDB Class Reference

#include <SurveyInputTrackerFromDB.h>

Inheritance diagram for SurveyInputTrackerFromDB:
SurveyInputBase edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 Read ideal tracker geometry from DB. More...
 
 SurveyInputTrackerFromDB (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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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...
 

Private Attributes

std::string textFileName
 
const edm::ParameterSet theParameterSet
 
SurveyInputTextReader::MapType uIdMap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 read ideal tracker from DB.

Date:
2012/06/13 09:22:26
Revision:
1.4
Author
Chung Khim Lae

Definition at line 20 of file SurveyInputTrackerFromDB.h.

Constructor & Destructor Documentation

SurveyInputTrackerFromDB::SurveyInputTrackerFromDB ( const edm::ParameterSet cfg)

Definition at line 20 of file SurveyInputTrackerFromDB.cc.

21  : textFileName( cfg.getParameter<std::string>("textFileName") ),
22  theParameterSet( cfg )
23 {}
T getParameter(std::string const &) const
const edm::ParameterSet theParameterSet

Member Function Documentation

void SurveyInputTrackerFromDB::addSurveyInfo ( Alignable ali)
private

Add survey info to an alignable.

Definition at line 67 of file SurveyInputTrackerFromDB.cc.

References Alignable::alignableObjectId(), AlCaHLTBitMon_QueryRunRegistry::comp, Alignable::components(), alignCSCRings::e, relativeConstraints::error, i, Alignable::id(), Basic3DVector< T >::mag(), Alignable::move(), Parameters::parameters, Alignable::rotateInLocalFrame(), idealTransformation::rotation, edm::second(), Alignable::setSurvey(), Alignable::surface(), AlignableSurface::toGlobal(), and uIdMap.

Referenced by analyze().

68 {
69  const align::Alignables& comp = ali->components();
70  unsigned int nComp = comp.size();
71 
72  for (unsigned int i = 0; i < nComp; ++i) addSurveyInfo(comp[i]);
73 
75 
76  SurveyInputTextReader::MapType::const_iterator it
77  = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
78 
79  if (it != uIdMap.end()){
80 
81  const align::Scalars& parameters = (it)->second;
82 
83  //move the surface
84  //displacement
85  align::LocalVector lvector (parameters[0], parameters[1], parameters[2]);
86  align::GlobalVector gvector = ali->surface().toGlobal(lvector);
87  ali->move(gvector);
88  //rotation
89  Basic3DVector<align::Scalar> rot_aa(parameters[3], parameters[4], parameters[5]);
90  align::RotationType rotation(rot_aa, rot_aa.mag());
92 
93  //sets the errors for the hierarchy level
94  double* errorData = error.Array();
95  for (unsigned int i = 0; i < 21; ++i){errorData[i] = parameters[i+6];}
96 
97  ali->setSurvey( new SurveyDet(ali->surface(), error*(1e-6)) );
98  }
99  else {
100  error = ROOT::Math::SMatrixIdentity();
101  ali->setSurvey( new SurveyDet(ali->surface(), error * 1e-6) );
102  }
103 
104 }
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
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:91
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
virtual Alignables components() const =0
Return vector of all direct components.
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 addSurveyInfo(Alignable *)
Add survey info to an alignable.
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:268
std::vector< Alignable * > Alignables
Definition: Utilities.h:28
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
SurveyInputTextReader::MapType uIdMap
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:39
void SurveyInputTrackerFromDB::analyze ( const edm::Event ,
const edm::EventSetup setup 
)
virtual

Read ideal tracker geometry from DB.

Implements SurveyInputBase.

Definition at line 25 of file SurveyInputTrackerFromDB.cc.

References SurveyInputBase::addComponent(), addSurveyInfo(), Alignable::alignmentErrors(), Alignable::alignments(), cond::service::PoolDBOutputService::beginOfTime(), TrackerGeomBuilderFromGeometricDet::build(), SurveyInputBase::detector(), relativeConstraints::geom, edm::EventSetup::get(), edm::Service< T >::isAvailable(), edm::ESHandle< class >::product(), SurveyInputTextReader::readFile(), textFileName, SurveyInputBase::theFirstEvent, theParameterSet, patCandidatesForDimuonsSequences_cff::tracker, uIdMap, SurveyInputTextReader::UniqueIdMap(), and cond::service::PoolDBOutputService::writeOne().

26 {
27 
28  if (theFirstEvent) {
29 
30  // std::cout << "***************ENTERING INITIALIZATION******************" << std::endl;
31 
32  //Retrieve tracker topology from geometry
34  setup.get<IdealGeometryRecord>().get(tTopoHandle);
35  const TrackerTopology* const tTopo = tTopoHandle.product();
36 
37  //Get map from textreader
38  SurveyInputTextReader dataReader;
39  dataReader.readFile( textFileName );
40  uIdMap = dataReader.UniqueIdMap();
41 
43  setup.get<IdealGeometryRecord>().get(geom);
45 
46  addComponent( new AlignableTracker( tracker, tTopo ) );
48 
49  //write out to a DB ...
50  Alignments* myAlignments = detector()->alignments();
51  AlignmentErrors* myAlignmentErrors = detector()->alignmentErrors();
52 
53  // 2. Store alignment[Error]s to DB
55  // Call service
56 
57  if( !poolDbService.isAvailable() ) // Die if not available
58  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
59 
60  poolDbService->writeOne<Alignments>( myAlignments, poolDbService->beginOfTime(), "TrackerAlignmentRcd" );
61  poolDbService->writeOne<AlignmentErrors>( myAlignmentErrors, poolDbService->beginOfTime(), "TrackerAlignmentErrorRcd" );
62 
63  theFirstEvent = false;
64  }
65 }
void readFile(const std::string &textFileName)
Read given text file.
TrackerGeometry * build(const GeometricDet *gd, const edm::ParameterSet &pSet)
static void addComponent(Alignable *)
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
static Alignable * detector()
Get alignable detector as read from input.
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
const MapType & UniqueIdMap() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
const edm::ParameterSet theParameterSet
SurveyInputTextReader::MapType uIdMap
virtual Alignments * alignments() const =0
Return vector of alignment data.
virtual AlignmentErrors * alignmentErrors() const =0
Return vector of alignment errors.

Member Data Documentation

std::string SurveyInputTrackerFromDB::textFileName
private

Definition at line 39 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

const edm::ParameterSet SurveyInputTrackerFromDB::theParameterSet
private

Definition at line 46 of file SurveyInputTrackerFromDB.h.

Referenced by analyze().

SurveyInputTextReader::MapType SurveyInputTrackerFromDB::uIdMap
private

Definition at line 37 of file SurveyInputTrackerFromDB.h.

Referenced by addSurveyInfo(), and analyze().