1 #ifndef ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_
2 #define ALIGNMENT_MILLEPEDEALIGNMENTALGORITHM_INTERFACE_MILLEPEDEFILEREADER_H_
79 std::array<double, 6>
Xobs = {{0.,0.,0.,0.,0.,0.}};
80 std::array<double, 6>
XobsErr = {{0.,0.,0.,0.,0.,0.}};
81 std::array<double, 6>
tXobs = {{0.,0.,0.,0.,0.,0.}};
82 std::array<double, 6>
tXobsErr = {{0.,0.,0.,0.,0.,0.}};
84 std::array<double, 6>
Yobs = {{0.,0.,0.,0.,0.,0.}};
85 std::array<double, 6>
YobsErr = {{0.,0.,0.,0.,0.,0.}};
86 std::array<double, 6>
tYobs = {{0.,0.,0.,0.,0.,0.}};
87 std::array<double, 6>
tYobsErr = {{0.,0.,0.,0.,0.,0.}};
89 std::array<double, 6>
Zobs = {{0.,0.,0.,0.,0.,0.}};
90 std::array<double, 6>
ZobsErr = {{0.,0.,0.,0.,0.,0.}};
91 std::array<double, 6>
tZobs = {{0.,0.,0.,0.,0.,0.}};
92 std::array<double, 6>
tZobsErr = {{0.,0.,0.,0.,0.,0.}};
104 millePedeLogFile_(config.getParameter<std::
string>(
"millePedeLogFile")),
105 millePedeResFile_(config.getParameter<std::
string>(
"millePedeResFile")),
107 sigCut_ (config.getParameter<double>(
"sigCut")),
108 Xcut_ (config.getParameter<double>(
"Xcut")),
109 tXcut_ (config.getParameter<double>(
"tXcut")),
110 Ycut_ (config.getParameter<double>(
"Ycut")),
111 tYcut_ (config.getParameter<double>(
"tYcut")),
112 Zcut_ (config.getParameter<double>(
"Zcut")),
113 tZcut_ (config.getParameter<double>(
"tZcut")),
114 maxMoveCut_ (config.getParameter<double>(
"maxMoveCut")),
115 maxErrorCut_(config.getParameter<double>(
"maxErrorCut"))
121 readMillePedeLogFile();
122 readMillePedeResultFile();
140 logFile.open(millePedeLogFile_.c_str());
142 if (logFile.is_open()) {
143 edm::LogInfo(
"MillePedeFileReader") <<
"Reading millepede log-file";
146 while (getline(logFile, line)) {
149 if (line.find(Nrec_string) != std::string::npos) {
150 std::istringstream iss(line);
152 iss >> trash >> trash >> Nrec;
165 edm::LogError(
"MillePedeFileReader") <<
"Could not read millepede log-file.";
179 std::ifstream resFile;
180 resFile.open(millePedeResFile_.c_str());
182 if (resFile.is_open()) {
183 edm::LogInfo(
"MillePedeFileReader") <<
"Reading millepede result-file";
184 double Multiplier[6] = {10000.,10000.,10000.,1000000.,1000000.,1000000.};
187 getline(resFile, line);
189 while (getline(resFile, line)) {
190 std::istringstream iss(line);
192 std::vector<std::string> tokens;
194 while (iss >> token) {
195 tokens.push_back(token);
198 if (tokens.size() > 4 ) {
201 int alignable = std::stoi(tokens[0]);
202 int alignableIndex = alignable % 10 - 1;
204 double ObsMove = std::stof(tokens[3]) * Multiplier[alignableIndex];
205 double ObsErr = std::stof(tokens[4]) * Multiplier[alignableIndex];
209 if (alignable >= 60 && alignable <= 69) {
211 }
else if (alignable >= 8780 && alignable <= 8789) {
213 }
else if (alignable >= 17520 && alignable <= 17529) {
215 }
else if (alignable >= 22380 && alignable <= 22389) {
217 }
else if (alignable >= 27260 && alignable <= 27269) {
219 }
else if (alignable >= 32120 && alignable <= 32129) {
225 if (alignableIndex == 0 && det >= 0 && det <= 5) {
227 XobsErr[det] = ObsErr;
228 }
else if (alignableIndex == 1 && det >= 0 && det <= 5) {
230 YobsErr[det] = ObsErr;
231 }
else if (alignableIndex == 2 && det >= 0 && det <= 5) {
233 ZobsErr[det] = ObsErr;
234 }
else if (alignableIndex == 3 && det >= 0 && det <= 5) {
235 tXobs[det] = ObsMove;
236 tXobsErr[det] = ObsErr;
237 }
else if (alignableIndex == 4 && det >= 0 && det <= 5) {
238 tYobs[det] = ObsMove;
239 tYobsErr[det] = ObsErr;
240 }
else if (alignableIndex == 5 && det >= 0 && det <= 5) {
241 tZobs[det] = ObsMove;
242 tZobsErr[det] = ObsErr;
245 if (
abs(ObsMove) > maxMoveCut_) {
253 }
else if (
abs(ObsMove) > Cutoffs[alignableIndex]) {
256 if (
abs(ObsErr) > maxErrorCut_) {
264 if (
abs(ObsMove/ObsErr) > sigCut_) {
273 edm::LogError(
"MillePedeFileReader") <<
"Could not read millepede result-file.";
std::array< double, 6 > const & getTYobs() const
std::string millePedeLogFile_
std::array< double, 6 > const & getYobsErr() const
std::array< double, 6 > Yobs
std::array< double, 6 > tZobs
std::array< double, 6 > XobsErr
std::array< double, 6 > Zobs
std::array< double, 6 > tXobsErr
void readMillePedeLogFile()
std::array< double, 6 > ZobsErr
std::array< double, 6 > const & getYobs() const
std::array< double, 6 > const & getTXobs() const
std::array< double, 6 > const & getXobsErr() const
std::array< double, 6 > const & getTZobs() const
void readMillePedeResultFile()
Abs< T >::type abs(const T &t)
std::array< double, 6 > tZobsErr
std::array< double, 6 > tYobs
std::array< double, 6 > Xobs
std::array< double, 6 > tYobsErr
std::array< double, 6 > const & getTXobsErr() const
std::array< double, 6 > const & getZobs() const
std::array< double, 6 > YobsErr
std::array< double, 6 > tXobs
std::array< double, 6 > const & getZobsErr() const
MillePedeFileReader(const edm::ParameterSet &)
std::array< double, 6 > const & getTZobsErr() const
std::array< double, 6 > const & getTYobsErr() const
std::array< double, 6 > const & getXobs() const
std::string millePedeResFile_