CMS 3D CMS Logo

SurveyInputTrackerFromDB.cc
Go to the documentation of this file.
12 
13 // Database
20 
22 
24  : tTopoToken_(esConsumes()),
25  geomDetToken_(esConsumes()),
26  ptpToken_(esConsumes()),
27  ptitpToken_(esConsumes()),
28  textFileName(cfg.getParameter<std::string>("textFileName")) {}
29 
31  if (theFirstEvent) {
32  // std::cout << "***************ENTERING INITIALIZATION******************" << std::endl;
33 
34  //Retrieve tracker topology from geometry
35  const TrackerTopology* const tTopo = &setup.getData(tTopoToken_);
36 
37  //Get map from textreader
38  SurveyInputTextReader dataReader;
39  dataReader.readFile(textFileName);
40  uIdMap = dataReader.UniqueIdMap();
41 
42  const GeometricDet* geom = &setup.getData(geomDetToken_);
43  const PTrackerParameters& ptp = setup.getData(ptpToken_);
44  const PTrackerAdditionalParametersPerDet* ptitp = &setup.getData(ptitpToken_);
46 
49 
50  //write out to a DB ...
51  Alignments* myAlignments = detector()->alignments();
52  AlignmentErrorsExtended* myAlignmentErrorsExtended = detector()->alignmentErrors();
53 
54  // 2. Store alignment[Error]s to DB
56  // Call service
57 
58  if (!poolDbService.isAvailable()) // Die if not available
59  throw cms::Exception("NotAvailable") << "PoolDBOutputService not available";
60 
61  poolDbService->writeOne<Alignments>(myAlignments, poolDbService->beginOfTime(), "TrackerAlignmentRcd");
62  poolDbService->writeOne<AlignmentErrorsExtended>(
63  myAlignmentErrorsExtended, poolDbService->beginOfTime(), "TrackerAlignmentErrorExtendedRcd");
64 
65  theFirstEvent = false;
66  }
67 }
68 
70  const align::Alignables& comp = ali->components();
71  unsigned int nComp = comp.size();
72 
73  for (unsigned int i = 0; i < nComp; ++i)
75 
77 
78  SurveyInputTextReader::MapType::const_iterator it = uIdMap.find(std::make_pair(ali->id(), ali->alignableObjectId()));
79 
80  if (it != uIdMap.end()) {
81  const align::Scalars& parameters = (it)->second;
82 
83  //move the surface
84  //displacement
86  align::GlobalVector gvector = ali->surface().toGlobal(lvector);
87  ali->move(gvector);
88  //rotation
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) {
96  errorData[i] = parameters[i + 6];
97  }
98 
99  ali->setSurvey(new SurveyDet(ali->surface(), error * (1e-6)));
100  } else {
101  error = ROOT::Math::SMatrixIdentity();
102  ali->setSurvey(new SurveyDet(ali->surface(), error * 1e-6));
103  }
104 }
105 // Plug in to framework
106 
108 
Vector3DBase
Definition: Vector3DBase.h:8
AlignmentErrorsExtended.h
TkRotation< Scalar >
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
mps_fire.i
i
Definition: mps_fire.py:428
SurveyInputBase::addComponent
static void addComponent(Alignable *)
Definition: SurveyInputBase.cc:13
SurveyInputBase::theFirstEvent
bool theFirstEvent
Definition: SurveyInputBase.h:35
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
PTrackerParameters
Definition: PTrackerParameters.h:6
align::Scalars
std::vector< Scalar > Scalars
Definition: Utilities.h:26
ESHandle.h
TrackerGeomBuilderFromGeometricDet::build
TrackerGeometry * build(const GeometricDet *gd, const PTrackerAdditionalParametersPerDet *ptitp, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
Definition: TrackerGeomBuilderFromGeometricDet.cc:44
TrackerTopology
Definition: TrackerTopology.h:16
Alignable
Definition: Alignable.h:27
PTrackerAdditionalParametersPerDet
Definition: PTrackerAdditionalParametersPerDet.h:9
SurveyInputTrackerFromDB::ptpToken_
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
Definition: SurveyInputTrackerFromDB.h:32
Alignments.h
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
align::ErrorMatrix
math::Error< 6 >::type ErrorMatrix
Definition: Definitions.h:37
Alignable::alignments
virtual Alignments * alignments() const =0
Return vector of alignment data.
PTrackerAdditionalParametersPerDetRcd.h
PTrackerParameters.h
SurveyInputTrackerFromDB::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Read ideal tracker geometry from DB.
Definition: SurveyInputTrackerFromDB.cc:30
Basic3DVector::mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: extBasic3DVector.h:116
relativeConstraints.error
error
Definition: relativeConstraints.py:53
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
SurveyInputTrackerFromDB::geomDetToken_
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
Definition: SurveyInputTrackerFromDB.h:31
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TrackerAlignmentErrorExtendedRcd.h
SurveyInputTrackerFromDB.h
SurveyDet
Definition: SurveyDet.h:15
MakerMacros.h
Alignable::setSurvey
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
PoolDBOutputService.h
TrackerTopologyRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Service.h
AlignableTracker
Definition: AlignableTracker.h:17
SurveyInputTextReader::readFile
void readFile(const std::string &textFileName)
Read given text file.
Definition: SurveyInputTextReader.cc:11
GeometricDet
Definition: GeometricDet.h:31
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
SurveyInputTrackerFromDB::uIdMap
SurveyInputTextReader::MapType uIdMap
Definition: SurveyInputTrackerFromDB.h:28
SurveyInputTrackerFromDB::SurveyInputTrackerFromDB
SurveyInputTrackerFromDB(const edm::ParameterSet &)
Definition: SurveyInputTrackerFromDB.cc:23
SurveyInputTrackerFromDB::tTopoToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SurveyInputTrackerFromDB.h:30
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
edm::ParameterSet
Definition: ParameterSet.h:47
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
PTrackerParametersRcd.h
SurveyInputTrackerFromDB::textFileName
std::string textFileName
Definition: SurveyInputTrackerFromDB.h:35
Alignable::rotateInLocalFrame
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:129
edm::Service< cond::service::PoolDBOutputService >
IdealGeometryRecord.h
TrackerAlignmentRcd.h
edm::EventSetup
Definition: EventSetup.h:58
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
SurveyInputTextReader::UniqueIdMap
const MapType & UniqueIdMap() const
Definition: SurveyInputTextReader.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
looper.cfg
cfg
Definition: looper.py:296
align::Alignables
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
SurveyInputTrackerFromDB
Definition: SurveyInputTrackerFromDB.h:20
SurveyInputTextReader
Definition: SurveyInputTextReader.h:18
std
Definition: JetResolutionObject.h:76
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
Alignable::alignmentErrors
virtual AlignmentErrorsExtended * alignmentErrors() const =0
Return vector of alignment errors.
EventSetup.h
SurveyInputTrackerFromDB::addSurveyInfo
void addSurveyInfo(Alignable *)
Add survey info to an alignable.
Definition: SurveyInputTrackerFromDB.cc:69
TrackerGeomBuilderFromGeometricDet.h
TrackerGeomBuilderFromGeometricDet
Definition: TrackerGeomBuilderFromGeometricDet.h:18
AlignableTracker.h
cms::Exception
Definition: Exception.h:70
ParameterSet.h
SurveyDet.h
SurveyInputTrackerFromDB::ptitpToken_
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd > ptitpToken_
Definition: SurveyInputTrackerFromDB.h:33
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
Alignable::components
virtual const Alignables & components() const =0
Return vector of all direct components.
Alignments
Definition: Alignments.h:10
Basic3DVector< align::Scalar >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
SurveyInputBase::detector
static Alignable * detector()
Get alignable detector as read from input.
Definition: SurveyInputBase.h:41
TrackerGeometry
Definition: TrackerGeometry.h:14