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 ()
 
ModuleDescription const & moduleDescription () const
 
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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob () override
 
virtual void endJob () override
 
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
 
- 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::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 153 of file HiMixingModule.cc.

Constructor & Destructor Documentation

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

Definition at line 181 of file HiMixingModule.cc.

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

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

242 {
243 
244  // do anything here that needs to be done at desctruction time
245  // (e.g. close files, deallocate resources etc.)
246 
247 }

Member Function Documentation

void HiMixingModule::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 271 of file HiMixingModule.cc.

272 {
273 }
void HiMixingModule::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 277 of file HiMixingModule.cc.

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

Implements edm::EDProducer.

Definition at line 256 of file HiMixingModule.cc.

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

257 {
258  using namespace edm;
259 
260  for(size_t i = 0; i < workers_.size(); ++i){
261  (workers_[i])->addSignals(iEvent);
262  }
263 
264  std::auto_ptr< PileupMixingContent > PileupMixing_ = std::auto_ptr< PileupMixingContent >(new PileupMixingContent());
265  iEvent.put(PileupMixing_);
266 
267 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< HiMixingWorkerBase * > workers_
bool HiMixingModule::verifyRegistry ( std::string  object,
std::string  subdet,
InputTag tag,
std::string &  label 
)
private

Definition at line 280 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.

280  {
281  // verify that the given product exists in the product registry
282  // and create the label to be given to the CrossingFrame
283 
285  // Loop over provenance of products in registry.
286  std::string lookfor;
287  if (object=="HepMCProduct") lookfor="edm::"+object;//exception for HepMCProduct
288  else if (object=="edm::HepMCProduct") lookfor=object;
289  else lookfor="std::vector<"+object+">";
290  bool found=false;
291  for (edm::ProductRegistry::ProductList::const_iterator it = reg->productList().begin();
292  it != reg->productList().end(); ++it) {
293  // See FWCore/Framework/interface/BranchDescription.h
294  // BranchDescription contains all the information for the product.
295  edm::BranchDescription desc = it->second;
296  if (desc.className()==lookfor && desc.moduleLabel()==tag.label() && desc.productInstanceName()==tag.instance()) {
297  label=desc.moduleLabel()+desc.productInstanceName();
298  found=true;
299  /*
300  wantedBranches_.push_back(desc.friendlyClassName() + '_' +
301  desc.moduleLabel() + '_' +
302  desc.productInstanceName());
303  */
304  break;
305  }
306  }
307  if (!found) {
308  LogWarning("MixingModule")<<"!!!!!!!!!Could not find in registry requested object: "<<object<<" with "<<tag<<".\nWill NOT be considered for mixing!!!!!!!!!";
309  return false;
310  }
311 
312  return true;
313 }
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 165 of file HiMixingModule.cc.