CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/L1GlobalTriggerRawToDigi/src/ConditionDumperInEdm.cc

Go to the documentation of this file.
00001 #include "EventFilter/L1GlobalTriggerRawToDigi/interface/ConditionDumperInEdm.h"
00002 #include <memory>
00003 
00004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00005 
00006 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
00007 #include "DataFormats/L1GlobalTrigger/interface/L1GtfeExtWord.h"
00008 
00009 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00010 #include "CondFormats/RunInfo/interface/RunInfo.h"
00011 
00012 
00013 //
00014 // constructors and destructor
00015 //
00016 ConditionDumperInEdm::ConditionDumperInEdm(const edm::ParameterSet& iConfig)
00017 {
00018   
00019   gtEvmDigisLabel_ = iConfig.getParameter<edm::InputTag>("gtEvmDigisLabel");
00020 
00021 
00022   //per LUMI products
00023   produces<edm::ConditionsInLumiBlock,edm::InLumi>();
00024   //per RUN products
00025   produces<edm::ConditionsInRunBlock,edm::InRun>();
00026   //per EVENT products
00027   produces<edm::ConditionsInEventBlock>();
00028 
00029 }
00030 
00031 
00032 ConditionDumperInEdm::~ConditionDumperInEdm()
00033 {
00034 }
00035 
00036 
00037 //
00038 // member functions
00039 //
00040 void ConditionDumperInEdm::beginLuminosityBlock(edm::LuminosityBlock&lumi, edm::EventSetup const&setup){
00041 }
00042 void ConditionDumperInEdm::endLuminosityBlock(edm::LuminosityBlock&lumi, edm::EventSetup const&setup){
00043   std::auto_ptr<edm::ConditionsInLumiBlock> lumiOut( new edm::ConditionsInLumiBlock(lumiBlock_));
00044   lumi.put( lumiOut );
00045 }
00046 
00047 void ConditionDumperInEdm::beginRun(edm::Run& run , const edm::EventSetup& setup){
00048 }
00049 
00050 void ConditionDumperInEdm::endRun(edm::Run& run , const edm::EventSetup& setup){
00051   //dump of RunInfo
00052   {
00053     edm::ESHandle<RunInfo> sum;
00054     setup.get<RunInfoRcd>().get(sum);
00055     runBlock_.BStartCurrent=sum->m_start_current;
00056     runBlock_.BStopCurrent=sum->m_stop_current;
00057     runBlock_.BAvgCurrent=sum->m_avg_current;
00058   }
00059 
00060   std::auto_ptr<edm::ConditionsInRunBlock> outBlock(new edm::ConditionsInRunBlock(runBlock_));
00061   run.put(outBlock);
00062 }
00063 
00064 // ------------ method called to produce the data  ------------
00065 void
00066 ConditionDumperInEdm::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00067 {
00068 
00069   //get the L1 object 
00070   edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtReadoutRecordData;
00071   iEvent.getByLabel(gtEvmDigisLabel_, gtReadoutRecordData);
00072 
00073   if (!gtReadoutRecordData.isValid()) {
00074       LogDebug("ConditionDumperInEdm")
00075               << "\nWarning: L1GlobalTriggerEvmReadoutRecord with input tag " << gtEvmDigisLabel_
00076               << "\nrequested in configuration, but not found in the event."
00077               << "\nNo BST quantities retrieved." << std::endl;
00078 
00079       std::auto_ptr<edm::ConditionsInEventBlock> eventOut( new edm::ConditionsInEventBlock(eventBlock_));
00080       iEvent.put( eventOut );
00081 
00082       return;
00083   }
00084 
00085   const L1GtfeExtWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
00086 
00087   //lumi info
00088   lumiBlock_.totalIntensityBeam1=gtfeBlockData.totalIntensityBeam1();
00089   lumiBlock_.totalIntensityBeam2=gtfeBlockData.totalIntensityBeam2();
00090 
00091   //run info
00092   runBlock_.beamMomentum=gtfeBlockData.beamMomentum();
00093   runBlock_.beamMode=gtfeBlockData.beamMode();
00094   //  runBlock_.particleTypeBeam1=gtfeBlockData.particleTypeBeam1();
00095   //  runBlock_.particleTypeBeam2=gtfeBlockData.particleTypeBeam2();
00096   runBlock_.lhcFillNumber=gtfeBlockData.lhcFillNumber();
00097 
00098   //event info
00099   eventBlock_. bstMasterStatus= gtfeBlockData.bstMasterStatus() ;
00100   eventBlock_.turnCountNumber = gtfeBlockData.turnCountNumber();
00101 
00102   std::auto_ptr<edm::ConditionsInEventBlock> eventOut( new edm::ConditionsInEventBlock(eventBlock_));
00103   iEvent.put( eventOut );
00104 }
00105 
00106