CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::HiMixingModule Class Reference
Inheritance diagram for edm::HiMixingModule:
edm::stream::EDProducer<>

Public Member Functions

 HiMixingModule (const edm::ParameterSet &)
 
 ~HiMixingModule () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
bool verifyRegistry (std::string object, std::string subdet, InputTag &tag, std::string &label)
 

Private Attributes

std::vector< HiMixingWorkerBase * > workers_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 151 of file HiMixingModule.cc.

Constructor & Destructor Documentation

◆ HiMixingModule()

HiMixingModule::HiMixingModule ( const edm::ParameterSet pset)
explicit

Definition at line 177 of file HiMixingModule.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), input, PixelMapPlotter::inputs, ProducerED_cfi::InputTag, label, names, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, and triggerMatcherToHLTDebug_cfi::tags.

177  {
178  ParameterSet ps = pset.getParameter<ParameterSet>("mixObjects");
179  std::vector<std::string> names = ps.getParameterNames();
180  std::vector<std::string> simtags = pset.getParameter<std::vector<std::string> >("srcSIM");
181  std::vector<std::string> gentags = pset.getParameter<std::vector<std::string> >("srcGEN");
182 
183  if (simtags.size() != gentags.size())
184  LogError("MixingInput") << "Generator and Simulation input lists are not matching each other" << endl;
185 
186  for (std::vector<string>::iterator it = names.begin(); it != names.end(); ++it) {
187  ParameterSet pstag = ps.getParameter<ParameterSet>((*it));
188  if (!pstag.exists("type"))
189  continue; //to allow replacement by empty pset
190  std::string object = pstag.getParameter<std::string>("type");
191  std::vector<InputTag> tags = pstag.getParameter<std::vector<InputTag> >("input");
192 
193  std::string signal;
194  for (size_t itag = 0; itag < tags.size(); ++itag) {
195  InputTag tag = tags[itag];
196  std::vector<InputTag> inputs;
197 
198  for (size_t input = 0; input < simtags.size(); ++input) {
199  if (object == "HepMCProduct")
200  signal = gentags[input];
201  else
202  signal = simtags[input];
203  inputs.push_back(InputTag(signal, tag.instance()));
204  }
205 
206  std::string label = tag.label() + tag.instance();
207  // verifyRegistry(object,std::string(""),tag,label);
208  if (object == "HepMCProduct") {
209  workers_.push_back(new HiMixingWorker<HepMCProduct>(object, inputs, label));
210  produces<CrossingFrame<HepMCProduct> >(label);
211  consumes<HepMCProduct>(tag);
212  } else if (object == "SimTrack") {
213  workers_.push_back(new HiMixingWorker<SimTrack>(object, inputs, label));
214  produces<CrossingFrame<SimTrack> >(label);
215  consumes<std::vector<SimTrack> >(tag);
216  } else if (object == "SimVertex") {
217  workers_.push_back(new HiMixingWorker<SimVertex>(object, inputs, label));
218  produces<CrossingFrame<SimVertex> >(label);
219  consumes<std::vector<SimVertex> >(tag);
220  } else if (object == "PSimHit") {
221  workers_.push_back(new HiMixingWorker<PSimHit>(object, inputs, label));
222  produces<CrossingFrame<PSimHit> >(label);
223  consumes<std::vector<PSimHit> >(tag);
224  } else if (object == "PCaloHit") {
225  workers_.push_back(new HiMixingWorker<PCaloHit>(object, inputs, label));
226  produces<CrossingFrame<PCaloHit> >(label);
227  consumes<std::vector<PCaloHit> >(tag);
228  } else
229  LogInfo("Error") << "What the hell is this object?!";
230 
231  LogInfo("HiMixingModule") << "Will mix " << object << "s with InputTag= " << tag.encode() << ", label will be "
232  << label;
233  }
234  }
235 
236  produces<PileupMixingContent>();
237  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool exists(std::string const &parameterName) const
checks if a parameter exists
Log< level::Error, false > LogError
const std::string names[nVars_]
static std::string const input
Definition: EdmProvDump.cc:50
char const * label
Log< level::Info, false > LogInfo
std::vector< HiMixingWorkerBase * > workers_
std::vector< std::string > getParameterNames() const

◆ ~HiMixingModule()

HiMixingModule::~HiMixingModule ( )
override

Definition at line 239 of file HiMixingModule.cc.

239  {
240  // do anything here that needs to be done at desctruction time
241  // (e.g. close files, deallocate resources etc.)
242  }

Member Function Documentation

◆ produce()

void HiMixingModule::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 249 of file HiMixingModule.cc.

References mps_fire::i, iEvent, and eostools::move().

249  {
250  using namespace edm;
251 
252  for (size_t i = 0; i < workers_.size(); ++i) {
253  (workers_[i])->addSignals(iEvent);
254  }
255 
256  std::unique_ptr<PileupMixingContent> PileupMixing_ = std::make_unique<PileupMixingContent>();
257  iEvent.put(std::move(PileupMixing_));
258  }
int iEvent
Definition: GenABIO.cc:224
std::vector< HiMixingWorkerBase * > workers_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

◆ verifyRegistry()

bool HiMixingModule::verifyRegistry ( std::string  object,
std::string  subdet,
InputTag tag,
std::string &  label 
)
private

Definition at line 260 of file HiMixingModule.cc.

References submitPVResolutionJobs::desc, newFWLiteAna::found, label, resolutioncreator_cfi::object, edm::ConstProductRegistry::productList(), AlCaHLTBitMon_QueryRunRegistry::string, and makeGlobalPositionRcd_cfg::tag.

260  {
261  // verify that the given product exists in the product registry
262  // and create the label to be given to the CrossingFrame
263 
265  // Loop over provenance of products in registry.
266  std::string lookfor;
267  if (object == "HepMCProduct")
268  lookfor = "edm::" + object; //exception for HepMCProduct
269  else if (object == "edm::HepMCProduct")
270  lookfor = object;
271  else
272  lookfor = "std::vector<" + object + ">";
273  bool found = false;
274  for (edm::ProductRegistry::ProductList::const_iterator it = reg->productList().begin();
275  it != reg->productList().end();
276  ++it) {
277  // See FWCore/Framework/interface/BranchDescription.h
278  // BranchDescription contains all the information for the product.
279  edm::BranchDescription desc = it->second;
280  if (desc.className() == lookfor && desc.moduleLabel() == tag.label() &&
281  desc.productInstanceName() == tag.instance()) {
282  label = desc.moduleLabel() + desc.productInstanceName();
283  found = true;
284  /*
285  wantedBranches_.push_back(desc.friendlyClassName() + '_' +
286  desc.moduleLabel() + '_' +
287  desc.productInstanceName());
288  */
289  break;
290  }
291  }
292  if (!found) {
293  LogWarning("MixingModule") << "!!!!!!!!!Could not find in registry requested object: " << object << " with "
294  << tag << ".\nWill NOT be considered for mixing!!!!!!!!!";
295  return false;
296  }
297 
298  return true;
299  }
ProductList const & productList() const
char const * label
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ workers_

std::vector<HiMixingWorkerBase*> edm::HiMixingModule::workers_
private

Definition at line 163 of file HiMixingModule.cc.