CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::HiMixingModule Class Reference
Inheritance diagram for edm::HiMixingModule:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiMixingModule (const edm::ParameterSet &)
 
 ~HiMixingModule ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual 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::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 148 of file HiMixingModule.cc.

Constructor & Destructor Documentation

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

Definition at line 176 of file HiMixingModule.cc.

References edm::InputTag::encode(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), LaserDQM_cfg::input, SiPixelRawToDigiRegional_cfi::inputs, edm::InputTag::instance(), diffTwoXMLs::label, edm::InputTag::label(), cscdqm::h::names, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, and o2o::tags.

177 {
178 
179  ParameterSet ps=pset.getParameter<ParameterSet>("mixObjects");
180  std::vector<std::string> names = ps.getParameterNames();
181  std::vector<std::string> simtags = pset.getParameter<std::vector<std::string> >("srcSIM");
182  std::vector<std::string> gentags = pset.getParameter<std::vector<std::string> >("srcGEN");
183 
184  if(simtags.size() != gentags.size()) 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 
188  ParameterSet pstag=ps.getParameter<ParameterSet>((*it));
189  if (!pstag.exists("type")) 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") signal = gentags[input];
200  else 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  }else if (object=="SimTrack"){
210  workers_.push_back(new HiMixingWorker<SimTrack>(object,inputs,label));
211  produces<CrossingFrame<SimTrack> >(label);
212  }else if (object=="SimVertex"){
213  workers_.push_back(new HiMixingWorker<SimVertex>(object,inputs,label));
214  produces<CrossingFrame<SimVertex> >(label);
215  }else if (object=="PSimHit"){
216  workers_.push_back(new HiMixingWorker<PSimHit>(object,inputs,label));
217  produces<CrossingFrame<PSimHit> >(label);
218  }else if (object=="PCaloHit"){
219  workers_.push_back(new HiMixingWorker<PCaloHit>(object,inputs,label));
220  produces<CrossingFrame<PCaloHit> >(label);
221  }else LogInfo("Error")<<"What the hell is this object?!";
222 
223  LogInfo("HiMixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
224  }
225  }
226 
227  produces<PileupMixingContent>();
228 }
T getParameter(std::string const &) const
static const HistoName names[]
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string encode() const
Definition: InputTag.cc:164
std::vector< std::string > getParameterNames() const
tuple tags
Definition: o2o.py:248
std::vector< HiMixingWorkerBase * > workers_
std::string const & label() const
Definition: InputTag.h:42
std::string const & instance() const
Definition: InputTag.h:43
HiMixingModule::~HiMixingModule ( )

Definition at line 231 of file HiMixingModule.cc.

232 {
233 
234  // do anything here that needs to be done at desctruction time
235  // (e.g. close files, deallocate resources etc.)
236 
237 }

Member Function Documentation

void HiMixingModule::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 261 of file HiMixingModule.cc.

262 {
263 }
void HiMixingModule::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 267 of file HiMixingModule.cc.

267  {
268 }
void HiMixingModule::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 246 of file HiMixingModule.cc.

References i, and edm::Event::put().

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::auto_ptr< PileupMixingContent > PileupMixing_ = std::auto_ptr< PileupMixingContent >(new PileupMixingContent());
255  iEvent.put(PileupMixing_);
256 
257 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
std::vector< HiMixingWorkerBase * > workers_
bool HiMixingModule::verifyRegistry ( std::string  object,
std::string  subdet,
InputTag tag,
std::string &  label 
)
private

Definition at line 270 of file HiMixingModule.cc.

References edm::BranchDescription::className(), newFWLiteAna::found, edm::InputTag::instance(), edm::InputTag::label(), edm::BranchDescription::moduleLabel(), dbtoconf::object, edm::BranchDescription::productInstanceName(), edm::ConstProductRegistry::productList(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Member Data Documentation

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

Definition at line 160 of file HiMixingModule.cc.