CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::ConditionalTaskHelper Class Reference

Public Types

using AliasInfo = StreamSchedule::AliasInfo
 

Public Member Functions

std::multimap< std::string, AliasInfo > const & aliasMap () const
 
std::multimap< std::string, edm::BranchDescription const * > conditionalModuleBranches (std::unordered_set< std::string > const &conditionalmods) const
 
 ConditionalTaskHelper (ParameterSet &proc_pset, ProductRegistry &preg, PreallocationConfiguration const *prealloc, std::shared_ptr< ProcessConfiguration const > processConfiguration, WorkerManager &workerManager, std::vector< std::string > const &trigPathNames)
 

Private Member Functions

void fillAliasMap (ParameterSet const &proc_pset, std::unordered_set< std::string > const &allConditionalMods)
 
void processSwitchEDAliases (ParameterSet const &proc_pset, ProductRegistry &preg, ProcessConfiguration const &processConfiguration, std::unordered_set< std::string > const &allConditionalMods)
 

Private Attributes

std::multimap< std::string, AliasInfoaliasMap_
 
std::multimap< std::string, edm::BranchDescription const * > conditionalModsBranches_
 

Detailed Description

Definition at line 154 of file StreamSchedule.cc.

Member Typedef Documentation

◆ AliasInfo

Definition at line 156 of file StreamSchedule.cc.

Constructor & Destructor Documentation

◆ ConditionalTaskHelper()

edm::ConditionalTaskHelper::ConditionalTaskHelper ( ParameterSet proc_pset,
ProductRegistry preg,
PreallocationConfiguration const *  prealloc,
std::shared_ptr< ProcessConfiguration const >  processConfiguration,
WorkerManager workerManager,
std::vector< std::string > const &  trigPathNames 
)
inline

Definition at line 158 of file StreamSchedule.cc.

References conditionalModsBranches_, fillAliasMap(), spr::find(), edm::ParameterSet::getParameter(), hltMonBTagIPClient_cfi::pathName, processSwitchEDAliases(), dumpMFGeometry_cfg::prod, edm::ProductRegistry::productList(), and funct::void.

163  {
164  std::unordered_set<std::string> allConditionalMods;
165  for (auto const& pathName : trigPathNames) {
166  auto const modnames = proc_pset.getParameter<vstring>(pathName);
167 
168  //Pull out ConditionalTask modules
169  auto itCondBegin = std::find(modnames.begin(), modnames.end(), "#");
170  if (itCondBegin == modnames.end())
171  continue;
172 
173  //the last entry should be ignored since it is required to be "@"
174  allConditionalMods.insert(itCondBegin + 1, std::prev(modnames.end()));
175  }
176 
177  for (auto const& cond : allConditionalMods) {
178  //force the creation of the conditional modules so alias check can work
179  (void)getWorker(cond, proc_pset, workerManager, preg, prealloc, processConfiguration);
180  }
181 
182  fillAliasMap(proc_pset, allConditionalMods);
183  processSwitchEDAliases(proc_pset, preg, *processConfiguration, allConditionalMods);
184 
185  //find branches created by the conditional modules
186  for (auto const& prod : preg.productList()) {
187  if (allConditionalMods.find(prod.first.moduleLabel()) != allConditionalMods.end()) {
188  conditionalModsBranches_.emplace(prod.first.moduleLabel(), &prod.second);
189  }
190  }
191  }
std::multimap< std::string, edm::BranchDescription const * > conditionalModsBranches_
vector< string > vstring
Definition: ExoticaDQM.cc:8
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
void processSwitchEDAliases(ParameterSet const &proc_pset, ProductRegistry &preg, ProcessConfiguration const &processConfiguration, std::unordered_set< std::string > const &allConditionalMods)
void fillAliasMap(ParameterSet const &proc_pset, std::unordered_set< std::string > const &allConditionalMods)
Definition: plugin.cc:23

Member Function Documentation

◆ aliasMap()

std::multimap<std::string, AliasInfo> const& edm::ConditionalTaskHelper::aliasMap ( ) const
inline

Definition at line 193 of file StreamSchedule.cc.

References aliasMap_.

Referenced by edm::StreamSchedule::fillWorkers().

193 { return aliasMap_; }
std::multimap< std::string, AliasInfo > aliasMap_

◆ conditionalModuleBranches()

std::multimap<std::string, edm::BranchDescription const*> edm::ConditionalTaskHelper::conditionalModuleBranches ( std::unordered_set< std::string > const &  conditionalmods) const
inline

Definition at line 195 of file StreamSchedule.cc.

References conditionalModsBranches_, mod(), FastTimerService_cff::range, and runTheMatrix::ret.

