test
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
MillePedeFileReader Class Reference

#include <MillePedeFileReader.h>

Public Member Functions

std::array< double, 6 > const & getTXobs () const
 
std::array< double, 6 > const & getTXobsErr () const
 
std::array< double, 6 > const & getTYobs () const
 
std::array< double, 6 > const & getTYobsErr () const
 
std::array< double, 6 > const & getTZobs () const
 
std::array< double, 6 > const & getTZobsErr () const
 
std::array< double, 6 > const & getXobs () const
 
std::array< double, 6 > const & getXobsErr () const
 
std::array< double, 6 > const & getYobs () const
 
std::array< double, 6 > const & getYobsErr () const
 
std::array< double, 6 > const & getZobs () const
 
std::array< double, 6 > const & getZobsErr () const
 
 MillePedeFileReader (const edm::ParameterSet &)
 
void read ()
 
bool storeAlignments ()
 
 ~MillePedeFileReader ()
 

Private Member Functions

void readMillePedeLogFile ()
 
void readMillePedeResultFile ()
 

Private Attributes

double Cutoffs [6]
 
double maxErrorCut_
 
double maxMoveCut_
 
std::string millePedeLogFile_
 
std::string millePedeResFile_
 
int Nrec = 0
 
double sigCut_
 
double tXcut_
 
std::array< double, 6 > tXobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > tXobsErr = {{0.,0.,0.,0.,0.,0.}}
 
double tYcut_
 
std::array< double, 6 > tYobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > tYobsErr = {{0.,0.,0.,0.,0.,0.}}
 
double tZcut_
 
std::array< double, 6 > tZobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > tZobsErr = {{0.,0.,0.,0.,0.,0.}}
 
bool updateDB = false
 
double Xcut_
 
std::array< double, 6 > Xobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > XobsErr = {{0.,0.,0.,0.,0.,0.}}
 
double Ycut_
 
std::array< double, 6 > Yobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > YobsErr = {{0.,0.,0.,0.,0.,0.}}
 
double Zcut_
 
std::array< double, 6 > Zobs = {{0.,0.,0.,0.,0.,0.}}
 
std::array< double, 6 > ZobsErr = {{0.,0.,0.,0.,0.,0.}}
 

Detailed Description

Definition at line 12 of file MillePedeFileReader.h.

Constructor & Destructor Documentation

MillePedeFileReader::MillePedeFileReader ( const edm::ParameterSet config)
explicit

Definition at line 18 of file MillePedeFileReader.cc.

18  :
19  millePedeLogFile_(config.getParameter<std::string>("millePedeLogFile")),
20  millePedeResFile_(config.getParameter<std::string>("millePedeResFile")),
21 
22  sigCut_ (config.getParameter<double>("sigCut")),
23  Xcut_ (config.getParameter<double>("Xcut")),
24  tXcut_ (config.getParameter<double>("tXcut")),
25  Ycut_ (config.getParameter<double>("Ycut")),
26  tYcut_ (config.getParameter<double>("tYcut")),
27  Zcut_ (config.getParameter<double>("Zcut")),
28  tZcut_ (config.getParameter<double>("tZcut")),
29  maxMoveCut_ (config.getParameter<double>("maxMoveCut")),
30  maxErrorCut_(config.getParameter<double>("maxErrorCut"))
31 {
32 }
T getParameter(std::string const &) const
MillePedeFileReader::~MillePedeFileReader ( )
inline

Definition at line 18 of file MillePedeFileReader.h.

18 {}

Member Function Documentation

std::array<double, 6> const& MillePedeFileReader::getTXobs ( ) const
inline

Definition at line 25 of file MillePedeFileReader.h.

References tXobs.

25 { return tXobs; }
std::array< double, 6 > tXobs
std::array<double, 6> const& MillePedeFileReader::getTXobsErr ( ) const
inline

Definition at line 26 of file MillePedeFileReader.h.

References tXobsErr.

26 { return tXobsErr; }
std::array< double, 6 > tXobsErr
std::array<double, 6> const& MillePedeFileReader::getTYobs ( ) const
inline

Definition at line 30 of file MillePedeFileReader.h.

References tYobs.

30 { return tYobs; }
std::array< double, 6 > tYobs
std::array<double, 6> const& MillePedeFileReader::getTYobsErr ( ) const
inline

Definition at line 31 of file MillePedeFileReader.h.

References tYobsErr.

31 { return tYobsErr; }
std::array< double, 6 > tYobsErr
std::array<double, 6> const& MillePedeFileReader::getTZobs ( ) const
inline

Definition at line 35 of file MillePedeFileReader.h.

References tZobs.

35 { return tZobs; }
std::array< double, 6 > tZobs
std::array<double, 6> const& MillePedeFileReader::getTZobsErr ( ) const
inline

Definition at line 36 of file MillePedeFileReader.h.

References tZobsErr.

