Public Member Functions | |
HiMixingModule (const edm::ParameterSet &) | |
~HiMixingModule () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
bool | verifyRegistry (std::string object, std::string subdet, InputTag &tag, std::string &label) |
Private Attributes | |
std::vector< HiMixingWorkerBase * > | workers_ |
Definition at line 149 of file HiMixingModule.cc.
HiMixingModule::HiMixingModule | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 177 of file HiMixingModule.cc.
References edm::InputTag::encode(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), collect_tpl::input, edm::InputTag::instance(), label, edm::InputTag::label(), h::names, GlobalPosition_Frontier_DevDB_cff::tag, and o2o::tags.
{ ParameterSet ps=pset.getParameter<ParameterSet>("mixObjects"); std::vector<std::string> names = ps.getParameterNames(); std::vector<std::string> simtags = pset.getParameter<std::vector<std::string> >("srcSIM"); std::vector<std::string> gentags = pset.getParameter<std::vector<std::string> >("srcGEN"); if(simtags.size() != gentags.size()) LogError("MixingInput")<<"Generator and Simulation input lists are not matching each other"<<endl; for (std::vector<string>::iterator it=names.begin();it!= names.end();++it){ ParameterSet pstag=ps.getParameter<ParameterSet>((*it)); if (!pstag.exists("type")) continue; //to allow replacement by empty pset std::string object = pstag.getParameter<std::string>("type"); std::vector<InputTag> tags=pstag.getParameter<std::vector<InputTag> >("input"); std::string signal; for(size_t itag = 0; itag < tags.size(); ++itag){ InputTag tag=tags[itag]; std::vector<InputTag> inputs; for(size_t input = 0; input < simtags.size(); ++input){ if (object=="HepMCProduct") signal = gentags[input]; else signal = simtags[input]; inputs.push_back(InputTag(signal,tag.instance())); } std::string label=tag.label()+tag.instance(); // verifyRegistry(object,std::string(""),tag,label); if (object=="HepMCProduct"){ workers_.push_back(new HiMixingWorker<HepMCProduct>(object,inputs,label)); produces<CrossingFrame<HepMCProduct> >(label); }else if (object=="SimTrack"){ workers_.push_back(new HiMixingWorker<SimTrack>(object,inputs,label)); produces<CrossingFrame<SimTrack> >(label); }else if (object=="SimVertex"){ workers_.push_back(new HiMixingWorker<SimVertex>(object,inputs,label)); produces<CrossingFrame<SimVertex> >(label); }else if (object=="PSimHit"){ workers_.push_back(new HiMixingWorker<PSimHit>(object,inputs,label)); produces<CrossingFrame<PSimHit> >(label); }else if (object=="PCaloHit"){ workers_.push_back(new HiMixingWorker<PCaloHit>(object,inputs,label)); produces<CrossingFrame<PCaloHit> >(label); }else LogInfo("Error")<<"What the hell is this object?!"; LogInfo("HiMixingModule") <<"Will mix "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label; } } produces<PileupMixingContent>(); }
HiMixingModule::~HiMixingModule | ( | ) |
Definition at line 232 of file HiMixingModule.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void HiMixingModule::beginJob | ( | void | ) | [private, virtual] |
void HiMixingModule::endJob | ( | void | ) | [private, virtual] |
void HiMixingModule::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 247 of file HiMixingModule.cc.
References i, and edm::Event::put().
bool HiMixingModule::verifyRegistry | ( | std::string | object, |
std::string | subdet, | ||
InputTag & | tag, | ||
std::string & | label | ||
) | [private] |
Definition at line 271 of file HiMixingModule.cc.
References edm::BranchDescription::className(), newFWLiteAna::found, edm::InputTag::instance(), edm::InputTag::label(), edm::BranchDescription::moduleLabel(), dbtoconf::object, and edm::BranchDescription::productInstanceName().
{ // verify that the given product exists in the product registry // and create the label to be given to the CrossingFrame edm::Service<edm::ConstProductRegistry> reg; // Loop over provenance of products in registry. std::string lookfor; if (object=="HepMCProduct") lookfor="edm::"+object;//exception for HepMCProduct else if (object=="edm::HepMCProduct") lookfor=object; else lookfor="std::vector<"+object+">"; bool found=false; for (edm::ProductRegistry::ProductList::const_iterator it = reg->productList().begin(); it != reg->productList().end(); ++it) { // See FWCore/Framework/interface/BranchDescription.h // BranchDescription contains all the information for the product. edm::BranchDescription desc = it->second; if (desc.className()==lookfor && desc.moduleLabel()==tag.label() && desc.productInstanceName()==tag.instance()) { label=desc.moduleLabel()+desc.productInstanceName(); found=true; /* wantedBranches_.push_back(desc.friendlyClassName() + '_' + desc.moduleLabel() + '_' + desc.productInstanceName()); */ break; } } if (!found) { LogWarning("MixingModule")<<"!!!!!!!!!Could not find in registry requested object: "<<object<<" with "<<tag<<".\nWill NOT be considered for mixing!!!!!!!!!"; return false; } return true; }
std::vector<HiMixingWorkerBase *> edm::HiMixingModule::workers_ [private] |
Definition at line 161 of file HiMixingModule.cc.