31 theMaxNumberOfParameterInstances(0)
33 std::vector<Alignable*> alis;
39 for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
62 if (!alignable)
return 0;
66 return position->second;
68 const DetId detId(alignable->
id());
71 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable " 72 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 73 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
84 if (!alignable)
return 0;
90 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
91 if (positionParam!=(*positionAli).second.end()) {
92 if (instance>=(*positionParam).second.size()) {
93 throw cms::Exception(
"Alignment") <<
"RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange: " 94 <<
"RunRangeIdx out of bounds.\n";
98 return position->second;
101 return position->second;
104 const DetId detId(alignable->
id());
107 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable " 108 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 109 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
119 return position->second;
122 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamLabel" 123 <<
"No label for beam Id " << lasBeamId;
132 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" 133 <<
"Parameter number " << parNum
136 return aliLabel + parNum;
144 if (!alignable)
return 0;
147 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" 148 <<
"Parameter number " << parNum
158 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
159 if (positionParam!=(*positionAli).second.end()) {
163 for (RunRangeVector::const_iterator iRunRange = runRanges.begin();
164 iRunRange != runRanges.end();
166 if (eventInfo.
eventId().
run() >= iRunRange->first &&
167 eventInfo.
eventId().
run() <= iRunRange->second) {
172 const DetId detId(alignable->
id());
174 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Instance for Alignable " 175 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 176 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId()
180 return position->second + parNum;
184 return position->second + parNum;
187 const DetId detId(alignable->
id());
190 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Alignable " 191 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = " 192 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
211 size_t nRunRanges = 1;
213 for (RunRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
214 iParam != (*positionAli).second.end();
216 nRunRanges =
std::max(nRunRanges, iParam->second.size());
220 RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
221 if (iParam != (*positionAli).second.end()) {
222 return iParam->second.size();
236 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel" 237 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
255 if (
theIdToAlignableMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
258 return position->second;
263 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel" 264 <<
"Alignable label " << aliLabel <<
" not in map.";
276 if (
theLabelToLasBeamMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
279 return position->second;
281 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel" 282 <<
"Alignable label " << aliLabel <<
" not in map.";
307 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
308 if (positionParam==(*positionAli).second.end()) {
312 return positionParam->second[runRangeIndex];
319 std::vector<std::string>
result;
324 if (delimiterPos == std::string::npos) {
325 result.push_back(s.substr(previousPos));
328 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
329 previousPos = delimiterPos + 1;
338 std::vector<unsigned int>
result;
340 if (selString[
pos]==
'1') result.push_back(
pos);
350 static std::atomic<bool> oldRunRangeSelectionWarning{
false };
356 std::vector<char> paramSelDummy(6,
'1');
358 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
361 for (std::vector<edm::ParameterSet>::const_iterator iter = RunRangeSelectionVPSet.begin();
362 iter != RunRangeSelectionVPSet.end();
365 const std::vector<std::string> tempRunRanges = (*iter).getParameter<std::vector<std::string> >(
"RunRanges");
366 if (tempRunRanges.size()==0) {
367 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 368 <<
"RunRanges empty\n";
374 for (std::vector<std::string>::const_iterator iRunRange = tempRunRanges.begin();
375 iRunRange != tempRunRanges.end();
377 if ((*iRunRange).find(
':')==std::string::npos) {
380 temp = strtol((*iRunRange).c_str(), 0, 0);
381 if (temp!=-1) first =
temp;
385 bool expected =
false;
386 if (oldRunRangeSelectionWarning.compare_exchange_strong(expected,
true)) {
387 edm::LogWarning(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap" 388 <<
"Config file contains old format for 'RunRangeSelection'. Only the start run\n" 389 <<
"number is used internally. The number of the last run is ignored and can be\n" 390 <<
"safely removed from the config file.\n";
393 std::vector<std::string> tokens =
edm::tokenize(*iRunRange,
":");
395 temp = strtol(tokens[0].c_str(), 0, 0);
396 if (temp!=-1) first =
temp;
403 for (
unsigned int i = 0;
i<RunRanges.size()-1;++
i) {
404 RunRanges[
i].second = RunRanges[
i+1].first - 1;
405 if (RunRanges[
i].first > RunRanges[
i].
second) {
406 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 407 <<
"Inconsistency in 'RunRangeSelection' parameter set.";
411 const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >(
"selector");
412 for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
413 iSel != selStrings.end();
415 std::vector<std::string> decompSel(this->
decompose(*iSel,
','));
417 if (decompSel.size()!=2) {
418 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 419 << *iSel <<
" should have at least 2 ','-separated parts\n";
422 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
428 for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
432 if((*iAli)->alignmentParameters() ==
NULL) {
434 <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 435 <<
"Run dependence configured for alignable of type " 437 <<
" at (" << (*iAli)->globalPosition().x() <<
","<< (*iAli)->globalPosition().y() <<
"," << (*iAli)->globalPosition().z()<<
"), " 438 <<
"but that has no parameters. Please check that all run " 439 <<
"dependent parameters are also selected for alignment.\n";
442 for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
443 iParam != selParam.end();
449 if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->
size()) {
450 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 451 <<
"mismatch in number of parameters\n";
454 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
455 if (positionParam!=(*positionAli).second.end()) {
456 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n" 457 <<
"RunRange range for parameter specified twice\n";
475 std::vector<Alignable*> allComps;
477 for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
479 allComps.push_back(*iAli);
480 (*iAli)->recursiveComponents(allComps);
485 for (std::vector<Alignable*>::const_iterator iter = allComps.begin();
486 iter != allComps.end(); ++iter) {
495 unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70,
496 1, 11, 21, 31, 41, 51, 61, 71,
497 100, 110, 120, 130, 140, 150, 160, 170,
498 101, 111, 121, 131, 141, 151, 161, 171,
499 200, 210, 220, 230, 240, 250, 260, 270};
501 const size_t nBeams =
sizeof(beamIds)/
sizeof(beamIds[0]);
502 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
509 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::buildMap: " 510 <<
"Too many labels per instance (" <<
id-1 <<
") leading to double use, " 511 <<
"increase PedeLabelerBase::theParamInstanceOffset!\n";
526 const unsigned int key = (*it).second;
530 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
unsigned int lasBeamLabel(unsigned int lasBeamId) const
AlignableToIdMap::value_type AlignableToIdPair
UintUintMap theLabelToLasBeamMap
labels for las beams
unsigned int lasBeamIdFromLabel(unsigned int label) const
unsigned int alignableLabel(Alignable *alignable) const
Return 32-bit unique label for alignable, 0 indicates failure.
static PFTauRenderPlugin instance
Alignable * alignableFromLabel(unsigned int label) const
static const unsigned int theMinLabel
const edm::EventID eventId() const
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const
returns the number of instances for a given parameter
const RunRange theOpenRunRange
unsigned int theMaxNumberOfParameterInstances
reverse of the above
define event information passed to algorithms
static const unsigned int theMaxNumParam
U second(std::pair< T, U > const &p)
AlignableTracker * aliTracker_
unsigned int alignableLabelFromLabel(unsigned int label) const
alignable label from parameter label (works also for alignable label...)
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.
unsigned int alignableLabelFromParamAndInstance(Alignable *alignable, unsigned int param, unsigned int instance) const
~RunRangeDependentPedeLabeler()
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_
const align::Alignables & selectedAlignables() const
vector of alignables selected so far
unsigned int runRangeIndexFromLabel(unsigned int label) const
const RunRange & runRangeFromLabel(unsigned int label) const
int size(void) const
Get number of parameters.
const char * idToString(align::StructureType type) const
UintUintMap theLasBeamToLabelMap
reverse map
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]
#define DEFINE_EDM_PLUGIN(factory, type, name)
unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const
returns the label for a given alignable parameter number combination
eventInfo
add run, event number and lumi section
unsigned int paramNumFromLabel(unsigned int paramLabel) const
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
std::vector< unsigned int > convertParamSel(const std::string &selString) const
align::RunRanges RunRanges
Constructor of the full muon geometry.
bool hasSplitParameters(Alignable *alignable) const
returns true if the alignable has parameters that are split into various bins
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
unsigned int buildMap(const std::vector< Alignable * > &alis)
returns size of map
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator