31 theMaxNumberOfParameterInstances(0) {
63 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" 64 <<
"Alignable " <<
typeid(*alignable).name()
65 <<
" not in map, det/subdet/alignableStructureType = " <<
detId.det() <<
"/" 83 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(param);
84 if (positionParam != (*positionAli).second.end()) {
85 if (
instance >= (*positionParam).second.size()) {
86 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabelFromParamAndMomentum" 87 <<
"iovIdx out of bounds";
99 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" 100 <<
"Alignable " <<
typeid(*alignable).name()
101 <<
" not in map, det/subdet/alignableStructureType = " <<
detId.det() <<
"/" 114 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::lasBeamLabel" 115 <<
"No label for beam Id " << lasBeamId;
123 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::parameterLabel" 124 <<
"Parameter number " << parNum <<
" out of range 0 <= num < " <<
theMaxNumParam;
126 return aliLabel + parNum;
138 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::parameterLabel" 139 <<
"Parameter number " << parNum <<
" out of range 0 <= num < " <<
theMaxNumParam;
146 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(parNum);
147 if (positionParam != (*positionAli).second.end()) {
151 for (
const auto &iMomentum : momentumRanges) {
152 if (iMomentum.first <= mom && mom < iMomentum.second) {
158 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" 159 <<
"Alignable " <<
typeid(*alignable).name()
160 <<
" not in map, det/subdet/alignableStructureType = " <<
detId.det() <<
"/" 173 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableLabel" 174 <<
"Alignable " <<
typeid(*alignable).name()
175 <<
" not in map, det/subdet/alignableStructureType = " <<
detId.det() <<
"/" 193 size_t nMomentums = 1;
195 for (
const auto &iParam : (*positionAli).second) {
196 nMomentums =
std::max(nMomentums, iParam.second.size());
200 MomentumRangeParamMap::const_iterator iParam = (*positionAli).second.find(param);
201 if (iParam != (*positionAli).second.end()) {
202 return iParam->second.size();
215 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::paramNumFromLabel" 240 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::alignableFromLabel" 241 <<
"Alignable label " << aliLabel <<
" not in map.";
257 edm::LogError(
"LogicError") <<
"@SUB=MomentumDependentPedeLabeler::lasBeamIdFromLabel" 258 <<
"Alignable label " << aliLabel <<
" not in map.";
266 std::vector<std::string>
result;
271 if (delimiterPos == std::string::npos) {
272 result.push_back(
s.substr(previousPos));
275 result.push_back(
s.substr(previousPos, delimiterPos - previousPos));
276 previousPos = delimiterPos + 1;
284 std::vector<unsigned int>
result;
286 if (selString[
pos] ==
'1')
300 std::vector<char> paramSelDumthe(6,
'1');
302 const auto parameterInstancesVPSet =
config.getParameter<std::vector<edm::ParameterSet> >(
"parameterInstances");
304 for (
const auto &iter : parameterInstancesVPSet) {
305 const auto tempMomentumRanges = iter.getParameter<std::vector<std::string> >(
"momentumRanges");
306 if (tempMomentumRanges.empty()) {
307 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n" 308 <<
"MomentumRanges empty\n";
314 for (
unsigned int iMomentum = 0; iMomentum < tempMomentumRanges.size(); ++iMomentum) {
315 std::vector<std::string> tokens =
edm::tokenize(tempMomentumRanges[iMomentum],
":");
317 lower = strtod(tokens[0].c_str(),
nullptr);
318 upper = strtod(tokens[1].c_str(),
nullptr);
320 MomentumRanges.push_back(std::pair<float, float>(lower, upper));
323 const auto selStrings = iter.getParameter<std::vector<std::string> >(
"selector");
324 for (
const auto &iSel : selStrings) {
325 std::vector<std::string> decompSel(this->
decompose(iSel,
','));
327 if (decompSel.size() != 2) {
328 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n" 329 << iSel <<
" should have at least 2 ','-separated parts\n";
332 std::vector<unsigned int> selParam = this->
convertParamSel(decompSel[1]);
334 selector.addSelection(decompSel[0], paramSelDumthe);
336 const auto &alis =
selector.selectedAlignables();
337 for (
const auto &iAli : alis) {
338 if (iAli->alignmentParameters() ==
nullptr) {
340 <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n" 341 <<
"Momentum dependence configured for alignable of type " 343 <<
"," << iAli->globalPosition().y() <<
"," << iAli->globalPosition().z() <<
"), " 344 <<
"but that has no parameters. Please check that all run " 345 <<
"momentum parameters are also selected for alignment.\n";
348 for (
const auto &iParam : selParam) {
352 if (static_cast<int>(selParam[selParam.size() - 1]) >= AliParams->
size()) {
353 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n" 354 <<
"mismatch in number of parameters\n";
357 MomentumRangeParamMap::const_iterator positionParam = (*positionAli).second.find(iParam);
358 if (positionParam != (*positionAli).second.end()) {
359 throw cms::Exception(
"BadConfig") <<
"@SUB=MomentumDependentPedeLabeler::buildMomentumDependencyMap\n" 360 <<
"Momentum range for parameter specified twice\n";
379 for (
const auto &iAli : alis) {
381 allComps.push_back(iAli);
382 iAli->recursiveComponents(allComps);
387 for (
const auto &iter : allComps) {
396 unsigned int beamIds[] = {0, 10, 20, 30, 40, 50, 60, 70,
397 1, 11, 21, 31, 41, 51, 61, 71,
398 100, 110, 120, 130, 140, 150, 160, 170,
399 101, 111, 121, 131, 141, 151, 161, 171,
400 200, 210, 220, 230, 240, 250, 260, 270};
402 const size_t nBeams =
sizeof(beamIds) /
sizeof(beamIds[0]);
403 for (
size_t iBeam = 0; iBeam < nBeams; ++iBeam) {
410 throw cms::Exception(
"Alignment") <<
"@SUB=MomentumDependentPedeLabeler::buildMap: " 411 <<
"Too many labels per instance (" <<
id - 1 <<
") leading to double use, " 412 <<
"increase PedeLabelerBase::theParamInstanceOffset!\n";
424 const unsigned int key =
it.second;
428 for (
unsigned int iInstance = 0; iInstance < nInstances; ++iInstance) {
unsigned int parameterLabel(unsigned int aliLabel, unsigned int parNum) const override
returns the label for a given alignable parameter number combination
unsigned int lasBeamIdFromLabel(unsigned int label) const override
~MomentumDependentPedeLabeler() override
static PFTauRenderPlugin instance
unsigned int alignableLabelFromLabel(unsigned int label) const override
alignable label from parameter label (works also for alignable label...)
UintUintMap theLabelToLasBeamMap
labels for las beams
static const unsigned int theMinLabel
Log< level::Error, false > LogError
MomentumDependentPedeLabeler(const PedeLabelerBase::TopLevelAlignables &alignables, const edm::ParameterSet &config)
constructor from three Alignables (null pointers allowed )
define event information passed to algorithms
static const unsigned int theMaxNumParam
unsigned int lasBeamLabel(unsigned int lasBeamId) const override
AlignableTracker * aliTracker_
Container::value_type value_type
unsigned int alignableLabelFromParamAndInstance(const Alignable *alignable, unsigned int param, unsigned int instance) const override
unsigned int buildMap(const align::Alignables &)
returns size of map
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
int size(void) const
Get number of parameters.
key
prepare the HTCondor submission files and eventually submit them
std::vector< std::string > decompose(const std::string &s, std::string::value_type delimiter) const
UintUintMap theLasBeamToLabelMap
reverse map
unsigned int buildReverseMap()
returns size of map
unsigned int alignableLabel(const Alignable *alignable) const override
Return 32-bit unique label for alignable, 0 indicates failure.
AlignableExtras * aliExtras_
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
std::vector< unsigned int > convertParamSel(const std::string &selString) const
const AlignableObjectId & objectIdProvider() const
Return tracker alignable object ID provider derived from the tracker's geometry.
const char * idToString(align::StructureType type) const
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator
GlobalVector globalMomentum() const
static const unsigned int theParamInstanceOffset
Alignable * alignableFromLabel(unsigned int label) const override
std::vector< Alignable * > Alignables
std::vector< MomentumRange > MomentumRangeVector
unsigned int paramNumFromLabel(unsigned int paramLabel) const override
parameter number, 0 <= .. < theMaxNumParam, belonging to unique parameter label
unsigned int buildMomentumDependencyMap(AlignableTracker *aliTracker, AlignableMuon *aliMuon, AlignableExtras *extras, const edm::ParameterSet &config)
static int position[264][3]
unsigned int numberOfParameterInstances(Alignable *alignable, int param=-1) const override
returns the number of instances for a given parameter
bool hasSplitParameters(Alignable *alignable) const override
returns true if the alignable has parameters that are split into various bins
#define DEFINE_EDM_PLUGIN(factory, type, name)
eventInfo
add run, event number and lumi section
unsigned int theMaxNumberOfParameterInstances
AlignableToIdMap theAlignableToIdMap
Constructor of the full muon geometry.
AlignableToMomentumRangeMap theAlignableToMomentumRangeMap
providing unique ID for alignable, space for param IDs
AlignableToIdMap::value_type AlignableToIdPair
IdToAlignableMap theIdToAlignableMap
providing unique ID for alignable, space for param IDs