CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/CSCRawToDigi/plugins/CSCDigiToRawModule.cc

Go to the documentation of this file.
00001 
00008 #include "EventFilter/CSCRawToDigi/src/CSCDigiToRawModule.h"
00009 #include "EventFilter/CSCRawToDigi/src/CSCDigiToRaw.h"
00010 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00011 #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h"
00012 #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h"
00013 #include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h"
00014 #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h"
00015 #include "DataFormats/CSCDigi/interface/CSCCLCTDigiCollection.h"
00016 #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
00017 #include "DataFormats/Common/interface/Handle.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "FWCore/Framework/interface/ESHandle.h"
00020 #include "FWCore/Framework/interface/EventSetup.h"
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022 #include "CondFormats/DataRecord/interface/CSCChamberMapRcd.h"
00023 
00024 
00025 
00026 using namespace edm;
00027 using namespace std;
00028 
00029 CSCDigiToRawModule::CSCDigiToRawModule(const edm::ParameterSet & pset): 
00030   packer(new CSCDigiToRaw(pset)),
00031   theStripDigiTag(pset.getParameter<edm::InputTag>("stripDigiTag")),
00032   theWireDigiTag(pset.getParameter<edm::InputTag>("wireDigiTag")),
00033   theComparatorDigiTag(pset.getParameter<edm::InputTag>("comparatorDigiTag")),
00034   theALCTDigiTag(pset.getParameter<edm::InputTag>("alctDigiTag")),
00035   theCLCTDigiTag(pset.getParameter<edm::InputTag>("clctDigiTag")),
00036   thePreTriggerTag(pset.getParameter<edm::InputTag>("preTriggerTag")),
00037   theCorrelatedLCTDigiTag(pset.getParameter<edm::InputTag>("correlatedLCTDigiTag"))
00038 {
00039   //theStrip = pset.getUntrackedParameter<string>("DigiCreator", "cscunpacker");
00040   produces<FEDRawDataCollection>("CSCRawData"); 
00041 }
00042 
00043 
00044 CSCDigiToRawModule::~CSCDigiToRawModule(){
00045   delete packer;
00046 }
00047 
00048 
00049 void CSCDigiToRawModule::produce(Event & e, const EventSetup& c){
00051   edm::ESHandle<CSCChamberMap> hcham;
00052   c.get<CSCChamberMapRcd>().get(hcham); 
00053   const CSCChamberMap* theMapping = hcham.product();
00054 
00055 
00056   auto_ptr<FEDRawDataCollection> fed_buffers(new FEDRawDataCollection);
00057   // Take digis from the event
00058   Handle<CSCStripDigiCollection> stripDigis;
00059   e.getByLabel(theStripDigiTag, stripDigis);
00060   Handle<CSCWireDigiCollection> wireDigis;
00061   e.getByLabel(theWireDigiTag, wireDigis);
00062   Handle<CSCComparatorDigiCollection> comparatorDigis;
00063   e.getByLabel(theComparatorDigiTag, comparatorDigis);
00064   Handle<CSCALCTDigiCollection> alctDigis;
00065   e.getByLabel(theALCTDigiTag, alctDigis);
00066   Handle<CSCCLCTDigiCollection> clctDigis;
00067   e.getByLabel(theCLCTDigiTag, clctDigis);
00068   Handle<CSCCLCTPreTriggerCollection> preTriggers;
00069   e.getByLabel(thePreTriggerTag, preTriggers);
00070   Handle<CSCCorrelatedLCTDigiCollection> correlatedLCTDigis;
00071   e.getByLabel(theCorrelatedLCTDigiTag, correlatedLCTDigis);
00072 
00073 
00074 
00075   // Create the packed data
00076   packer->createFedBuffers(*stripDigis, *wireDigis, *comparatorDigis, 
00077                            *alctDigis, *clctDigis, *preTriggers, *correlatedLCTDigis,
00078                            *(fed_buffers.get()), theMapping, e);
00079   
00080   // put the raw data to the event
00081   e.put(fed_buffers, "CSCRawData");
00082 }
00083 
00084