Referenced by edm::StreamSchedule::fillWorkers().

196  {
197  std::multimap<std::string, edm::BranchDescription const*> ret;
198  for (auto const& mod : conditionalmods) {
199  auto range = conditionalModsBranches_.equal_range(mod);
200  ret.insert(range.first, range.second);
201  }
202  return ret;
203  }
std::multimap< std::string, edm::BranchDescription const * > conditionalModsBranches_
ret
prodAgent to be discontinued
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ fillAliasMap()

void edm::ConditionalTaskHelper::fillAliasMap ( ParameterSet const &  proc_pset,
std::unordered_set< std::string > const &  allConditionalMods 
)
inlineprivate

Definition at line 206 of file StreamSchedule.cc.

References SiStripOfflineCRack_cfg::alias, aliasMap_, edm::ParameterSet::getParameter(), info(), instance, mod(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ConditionalTaskHelper().

206  {
207  auto aliases = proc_pset.getParameter<std::vector<std::string>>("@all_aliases");
208  std::string const star("*");
209  for (auto const& alias : aliases) {
210  auto info = proc_pset.getParameter<edm::ParameterSet>(alias);
211  auto aliasedToModuleLabels = info.getParameterNames();
212  for (auto const& mod : aliasedToModuleLabels) {
213  if (not mod.empty() and mod[0] != '@' and allConditionalMods.find(mod) != allConditionalMods.end()) {
214  auto aliasVPSet = info.getParameter<std::vector<edm::ParameterSet>>(mod);
215  for (auto const& aliasPSet : aliasVPSet) {
216  std::string type = star;
217  std::string instance = star;
218  std::string originalInstance = star;
219  if (aliasPSet.exists("type")) {
220  type = aliasPSet.getParameter<std::string>("type");
221  }
222  if (aliasPSet.exists("toProductInstance")) {
223  instance = aliasPSet.getParameter<std::string>("toProductInstance");
224  }
225  if (aliasPSet.exists("fromProductInstance")) {
226  originalInstance = aliasPSet.getParameter<std::string>("fromProductInstance");
227  }
228 
229  aliasMap_.emplace(alias, AliasInfo{type, instance, originalInstance, mod});
230  }
231  }
232  }
233  }
234  }
StreamSchedule::AliasInfo AliasInfo
static const TGPicture * info(bool iBackgroundIsBlack)
static PFTauRenderPlugin instance
std::multimap< std::string, AliasInfo > aliasMap_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ processSwitchEDAliases()

void edm::ConditionalTaskHelper::processSwitchEDAliases ( ParameterSet const &  proc_pset,
ProductRegistry preg,
ProcessConfiguration const &  processConfiguration,
std::unordered_set< std::string > const &  allConditionalMods 
)
inlineprivate

Definition at line 236 of file StreamSchedule.cc.

References aliasMap_, edm::ParameterSet::getParameter(), callgraph::module, edm::detail::processEDAliases(), edm::ProcessConfiguration::processName(), FastTimerService_cff::range, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ConditionalTaskHelper().

239  {
240  auto const& all_modules = proc_pset.getParameter<std::vector<std::string>>("@all_modules");
241  std::vector<std::string> switchEDAliases;
242  for (auto const& module : all_modules) {
243  auto const& mod_pset = proc_pset.getParameter<edm::ParameterSet>(module);
244  if (mod_pset.getParameter<std::string>("@module_type") == "SwitchProducer") {
245  auto const& all_cases = mod_pset.getParameter<std::vector<std::string>>("@all_cases");
246  for (auto const& case_label : all_cases) {
247  auto range = aliasMap_.equal_range(case_label);
248  if (range.first != range.second) {
249  switchEDAliases.push_back(case_label);
250  }
251  }
252  }
253  }
255  switchEDAliases, allConditionalMods, proc_pset, processConfiguration.processName(), preg);
256  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::multimap< std::string, AliasInfo > aliasMap_
void processEDAliases(std::vector< std::string > const &aliasNamesToProcess, std::unordered_set< std::string > const &aliasModulesToProcess, ParameterSet const &proc_pset, std::string const &processName, ProductRegistry &preg)

Member Data Documentation

◆ aliasMap_

std::multimap<std::string, AliasInfo> edm::ConditionalTaskHelper::aliasMap_
private

Definition at line 258 of file StreamSchedule.cc.

Referenced by aliasMap(), fillAliasMap(), and processSwitchEDAliases().

◆ conditionalModsBranches_

std::multimap<std::string, edm::BranchDescription const*> edm::ConditionalTaskHelper::conditionalModsBranches_
private

Definition at line 259 of file StreamSchedule.cc.

Referenced by conditionalModuleBranches(), and ConditionalTaskHelper().