30 std::vector<Alignable*> alis;
36 for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
58 if (!alignable)
return 0;
62 return position->second;
64 const DetId detId(alignable->
id());
67 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable "
68 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
69 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
80 if (!alignable)
return 0;
86 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
87 if (positionParam!=(*positionAli).second.end()) {
88 if (instance>=(*positionParam).second.size()) {
89 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabelFromParamAndRunRange"
90 <<
"RunRangeIdx out of bounds";
94 return position->second;
97 return position->second;
100 const DetId detId(alignable->
id());
103 <<
"@SUB=RunRangeDependentPedeLabeler::alignableLabel" <<
"Alignable "
104 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
105 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
115 return position->second;
118 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamLabel"
119 <<
"No label for beam Id " << lasBeamId;
128 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
129 <<
"Parameter number " << parNum
132 return aliLabel + parNum;
140 if (!alignable)
return 0;
143 throw cms::Exception(
"Alignment") <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel"
144 <<
"Parameter number " << parNum
154 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
155 if (positionParam!=(*positionAli).second.end()) {
159 for (RunRangeVector::const_iterator iRunRange = runRanges.begin();
160 iRunRange != runRanges.end();
162 if (eventInfo.
eventId_.
run() >= iRunRange->first &&
168 const DetId detId(alignable->
id());
170 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Instance for Alignable "
171 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
172 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId()
176 return position->second + parNum;
180 return position->second + parNum;
183 const DetId detId(alignable->
id());
186 <<
"@SUB=RunRangeDependentPedeLabeler::parameterLabel" <<
"Alignable "
187 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
188 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
207 size_t nRunRanges = 1;
209 for (RunRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
210 iParam != (*positionAli).second.end();
212 nRunRanges =
std::max(nRunRanges, iParam->second.size());
216 RunRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
217 if (iParam != (*positionAli).second.end()) {
218 return iParam->second.size();
232 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::paramNumFromLabel"
233 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
251 if (
theIdToAlignableMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
254 return position->second;
259 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::alignableFromLabel"
260 <<
"Alignable label " << aliLabel <<
" not in map.";
272 if (
theLabelToLasBeamMap.empty()) const_cast<RunRangeDependentPedeLabeler*>(
this)->buildReverseMap();
275 return position->second;
277 edm::LogError(
"LogicError") <<
"@SUB=RunRangeDependentPedeLabeler::lasBeamIdFromLabel"
278 <<
"Alignable label " << aliLabel <<
" not in map.";
303 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(paramNum);
304 if (positionParam==(*positionAli).second.end()) {
308 return positionParam->second[runRangeIndex];
315 std::vector<std::string>
result;
320 if (delimiterPos == std::string::npos) {
321 result.push_back(s.substr(previousPos));
324 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
325 previousPos = delimiterPos + 1;
334 std::vector<unsigned int>
result;
336 if (selString[
pos]==
'1') result.push_back(
pos);
346 static bool oldRunRangeSelectionWarning =
false;
352 std::vector<char> paramSelDummy(6,
'1');
354 const std::vector<edm::ParameterSet> RunRangeSelectionVPSet =
357 for (std::vector<edm::ParameterSet>::const_iterator iter = RunRangeSelectionVPSet.begin();
358 iter != RunRangeSelectionVPSet.end();
361 const std::vector<std::string> tempRunRanges = (*iter).getParameter<std::vector<std::string> >(
"RunRanges");
362 if (tempRunRanges.size()==0) {
363 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
364 <<
"RunRanges empty\n";
370 for (std::vector<std::string>::const_iterator iRunRange = tempRunRanges.begin();
371 iRunRange != tempRunRanges.end();
373 if ((*iRunRange).find(
':')==std::string::npos) {
376 temp = strtol((*iRunRange).c_str(), 0, 0);
377 if (temp!=-1) first =
temp;
381 if (!oldRunRangeSelectionWarning) {
382 edm::LogWarning(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap"
383 <<
"Config file contains old format for 'RunRangeSelection'. Only the start run\n"
384 <<
"number is used internally. The number of the last run is ignored and can be\n"
385 <<
"safely removed from the config file.\n";
386 oldRunRangeSelectionWarning =
true;
389 std::vector<std::string> tokens =
edm::tokenize(*iRunRange,
":");
391 temp = strtol(tokens[0].c_str(), 0, 0);
392 if (temp!=-1) first =
temp;
399 for (
unsigned int i = 0;
i<RunRanges.size()-1;++
i) {
400 RunRanges[
i].second = RunRanges[
i+1].first - 1;
401 if (RunRanges[
i].first > RunRanges[
i].
second) {
402 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
403 <<
"Inconsistency in 'RunRangeSelection' parameter set.";
407 const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >(
"selector");
408 for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
409 iSel != selStrings.end();
411 std::vector<std::string> decompSel(this->
decompose(*iSel,
','));
413 if (decompSel.size()!=2) {
414 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
415 << *iSel <<
" should have at least 2 ','-separated parts\n";
418 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
423 for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
426 for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
427 iParam != selParam.end();
433 if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->
size()) {
434 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
435 <<
"mismatch in number of parameters\n";
438 RunRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
439 if (positionParam!=(*positionAli).second.end()) {
440 throw cms::Exception(
"BadConfig") <<
"@SUB=RunRangeDependentPedeLabeler::buildRunRangeDependencyMap\n"
441 <<
"RunRange range for parameter specified twice\n";
459 std::vector<Alignable*> allComps;
461 for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
463 allComps.push_back(*iAli);
464 (*iAli)->recursiveComponents(allComps);
469 for (std::vector<Alignable*>::const_iterator iter = allComps.begin();
470 iter != allComps.end(); ++iter) {
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) {
505 const unsigned int key = (*it).second;
508 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
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const
returns the number of instances for a given parameter
static int position[TOTALCHAMBERS][3]
const RunRange theOpenRunRange
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
const T & max(const T &a, const T &b)
unsigned int alignableLabelFromParamAndInstance(Alignable *alignable, unsigned int param, unsigned int instance) const
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
~RunRangeDependentPedeLabeler()
const edm::EventID & eventId_
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 )
#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
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
define event information passed to algorithms