30 theMaxNumberOfParameterInstances(0)
32 std::vector<Alignable*> alis;
38 for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
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 (RunRangeVector::const_iterator iRunRange = runRanges.begin();
163 iRunRange != runRanges.end();
165 if (eventInfo.
eventId().
run() >= iRunRange->first &&
166 eventInfo.
eventId().
run() <= iRunRange->second) {
171 const DetId detId(alignable->
id());
173 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Instance for Alignable "
174 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
175 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId()
179 return position->second + parNum;
183 return position->second + parNum;
186 const DetId detId(alignable->
id());
189 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Alignable "
190 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
191 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
210 size_t nRunRanges = 1;
212 for (RunRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
213 iParam != (*positionAli).second.end();
215 nRunRanges =
std::max(nRunRanges, iParam->second.size());
219 RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
220 if (iParam != (*positionAli).second.end()) {
221 return iParam->second.size();
235 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
236 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
254 if (
theIdToAlignableMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
257 return position->second;
262 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
263 <<
"Alignable label " << aliLabel <<
" not in map.";
275 if (
theLabelToLasBeamMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
278 return position->second;
280 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
281 <<
"Alignable label " << aliLabel <<
" not in map.";
306 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
307 if (positionParam==(*positionAli).second.end()) {
311 return positionParam->second[runRangeIndex];
318 std::vector<std::string>
result;
323 if (delimiterPos == std::string::npos) {
324 result.push_back(s.substr(previousPos));
327 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
328 previousPos = delimiterPos + 1;
337 std::vector<unsigned int>
result;
339 if (selString[pos]==
'1') result.push_back(pos);
349 static bool oldRunRangeSelectionWarning =
false;
355 std::vector<char> paramSelDummy(6,
'1');
357 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
360 for (std::vector<edm::ParameterSet>::const_iterator
iter = RunRangeSelectionVPSet.begin();
361 iter != RunRangeSelectionVPSet.end();
364 const std::vector<std::string> tempRunRanges = (*iter).getParameter<std::vector<std::string> >(
"RunRanges");
365 if (tempRunRanges.size()==0) {
366 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
367 <<
"RunRanges empty\n";
373 for (std::vector<std::string>::const_iterator iRunRange = tempRunRanges.begin();
374 iRunRange != tempRunRanges.end();
376 if ((*iRunRange).find(
':')==std::string::npos) {
379 temp = strtol((*iRunRange).c_str(), 0, 0);
380 if (temp!=-1) first =
temp;
384 if (!oldRunRangeSelectionWarning) {
385 edm::LogWarning(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
386 <<
"Config file contains old format for 'RunRangeSelection'. Only the start run\n"
387 <<
"number is used internally. The number of the last run is ignored and can be\n"
388 <<
"safely removed from the config file.\n";
389 oldRunRangeSelectionWarning =
true;
392 std::vector<std::string> tokens =
edm::tokenize(*iRunRange,
":");
394 temp = strtol(tokens[0].c_str(), 0, 0);
395 if (temp!=-1) first =
temp;
402 for (
unsigned int i = 0;
i<RunRanges.size()-1;++
i) {
403 RunRanges[
i].second = RunRanges[
i+1].first - 1;
404 if (RunRanges[
i].first > RunRanges[
i].
second) {
405 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
406 <<
"Inconsistency in 'RunRangeSelection' parameter set.";
410 const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >(
"selector");
411 for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
412 iSel != selStrings.end();
414 std::vector<std::string> decompSel(this->
decompose(*iSel,
','));
416 if (decompSel.size()!=2) {
417 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
418 << *iSel <<
" should have at least 2 ','-separated parts\n";
421 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
427 for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
431 if((*iAli)->alignmentParameters() ==
NULL) {
433 <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
434 <<
"Run dependence configured for alignable of type "
436 <<
" at (" << (*iAli)->globalPosition().x() <<
","<< (*iAli)->globalPosition().y() <<
"," << (*iAli)->globalPosition().z()<<
"), "
437 <<
"but that has no parameters. Please check that all run "
438 <<
"dependent parameters are also selected for alignment.\n";
441 for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
442 iParam != selParam.end();
448 if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->
size()) {
449 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
450 <<
"mismatch in number of parameters\n";
453 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
454 if (positionParam!=(*positionAli).second.end()) {
455 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
456 <<
"RunRange range for parameter specified twice\n";
474 std::vector<Alignable*> allComps;
476 for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
478 allComps.push_back(*iAli);
479 (*iAli)->recursiveComponents(allComps);
484 for (std::vector<Alignable*>::const_iterator
iter = allComps.begin();
494 unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70,
495 1, 11, 21, 31, 41, 51, 61, 71,
496 100, 110, 120, 130, 140, 150, 160, 170,
497 101, 111, 121, 131, 141, 151, 161, 171,
498 200, 210, 220, 230, 240, 250, 260, 270};
500 const size_t nBeams =
sizeof(beamIds)/
sizeof(beamIds[0]);
501 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
508 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::buildMap: "
509 <<
"Too many labels per instance (" <<
id-1 <<
") leading to double use, "
510 <<
"increase PedeLabelerBase::theParamInstanceOffset!\n";
525 const unsigned int key = (*it).second;
529 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
AlignmentAlgorithmBase::RunRange RunRange
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
unsigned long long Time_t
unsigned int buildReverseMap()
returns size of map
unsigned int alignableLabelFromParamAndInstance(Alignable *alignable, unsigned int param, unsigned int instance) const
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
~RunRangeDependentPedeLabeler()
AlignableToRunRangeRangeMap theAlignableToRunRangeRangeMap
providing unique ID for alignable, space for param IDs
unsigned int offset(bool)
Container::value_type value_type
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.
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
UintUintMap theLasBeamToLabelMap
reverse map
static const unsigned int theParamInstanceOffset
std::vector< RunRange > RunRanges
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
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
static const char * idToString(align::StructureType type)
Constructor of the full muon geometry.
bool hasSplitParameters(Alignable *alignable) const
returns true if the alignable has parameters that are split into various bins
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