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.size() > 0) {
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(std::vector<Alignable*>::const_iterator it = alis.begin(); it != alis.end(); ++it) {
182 const std::vector<Alignable*> &aliDaughts = (*it)->deepComponents();
183 for (std::vector<Alignable*>::const_iterator iD = aliDaughts.begin();
184 iD != aliDaughts.end(); ++iD) {
187 modules_selected = this->
createGroup(Id, range, std::list<Alignable*>(1,(*iD)), refrun);
189 selected_alis.push_back((*iD));
196 modules_selected = this->
createGroup(Id, range, selected_alis, refrun);
200 for(std::vector<edm::RunNumber_t>::const_iterator iRun = range.begin();
201 iRun != range.end(); ++iRun) {
202 localRunRange.insert((*iRun));
203 if((*iRun) > firstRun) {
207 <<
"@SUB=TkModuleGroupSelector::createModuleGroups:" 208 <<
" Run range not sorted.";
212 if(!modules_selected) {
214 <<
"@SUB=TkModuleGroupSelector:createModuleGroups:" 215 <<
" No module was selected in the module group selector in group " << (
firstId_.size()-1)<<
".";
220 for(std::set<edm::RunNumber_t>::const_iterator itRun = localRunRange.begin();
221 itRun != localRunRange.end(); ++itRun) {
251 const DetId temp_id(detId);
256 for(std::vector<int>::const_iterator itSubDets =
subdetids_.begin();
267 std::map<unsigned int, unsigned int>::const_iterator it =
mapDetIdGroupId_.find(detId);
269 const unsigned int iAlignableGroup = (*it).second;
270 const std::vector<edm::RunNumber_t> &
runs =
runRange_.at(iAlignableGroup);
271 const unsigned int id0 =
firstId_.at(iAlignableGroup);
275 unsigned int iovNum = 0;
276 for ( ; iovNum < runs.size(); ++iovNum) {
277 if (runs[iovNum] > run)
break;
280 throw cms::Exception(
"BadConfig") <<
"@SUB=TkModuleGroupSelector::getParameterIndexFromDetId:\n" 281 <<
"Run " << run <<
" not foreseen for detid '"<< detId <<
"'" 282 <<
" in module group " << iAlignableGroup <<
".";
289 if(iovNum+1 == runs.size()) {
290 if(refrun >= runs[iovNum])
292 }
else if( (iovNum+1) < runs.size()) {
293 if(refrun >= runs[iovNum] && refrun < runs[iovNum+1]) {
304 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