24 const std::vector<int> &sdets
30 for ( std::vector<std::string>::const_iterator iParam = parameterNames.begin();
31 iParam != parameterNames.end(); ++iParam) {
34 name !=
"RunRange" && name !=
"ReferenceRun" && name !=
"Granularity" 37 <<
"@SUB=TkModuleGroupSelector::TkModuleGroupSelector:" 38 <<
" Unknown parameter name '" << name <<
"' in PSet. Maybe a typo?";
48 const std::vector<edm::RunNumber_t> defaultRunRange
49 = (cfg.
exists(
"RunRange") ? cfg.
getParameter<std::vector<edm::RunNumber_t> >(
"RunRange")
50 : std::vector<edm::RunNumber_t>());
54 defaultRunRange, defaultReferenceRun);
62 mapDetIdGroupId_.insert(std::pair<unsigned int, unsigned int>(detid, groupid));
65 <<
"@SUB=TkModuleGroupSelector:fillDetIdMap:" 66 <<
" Module with det ID " << detid <<
" configured in group " << groupid
67 <<
" but it was already selected" 85 const std::vector<edm::RunNumber_t> &range,
86 const std::list<Alignable*> &selected_alis,
90 bool modules_selected =
false;
95 for(std::list<Alignable*>::const_iterator it = selected_alis.begin();
96 it != selected_alis.end(); ++it) {
98 modules_selected =
true;
100 if(refrun > 0 && !range.empty()) {
101 Id += range.size() - 1;
108 if(refrun > 0 && range.front() > refrun) {
110 <<
"@SUB=TkModuleGroupSelector::createGroup:\n" 111 <<
"Invalid combination of reference run number and specified run dependence" 112 <<
"\n in module group " <<
firstId_.size() <<
"." 113 <<
"\n Reference run number (" << refrun <<
") is smaller than starting run " 114 <<
"\n number (" << range.front() <<
") of first IOV.";
116 return modules_selected;
123 for ( std::vector<std::string>::const_iterator iParam = parameterNames.begin();
124 iParam != parameterNames.end(); ++iParam) {
127 name !=
"levels" && name !=
"RunRange" 128 && name !=
"split" && name !=
"ReferenceRun" 131 <<
"@SUB=TkModuleGroupSelector::verifyParameterNames:" 132 <<
" Unknown parameter name '" << name <<
"' in PSet number " << psetnr <<
". Maybe a typo?";
141 const std::vector<edm::RunNumber_t> &defaultRunRange,
144 std::set<edm::RunNumber_t> localRunRange;
147 unsigned int psetnr = 0;
149 for(edm::VParameterSet::const_iterator
pset = granularityConfig.begin();
150 pset != granularityConfig.end();
157 bool modules_selected =
false;
158 const std::vector<edm::RunNumber_t> range =
159 ((*pset).exists(
"RunRange") ?
pset->getParameter<std::vector<edm::RunNumber_t> >(
"RunRange")
163 <<
"@SUB=TkModuleGroupSelector::createModuleGroups:\n" 164 <<
"Run range array empty!";
169 if((*pset).exists(
"ReferenceRun")) {
172 refrun = defaultReferenceRun;
180 std::list<Alignable*> selected_alis;
181 for(
const auto& it: alis) {
182 const auto& aliDaughts = it->deepComponents();
183 for (
const auto& iD: aliDaughts) {
186 modules_selected = this->
createGroup(Id, range, std::list<Alignable*>(1,iD), refrun);
188 selected_alis.push_back(iD);
195 modules_selected = this->
createGroup(Id, range, selected_alis, refrun);
199 for(std::vector<edm::RunNumber_t>::const_iterator iRun = range.begin();
200 iRun != range.end(); ++iRun) {
201 localRunRange.insert((*iRun));
202 if((*iRun) > firstRun) {
206 <<
"@SUB=TkModuleGroupSelector::createModuleGroups:" 207 <<
" Run range not sorted.";
211 if(!modules_selected) {
213 <<
"@SUB=TkModuleGroupSelector:createModuleGroups:" 214 <<
" No module was selected in the module group selector in group " << (
firstId_.size()-1)<<
".";
219 for(std::set<edm::RunNumber_t>::const_iterator itRun = localRunRange.begin();
220 itRun != localRunRange.end(); ++itRun) {
250 const DetId temp_id(detId);
255 for(std::vector<int>::const_iterator itSubDets =
subdetids_.begin();
266 std::map<unsigned int, unsigned int>::const_iterator it =
mapDetIdGroupId_.find(detId);
268 const unsigned int iAlignableGroup = (*it).second;
269 const std::vector<edm::RunNumber_t> &
runs =
runRange_.at(iAlignableGroup);
270 const unsigned int id0 =
firstId_.at(iAlignableGroup);
274 unsigned int iovNum = 0;
275 for ( ; iovNum < runs.size(); ++iovNum) {
276 if (runs[iovNum] > run)
break;
279 throw cms::Exception(
"BadConfig") <<
"@SUB=TkModuleGroupSelector::getParameterIndexFromDetId:\n" 280 <<
"Run " << run <<
" not foreseen for detid '"<< detId <<
"'" 281 <<
" in module group " << iAlignableGroup <<
".";
288 if(iovNum+1 == runs.size()) {
289 if(refrun >= runs[iovNum])
291 }
else if( (iovNum+1) < runs.size()) {
292 if(refrun >= runs[iovNum] && refrun < runs[iovNum+1]) {
303 index = id0 + iovNum;
T getParameter(std::string const &) const
std::vector< int > subdetids_
std::vector< edm::RunNumber_t > globalRunRange_
edm::RunNumber_t firstRunOfIOV(unsigned int iovNum) const
First run of iov (0 if iovNum not treated).
std::vector< edm::RunNumber_t > referenceRun_
std::vector< ParameterSet > VParameterSet
void fillDetIdMap(const unsigned int detid, const unsigned int groupid)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
int getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const
unsigned int nparameters_
std::map< unsigned int, unsigned int > mapDetIdGroupId_
void clear()
remove all selected Alignables and geometrical restrictions
void verifyParameterNames(const edm::ParameterSet &pset, unsigned int psetnr) const
void createModuleGroups(AlignableTracker *aliTracker, const edm::VParameterSet &granularityConfig, const std::vector< edm::RunNumber_t > &defaultRunRange, edm::RunNumber_t defaultReferenceRun)
std::vector< std::vector< edm::RunNumber_t > > runRange_
std::vector< std::string > getParameterNames() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const align::Alignables & selectedAlignables() const
vector of alignables selected so far
TkModuleGroupSelector(AlignableTracker *aliTracker, const edm::ParameterSet &cfg, const std::vector< int > &sdets)
Constructor.
const bool testSplitOption(const edm::ParameterSet &pset) const
bool createGroup(unsigned int &Id, const std::vector< edm::RunNumber_t > &range, const std::list< Alignable * > &selected_alis, const edm::RunNumber_t refrun)
unsigned int getNumberOfParameters() const
unsigned int numIovs() const
Total number of IOVs.
unsigned int addSelections(const edm::ParameterSet &pSet)
std::vector< unsigned int > firstId_
Detector det() const
get the detector field from this detid