Alignment
SurveyAnalysis
plugins
DTSurveyConvert.cc
Go to the documentation of this file.
1
#include <fstream>
2
3
#include "
Alignment/MuonAlignment/interface/MuonAlignment.h
"
4
#include "
Alignment/SurveyAnalysis/interface/DTSurvey.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/Framework/interface/ESHandle.h
"
7
#include "
FWCore/Framework/interface/MakerMacros.h
"
8
// #include "FWCore/ParameterSet/interface/ParameterSet.h"
9
#include "
Geometry/DTGeometry/interface/DTGeometry.h
"
10
#include "
Geometry/Records/interface/MuonGeometryRecord.h
"
11
12
#include "
Alignment/SurveyAnalysis/plugins/DTSurveyConvert.h
"
13
14
DTSurveyConvert::DTSurveyConvert
(
const
edm::ParameterSet
&iConfig) {
15
//now do what ever initialization is needed
16
nameWheel_m2
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameWheel_m2"
);
17
nameWheel_m1
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameWheel_m1"
);
18
nameWheel_0
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameWheel_0"
);
19
nameWheel_p1
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameWheel_p1"
);
20
nameWheel_p2
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameWheel_p2"
);
21
22
nameChambers_m2
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameChambers_m2"
);
23
nameChambers_m1
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameChambers_m1"
);
24
nameChambers_0
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameChambers_0"
);
25
nameChambers_p1
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameChambers_p1"
);
26
nameChambers_p2
= iConfig.
getUntrackedParameter
<
std::string
>(
"nameChambers_p2"
);
27
28
wheel_m2
= iConfig.
getUntrackedParameter
<
bool
>(
"wheel_m2"
);
29
wheel_m1
= iConfig.
getUntrackedParameter
<
bool
>(
"wheel_m1"
);
30
wheel_0
= iConfig.
getUntrackedParameter
<
bool
>(
"wheel_0"
);
31
wheel_p1
= iConfig.
getUntrackedParameter
<
bool
>(
"wheel_p1"
);
32
wheel_p2
= iConfig.
getUntrackedParameter
<
bool
>(
"wheel_p2"
);
33
34
outputFileName
= iConfig.
getUntrackedParameter
<
std::string
>(
"OutputTextFile"
);
35
WriteToDB
= iConfig.
getUntrackedParameter
<
bool
>(
"writeToDB"
);
36
}
37
38
// ------------ method called to for each event ------------
39
void
DTSurveyConvert::analyze
(
const
edm::Event
&,
const
edm::EventSetup
&iSetup) {
40
edm::ESHandle<DTGeometry>
pDD;
41
iSetup.
get
<
MuonGeometryRecord
>().
get
(pDD);
42
43
std::ofstream
outFile
(
outputFileName
.c_str());
44
45
if
(
wheel_m2
==
true
) {
46
DTSurvey
*
wheel
=
new
DTSurvey
(
nameWheel_m2
,
nameChambers_m2
, -2);
47
wheel
->ReadChambers(pDD);
48
wheel
->CalculateChambers();
49
outFile
<< *
wheel
;
50
wheelList
.push_back(
wheel
);
51
}
52
if
(
wheel_m1
==
true
) {
53
DTSurvey
*
wheel
=
new
DTSurvey
(
nameWheel_m1
,
nameChambers_m1
, -1);
54
wheel
->ReadChambers(pDD);
55
wheel
->CalculateChambers();
56
outFile
<< *
wheel
;
57
wheelList
.push_back(
wheel
);
58
}
59
if
(
wheel_0
==
true
) {
60
DTSurvey
*
wheel
=
new
DTSurvey
(
nameWheel_0
,
nameChambers_0
, 0);
61
wheel
->ReadChambers(pDD);
62
wheel
->CalculateChambers();
63
outFile
<< *
wheel
;
64
wheelList
.push_back(
wheel
);
65
}
66
if
(
wheel_p1
==
true
) {
67
DTSurvey
*
wheel
=
new
DTSurvey
(
nameWheel_p1
,
nameChambers_p1
, 1);
68
wheel
->ReadChambers(pDD);
69
wheel
->CalculateChambers();
70
outFile
<< *
wheel
;
71
wheelList
.push_back(
wheel
);
72
}
73
if
(
wheel_p2
==
true
) {
74
DTSurvey
*
wheel
=
new
DTSurvey
(
nameWheel_p2
,
nameChambers_p2
, 2);
75
wheel
->ReadChambers(pDD);
76
wheel
->CalculateChambers();
77
outFile
<< *
wheel
;
78
wheelList
.push_back(
wheel
);
79
}
80
outFile
.close();
81
82
if
(
WriteToDB
==
true
) {
83
// Instantiate the helper class
84
MuonAlignment
align
(iSetup);
85
std::ifstream inFile(
outputFileName
.c_str());
86
while
(!inFile.eof()) {
87
float
dx
,
dy
,
dz
, sigma_dx, sigma_dy, sigma_dz;
88
float
alpha
,
beta
,
gamma
, sigma_alpha, sigma_beta, sigma_gamma;
89
inFile >>
dx
>> sigma_dx >>
dy
>> sigma_dy >>
dz
>> sigma_dz >>
alpha
>> sigma_alpha >>
beta
>> sigma_beta >>
90
gamma
>> sigma_gamma;
91
if
(inFile.eof())
92
break
;
93
std::vector<float> displacement;
94
displacement.push_back(
dx
);
95
displacement.push_back(
dy
);
96
displacement.push_back(
dz
);
97
displacement.push_back(-
alpha
);
98
displacement.push_back(-
beta
);
99
displacement.push_back(-
gamma
);
100
}
101
inFile.close();
102
align
.saveToDB();
103
}
104
}
105
106
DEFINE_FWK_MODULE
(
DTSurveyConvert
);
DTSurveyConvert::wheel_p1
bool wheel_p1
Definition:
DTSurveyConvert.h:47
DTSurveyConvert::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
DTSurveyConvert.cc:39
align
Definition:
AlignableIndexer.h:30
ESHandle.h
DTSurveyConvert
Definition:
DTSurveyConvert.h:26
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition:
zMuMuMuonUserData.py:9
zMuMuMuonUserData.beta
beta
Definition:
zMuMuMuonUserData.py:10
DTSurveyConvert::DTSurveyConvert
DTSurveyConvert(const edm::ParameterSet &)
Definition:
DTSurveyConvert.cc:14
DTSurveyConvert::nameWheel_m1
std::string nameWheel_m1
Definition:
DTSurveyConvert.h:34
CustomPhysics_cfi.gamma
gamma
Definition:
CustomPhysics_cfi.py:17
DTSurvey.h
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTSurveyConvert::nameChambers_p2
std::string nameChambers_p2
Definition:
DTSurveyConvert.h:42
DTSurveyConvert::nameWheel_p2
std::string nameWheel_p2
Definition:
DTSurveyConvert.h:37
MuonAlignment
Definition:
MuonAlignment.h:20
DTSurveyConvert::nameWheel_p1
std::string nameWheel_p1
Definition:
DTSurveyConvert.h:36
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
DTSurveyConvert::wheel_m2
bool wheel_m2
Definition:
DTSurveyConvert.h:44
edm::ESHandle< DTGeometry >
DTSurveyConvert::nameWheel_0
std::string nameWheel_0
Definition:
DTSurveyConvert.h:35
L1TdeCSCTF_cfi.outFile
outFile
Definition:
L1TdeCSCTF_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
DTGeometry.h
edm::ParameterSet
Definition:
ParameterSet.h:47
MuonAlignment.h
DTSurveyConvert::wheel_m1
bool wheel_m1
Definition:
DTSurveyConvert.h:45
makeMuonMisalignmentScenario.wheel
wheel
Definition:
makeMuonMisalignmentScenario.py:319
DTSurveyConvert::outputFileName
std::string outputFileName
Definition:
DTSurveyConvert.h:43
PVValHelper::dy
Definition:
PVValidationHelpers.h:49
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
DTSurveyConvert::wheel_0
bool wheel_0
Definition:
DTSurveyConvert.h:46
DTSurveyConvert::wheel_p2
bool wheel_p2
Definition:
DTSurveyConvert.h:48
DTSurveyConvert::nameChambers_p1
std::string nameChambers_p1
Definition:
DTSurveyConvert.h:41
PVValHelper::dz
Definition:
PVValidationHelpers.h:50
DTSurveyConvert.h
EventSetup.h
DTSurveyConvert::nameChambers_m1
std::string nameChambers_m1
Definition:
DTSurveyConvert.h:39
DTSurveyConvert::nameChambers_0
std::string nameChambers_0
Definition:
DTSurveyConvert.h:40
DTSurveyConvert::wheelList
std::vector< DTSurvey * > wheelList
Definition:
DTSurveyConvert.h:32
MuonGeometryRecord.h
edm::Event
Definition:
Event.h:73
MuonGeometryRecord
Definition:
MuonGeometryRecord.h:34
DTSurveyConvert::nameWheel_m2
std::string nameWheel_m2
Definition:
DTSurveyConvert.h:33
DTSurveyConvert::WriteToDB
bool WriteToDB
Definition:
DTSurveyConvert.h:49
PVValHelper::dx
Definition:
PVValidationHelpers.h:48
DTSurveyConvert::nameChambers_m2
std::string nameChambers_m2
Definition:
DTSurveyConvert.h:38
DTSurvey
Definition:
DTSurvey.h:25
Generated for CMSSW Reference Manual by
1.8.16