CMS 3D CMS Logo

MillePedeFileReader.cc
Go to the documentation of this file.
1 /*** Header file ***/
4 
5 /*** system includes ***/
6 #include <cmath> // include floating-point std::abs functions
7 #include <fstream>
8 
9 /*** Alignment ***/
12 
13 //=============================================================================
14 //=== PUBLIC METHOD IMPLEMENTATION ===
15 //=============================================================================
16 
18  const std::shared_ptr<const PedeLabelerBase>& pedeLabeler,
19  const std::shared_ptr<const AlignPCLThresholdsHG>& theThresholds,
20  const std::shared_ptr<const PixelTopologyMap>& pixelTopologyMap,
21  const std::shared_ptr<const SiPixelQuality>& pixelQualityMap)
22  : pedeLabeler_(pedeLabeler),
23  theThresholds_(theThresholds),
24  pixelTopologyMap_(pixelTopologyMap),
25  ignoreInactiveAlignables_(config.getParameter<bool>("ignoreInactiveAlignables")),
26  quality_(pixelQualityMap),
27  dirName_(config.getParameter<std::string>("fileDir")),
28  millePedeEndFile_(config.getParameter<std::string>("millePedeEndFile")),
29  millePedeLogFile_(config.getParameter<std::string>("millePedeLogFile")),
30  millePedeResFile_(config.getParameter<std::string>("millePedeResFile")),
31  isHG_(config.getParameter<bool>("isHG")) {
32  if (!dirName_.empty() && dirName_.find_last_of('/') != dirName_.size() - 1)
33  dirName_ += '/'; // may need '/'
34 }
35 
37  if (isHG_) {
39  }
43 }
44 
46 
47 //=============================================================================
48 //=== PRIVATE METHOD IMPLEMENTATION ===
49 //=============================================================================
51  std::ifstream endFile;
52  endFile.open((dirName_ + millePedeEndFile_).c_str());
53 
54  if (endFile.is_open()) {
55  edm::LogInfo("MillePedeFileReader") << "Reading millepede end-file";
57  getline(endFile, line);
58  std::string trash;
59  if (line.find("-1") != std::string::npos) {
60  getline(endFile, line);
62  std::istringstream iss(line);
63  iss >> exitCode_ >> trash;
64  edm::LogInfo("MillePedeFileReader")
65  << " Pede exit code is: " << exitCode_ << " (" << exitMessage_ << ")" << std::endl;
66  } else {
68  std::istringstream iss(line);
69  iss >> exitCode_ >> trash;
70  edm::LogInfo("MillePedeFileReader")
71  << " Pede exit code is: " << exitCode_ << " (" << exitMessage_ << ")" << std::endl;
72  }
73  } else {
74  edm::LogError("MillePedeFileReader") << "Could not read millepede end-file.";
75  exitMessage_ = "no exit code found";
76  }
77 }
78 
80  std::ifstream logFile;
81  logFile.open((dirName_ + millePedeLogFile_).c_str());
82 
83  if (logFile.is_open()) {
84  edm::LogInfo("MillePedeFileReader") << "Reading millepede log-file";
86 
87  while (getline(logFile, line)) {
88  std::string Nrec_string = "NREC =";
89  std::string Binaries_string = "C_binary";
90 
91  if (line.find(Nrec_string) != std::string::npos) {
92  std::istringstream iss(line);
93  std::string trash;
94  iss >> trash >> trash >> Nrec_;
95 
96  if (Nrec_ < theThresholds_->getNrecords()) {
97  edm::LogInfo("MillePedeFileReader")
98  << "Number of records used " << theThresholds_->getNrecords() << std::endl;
99  updateDB_ = false;
100  }
101  }
102 
103  if (line.find(Binaries_string) != std::string::npos) {
104  binariesAmount_ += 1;
105  }
106  }
107  } else {
108  edm::LogError("MillePedeFileReader") << "Could not read millepede log-file.";
109 
110  updateDB_ = false;
111  Nrec_ = 0;
112  }
113 }
114 
116  // cutoffs by coordinate and by alignable
117  std::map<std::string, std::array<float, 6> > cutoffs_;
118  std::map<std::string, std::array<float, 6> > significances_;
119  std::map<std::string, std::array<float, 6> > thresholds_;
120  std::map<std::string, std::array<float, 6> > errors_;
121  std::map<std::string, std::array<float, 6> > fractions_;
122 
123  std::map<std::string, std::array<int, 6> > countsAbove_;
124  std::map<std::string, std::array<int, 6> > countsTotal_;
125 
127 
128  std::vector<std::string> alignables_ = theThresholds_->getAlignableList();
129  for (auto& ali : alignables_) {
130  cutoffs_[ali] = theThresholds_->getCut(ali);
131  significances_[ali] = theThresholds_->getSigCut(ali);
132  thresholds_[ali] = theThresholds_->getMaxMoveCut(ali);
133  errors_[ali] = theThresholds_->getMaxErrorCut(ali);
134 
135  if (theThresholds_->hasFloatMap(ali)) {
136  fractions_[ali] = theThresholds_->getFractionCut(ali);
137  countsAbove_[ali] = {{0, 0, 0, 0, 0, 0}};
138  countsTotal_[ali] = {{0, 0, 0, 0, 0, 0}};
139  }
140  }
141 
142  updateDB_ = false;
143  vetoUpdateDB_ = false;
144  std::ifstream resFile;
145  resFile.open((dirName_ + millePedeResFile_).c_str());
146 
147  if (resFile.is_open()) {
148  edm::LogInfo("MillePedeFileReader") << "Reading millepede result-file";
149 
151  getline(resFile, line); // drop first line
152 
153  while (getline(resFile, line)) {
154  std::istringstream iss(line);
155 
156  std::vector<std::string> tokens;
158  while (iss >> token) {
159  tokens.push_back(token);
160  }
161 
162  auto alignableLabel = std::stoul(tokens[0]);
163  const auto alignable = pedeLabeler_->alignableFromLabel(alignableLabel);
164  auto det = getHLS(alignable);
165  // check if the modules associated to the alignable are active
166  const bool active = isAlignableActive(alignable, quality_);
167  int detIndex = static_cast<int>(det);
168  auto alignableIndex = alignableLabel % 10 - 1;
170 
171  if (!active) {
172  edm::LogPrint("MillePedeFileReader") << "Alignable :" << detLabel << " is inactive";
173  }
174 
175  if (tokens.size() > 4 /*3*/) {
176  countsTotal_[detLabel][alignableIndex]++; //Count aligned modules/ladders per structure
177  const auto paramNum = pedeLabeler_->paramNumFromLabel(alignableLabel);
178  align::StructureType type = alignable->alignableObjectId();
179  align::ID id = alignable->id();
180 
181  double ObsMove = std::stof(tokens[3]) * multiplier_[alignableIndex];
182  double ObsErr = std::stof(tokens[4]) * multiplier_[alignableIndex];
183 
184  auto coord = static_cast<AlignPCLThresholdsHG::coordType>(alignableIndex);
185 
186  if (det != PclHLS::NotInPCL) {
187  if (type != align::TPBLadder && type != align::TPEPanel) {
188  switch (coord) {
190  Xobs_[detIndex] = ObsMove;
191  XobsErr_[detIndex] = ObsErr;
192  break;
194  Yobs_[detIndex] = ObsMove;
195  YobsErr_[detIndex] = ObsErr;
196  break;
198  Zobs_[detIndex] = ObsMove;
199  ZobsErr_[detIndex] = ObsErr;
200  break;
202  tXobs_[detIndex] = ObsMove;
203  tXobsErr_[detIndex] = ObsErr;
204  break;
206  tYobs_[detIndex] = ObsMove;
207  tYobsErr_[detIndex] = ObsErr;
208  break;
210  tZobs_[detIndex] = ObsMove;
211  tZobsErr_[detIndex] = ObsErr;
212  break;
213  default:
214  edm::LogError("MillePedeFileReader") << "Currently not able to handle DOF " << coord << std::endl;
215  break;
216  }
217  } else {
218  auto hgIndex = getIndexForHG(id, det);
219  switch (coord) {
221  Xobs_HG_[hgIndex - 1] = ObsMove;
222  XobsErr_HG_[hgIndex - 1] = ObsErr;
223  break;
225  Yobs_HG_[hgIndex - 1] = ObsMove;
226  YobsErr_HG_[hgIndex - 1] = ObsErr;
227  break;
229  Zobs_HG_[hgIndex - 1] = ObsMove;
230  ZobsErr_HG_[hgIndex - 1] = ObsErr;
231  break;
233  tXobs_HG_[hgIndex - 1] = ObsMove;
234  tXobsErr_HG_[hgIndex - 1] = ObsErr;
235  break;
237  tYobs_HG_[hgIndex - 1] = ObsMove;
238  tYobsErr_HG_[hgIndex - 1] = ObsErr;
239  break;
241  tZobs_HG_[hgIndex - 1] = ObsMove;
242  tZobsErr_HG_[hgIndex - 1] = ObsErr;
243  break;
244  default:
245  edm::LogError("MillePedeFileReader") << "Currently not able to handle DOF " << coord << std::endl;
246  break;
247  }
248  }
249 
250  } else {
251  edm::LogError("MillePedeFileReader")
252  << "Currently not able to handle coordinate: " << coord << " (" << paramNum << ") "
253  << Form(" %s with ID %d (subdet %d)", alignableObjectId.idToString(type), id, DetId(id).subdetId())
254  << std::endl;
255  continue;
256  }
257 
258  edm::LogVerbatim("MillePedeFileReader")
259  << " alignableLabel: " << alignableLabel << " with alignableIndex " << alignableIndex << " detIndex "
260  << detIndex << "\n"
261  << " i.e. detLabel: " << detLabel << " (" << coord << ")\n"
262  << " has movement: " << ObsMove << " +/- " << ObsErr << "\n"
263  << " cutoff (cutoffs_[" << detLabel << "][" << coord << "]): " << cutoffs_[detLabel][alignableIndex] << "\n"
264  << " significance (significances_[" << detLabel << "][" << coord
265  << "]): " << significances_[detLabel][alignableIndex] << "\n"
266  << " error thresolds (errors_[" << detLabel << "][" << coord << "]): " << errors_[detLabel][alignableIndex]
267  << "\n"
268  << " max movement (thresholds_[" << detLabel << "][" << coord
269  << "]): " << thresholds_[detLabel][alignableIndex] << "\n"
270  << " fraction (fractions_[" << detLabel << "][" << coord << "]): " << fractions_[detLabel][alignableIndex]
271  << "\n"
272  << "=============" << std::endl;
273 
274  if (std::abs(ObsMove) > thresholds_[detLabel][alignableIndex]) {
275  if (active || ignoreInactiveAlignables_) {
276  edm::LogWarning("MillePedeFileReader")
277  << "Aborting payload creation."
278  << " Exceeding maximum thresholds for movement: " << std::abs(ObsMove) << " for " << detLabel << " ("
279  << coord << ")";
280  updateBits_.set(0);
281  vetoUpdateDB_ = true;
282  continue;
283  } else {
284  edm::LogInfo("MillePedeFileReader")
285  << " Exceeding maximum thresholds for movement: " << std::abs(ObsMove) << " for " << detLabel << " ("
286  << coord << ") but continuing as the alignable is inactive!";
287  }
288 
289  } else if (std::abs(ObsMove) > cutoffs_[detLabel][alignableIndex]) {
290  updateBits_.set(1);
291 
292  if (std::abs(ObsErr) > errors_[detLabel][alignableIndex]) {
293  edm::LogWarning("MillePedeFileReader") << "Aborting payload creation."
294  << " Exceeding maximum thresholds for error: " << std::abs(ObsErr)
295  << " for" << detLabel << "(" << coord << ")";
296  updateBits_.set(2);
297  vetoUpdateDB_ = true;
298  continue;
299  } else {
300  if (std::abs(ObsMove / ObsErr) < significances_[detLabel][alignableIndex]) {
301  updateBits_.set(3);
302  continue;
303  }
304  }
305  updateDB_ = true;
306  if (!isHG_) {
307  edm::LogInfo("MillePedeFileReader")
308  << "This correction: " << ObsMove << "+/-" << ObsErr << " for " << detLabel << "(" << coord
309  << ") will trigger a new Tracker Alignment payload!";
310  }
311  countsAbove_[detLabel][alignableIndex]++;
312  }
313  }
314  }
315  } else {
316  edm::LogError("MillePedeFileReader") << "Could not read millepede result-file.";
317 
318  updateDB_ = false;
319  Nrec_ = 0;
320  }
321 
322  if (isHG_) { // check fractionCut
323  updateDB_ = false; // reset booleans since fractionCut is considered for HG
324  std::stringstream ss;
325  for (auto& ali : alignables_) {
326  ss << ali << std::endl;
327  for (long unsigned int i = 0; i < countsTotal_[ali].size(); i++) {
328  if (countsTotal_[ali][i] != 0 && fractions_[ali][i] != -1) {
329  float fraction_ = countsAbove_[ali][i] / (1.0 * countsTotal_[ali][i]);
330  ss << static_cast<AlignPCLThresholdsHG::coordType>(i) << ": Fraction = " << fraction_
331  << " Fraction Threshold = " << fractions_[ali][i];
332  if (fraction_ >= fractions_[ali][i]) {
333  updateDB_ = true;
334  ss << " above fraction threshold" << std::endl;
335  fractionExceeded_[ali][i] = true;
336  } else {
337  ss << std::endl;
338  fractionExceeded_[ali][i] = false;
339  }
340  } else
341  ss << "No entries available or no fraction thresholds defined" << std::endl;
342  }
343  ss << "===================" << std::endl;
344  }
345  if (updateDB_ && !vetoUpdateDB_) {
346  ss << "Alignment will be updated" << std::endl;
347  } else {
348  ss << "Alignment will NOT be updated" << std::endl;
349  }
350  edm::LogWarning("MillePedeFileReader") << ss.str();
351  }
352 }
353 
355  const std::shared_ptr<const SiPixelQuality>& pixelQual) {
356  std::vector<DetId> detIds;
357 
358  // Get the list of deep components (lowest daughters) of the Alignable
359  const auto& deepComponents = alignable->deepComponents();
360 
361  // Iterate through the deep components to retrieve their DetIds
362  for (const auto& component : deepComponents) {
363  DetId detId = component->geomDetId();
364  if (detId != DetId(0)) {
365  detIds.push_back(detId);
366  }
367  }
368 
369  // Counter for bad modules
370  int badModuleCount = 0;
371  int totalDetIds = detIds.size();
372 
373  const auto& theDisabledModules = pixelQual->getBadComponentList();
374  std::vector<SiPixelQuality::disabledModuleType> theDisabledModuleInAlignable;
375  for (const auto& mod : theDisabledModules) {
376  if (std::find(detIds.begin(), detIds.end(), mod.DetID) != detIds.end()) {
377  theDisabledModuleInAlignable.push_back(mod);
378  }
379  }
380 
381  // nothing left to do
382  if (theDisabledModuleInAlignable.empty()) {
383  return true;
384  }
385 
386  bool header{false};
387 
388  std::stringstream out;
389  for (const auto& mod : theDisabledModuleInAlignable) {
390  if (!header)
391  out << " Alignable = " << getStringFromHLS(getHLS(alignable));
392  header = true;
393  bool isBad = pixelQual->IsModuleBad(mod.DetID);
394  std::bitset<16> bad_rocs(mod.BadRocs);
395  if (isBad || bad_rocs.all()) {
396  badModuleCount++;
397  }
398  out << " " << mod.DetID << " (" << (isBad || bad_rocs.all()) << ") , " << bad_rocs;
399  }
400  out << std::endl;
401 
402  if (badModuleCount > 0) {
403  out << " " << badModuleCount << " modules are bad out of " << totalDetIds << std::endl;
404  edm::LogPrint("MillePedeFileReader") << out.str();
405  }
406 
407  // Return false if at least half of the detIds are bad
408  if (badModuleCount >= (totalDetIds + 1) / 2) {
409  return false;
410  }
411 
412  // If less than half are bad, return true
413  return true;
414 }
415 
417  if (!alignable)
418  return PclHLS::NotInPCL;
419 
420  const auto& tns = pedeLabeler_->alignableTracker()->trackerNameSpace();
421  const align::ID id = alignable->id();
422 
423  switch (alignable->alignableObjectId()) {
425  switch (tns.tpb().halfBarrelNumber(id)) {
426  case 1:
428  case 2:
430  default:
431  throw cms::Exception("LogicError")
432  << "@SUB=MillePedeFileReader::getHLS\n"
433  << "Found a pixel half-barrel number that should not exist: " << tns.tpb().halfBarrelNumber(id);
434  }
436  switch (tns.tpe().endcapNumber(id)) {
437  case 1:
438  switch (tns.tpe().halfCylinderNumber(id)) {
439  case 1:
441  case 2:
443  default:
444  throw cms::Exception("LogicError")
445  << "@SUB=MillePedeFileReader::getHLS\n"
446  << "Found a pixel half-cylinder number that should not exist: " << tns.tpe().halfCylinderNumber(id);
447  }
448  case 2:
449  switch (tns.tpe().halfCylinderNumber(id)) {
450  case 1:
452  case 2:
454  default:
455  throw cms::Exception("LogicError")
456  << "@SUB=MillePedeFileReader::getHLS\n"
457  << "Found a pixel half-cylinder number that should not exist: " << tns.tpe().halfCylinderNumber(id);
458  }
459  default:
460  throw cms::Exception("LogicError")
461  << "@SUB=MillePedeFileReader::getHLS\n"
462  << "Found a pixel endcap number that should not exist: " << tns.tpe().endcapNumber(id);
463  }
464  case align::TPBLadder:
465  switch (tns.tpb().layerNumber(id)) {
466  case 1:
468  case 2:
470  case 3:
472  case 4:
474  default:
475  throw cms::Exception("LogicError")
476  << "@SUB=MillePedeFileReader::getHLS\n"
477  << "Found a pixel layer number that should not exist: " << tns.tpb().layerNumber(id);
478  }
479  case align::TPEPanel:
480  switch (static_cast<signed int>((tns.tpe().endcapNumber(id) == 1) ? -1 * tns.tpe().halfDiskNumber(id)
481  : tns.tpe().halfDiskNumber(id))) {
482  case -3:
483  return PclHLS::TPEPanelDiskM3;
484  case -2:
485  return PclHLS::TPEPanelDiskM2;
486  case -1:
487  return PclHLS::TPEPanelDiskM1;
488  case 3:
489  return PclHLS::TPEPanelDisk3;
490  case 2:
491  return PclHLS::TPEPanelDisk2;
492  case 1:
493  return PclHLS::TPEPanelDisk1;
494  default:
495  throw cms::Exception("LogicError")
496  << "@SUB=MillePedeFileReader::getHLS\n"
497  << "Found a pixel disk number that should not exist: "
498  << static_cast<signed int>((tns.tpe().endcapNumber(id) == 1) ? -1 * tns.tpe().halfDiskNumber(id)
499  : tns.tpe().halfDiskNumber(id));
500  }
501  default:
502  return PclHLS::NotInPCL;
503  }
504 }
505 
507  switch (HLS) {
509  return "TPBHalfBarrelXminus";
511  return "TPBHalfBarrelXplus";
513  return "TPEHalfCylinderXminusZminus";
515  return "TPEHalfCylinderXplusZminus";
517  return "TPEHalfCylinderXminusZplus";
519  return "TPEHalfCylinderXplusZplus";
521  return "TPBLadderLayer1";
523  return "TPBLadderLayer2";
525  return "TPBLadderLayer3";
527  return "TPBLadderLayer4";
529  return "TPEPanelDisk1";
531  return "TPEPanelDisk2";
533  return "TPEPanelDisk3";
535  return "TPEPanelDiskM1";
537  return "TPEPanelDiskM2";
539  return "TPEPanelDiskM3";
540  default:
541  //return "NotInPCL";
542  throw cms::Exception("LogicError")
543  << "@SUB=MillePedeFileReader::getStringFromHLS\n"
544  << "Found an alignable structure not possible to map in the default AlignPCLThresholdsHG partitions";
545  }
546 }
547 
549  int currentSum = 0;
550 
552  std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(1) / 2);
553  currentSum += pixelTopologyMap_->getPXBLadders(1);
555  std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(2) / 2);
556  currentSum += pixelTopologyMap_->getPXBLadders(2);
558  std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(3) / 2);
559  currentSum += pixelTopologyMap_->getPXBLadders(3);
561  std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(4) / 2);
562  currentSum += pixelTopologyMap_->getPXBLadders(4);
563 
564  indexHelper[PclHLS::TPEPanelDiskM3] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-3));
565  currentSum += pixelTopologyMap_->getPXFBlades(-3) * 2;
566  indexHelper[PclHLS::TPEPanelDiskM2] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-2));
567  currentSum += pixelTopologyMap_->getPXFBlades(-2) * 2;
568  indexHelper[PclHLS::TPEPanelDiskM1] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-1));
569  currentSum += pixelTopologyMap_->getPXFBlades(-1) * 2;
570 
571  indexHelper[PclHLS::TPEPanelDisk1] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(1));
572  currentSum += pixelTopologyMap_->getPXFBlades(1) * 2;
573  indexHelper[PclHLS::TPEPanelDisk2] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(2));
574  currentSum += pixelTopologyMap_->getPXFBlades(2) * 2;
575  indexHelper[PclHLS::TPEPanelDisk3] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(3));
576 }
577 
579  const auto& tns = pedeLabeler_->alignableTracker()->trackerNameSpace();
580 
581  switch (HLS) {
583  return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
584  : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
586  return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
587  : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
589  return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
590  : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
592  return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
593  : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
595  return (tns.tpe().halfCylinderNumber(id) == 1)
596  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
597  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
599  return (tns.tpe().halfCylinderNumber(id) == 1)
600  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
601  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
603  return (tns.tpe().halfCylinderNumber(id) == 1)
604  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
605  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
607  return (tns.tpe().halfCylinderNumber(id) == 1)
608  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
609  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
611  return (tns.tpe().halfCylinderNumber(id) == 1)
612  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
613  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
615  return (tns.tpe().halfCylinderNumber(id) == 1)
616  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
617  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
618  default:
619  return -200;
620  }
621 }
622 
623 //=============================================================================
624 //=== STATIC CONST MEMBER DEFINITION ===
625 //=============================================================================
626 constexpr std::array<double, 6> MillePedeFileReader::multiplier_;
627 
629  desc.add<std::string>("fileDir", std::string());
630  desc.add<bool>("ignoreInactiveAlignables", true);
631  desc.add<std::string>("millePedeEndFile", "millepede.end");
632  desc.add<std::string>("millePedeLogFile", "millepede.log");
633  desc.add<std::string>("millePedeResFile", "millepede.res");
634  desc.add<bool>("isHG", false);
635 }
std::array< double, SIZE_LG_STRUCTS > Zobs_
Log< level::Info, true > LogVerbatim
std::array< double, SIZE_HG_STRUCTS > tXobs_HG_
std::array< double, SIZE_LG_STRUCTS > tYobs_
std::array< double, SIZE_LG_STRUCTS > tZobsErr_
std::array< double, SIZE_LG_STRUCTS > Yobs_
const std::shared_ptr< const AlignPCLThresholdsHG > theThresholds_
std::array< double, SIZE_HG_STRUCTS > XobsErr_HG_
uint32_t ID
Definition: Definitions.h:24
std::bitset< 4 > updateBits_
std::array< double, SIZE_LG_STRUCTS > YobsErr_
std::array< double, SIZE_HG_STRUCTS > YobsErr_HG_
const std::shared_ptr< const PixelTopologyMap > pixelTopologyMap_
const std::shared_ptr< const SiPixelQuality > quality_
Definition: config.py:1
PclHLS getHLS(const Alignable *)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const Alignables & deepComponents() const
Definition: Alignable.h:72
std::array< double, SIZE_HG_STRUCTS > Zobs_HG_
std::array< double, SIZE_LG_STRUCTS > Xobs_
static constexpr std::array< double, 6 > multiplier_
std::array< double, SIZE_HG_STRUCTS > Xobs_HG_
std::array< double, SIZE_HG_STRUCTS > tYobs_HG_
const std::string millePedeLogFile_
std::array< double, SIZE_LG_STRUCTS > tXobs_
std::array< double, SIZE_LG_STRUCTS > tYobsErr_
std::array< double, SIZE_HG_STRUCTS > ZobsErr_HG_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::array< double, SIZE_HG_STRUCTS > tZobs_HG_
Allows conversion between type and name, and vice-versa.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Log< level::Warning, true > LogPrint
std::string getStringFromHLS(PclHLS HLS)
Log< level::Info, false > LogInfo
Definition: DetId.h:17
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
const std::string millePedeResFile_
std::array< double, SIZE_LG_STRUCTS > tXobsErr_
const bool ignoreInactiveAlignables_
std::unordered_map< PclHLS, std::pair< int, int > > indexHelper
MillePedeFileReader(const edm::ParameterSet &, const std::shared_ptr< const PedeLabelerBase > &, const std::shared_ptr< const AlignPCLThresholdsHG > &, const std::shared_ptr< const PixelTopologyMap > &, const std::shared_ptr< const SiPixelQuality > &)
std::array< double, SIZE_HG_STRUCTS > tZobsErr_HG_
std::array< double, SIZE_LG_STRUCTS > XobsErr_
int getIndexForHG(align::ID id, PclHLS HLS)
const std::shared_ptr< const PedeLabelerBase > pedeLabeler_
const std::string millePedeEndFile_
std::array< double, SIZE_HG_STRUCTS > tXobsErr_HG_
std::array< double, SIZE_HG_STRUCTS > Yobs_HG_
std::array< double, SIZE_LG_STRUCTS > tZobs_
bool isAlignableActive(const Alignable *alignable, const std::shared_ptr< const SiPixelQuality > &pixelQual)
std::map< std::string, std::array< bool, 6 > > fractionExceeded_
Log< level::Warning, false > LogWarning
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::array< double, SIZE_LG_STRUCTS > ZobsErr_
std::array< double, SIZE_HG_STRUCTS > tYobsErr_HG_