CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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::endLuminosityBlockProduce(edm::LuminosityBlock&lumi, edm::EventSetup const&setup){
00041   std::auto_ptr<edm::ConditionsInLumiBlock> lumiOut( new edm::ConditionsInLumiBlock(lumiBlock_));
00042   lumi.put( lumiOut );
00043 }
00044 
00045 void ConditionDumperInEdm::endRunProduce(edm::Run& run , const edm::EventSetup& setup){
00046   //dump of RunInfo
00047   {
00048     edm::ESHandle<RunInfo> sum;
00049     setup.get<RunInfoRcd>().get(sum);
00050     runBlock_.BStartCurrent=sum->m_start_current;
00051     runBlock_.BStopCurrent=sum->m_stop_current;
00052     runBlock_.BAvgCurrent=sum->m_avg_current;
00053   }
00054 
00055   std::auto_ptr<edm::ConditionsInRunBlock> outBlock(new edm::ConditionsInRunBlock(runBlock_));
00056   run.put(outBlock);
00057 }
00058 
00059 // ------------ method called to produce the data  ------------
00060 void
00061 ConditionDumperInEdm::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00062 {
00063 
00064   //get the L1 object 
00065   edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtReadoutRecordData;
00066   iEvent.getByLabel(gtEvmDigisLabel_, gtReadoutRecordData);
00067 
00068   if (!gtReadoutRecordData.isValid()) {
00069       LogDebug("ConditionDumperInEdm")
00070               << "\nWarning: L1GlobalTriggerEvmReadoutRecord with input tag " << gtEvmDigisLabel_
00071               << "\nrequested in configuration, but not found in the event."
00072               << "\nNo BST quantities retrieved." << std::endl;
00073 
00074       std::auto_ptr<edm::ConditionsInEventBlock> eventOut( new edm::ConditionsInEventBlock(eventBlock_));
00075       iEvent.put( eventOut );
00076 
00077       return;
00078   }
00079 
00080   const L1GtfeExtWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
00081 
00082   //lumi info
00083   lumiBlock_.totalIntensityBeam1=gtfeBlockData.totalIntensityBeam1();
00084   lumiBlock_.totalIntensityBeam2=gtfeBlockData.totalIntensityBeam2();
00085 
00086   //run info
00087   runBlock_.beamMomentum=gtfeBlockData.beamMomentum();
00088   runBlock_.beamMode=gtfeBlockData.beamMode();
00089   //  runBlock_.particleTypeBeam1=gtfeBlockData.particleTypeBeam1();
00090   //  runBlock_.particleTypeBeam2=gtfeBlockData.particleTypeBeam2();
00091   runBlock_.lhcFillNumber=gtfeBlockData.lhcFillNumber();
00092 
00093   //event info
00094   eventBlock_. bstMasterStatus= gtfeBlockData.bstMasterStatus() ;
00095   eventBlock_.turnCountNumber = gtfeBlockData.turnCountNumber();
00096 
00097   std::auto_ptr<edm::ConditionsInEventBlock> eventOut( new edm::ConditionsInEventBlock(eventBlock_));
00098   iEvent.put( eventOut );
00099 }
00100 
00101