36 { return tZobsErr; }
std::array< double, 6 > tZobsErr
std::array<double, 6> const& MillePedeFileReader::getXobs ( ) const
inline

Definition at line 23 of file MillePedeFileReader.h.

References Xobs.

23 { return Xobs; }
std::array< double, 6 > Xobs
std::array<double, 6> const& MillePedeFileReader::getXobsErr ( ) const
inline

Definition at line 24 of file MillePedeFileReader.h.

References XobsErr.

24 { return XobsErr; }
std::array< double, 6 > XobsErr
std::array<double, 6> const& MillePedeFileReader::getYobs ( ) const
inline

Definition at line 28 of file MillePedeFileReader.h.

References Yobs.

28 { return Yobs; }
std::array< double, 6 > Yobs
std::array<double, 6> const& MillePedeFileReader::getYobsErr ( ) const
inline

Definition at line 29 of file MillePedeFileReader.h.

References YobsErr.

29 { return YobsErr; }
std::array< double, 6 > YobsErr
std::array<double, 6> const& MillePedeFileReader::getZobs ( ) const
inline

Definition at line 33 of file MillePedeFileReader.h.

References Zobs.

33 { return Zobs; }
std::array< double, 6 > Zobs
std::array<double, 6> const& MillePedeFileReader::getZobsErr ( ) const
inline

Definition at line 34 of file MillePedeFileReader.h.

References ZobsErr.

34 { return ZobsErr; }
std::array< double, 6 > ZobsErr
void MillePedeFileReader::read ( )
void MillePedeFileReader::readMillePedeLogFile ( )
private

Definition at line 52 of file MillePedeFileReader.cc.

References geometryCSVtoXML::line, heppy_check::logFile, and AlCaHLTBitMon_QueryRunRegistry::string.

53 {
54  std::ifstream logFile;
55  logFile.open(millePedeLogFile_.c_str());
56 
57  if (logFile.is_open()) {
58  edm::LogInfo("MillePedeFileReader") << "Reading millepede log-file";
60 
61  while (getline(logFile, line)) {
62  std::string Nrec_string = "NREC =";
63 
64  if (line.find(Nrec_string) != std::string::npos) {
65  std::istringstream iss(line);
66  std::string trash;
67  iss >> trash >> trash >> Nrec;
68 
69  if (Nrec < 25000) {
70  updateDB = false;
71  }
72  }
73  }
74 
75  } else {
76  edm::LogError("MillePedeFileReader") << "Could not read millepede log-file.";
77 
78  updateDB = false;
79  Nrec = 0;
80  }
81 }
tuple logFile
Definition: heppy_check.py:39
void MillePedeFileReader::readMillePedeResultFile ( )
private

Definition at line 84 of file MillePedeFileReader.cc.

References funct::abs(), geometryCSVtoXML::line, AlCaHLTBitMon_QueryRunRegistry::string, and unpackBuffers-CaloStage2::token.

85 {
86  updateDB = false;
87  std::ifstream resFile;
88  resFile.open(millePedeResFile_.c_str());
89 
90  if (resFile.is_open()) {
91  edm::LogInfo("MillePedeFileReader") << "Reading millepede result-file";
92  double Multiplier[6] = {10000.,10000.,10000.,1000000.,1000000.,1000000.};
93 
95  getline(resFile, line); // drop first line
96 
97  while (getline(resFile, line)) {
98  std::istringstream iss(line);
99 
100  std::vector<std::string> tokens;
102  while (iss >> token) {
103  tokens.push_back(token);
104  }
105 
106  if (tokens.size() > 4 /*3*/) {
107 
108  int alignable = std::stoi(tokens[0]);
109  int alignableIndex = alignable % 10 - 1;
110 
111  double ObsMove = std::stof(tokens[3]) * Multiplier[alignableIndex];
112  double ObsErr = std::stof(tokens[4]) * Multiplier[alignableIndex];
113 
114  int det = -1;
115 
116  if (alignable >= 60 && alignable <= 69) {
117  det = 2; // TPBHalfBarrel (x+)
118  } else if (alignable >= 8780 && alignable <= 8789) {
119  det = 3; // TPBHalfBarrel (x-)
120  } else if (alignable >= 17520 && alignable <= 17529) {
121  det = 4; // TPEHalfCylinder (x+,z+)
122  } else if (alignable >= 22380 && alignable <= 22389) {
123  det = 5; // TPEHalfCylinder (x-,z+)
124  } else if (alignable >= 27260 && alignable <= 27269) {
125  det = 0; // TPEHalfCylinder (x+,z-)
126  } else if (alignable >= 32120 && alignable <= 32129) {
127  det = 1; //TPEHalfCylinder (x-,z-)
128  } else {
129  continue;
130  }
131 
132  if (alignableIndex == 0 && det >= 0 && det <= 5) {
133  Xobs[det] = ObsMove;
134  XobsErr[det] = ObsErr;
135  } else if (alignableIndex == 1 && det >= 0 && det <= 5) {
136  Yobs[det] = ObsMove;
137  YobsErr[det] = ObsErr;
138  } else if (alignableIndex == 2 && det >= 0 && det <= 5) {
139  Zobs[det] = ObsMove;
140  ZobsErr[det] = ObsErr;
141  } else if (alignableIndex == 3 && det >= 0 && det <= 5) {
142  tXobs[det] = ObsMove;
143  tXobsErr[det] = ObsErr;
144  } else if (alignableIndex == 4 && det >= 0 && det <= 5) {
145  tYobs[det] = ObsMove;
146  tYobsErr[det] = ObsErr;
147  } else if (alignableIndex == 5 && det >= 0 && det <= 5) {
148  tZobs[det] = ObsMove;
149  tZobsErr[det] = ObsErr;
150  }
151 
152  if (std::abs(ObsMove) > maxMoveCut_) {
153  updateDB = false;
154  break;
155 
156  } else if (std::abs(ObsMove) > Cutoffs[alignableIndex]) {
157 
158  if (std::abs(ObsErr) > maxErrorCut_) {
159  updateDB = false;
160  break;
161  } else {
162  if (std::abs(ObsMove/ObsErr) < sigCut_) {
163  continue;
164  }
165  }
166  updateDB = true;
167  }
168  }
169  }
170  } else {
171  edm::LogError("MillePedeFileReader") << "Could not read millepede result-file.";
172 
173  updateDB = false;
174  Nrec = 0;
175  }
176 }
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
std::array< double, 6 > ZobsErr
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::array< double, 6 > tZobsErr
std::array< double, 6 > tYobs
std::array< double, 6 > Xobs
std::array< double, 6 > tYobsErr
std::array< double, 6 > YobsErr
std::array< double, 6 > tXobs
bool MillePedeFileReader::storeAlignments ( )

