30 :
PedeLabelerBase(alignables, config), theMaxNumberOfParameterInstances(0) {
58 return position->second;
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";
90 return position->second;
93 return position->second;
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() <<
"/" 110 return position->second;
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() <<
"/" 163 return position->second + parNum;
167 return position->second + parNum;
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" 215 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
234 return position->second;
239 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel" 240 <<
"Alignable label " << aliLabel <<
" not in map.";
254 return position->second;
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')
311 result.push_back(
pos);
320 static std::atomic<bool> oldRunRangeSelectionWarning{
false};
326 std::vector<char> paramSelDummy(6,
'1');
328 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
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) {
369 RunRanges[
i].second = RunRanges[
i + 1].first - 1;
370 if (RunRanges[
i].first > RunRanges[
i].
second) {
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) {
const TimeTypeSpecs timeTypeSpecs[]
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
T getUntrackedParameter(std::string const &, T const &) const
AlignableToIdMap::value_type AlignableToIdPair
~RunRangeDependentPedeLabeler() override
UintUintMap theLabelToLasBeamMap
labels for las beams
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
static PFTauRenderPlugin instance
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
unsigned int alignableLabel(Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
static const unsigned int theMinLabel
unsigned int alignableLabelFromParamAndInstance(Alignable *alignable, unsigned int param, unsigned int instance) const override
const edm::EventID eventId() const
const RunRange theOpenRunRange
unsigned int theMaxNumberOfParameterInstances
reverse of the above
define event information passed to algorithms
static const unsigned int theMaxNumParam
const RunRange & runRangeFromLabel(unsigned int label) const override
U second(std::pair< T, U > const &p)
AlignableTracker * aliTracker_
void clear()
remove all selected Alignables and geometrical restrictions
Container::value_type value_type
unsigned long long Time_t
unsigned int buildReverseMap()
returns size of map
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
AlignableToIdMap theAlignableToIdMap
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs
AlignableExtras * aliExtras_
unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const override
returns the label for a given alignable parameter number combination
const align::Alignables & selectedAlignables() const
vector of alignables selected so far
unsigned int runRangeIndexFromLabel(unsigned int label) const
bool hasSplitParameters(Alignable *alignable) const override
returns true if the alignable has parameters that are split into various bins
int size(void) const
Get number of parameters.
const char * idToString(align::StructureType type) const
UintUintMap theLasBeamToLabelMap
reverse map
unsigned int lasBeamLabel(unsigned int lasBeamId) const override
static const unsigned int theParamInstanceOffset
std::vector< RunRange > RunRangeVector
std::vector< Alignable * > Alignables
unsigned int addSelection(const std::string &name, const std::vector< char > ¶mSel)
unsigned int buildRunRangeDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
RunRangeDependentPedeLabeler(const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
static int position[264][3]
unsigned int lasBeamIdFromLabel(unsigned int label) const override
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< unsigned int > convertParamSel(const std::string &selString) const
align::RunRanges RunRanges
Constructor of the full muon geometry.
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const override
returns the number of instances for a given parameter
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
unsigned int buildMap(const align::Alignables &)
returns size of map
Alignable * alignableFromLabel(unsigned int label) const override
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator