60 const DetId detId(alignable->
id());
62 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel"
63 <<
"Alignable " <<
typeid(*alignable).name()
64 <<
" not in map, det/subdet/alignableStructureType = " << detId.det() <<
"/"
82 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
83 if (positionParam != (*positionAli).second.end()) {
84 if (
instance >= (*positionParam).second.size()) {
85 throw cms::Exception(
"Alignment") <<
"RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange: "
86 <<
"RunRangeIdx out of bounds.\n";
96 const DetId detId(alignable->
id());
98 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel"
99 <<
"Alignable " <<
typeid(*alignable).name()
100 <<
" not in map, det/subdet/alignableStructureType = " << detId.det() <<
"/"
113 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
114 <<
"No label for beam Id " << lasBeamId;
122 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
123 <<
"Parameter number " << parNum <<
" out of range 0 <= num < " <<
theMaxNumParam;
125 return aliLabel + parNum;
137 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
138 <<
"Parameter number " << parNum <<
" out of range 0 <= num < " <<
theMaxNumParam;
145 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
146 if (positionParam != (*positionAli).second.end()) {
149 for (
const auto& iRunRange : runRanges) {
150 if (
eventInfo.eventId().run() >= iRunRange.first &&
eventInfo.eventId().run() <= iRunRange.second) {
155 const DetId detId(alignable->
id());
156 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
157 <<
"Instance for Alignable " <<
typeid(*alignable).name()
158 <<
" not in map, det/subdet/alignableStructureType = " << detId.det() <<
"/"
170 const DetId detId(alignable->
id());
172 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
173 <<
"Alignable " <<
typeid(*alignable).name()
174 <<
" not in map, det/subdet/alignableStructureType = " << detId.det() <<
"/"
192 size_t nRunRanges = 1;
194 for (
const auto& iParam : (*positionAli).second) {
195 nRunRanges =
std::max(nRunRanges, iParam.second.size());
199 RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
200 if (iParam != (*positionAli).second.end()) {
201 return iParam->second.size();
214 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
239 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
240 <<
"Alignable label " << aliLabel <<
" not in map.";
256 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
257 <<
"Alignable label " << aliLabel <<
" not in map.";
279 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
280 if (positionParam == (*positionAli).second.end()) {
284 return positionParam->second[runRangeIndex];
290 std::vector<std::string>
result;
295 if (delimiterPos == std::string::npos) {
296 result.push_back(
s.substr(previousPos));
299 result.push_back(
s.substr(previousPos, delimiterPos - previousPos));
300 previousPos = delimiterPos + 1;
308 std::vector<unsigned int>
result;
310 if (selString[
pos] ==
'1')
320 static std::atomic<bool> oldRunRangeSelectionWarning{
false};
326 std::vector<char> paramSelDummy(6,
'1');
328 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
329 config.getUntrackedParameter<std::vector<edm::ParameterSet> >(
"RunRangeSelection");
331 for (
const auto& runRangeSel : RunRangeSelectionVPSet) {
332 const auto tempRunRanges = runRangeSel.getParameter<std::vector<std::string> >(
"RunRanges");
333 if (tempRunRanges.empty()) {
334 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
335 <<
"RunRanges empty\n";
341 for (
const auto& iRunRange : tempRunRanges) {
342 if (iRunRange.find(
':') == std::string::npos) {
344 temp = strtol(iRunRange.c_str(),
nullptr, 0);
349 bool expected =
false;
350 if (oldRunRangeSelectionWarning.compare_exchange_strong(expected,
true)) {
352 <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
353 <<
"Config file contains old format for 'RunRangeSelection'. Only the start run\n"
354 <<
"number is used internally. The number of the last run is ignored and can be\n"
355 <<
"safely removed from the config file.\n";
358 std::vector<std::string> tokens =
edm::tokenize(iRunRange,
":");
360 temp = strtol(tokens[0].c_str(),
nullptr, 0);
368 for (
unsigned int i = 0;
i <
RunRanges.size() - 1; ++
i) {
371 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
372 <<
"Inconsistency in 'RunRangeSelection' parameter set.";
376 const auto selStrings = runRangeSel.getParameter<std::vector<std::string> >(
"selector");
377 for (
const auto& iSel : selStrings) {
378 std::vector<std::string> decompSel(this->
decompose(iSel,
','));
380 if (decompSel.size() != 2) {
381 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
382 << iSel <<
" should have at least 2 ','-separated parts\n";
385 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
391 for (
const auto& iAli : alis) {
392 if (iAli->alignmentParameters() ==
nullptr) {
394 <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
395 <<
"Run dependence configured for alignable of type "
397 <<
"," << iAli->globalPosition().y() <<
"," << iAli->globalPosition().z() <<
"), "
398 <<
"but that has no parameters. Please check that all run "
399 <<
"dependent parameters are also selected for alignment.\n";
402 for (
const auto& iParam : selParam) {
406 if (static_cast<int>(selParam[selParam.size() - 1]) >= AliParams->
size()) {
407 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
408 <<
"mismatch in number of parameters\n";
411 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
412 if (positionParam != (*positionAli).second.end()) {
413 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
414 <<
"RunRange range for parameter specified twice\n";
433 for (
const auto& iAli : alis) {
435 allComps.push_back(iAli);
436 iAli->recursiveComponents(allComps);
441 for (
const auto& iter : allComps) {
450 unsigned int beamIds[] = {0, 10, 20, 30, 40, 50, 60, 70,
451 1, 11, 21, 31, 41, 51, 61, 71,
452 100, 110, 120, 130, 140, 150, 160, 170,
453 101, 111, 121, 131, 141, 151, 161, 171,
454 200, 210, 220, 230, 240, 250, 260, 270};
456 const size_t nBeams =
sizeof(beamIds) /
sizeof(beamIds[0]);
457 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
464 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::buildMap: "
465 <<
"Too many labels per instance (" <<
id - 1 <<
") leading to double use, "
466 <<
"increase PedeLabelerBase::theParamInstanceOffset!\n";
478 const unsigned int key = it.second;
482 for (
unsigned int iInstance = 0; iInstance < nInstances; ++iInstance) {