Definition at line 41 of file MillePedeFileReader.cc.

Referenced by PCLTrackerAlProducer::finish().

41  {
42  return updateDB;
43 }

Member Data Documentation

double MillePedeFileReader::Cutoffs[6]
private
Initial value:

Definition at line 60 of file MillePedeFileReader.h.

double MillePedeFileReader::maxErrorCut_
private

Definition at line 58 of file MillePedeFileReader.h.

double MillePedeFileReader::maxMoveCut_
private

Definition at line 58 of file MillePedeFileReader.h.

std::string MillePedeFileReader::millePedeLogFile_
private

Definition at line 48 of file MillePedeFileReader.h.

std::string MillePedeFileReader::millePedeResFile_
private

Definition at line 49 of file MillePedeFileReader.h.

int MillePedeFileReader::Nrec = 0
private

Definition at line 64 of file MillePedeFileReader.h.

double MillePedeFileReader::sigCut_
private

Definition at line 52 of file MillePedeFileReader.h.

double MillePedeFileReader::tXcut_
private

Definition at line 54 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::tXobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 68 of file MillePedeFileReader.h.

Referenced by getTXobs().

std::array<double, 6> MillePedeFileReader::tXobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 69 of file MillePedeFileReader.h.

Referenced by getTXobsErr().

double MillePedeFileReader::tYcut_
private

Definition at line 55 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::tYobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 73 of file MillePedeFileReader.h.

Referenced by getTYobs().

std::array<double, 6> MillePedeFileReader::tYobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 74 of file MillePedeFileReader.h.

Referenced by getTYobsErr().

double MillePedeFileReader::tZcut_
private

Definition at line 56 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::tZobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 78 of file MillePedeFileReader.h.

Referenced by getTZobs().

std::array<double, 6> MillePedeFileReader::tZobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 79 of file MillePedeFileReader.h.

Referenced by getTZobsErr().

bool MillePedeFileReader::updateDB = false
private

Definition at line 63 of file MillePedeFileReader.h.

double MillePedeFileReader::Xcut_
private

Definition at line 54 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::Xobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 66 of file MillePedeFileReader.h.

Referenced by getXobs().

std::array<double, 6> MillePedeFileReader::XobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 67 of file MillePedeFileReader.h.

Referenced by getXobsErr().

double MillePedeFileReader::Ycut_
private

Definition at line 55 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::Yobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 71 of file MillePedeFileReader.h.

Referenced by getYobs().

std::array<double, 6> MillePedeFileReader::YobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 72 of file MillePedeFileReader.h.

Referenced by getYobsErr().

double MillePedeFileReader::Zcut_
private

Definition at line 56 of file MillePedeFileReader.h.

std::array<double, 6> MillePedeFileReader::Zobs = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 76 of file MillePedeFileReader.h.

Referenced by getZobs().

std::array<double, 6> MillePedeFileReader::ZobsErr = {{0.,0.,0.,0.,0.,0.}}
private

Definition at line 77 of file MillePedeFileReader.h.

Referenced by getZobsErr().