示例#1
0
void IsoMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){
  auto mu_pt = make_auto(new std::vector<float>);
  auto mu_phi = make_auto(new std::vector<float>);
  auto mu_eta = make_auto(new std::vector<float>);
  auto mu_iso = make_auto(new std::vector<float>);
  
  edm::Handle<edm::ValueMap<double> > iso_handle;
  edm::Handle<std::vector<reco::RecoChargedCandidate> > muon_handle;
  iEvent.getByToken(iso_token_, iso_handle);
  iEvent.getByToken(cand_token_, muon_handle);
  
  for(auto it = iso_handle->begin(); it != iso_handle->end(); ++it){
    for(auto ite = it.begin(); ite != it.end(); ++ite){
      mu_iso->push_back(*ite);
    }
  }
  
  for(auto it = muon_handle->begin(); it != muon_handle->end(); ++it){
    mu_pt->push_back(it->pt());
    mu_phi->push_back(it->phi());
    mu_eta->push_back(it->eta());
  }

  iEvent.put(mu_pt, "mupt");
  iEvent.put(mu_phi, "muphi");
  iEvent.put(mu_eta, "mueta");
  iEvent.put(mu_iso, "muiso");
}
 void 
 SleepingProducer::produce(edm::Event& iEvent) {
   //printf("Producer %s\n",label().c_str());
   int sum=0;
   for(std::vector<const Getter*>::iterator it = m_getters.begin(), itEnd=m_getters.end();
       it != itEnd;
       ++it) {
     sum +=iEvent.get(*it);
     //printf("%s got %s with value %i\n",label().c_str(), (*it)->label().c_str(), iEvent.get((*it)));
   }
   wait(iEvent);
   iEvent.put(this,"",static_cast<int>(sum));
 }