29 theOpenMomentumRange(std::pair<float,float>(0.0, 10000.0))
31 std::vector<Alignable*> alis;
37 for ( std::vector<Alignable*>::iterator it = allExtras.begin(); it != allExtras.end(); ++it ) {
59 if (!alignable)
return 0;
63 return position->second;
65 const DetId detId(alignable->
id());
68 <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" <<
"Alignable "
69 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
70 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
81 if (!alignable)
return 0;
87 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
88 if (positionParam!=(*positionAli).second.end()) {
89 if (instance>=(*positionParam).second.size()) {
90 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabelFromParamAndMomentum"
91 <<
"iovIdx out of bounds";
95 return position->second;
98 return position->second;
101 const DetId detId(alignable->
id());
104 <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" <<
"Alignable "
105 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
106 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
116 return position->second;
119 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::lasBeamLabel"
120 <<
"No label for beam Id " << lasBeamId;
129 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::parameterLabel"
130 <<
"Parameter number " << parNum
133 return aliLabel + parNum;
141 if (!alignable)
return 0;
144 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::parameterLabel"
145 <<
"Parameter number " << parNum
155 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
156 if (positionParam!=(*positionAli).second.end()) {
161 for (MomentumRangeVector::const_iterator iMomentum = momentumRanges.begin();
162 iMomentum != momentumRanges.end();
165 if (iMomentum->first<=mom && mom<iMomentum->
second) {
170 const DetId detId(alignable->
id());
172 <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" <<
"Alignable "
173 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
174 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
177 return position->second + parNum;
181 return position->second + parNum;
184 const DetId detId(alignable->
id());
187 <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" <<
"Alignable "
188 <<
typeid(*alignable).name() <<
" not in map, det/subdet/alignableStructureType = "
189 << detId.det() <<
"/" << detId.subdetId() <<
"/" << alignable->
alignableObjectId();
208 size_t nMomentums = 1;
210 for (MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.begin();
211 iParam != (*positionAli).second.end();
213 nMomentums =
std::max(nMomentums, iParam->second.size());
217 MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
218 if (iParam != (*positionAli).second.end()) {
219 return iParam->second.size();
233 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::paramNumFromLabel"
234 <<
"Label " << paramLabel <<
" should be >= " <<
theMinLabel;
252 if (
theIdToAlignableMap.empty()) const_cast<MomentumDependentPedeLabeler*>(
this)->buildReverseMap();
255 return position->second;
260 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableFromLabel"
261 <<
"Alignable label " << aliLabel <<
" not in map.";
273 if (
theLabelToLasBeamMap.empty()) const_cast<MomentumDependentPedeLabeler*>(
this)->buildReverseMap();
276 return position->second;
278 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::lasBeamIdFromLabel"
279 <<
"Alignable label " << aliLabel <<
" not in map.";
288 std::vector<std::string>
result;
293 if (delimiterPos == std::string::npos) {
294 result.push_back(s.substr(previousPos));
297 result.push_back(s.substr(previousPos, delimiterPos - previousPos));
298 previousPos = delimiterPos + 1;
307 std::vector<unsigned int>
result;
309 if (selString[
pos]==
'1') result.push_back(
pos);
323 std::vector<char> paramSelDumthe(6,
'1');
325 const std::vector<edm::ParameterSet> parameterInstancesVPSet =
326 config.
getParameter<std::vector<edm::ParameterSet> >(
"parameterInstances");
328 for (std::vector<edm::ParameterSet>::const_iterator iter = parameterInstancesVPSet.begin();
329 iter != parameterInstancesVPSet.end();
332 const std::vector<std::string> tempMomentumRanges = (*iter).getParameter<std::vector<std::string> >(
"momentumRanges");
333 if (tempMomentumRanges.size()==0) {
334 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
335 <<
"MomentumRanges empty\n";
341 for (
unsigned int iMomentum=0;iMomentum<tempMomentumRanges.size();++iMomentum) {
342 std::vector<std::string> tokens =
edm::tokenize(tempMomentumRanges[iMomentum],
":");
344 lower = strtod(tokens[0].c_str(), 0);
345 upper = strtod(tokens[1].c_str(), 0);
347 MomentumRanges.push_back(std::pair<float,float>(lower, upper));
350 const std::vector<std::string> selStrings = (*iter).getParameter<std::vector<std::string> >(
"selector");
351 for (std::vector<std::string>::const_iterator iSel = selStrings.begin();
352 iSel != selStrings.end();
354 std::vector<std::string> decompSel(this->
decompose(*iSel,
','));
356 if (decompSel.size()!=2) {
357 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
358 << *iSel <<
" should have at least 2 ','-separated parts\n";
361 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
366 for (std::vector<Alignable*>::const_iterator iAli = alis.begin();
369 for (std::vector<unsigned int>::const_iterator iParam = selParam.begin();
370 iParam != selParam.end();
376 if (static_cast<int>(selParam[selParam.size()-1]) >= AliParams->
size()) {
377 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
378 <<
"mismatch in number of parameters\n";
381 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(*iParam);
382 if (positionParam!=(*positionAli).second.end()) {
383 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n"
384 <<
"Momentum range for parameter specified twice\n";
402 std::vector<Alignable*> allComps;
404 for (std::vector<Alignable*>::const_iterator iAli = alis.begin(); iAli != alis.end(); ++iAli) {
406 allComps.push_back(*iAli);
407 (*iAli)->recursiveComponents(allComps);
412 for (std::vector<Alignable*>::const_iterator iter = allComps.begin();
413 iter != allComps.end(); ++iter) {
422 unsigned int beamIds[] = { 0, 10, 20, 30, 40, 50, 60, 70,
423 1, 11, 21, 31, 41, 51, 61, 71,
424 100, 110, 120, 130, 140, 150, 160, 170,
425 101, 111, 121, 131, 141, 151, 161, 171,
426 200, 210, 220, 230, 240, 250, 260, 270};
428 const size_t nBeams =
sizeof(beamIds)/
sizeof(beamIds[0]);
429 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
447 const unsigned int key = (*it).second;
450 for (
unsigned int iInstance=0;iInstance<nInstances;++iInstance) {
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Alignable * alignableFromLabel(unsigned int label) const
unsigned int lasBeamLabel(unsigned int lasBeamId) const
static PFTauRenderPlugin instance
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
UintUintMap theLabelToLasBeamMap
labels for las beams
static const unsigned int theMinLabel
unsigned int alignableLabelFromParamAndInstance(Alignable *alignable, unsigned int param, unsigned int instance) const
unsigned int buildMap(const std::vector< Alignable * > &alis)
returns size of map
MomentumDependentPedeLabeler(const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
static int position[TOTALCHAMBERS][3]
static const unsigned int theMaxNumParam
U second(std::pair< T, U > const &p)
AlignableTracker * aliTracker_
~MomentumDependentPedeLabeler()
unsigned int paramNumFromLabel(unsigned int paramLabel) const
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
void clear()
remove all selected Alignables and geometrical restrictions
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const
returns the number of instances for a given parameter
const T & max(const T &a, const T &b)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
bool hasSplitParameters(Alignable *alignable) const
returns true if the alignable has parameters that are split into various bins
unsigned int offset(bool)
Container::value_type value_type
UintUintMap theLasBeamToLabelMap
reverse map
unsigned int buildReverseMap()
returns size of map
unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const
returns the label for a given alignable parameter number combination
unsigned int lasBeamIdFromLabel(unsigned int label) const
AlignableExtras * aliExtras_
const align::Alignables & selectedAlignables() const
vector of alignables selected so far
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
static const unsigned int theParamInstanceOffset
std::vector< Alignable * > Alignables
std::vector< MomentumRange > MomentumRangeVector
unsigned int addSelection(const std::string &name, const std::vector< char > ¶mSel)
unsigned int buildMomentumDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
GlobalVector globalMomentum() const
unsigned int alignableLabel(Alignable *alignable) const
Return 32-bit unique label for alignable, 0 indicates failure.
#define DEFINE_EDM_PLUGIN(factory, type, name)
AlignableToIdMap theAlignableToIdMap
std::vector< unsigned int > convertParamSel(const std::string &selString) const
Constructor of the full muon geometry.
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs
define event information passed to algorithms
AlignableToIdMap::value_type AlignableToIdPair
unsigned int alignableLabelFromLabel(unsigned int label) const
alignable label from parameter label (works also for alignable label...)
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs