31 theMaxNumberOfParameterInstances(0)
61 if (!alignable)
return 0;
65 return position->second;
67 const DetId detId(alignable->
id());
70 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable " 71 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 72 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
83 if (!alignable)
return 0;
89 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
90 if (positionParam!=(*positionAli).second.end()) {
91 if (instance>=(*positionParam).second.size()) {
92 throw cms::Exception(
"Alignment") <<
"RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange: " 93 <<
"RunRangeIdx out of bounds.\n";
97 return position->second;
100 return position->second;
103 const DetId detId(alignable->
id());
106 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable " 107 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 108 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
118 return position->second;
121 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamLabel" 122 <<
"No label for beam Id " << lasBeamId;
131 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" 132 <<
"Parameter number " << parNum
135 return aliLabel + parNum;
143 if (!alignable)
return 0;
146 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" 147 <<
"Parameter number " << parNum
157 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
158 if (positionParam!=(*positionAli).second.end()) {
162 for (
const auto& iRunRange: runRanges) {
163 if (eventInfo.
eventId().
run() >= iRunRange.first &&
164 eventInfo.
eventId().
run() <= iRunRange.second) {
169 const DetId detId(alignable->
id());
171 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Instance for Alignable " 172 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 173 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId()
177 return position->second + parNum;
181 return position->second + parNum;
184 const DetId detId(alignable->
id());
187 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Alignable " 188 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 189 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
208 size_t nRunRanges = 1;
210 for (
const auto iParam: (*positionAli).second) {
211 nRunRanges =
std::max(nRunRanges, iParam.second.size());
215 RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
216 if (iParam != (*positionAli).second.end()) {
217 return iParam->second.size();
231 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel" 232 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
252 return position->second;
257 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel" 258 <<
"Alignable label " << aliLabel <<
" not in map.";
272 return position->second;
274 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel" 275 <<
"Alignable label " << aliLabel <<
" not in map.";
300 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
301 if (positionParam==(*positionAli).second.end()) {
305 return positionParam->second[runRangeIndex];
312 std::vector<std::string>
result;
317 if (delimiterPos == std::string::npos) {
318 result.push_back(s.substr(previousPos));
321 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
322 previousPos = delimiterPos + 1;
331 std::vector<unsigned int>
result;
333 if (selString[
pos]==
'1') result.push_back(
pos);
343 static std::atomic<bool> oldRunRangeSelectionWarning{
false };
349 std::vector<char> paramSelDummy(6,
'1');
351 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
354 for (
const auto& runRangeSel: RunRangeSelectionVPSet) {
356 const auto tempRunRanges = runRangeSel.getParameter<std::vector<std::string> >(
"RunRanges");
357 if (tempRunRanges.empty()) {
358 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 359 <<
"RunRanges empty\n";
365 for (
const auto& iRunRange: tempRunRanges) {
366 if (iRunRange.find(
':') == std::string::npos) {
369 temp = strtol(iRunRange.c_str(),
nullptr, 0);
370 if (temp!=-1) first =
temp;
374 bool expected =
false;
375 if (oldRunRangeSelectionWarning.compare_exchange_strong(expected,
true)) {
376 edm::LogWarning(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap" 377 <<
"Config file contains old format for 'RunRangeSelection'. Only the start run\n" 378 <<
"number is used internally. The number of the last run is ignored and can be\n" 379 <<
"safely removed from the config file.\n";
382 std::vector<std::string> tokens =
edm::tokenize(iRunRange,
":");
384 temp = strtol(tokens[0].c_str(),
nullptr, 0);
385 if (temp!=-1) first =
temp;
392 for (
unsigned int i = 0;
i<RunRanges.size()-1;++
i) {
393 RunRanges[
i].second = RunRanges[
i+1].first - 1;
394 if (RunRanges[
i].first > RunRanges[
i].
second) {
395 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 396 <<
"Inconsistency in 'RunRangeSelection' parameter set.";
400 const auto selStrings = runRangeSel.getParameter<std::vector<std::string> >(
"selector");
401 for (
const auto& iSel: selStrings) {
402 std::vector<std::string> decompSel(this->
decompose(iSel,
','));
404 if (decompSel.size()!=2) {
405 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 406 << iSel <<
" should have at least 2 ','-separated parts\n";
409 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
415 for (
const auto& iAli: alis) {
417 if(iAli->alignmentParameters() ==
nullptr) {
419 <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 420 <<
"Run dependence configured for alignable of type " 422 <<
" at (" << iAli->globalPosition().x() <<
"," 423 << iAli->globalPosition().y() <<
"," 424 << iAli->globalPosition().z()<<
"), " 425 <<
"but that has no parameters. Please check that all run " 426 <<
"dependent parameters are also selected for alignment.\n";
429 for (
const auto& iParam: selParam) {
434 if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->
size()) {
435 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 436 <<
"mismatch in number of parameters\n";
439 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
440 if (positionParam!=(*positionAli).second.end()) {
441 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 442 <<
"RunRange range for parameter specified twice\n";
462 for (
const auto& iAli: alis) {
464 allComps.push_back(iAli);
465 iAli->recursiveComponents(allComps);
470 for (
const auto& iter: allComps) {
479 unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70,
480 1, 11, 21, 31, 41, 51, 61, 71,
481 100, 110, 120, 130, 140, 150, 160, 170,
482 101, 111, 121, 131, 141, 151, 161, 171,
483 200, 210, 220, 230, 240, 250, 260, 270};
485 const size_t nBeams =
sizeof(beamIds)/
sizeof(beamIds[0]);
486 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
493 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::buildMap: " 494 <<
"Too many labels per instance (" <<
id-1 <<
") leading to double use, " 495 <<
"increase PedeLabelerBase::theParamInstanceOffset!\n";
509 const unsigned int key = it.second;
513 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)
eventInfo
add run, event number and lumi section
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