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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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 149 of file HiMixingModule.cc.

Constructor & Destructor Documentation

◆ HiMixingModule()

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

Definition at line 175 of file HiMixingModule.cc.

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

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), input, PixelMapPlotter::inputs, HLT_2018_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 237 of file HiMixingModule.cc.

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

Member Function Documentation

◆ produce()

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

Definition at line 247 of file HiMixingModule.cc.

247  {
248  using namespace edm;
249 
250  for (size_t i = 0; i < workers_.size(); ++i) {
251  (workers_[i])->addSignals(iEvent);
252  }
253 
254  std::unique_ptr<PileupMixingContent> PileupMixing_ =
255  std::unique_ptr<PileupMixingContent>(new PileupMixingContent());
256  iEvent.put(std::move(PileupMixing_));
257  }

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 259 of file HiMixingModule.cc.

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

References edm::BranchDescription::className(), newFWLiteAna::found, label, edm::BranchDescription::moduleLabel(), resolutioncreator_cfi::object, edm::BranchDescription::productInstanceName(), 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 161 of file HiMixingModule.cc.

edm::BranchDescription::productInstanceName
std::string const & productInstanceName() const
Definition: BranchDescription.h:81
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
mps_fire.i
i
Definition: mps_fire.py:355
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
edm::LogInfo
Definition: MessageLogger.h:254
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::HiMixingWorker
Definition: HiMixingModule.cc:85
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:656
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
PileupMixingContent
Definition: PileupMixingContent.h:24
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::HiMixingModule::workers_
std::vector< HiMixingWorkerBase * > workers_
Definition: HiMixingModule.cc:161
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::BranchDescription::moduleLabel
std::string const & moduleLabel() const
Definition: BranchDescription.h:72
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
edm::BranchDescription
Definition: BranchDescription.h:32
edm::BranchDescription::className
std::string const & className() const
Definition: BranchDescription.h:79
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27