CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/EventFilter/FEDInterface/plugins/EvFFEDSelector.cc

Go to the documentation of this file.
00001 #include "EvFFEDSelector.h"
00002 
00003 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00004 
00005 namespace evf{
00006 
00007   EvFFEDSelector::EvFFEDSelector( const edm::ParameterSet& ps)
00008     : label_(ps.getParameter<edm::InputTag>("inputTag"))
00009     , fedlist_(ps.getParameter<std::vector<unsigned int> >("fedList")) 
00010   {
00011     
00012     produces<FEDRawDataCollection>();
00013   }
00014   void EvFFEDSelector::produce(edm::Event & e, const edm::EventSetup& c)
00015   {
00016     edm::Handle<FEDRawDataCollection> rawdata;
00017     FEDRawDataCollection *fedcoll = new FEDRawDataCollection();
00018     e.getByLabel(label_,rawdata);
00019     std::vector<unsigned int>::iterator it = fedlist_.begin();
00020     for(;it!=fedlist_.end();it++)
00021       {
00022         const FEDRawData& data = rawdata->FEDData(*it);
00023         if(data.size()>0){
00024           FEDRawData& fedData=fedcoll->FEDData(*it);
00025           fedData.resize(data.size());
00026           memcpy(fedData.data(),data.data(),data.size());
00027         } 
00028       }
00029     std::auto_ptr<FEDRawDataCollection> bare_product(fedcoll);
00030     e.put(bare_product);
00031   }
00032 }