#include <EventFilter/RawDataCollector/interface/RawDataCollectorModule.h>
Public Member Functions | |
void | produce (edm::Event &e, const edm::EventSetup &c) |
RawDataCollectorModule (const edm::ParameterSet &pset) | |
Constructor. | |
virtual | ~RawDataCollectorModule () |
Destructor. | |
Private Attributes | |
bool | useCurrentProcessOnly_ |
Definition at line 12 of file RawDataCollectorModule.h.
RawDataCollectorModule::RawDataCollectorModule | ( | const edm::ParameterSet & | pset | ) |
Constructor.
Definition at line 23 of file RawDataCollectorModule.cc.
References edm::ParameterSet::getParameter(), and useCurrentProcessOnly_.
00023 { 00024 00025 useCurrentProcessOnly_ = pset.getParameter<bool>("currentProcessOnly") ; 00026 00027 produces<FEDRawDataCollection>(); 00028 }
RawDataCollectorModule::~RawDataCollectorModule | ( | ) | [virtual] |
void RawDataCollectorModule::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Get Data from all FEDs
Implements edm::EDProducer.
Definition at line 35 of file RawDataCollectorModule.cc.
References GenMuonPlsPt100GeV_cfg::cout, FEDRawData::data(), data, FEDRawDataCollection::FEDData(), edm::Event::getManyByType(), i, j, k, FEDNumbering::lastFEDId(), edm::DataViewImpl::processHistory(), edm::Event::put(), edm::ProcessHistory::rbegin(), FEDRawData::resize(), FEDRawData::size(), size, and useCurrentProcessOnly_.
00035 { 00036 00038 std::vector< Handle<FEDRawDataCollection> > rawData; 00039 e.getManyByType(rawData); 00040 00041 std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection); 00042 00043 for (unsigned int i=0; i< rawData.size(); ++i ) { 00044 00045 const FEDRawDataCollection *rdc=rawData[i].product(); 00046 00047 if ( useCurrentProcessOnly_ && 00048 ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) ) 00049 continue ; // skip all raw collections not produced by the current process 00050 00051 for ( int j=0; j< FEDNumbering::lastFEDId(); ++j ) { 00052 const FEDRawData & fedData = rdc->FEDData(j); 00053 size_t size=fedData.size(); 00054 00055 if ( size > 0 ) { 00056 // this fed has data -- lets copy it 00057 FEDRawData & fedDataProd = producedData->FEDData(j); 00058 if ( fedDataProd.size() != 0 ) { 00059 std::cout << " More than one FEDRawDataCollection with data in FED "; 00060 std::cout << j << " Skipping the 2nd\n"; 00061 continue; 00062 } 00063 fedDataProd.resize(size); 00064 unsigned char *dataProd=fedDataProd.data(); 00065 const unsigned char *data=fedData.data(); 00066 for ( unsigned int k=0; k<size; ++k ) { 00067 dataProd[k]=data[k]; 00068 } 00069 } 00070 } 00071 } 00072 00073 // Insert the new product in the event 00074 e.put(producedData); 00075 00076 }
Definition at line 25 of file RawDataCollectorModule.h.
Referenced by produce(), and RawDataCollectorModule().