Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-24 22:51:36

0001 /*** Header file ***/
0002 #include "Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeFileReader.h"
0003 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
0004 
0005 /*** system includes ***/
0006 #include <cmath>  // include floating-point std::abs functions
0007 #include <fstream>
0008 
0009 /*** Alignment ***/
0010 #include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
0011 
0012 //=============================================================================
0013 //===   PUBLIC METHOD IMPLEMENTATION                                        ===
0014 //=============================================================================
0015 
0016 MillePedeFileReader ::MillePedeFileReader(const edm::ParameterSet& config,
0017                                           const std::shared_ptr<const PedeLabelerBase>& pedeLabeler,
0018                                           const std::shared_ptr<const AlignPCLThresholdsHG>& theThresholds,
0019                                           const std::shared_ptr<const PixelTopologyMap>& pixelTopologyMap)
0020     : pedeLabeler_(pedeLabeler),
0021       theThresholds_(theThresholds),
0022       pixelTopologyMap_(pixelTopologyMap),
0023       dirName_(config.getParameter<std::string>("fileDir")),
0024       millePedeEndFile_(config.getParameter<std::string>("millePedeEndFile")),
0025       millePedeLogFile_(config.getParameter<std::string>("millePedeLogFile")),
0026       millePedeResFile_(config.getParameter<std::string>("millePedeResFile")),
0027       isHG_(config.getParameter<bool>("isHG")) {
0028   if (!dirName_.empty() && dirName_.find_last_of('/') != dirName_.size() - 1)
0029     dirName_ += '/';  // may need '/'
0030 }
0031 
0032 void MillePedeFileReader ::read() {
0033   if (isHG_) {
0034     initializeIndexHelper();
0035   }
0036   readMillePedeEndFile();
0037   readMillePedeLogFile();
0038   readMillePedeResultFile();
0039 }
0040 
0041 bool MillePedeFileReader ::storeAlignments() { return (updateDB_ && !vetoUpdateDB_); }
0042 
0043 //=============================================================================
0044 //===   PRIVATE METHOD IMPLEMENTATION                                       ===
0045 //=============================================================================
0046 void MillePedeFileReader ::readMillePedeEndFile() {
0047   std::ifstream endFile;
0048   endFile.open((dirName_ + millePedeEndFile_).c_str());
0049 
0050   if (endFile.is_open()) {
0051     edm::LogInfo("MillePedeFileReader") << "Reading millepede end-file";
0052     std::string line;
0053     getline(endFile, line);
0054     std::string trash;
0055     if (line.find("-1") != std::string::npos) {
0056       getline(endFile, line);
0057       exitMessage_ = line;
0058       std::istringstream iss(line);
0059       iss >> exitCode_ >> trash;
0060       edm::LogInfo("MillePedeFileReader")
0061           << " Pede exit code is: " << exitCode_ << " (" << exitMessage_ << ")" << std::endl;
0062     } else {
0063       exitMessage_ = line;
0064       std::istringstream iss(line);
0065       iss >> exitCode_ >> trash;
0066       edm::LogInfo("MillePedeFileReader")
0067           << " Pede exit code is: " << exitCode_ << " (" << exitMessage_ << ")" << std::endl;
0068     }
0069   } else {
0070     edm::LogError("MillePedeFileReader") << "Could not read millepede end-file.";
0071     exitMessage_ = "no exit code found";
0072   }
0073 }
0074 
0075 void MillePedeFileReader ::readMillePedeLogFile() {
0076   std::ifstream logFile;
0077   logFile.open((dirName_ + millePedeLogFile_).c_str());
0078 
0079   if (logFile.is_open()) {
0080     edm::LogInfo("MillePedeFileReader") << "Reading millepede log-file";
0081     std::string line;
0082 
0083     while (getline(logFile, line)) {
0084       std::string Nrec_string = "NREC =";
0085       std::string Binaries_string = "C_binary";
0086 
0087       if (line.find(Nrec_string) != std::string::npos) {
0088         std::istringstream iss(line);
0089         std::string trash;
0090         iss >> trash >> trash >> Nrec_;
0091 
0092         if (Nrec_ < theThresholds_->getNrecords()) {
0093           edm::LogInfo("MillePedeFileReader")
0094               << "Number of records used " << theThresholds_->getNrecords() << std::endl;
0095           updateDB_ = false;
0096         }
0097       }
0098 
0099       if (line.find(Binaries_string) != std::string::npos) {
0100         binariesAmount_ += 1;
0101       }
0102     }
0103   } else {
0104     edm::LogError("MillePedeFileReader") << "Could not read millepede log-file.";
0105 
0106     updateDB_ = false;
0107     Nrec_ = 0;
0108   }
0109 }
0110 
0111 void MillePedeFileReader ::readMillePedeResultFile() {
0112   // cutoffs by coordinate and by alignable
0113   std::map<std::string, std::array<float, 6> > cutoffs_;
0114   std::map<std::string, std::array<float, 6> > significances_;
0115   std::map<std::string, std::array<float, 6> > thresholds_;
0116   std::map<std::string, std::array<float, 6> > errors_;
0117   std::map<std::string, std::array<float, 6> > fractions_;
0118 
0119   std::map<std::string, std::array<int, 6> > countsAbove_;
0120   std::map<std::string, std::array<int, 6> > countsTotal_;
0121 
0122   AlignableObjectId alignableObjectId{AlignableObjectId::Geometry::General};
0123 
0124   std::vector<std::string> alignables_ = theThresholds_->getAlignableList();
0125   for (auto& ali : alignables_) {
0126     cutoffs_[ali] = theThresholds_->getCut(ali);
0127     significances_[ali] = theThresholds_->getSigCut(ali);
0128     thresholds_[ali] = theThresholds_->getMaxMoveCut(ali);
0129     errors_[ali] = theThresholds_->getMaxErrorCut(ali);
0130 
0131     if (theThresholds_->hasFloatMap(ali)) {
0132       fractions_[ali] = theThresholds_->getFractionCut(ali);
0133       countsAbove_[ali] = {{0, 0, 0, 0, 0, 0}};
0134       countsTotal_[ali] = {{0, 0, 0, 0, 0, 0}};
0135     }
0136   }
0137 
0138   updateDB_ = false;
0139   vetoUpdateDB_ = false;
0140   std::ifstream resFile;
0141   resFile.open((dirName_ + millePedeResFile_).c_str());
0142 
0143   if (resFile.is_open()) {
0144     edm::LogInfo("MillePedeFileReader") << "Reading millepede result-file";
0145 
0146     std::string line;
0147     getline(resFile, line);  // drop first line
0148 
0149     while (getline(resFile, line)) {
0150       std::istringstream iss(line);
0151 
0152       std::vector<std::string> tokens;
0153       std::string token;
0154       while (iss >> token) {
0155         tokens.push_back(token);
0156       }
0157 
0158       auto alignableLabel = std::stoul(tokens[0]);
0159       const auto alignable = pedeLabeler_->alignableFromLabel(alignableLabel);
0160       auto det = getHLS(alignable);
0161       int detIndex = static_cast<int>(det);
0162       auto alignableIndex = alignableLabel % 10 - 1;
0163       std::string detLabel = getStringFromHLS(det);
0164 
0165       countsTotal_[detLabel][alignableIndex]++;
0166 
0167       if (tokens.size() > 4 /*3*/) {
0168         const auto paramNum = pedeLabeler_->paramNumFromLabel(alignableLabel);
0169         align::StructureType type = alignable->alignableObjectId();
0170         align::ID id = alignable->id();
0171 
0172         double ObsMove = std::stof(tokens[3]) * multiplier_[alignableIndex];
0173         double ObsErr = std::stof(tokens[4]) * multiplier_[alignableIndex];
0174 
0175         auto coord = static_cast<AlignPCLThresholdsHG::coordType>(alignableIndex);
0176 
0177         if (det != PclHLS::NotInPCL) {
0178           if (type != align::TPBLadder && type != align::TPEPanel) {
0179             switch (coord) {
0180               case AlignPCLThresholdsHG::X:
0181                 Xobs_[detIndex] = ObsMove;
0182                 XobsErr_[detIndex] = ObsErr;
0183                 break;
0184               case AlignPCLThresholdsHG::Y:
0185                 Yobs_[detIndex] = ObsMove;
0186                 YobsErr_[detIndex] = ObsErr;
0187                 break;
0188               case AlignPCLThresholdsHG::Z:
0189                 Zobs_[detIndex] = ObsMove;
0190                 ZobsErr_[detIndex] = ObsErr;
0191                 break;
0192               case AlignPCLThresholdsHG::theta_X:
0193                 tXobs_[detIndex] = ObsMove;
0194                 tXobsErr_[detIndex] = ObsErr;
0195                 break;
0196               case AlignPCLThresholdsHG::theta_Y:
0197                 tYobs_[detIndex] = ObsMove;
0198                 tYobsErr_[detIndex] = ObsErr;
0199                 break;
0200               case AlignPCLThresholdsHG::theta_Z:
0201                 tZobs_[detIndex] = ObsMove;
0202                 tZobsErr_[detIndex] = ObsErr;
0203                 break;
0204               default:
0205                 edm::LogError("MillePedeFileReader") << "Currently not able to handle DOF " << coord << std::endl;
0206                 break;
0207             }
0208           } else {
0209             auto hgIndex = getIndexForHG(id, det);
0210             switch (coord) {
0211               case AlignPCLThresholdsHG::X:
0212                 Xobs_HG_[hgIndex - 1] = ObsMove;
0213                 XobsErr_HG_[hgIndex - 1] = ObsErr;
0214                 break;
0215               case AlignPCLThresholdsHG::Y:
0216                 Yobs_HG_[hgIndex - 1] = ObsMove;
0217                 YobsErr_HG_[hgIndex - 1] = ObsErr;
0218                 break;
0219               case AlignPCLThresholdsHG::Z:
0220                 Zobs_HG_[hgIndex - 1] = ObsMove;
0221                 ZobsErr_HG_[hgIndex - 1] = ObsErr;
0222                 break;
0223               case AlignPCLThresholdsHG::theta_X:
0224                 tXobs_HG_[hgIndex - 1] = ObsMove;
0225                 tXobsErr_HG_[hgIndex - 1] = ObsErr;
0226                 break;
0227               case AlignPCLThresholdsHG::theta_Y:
0228                 tYobs_HG_[hgIndex - 1] = ObsMove;
0229                 tYobsErr_HG_[hgIndex - 1] = ObsErr;
0230                 break;
0231               case AlignPCLThresholdsHG::theta_Z:
0232                 tZobs_HG_[hgIndex - 1] = ObsMove;
0233                 tZobsErr_HG_[hgIndex - 1] = ObsErr;
0234                 break;
0235               default:
0236                 edm::LogError("MillePedeFileReader") << "Currently not able to handle DOF " << coord << std::endl;
0237                 break;
0238             }
0239           }
0240 
0241         } else {
0242           edm::LogError("MillePedeFileReader")
0243               << "Currently not able to handle coordinate: " << coord << " (" << paramNum << ")  "
0244               << Form(" %s with ID %d (subdet %d)", alignableObjectId.idToString(type), id, DetId(id).subdetId())
0245               << std::endl;
0246           continue;
0247         }
0248 
0249         edm::LogVerbatim("MillePedeFileReader")
0250             << " alignableLabel: " << alignableLabel << " with alignableIndex " << alignableIndex << " detIndex "
0251             << detIndex << "\n"
0252             << " i.e. detLabel: " << detLabel << " (" << coord << ")\n"
0253             << " has movement: " << ObsMove << " +/- " << ObsErr << "\n"
0254             << " cutoff (cutoffs_[" << detLabel << "][" << coord << "]): " << cutoffs_[detLabel][alignableIndex] << "\n"
0255             << " significance (significances_[" << detLabel << "][" << coord
0256             << "]): " << significances_[detLabel][alignableIndex] << "\n"
0257             << " error thresolds (errors_[" << detLabel << "][" << coord << "]): " << errors_[detLabel][alignableIndex]
0258             << "\n"
0259             << " max movement (thresholds_[" << detLabel << "][" << coord
0260             << "]): " << thresholds_[detLabel][alignableIndex] << "\n"
0261             << " fraction (fractions_[" << detLabel << "][" << coord << "]): " << fractions_[detLabel][alignableIndex]
0262             << "\n"
0263             << "=============" << std::endl;
0264 
0265         if (std::abs(ObsMove) > thresholds_[detLabel][alignableIndex]) {
0266           if (!isHG_) {
0267             edm::LogWarning("MillePedeFileReader")
0268                 << "Aborting payload creation."
0269                 << " Exceeding maximum thresholds for movement: " << std::abs(ObsMove) << " for" << detLabel << "("
0270                 << coord << ")";
0271           }
0272           updateBits_.set(0);
0273           vetoUpdateDB_ = true;
0274           continue;
0275 
0276         } else if (std::abs(ObsMove) > cutoffs_[detLabel][alignableIndex]) {
0277           updateBits_.set(1);
0278 
0279           if (std::abs(ObsErr) > errors_[detLabel][alignableIndex]) {
0280             if (!isHG_) {
0281               edm::LogWarning("MillePedeFileReader") << "Aborting payload creation."
0282                                                      << " Exceeding maximum thresholds for error: " << std::abs(ObsErr)
0283                                                      << " for" << detLabel << "(" << coord << ")";
0284             }
0285             updateBits_.set(2);
0286             vetoUpdateDB_ = true;
0287             continue;
0288           } else {
0289             if (std::abs(ObsMove / ObsErr) < significances_[detLabel][alignableIndex]) {
0290               updateBits_.set(3);
0291               continue;
0292             }
0293           }
0294           updateDB_ = true;
0295           if (!isHG_) {
0296             edm::LogInfo("MillePedeFileReader")
0297                 << "This correction: " << ObsMove << "+/-" << ObsErr << " for " << detLabel << "(" << coord
0298                 << ") will trigger a new Tracker Alignment payload!";
0299           }
0300           countsAbove_[detLabel][alignableIndex]++;
0301         }
0302       }
0303     }
0304   } else {
0305     edm::LogError("MillePedeFileReader") << "Could not read millepede result-file.";
0306 
0307     updateDB_ = false;
0308     Nrec_ = 0;
0309   }
0310 
0311   if (isHG_) {          // check fractionCut
0312     updateDB_ = false;  // reset both booleans since only fractionCut is considered for HG
0313     vetoUpdateDB_ = false;
0314     std::stringstream ss;
0315     for (auto& ali : alignables_) {
0316       ss << ali << std::endl;
0317       for (long unsigned int i = 0; i < countsTotal_[ali].size(); i++) {
0318         if (countsTotal_[ali][i] != 0 && fractions_[ali][i] != -1) {
0319           float fraction_ = countsAbove_[ali][i] / (1.0 * countsTotal_[ali][i]);
0320           ss << static_cast<AlignPCLThresholdsHG::coordType>(i) << ":   Fraction = " << fraction_
0321              << "   Fraction Threshold = " << fractions_[ali][i];
0322           if (fraction_ >= fractions_[ali][i]) {
0323             updateDB_ = true;
0324             ss << "   above fraction threshold" << std::endl;
0325           } else
0326             ss << std::endl;
0327         } else
0328           ss << "No entries available or no fraction thresholds defined" << std::endl;
0329       }
0330       ss << "===================" << std::endl;
0331     }
0332     if (updateDB_) {
0333       ss << "Alignment will be updated" << std::endl;
0334     } else {
0335       ss << "Alignment will NOT be updated" << std::endl;
0336     }
0337     edm::LogWarning("MillePedeFileReader") << ss.str();
0338   }
0339 }
0340 
0341 MillePedeFileReader::PclHLS MillePedeFileReader ::getHLS(const Alignable* alignable) {
0342   if (!alignable)
0343     return PclHLS::NotInPCL;
0344 
0345   const auto& tns = pedeLabeler_->alignableTracker()->trackerNameSpace();
0346   const align::ID id = alignable->id();
0347 
0348   switch (alignable->alignableObjectId()) {
0349     case align::TPBHalfBarrel:
0350       switch (tns.tpb().halfBarrelNumber(id)) {
0351         case 1:
0352           return PclHLS::TPBHalfBarrelXminus;
0353         case 2:
0354           return PclHLS::TPBHalfBarrelXplus;
0355         default:
0356           throw cms::Exception("LogicError")
0357               << "@SUB=MillePedeFileReader::getHLS\n"
0358               << "Found a pixel half-barrel number that should not exist: " << tns.tpb().halfBarrelNumber(id);
0359       }
0360     case align::TPEHalfCylinder:
0361       switch (tns.tpe().endcapNumber(id)) {
0362         case 1:
0363           switch (tns.tpe().halfCylinderNumber(id)) {
0364             case 1:
0365               return PclHLS::TPEHalfCylinderXminusZminus;
0366             case 2:
0367               return PclHLS::TPEHalfCylinderXplusZminus;
0368             default:
0369               throw cms::Exception("LogicError")
0370                   << "@SUB=MillePedeFileReader::getHLS\n"
0371                   << "Found a pixel half-cylinder number that should not exist: " << tns.tpe().halfCylinderNumber(id);
0372           }
0373         case 2:
0374           switch (tns.tpe().halfCylinderNumber(id)) {
0375             case 1:
0376               return PclHLS::TPEHalfCylinderXminusZplus;
0377             case 2:
0378               return PclHLS::TPEHalfCylinderXplusZplus;
0379             default:
0380               throw cms::Exception("LogicError")
0381                   << "@SUB=MillePedeFileReader::getHLS\n"
0382                   << "Found a pixel half-cylinder number that should not exist: " << tns.tpe().halfCylinderNumber(id);
0383           }
0384         default:
0385           throw cms::Exception("LogicError")
0386               << "@SUB=MillePedeFileReader::getHLS\n"
0387               << "Found a pixel endcap number that should not exist: " << tns.tpe().endcapNumber(id);
0388       }
0389     case align::TPBLadder:
0390       switch (tns.tpb().layerNumber(id)) {
0391         case 1:
0392           return PclHLS::TPBLadderLayer1;
0393         case 2:
0394           return PclHLS::TPBLadderLayer2;
0395         case 3:
0396           return PclHLS::TPBLadderLayer3;
0397         case 4:
0398           return PclHLS::TPBLadderLayer4;
0399         default:
0400           throw cms::Exception("LogicError")
0401               << "@SUB=MillePedeFileReader::getHLS\n"
0402               << "Found a pixel layer number that should not exist: " << tns.tpb().layerNumber(id);
0403       }
0404     case align::TPEPanel:
0405       switch (static_cast<signed int>((tns.tpe().endcapNumber(id) == 1) ? -1 * tns.tpe().halfDiskNumber(id)
0406                                                                         : tns.tpe().halfDiskNumber(id))) {
0407         case -3:
0408           return PclHLS::TPEPanelDiskM3;
0409         case -2:
0410           return PclHLS::TPEPanelDiskM2;
0411         case -1:
0412           return PclHLS::TPEPanelDiskM1;
0413         case 3:
0414           return PclHLS::TPEPanelDisk3;
0415         case 2:
0416           return PclHLS::TPEPanelDisk2;
0417         case 1:
0418           return PclHLS::TPEPanelDisk1;
0419         default:
0420           throw cms::Exception("LogicError")
0421               << "@SUB=MillePedeFileReader::getHLS\n"
0422               << "Found a pixel disk number that should not exist: "
0423               << static_cast<signed int>((tns.tpe().endcapNumber(id) == 1) ? -1 * tns.tpe().halfDiskNumber(id)
0424                                                                            : tns.tpe().halfDiskNumber(id));
0425       }
0426     default:
0427       return PclHLS::NotInPCL;
0428   }
0429 }
0430 
0431 std::string MillePedeFileReader::getStringFromHLS(MillePedeFileReader::PclHLS HLS) {
0432   switch (HLS) {
0433     case PclHLS::TPBHalfBarrelXminus:
0434       return "TPBHalfBarrelXminus";
0435     case PclHLS::TPBHalfBarrelXplus:
0436       return "TPBHalfBarrelXplus";
0437     case PclHLS::TPEHalfCylinderXminusZminus:
0438       return "TPEHalfCylinderXminusZminus";
0439     case PclHLS::TPEHalfCylinderXplusZminus:
0440       return "TPEHalfCylinderXplusZminus";
0441     case PclHLS::TPEHalfCylinderXminusZplus:
0442       return "TPEHalfCylinderXminusZplus";
0443     case PclHLS::TPEHalfCylinderXplusZplus:
0444       return "TPEHalfCylinderXplusZplus";
0445     case PclHLS::TPBLadderLayer1:
0446       return "TPBLadderLayer1";
0447     case PclHLS::TPBLadderLayer2:
0448       return "TPBLadderLayer2";
0449     case PclHLS::TPBLadderLayer3:
0450       return "TPBLadderLayer3";
0451     case PclHLS::TPBLadderLayer4:
0452       return "TPBLadderLayer4";
0453     case PclHLS::TPEPanelDisk1:
0454       return "TPEPanelDisk1";
0455     case PclHLS::TPEPanelDisk2:
0456       return "TPEPanelDisk2";
0457     case PclHLS::TPEPanelDisk3:
0458       return "TPEPanelDisk3";
0459     case PclHLS::TPEPanelDiskM1:
0460       return "TPEPanelDiskM1";
0461     case PclHLS::TPEPanelDiskM2:
0462       return "TPEPanelDiskM2";
0463     case PclHLS::TPEPanelDiskM3:
0464       return "TPEPanelDiskM3";
0465     default:
0466       //return "NotInPCL";
0467       throw cms::Exception("LogicError")
0468           << "@SUB=MillePedeFileReader::getStringFromHLS\n"
0469           << "Found an alignable structure not possible to map in the default AlignPCLThresholdsHG partitions";
0470   }
0471 }
0472 
0473 void MillePedeFileReader::initializeIndexHelper() {
0474   int currentSum = 0;
0475 
0476   indexHelper[PclHLS::TPBLadderLayer1] =
0477       std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(1) / 2);
0478   currentSum += pixelTopologyMap_->getPXBLadders(1);
0479   indexHelper[PclHLS::TPBLadderLayer2] =
0480       std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(2) / 2);
0481   currentSum += pixelTopologyMap_->getPXBLadders(2);
0482   indexHelper[PclHLS::TPBLadderLayer3] =
0483       std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(3) / 2);
0484   currentSum += pixelTopologyMap_->getPXBLadders(3);
0485   indexHelper[PclHLS::TPBLadderLayer4] =
0486       std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXBLadders(4) / 2);
0487   currentSum += pixelTopologyMap_->getPXBLadders(4);
0488 
0489   indexHelper[PclHLS::TPEPanelDiskM3] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-3));
0490   currentSum += pixelTopologyMap_->getPXFBlades(-3) * 2;
0491   indexHelper[PclHLS::TPEPanelDiskM2] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-2));
0492   currentSum += pixelTopologyMap_->getPXFBlades(-2) * 2;
0493   indexHelper[PclHLS::TPEPanelDiskM1] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(-1));
0494   currentSum += pixelTopologyMap_->getPXFBlades(-1) * 2;
0495 
0496   indexHelper[PclHLS::TPEPanelDisk1] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(1));
0497   currentSum += pixelTopologyMap_->getPXFBlades(1) * 2;
0498   indexHelper[PclHLS::TPEPanelDisk2] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(2));
0499   currentSum += pixelTopologyMap_->getPXFBlades(2) * 2;
0500   indexHelper[PclHLS::TPEPanelDisk3] = std::make_pair(currentSum, currentSum + pixelTopologyMap_->getPXFBlades(3));
0501   currentSum += pixelTopologyMap_->getPXFBlades(3) * 2;
0502 }
0503 
0504 int MillePedeFileReader::getIndexForHG(align::ID id, PclHLS HLS) {
0505   const auto& tns = pedeLabeler_->alignableTracker()->trackerNameSpace();
0506 
0507   switch (HLS) {
0508     case PclHLS::TPBLadderLayer1:
0509       return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
0510                                                    : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
0511     case PclHLS::TPBLadderLayer2:
0512       return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
0513                                                    : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
0514     case PclHLS::TPBLadderLayer3:
0515       return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
0516                                                    : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
0517     case PclHLS::TPBLadderLayer4:
0518       return (tns.tpb().halfBarrelNumber(id) == 1) ? tns.tpb().ladderNumber(id) + indexHelper[HLS].first
0519                                                    : tns.tpb().ladderNumber(id) + indexHelper[HLS].second;
0520     case PclHLS::TPEPanelDisk1:
0521       return (tns.tpe().halfCylinderNumber(id) == 1)
0522                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0523                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0524     case PclHLS::TPEPanelDisk2:
0525       return (tns.tpe().halfCylinderNumber(id) == 1)
0526                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0527                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0528     case PclHLS::TPEPanelDisk3:
0529       return (tns.tpe().halfCylinderNumber(id) == 1)
0530                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0531                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0532     case PclHLS::TPEPanelDiskM1:
0533       return (tns.tpe().halfCylinderNumber(id) == 1)
0534                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0535                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0536     case PclHLS::TPEPanelDiskM2:
0537       return (tns.tpe().halfCylinderNumber(id) == 1)
0538                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0539                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0540     case PclHLS::TPEPanelDiskM3:
0541       return (tns.tpe().halfCylinderNumber(id) == 1)
0542                  ? (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].first
0543                  : (tns.tpe().bladeNumber(id) * 2 - (tns.tpe().panelNumber(id) % 2)) + indexHelper[HLS].second;
0544     default:
0545       return -200;
0546   }
0547 }
0548 
0549 //=============================================================================
0550 //===   STATIC CONST MEMBER DEFINITION                                      ===
0551 //=============================================================================
0552 constexpr std::array<double, 6> MillePedeFileReader::multiplier_;