CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoLocalCalo/HcalLaserReco/src/HcalLaserReco.cc

Go to the documentation of this file.
00001 #include "FWCore/Framework/interface/EDProducer.h"
00002 #include "FWCore/Framework/interface/Event.h"
00003 #include "DataFormats/Common/interface/Handle.h"
00004 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00005 #include "DataFormats/HcalDigi/interface/HcalLaserDigi.h"
00006 #include "RecoLocalCalo/HcalLaserReco/src/HcalLaserUnpacker.h"
00007 #include "DataFormats/Common/interface/EDCollection.h"
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 #include "FWCore/Utilities/interface/InputTag.h"
00010 
00011 #include <iostream>
00012 #include <fstream>
00013 
00014 
00015 class HcalLaserReco : public edm::EDProducer {
00016 public:
00017   explicit HcalLaserReco(const edm::ParameterSet& ps);
00018   virtual ~HcalLaserReco();
00019   virtual void produce(edm::Event& e, const edm::EventSetup& c);
00020 private:
00021   int qdctdcFed_;
00022   HcalLaserUnpacker unpacker_;
00023   edm::InputTag fedRawDataCollectionTag_;
00024 };
00025 
00026 HcalLaserReco::HcalLaserReco(edm::ParameterSet const& conf):
00027   qdctdcFed_(conf.getUntrackedParameter<int>("QADCTDCFED",8)),
00028   fedRawDataCollectionTag_(conf.getParameter<edm::InputTag>("fedRawDataCollectionTag"))
00029 {
00030   
00031     produces<HcalLaserDigi>();
00032 }
00033 
00034 // Virtual destructor needed.
00035 HcalLaserReco::~HcalLaserReco() { }  
00036 
00037 // Functions that gets called by framework every event
00038 void HcalLaserReco::produce(edm::Event& e, const edm::EventSetup&)
00039 {
00040   // Step A: Get Inputs 
00041   edm::Handle<FEDRawDataCollection> rawraw;
00042   e.getByLabel(fedRawDataCollectionTag_, rawraw);
00043 
00044   // Step B: Create empty output    
00045   std::auto_ptr<HcalLaserDigi>
00046     digi(new HcalLaserDigi);
00047     
00048   if (qdctdcFed_ >=0) {
00049     // Step C: unpack all requested FEDs
00050     const FEDRawData& fed = rawraw->FEDData(qdctdcFed_);
00051     unpacker_.unpack(fed,*digi);
00052   }
00053   
00054   // Step D: Put outputs into event
00055   e.put(digi);
00056 }
00057 
00058 #include "FWCore/PluginManager/interface/ModuleDef.h"
00059 #include "FWCore/Framework/interface/MakerMacros.h"
00060 
00061 DEFINE_FWK_MODULE(HcalLaserReco);
00062