1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// -*- C++ -*-
//
//
// Description: Module to test the Alignment software
//
//
// Original Author: Frederic Ronga
// Created: March 16, 2006
//
// system include files
#include <TRotMatrix.h>
// user include files
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "CondFormats/Alignment/interface/Alignments.h"
#include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
#include "CondFormats/AlignmentRecord/interface/TrackerAlignmentRcd.h"
#include "CondFormats/AlignmentRecord/interface/TrackerAlignmentErrorExtendedRcd.h"
//
//
// class declaration
//
class TestTrackerReader : public edm::one::EDAnalyzer<> {
public:
explicit TestTrackerReader(const edm::ParameterSet&) : aliToken_(esConsumes()), aliErrToken_(esConsumes()), rot(0) {}
virtual void analyze(const edm::Event&, const edm::EventSetup&);
private:
// ----------member data ---------------------------
const edm::ESGetToken<Alignments, TrackerAlignmentRcd> aliToken_;
const edm::ESGetToken<AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd> aliErrToken_;
float x, y, z, phi, theta, length, thick, width;
TRotMatrix* rot;
};
void TestTrackerReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
edm::LogInfo("TrackerAlignment") << "Starting!";
// Retrieve alignment[Error]s from DBase
const Alignments* alignments = &iSetup.getData(aliToken_);
const AlignmentErrorsExtended* alignmentErrors = &iSetup.getData(aliErrToken_);
edm::LogVerbatim("DumpAlignments") << "\n----------------------\n";
for (std::vector<AlignTransform>::const_iterator it = alignments->m_align.begin(); it != alignments->m_align.end();
it++) {
CLHEP::HepRotation rot((*it).rotation());
align::RotationType rotation(
rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz());
edm::LogVerbatim("DumpAlignments") << (*it).rawId() << " " << (*it).translation().x() << " "
<< (*it).translation().y() << " " << (*it).translation().z() << " "
<< rotation.xx() << " " << rotation.xy() << " " << rotation.xz() << " "
<< rotation.yx() << " " << rotation.yy() << " " << rotation.yz() << " "
<< rotation.zx() << " " << rotation.zy() << " " << rotation.zz();
}
edm::LogVerbatim("DumpAlignments") << "\n----------------------\n";
edm::LogVerbatim("DumpAlignmentErrorsExtended") << "\n----------------------\n";
std::vector<AlignTransformErrorExtended> alignErrors = alignmentErrors->m_alignError;
for (std::vector<AlignTransformErrorExtended>::const_iterator it = alignErrors.begin(); it != alignErrors.end();
it++) {
edm::LogVerbatim("DumpAlignments") << (*it).rawId() << (*it).matrix();
}
edm::LogVerbatim("DumpAlignmentErrorsExtended") << "\n----------------------\n";
edm::LogInfo("TrackerAlignment") << "Done!";
}
//define this as a plug-in
DEFINE_FWK_MODULE(TestTrackerReader);
|