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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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  }

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

◆ ~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.

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  }

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

◆ verifyRegistry()

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

Definition at line 260 of file HiMixingModule.cc.

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  }

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

Member Data Documentation

◆ workers_

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

Definition at line 163 of file HiMixingModule.cc.

resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ConstProductRegistry::productList
ProductList const & productList() const
Definition: ConstProductRegistry.h:44
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::HiMixingWorker
Definition: HiMixingModule.cc:87
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
edm::ParameterSet
Definition: ParameterSet.h:47
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:663
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::HiMixingModule::workers_
std::vector< HiMixingWorkerBase * > workers_
Definition: HiMixingModule.cc:163
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
edm::BranchDescription
Definition: BranchDescription.h:32
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27