00001 00010 #include "RecoLocalCalo/EcalRecProducers/plugins/EcalCompactTrigPrimProducer.h" 00011 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" 00012 00013 00014 EcalCompactTrigPrimProducer::EcalCompactTrigPrimProducer(const edm::ParameterSet& ps): 00015 inCollection_(ps.getParameter<edm::InputTag>("inColl")), 00016 outCollection_(ps.getParameter<std::string>("outColl")) 00017 { 00018 00019 produces<EcalTrigPrimCompactColl>(outCollection_); 00020 } 00021 00022 void EcalCompactTrigPrimProducer::produce(edm::Event& event, const edm::EventSetup& es) 00023 { 00024 std::auto_ptr<EcalTrigPrimCompactColl> outColl(new EcalTrigPrimCompactColl); 00025 edm::Handle<EcalTrigPrimDigiCollection> hTPDigis; 00026 event.getByLabel(inCollection_, hTPDigis); 00027 00028 const EcalTrigPrimDigiCollection* trigPrims = hTPDigis.product(); 00029 00030 for(EcalTrigPrimDigiCollection::const_iterator trigPrim = trigPrims->begin(); 00031 trigPrim != trigPrims->end(); ++trigPrim){ 00032 outColl->setValue(trigPrim->id().ieta(), trigPrim->id().iphi(), trigPrim->sample(trigPrim->sampleOfInterest()).raw()); 00033 } 00034 event.put(outColl, outCollection_); 00035 }