CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/EventFilter/Utilities/plugins/testGlobalNumbers.cc

Go to the documentation of this file.
00001 
00010 #include "FWCore/Framework/interface/MakerMacros.h"
00011 #include "FWCore/Framework/interface/EDAnalyzer.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00014 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
00015 #include "DataFormats/FEDRawData/interface/FEDTrailer.h"
00016 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00017 
00018 #include "EventFilter/FEDInterface/interface/GlobalEventNumber.h"
00019 
00020 #include <iostream>
00021 #include <iomanip>
00022 
00023 using namespace edm;
00024 using namespace std;
00025 
00026 namespace test{
00027 
00028   static const unsigned int GTEVMId= 812;
00029   static const unsigned int GTPEId= 814;
00030   class GlobalNumbersAnalysis: public EDAnalyzer{
00031   private:
00032   public:
00033     GlobalNumbersAnalysis(const ParameterSet& pset){
00034     }
00035 
00036  
00037     void analyze(const Event & e, const EventSetup& c){
00038       cout << "--- Run: " << e.id().run()
00039            << " LS: " << e.luminosityBlock() 
00040            << " Event: " << e.id().event() 
00041            << " Type: " << e.experimentType() << endl;
00042       Handle<FEDRawDataCollection> rawdata;
00043       e.getByLabel("source",rawdata);
00044       const FEDRawData& data = rawdata->FEDData(GTEVMId);
00045       size_t size=data.size();
00046 
00047       if (size>0 ) {
00048           cout << "FED# " << setw(4) << GTEVMId << " " << setw(8) << size << " bytes " << endl;
00049           if(evf::evtn::evm_board_sense(data.data(),size))
00050             {
00051               cout << "FED# " << setw(4) << GTEVMId << " is the real GT EVM block " << endl;
00052               cout << "Event # " << evf::evtn::get(data.data(),true) << endl;
00053               cout << "LS # " << evf::evtn::getlbn(data.data()) << endl;
00054               cout << "ORBIT # " << evf::evtn::getorbit(data.data()) << endl;
00055               cout << "GPS LOW # " << evf::evtn::getgpslow(data.data()) << endl;
00056               cout << "GPS HI # " << evf::evtn::getgpshigh(data.data()) << endl;
00057               cout << "BX FROM FDL 0-xing # " << evf::evtn::getfdlbx(data.data()) << endl;
00058               cout << "PRESCALE INDEX FROM FDL 0-xing # " << evf::evtn::getfdlpsc(data.data()) << endl;
00059             }
00060           }
00061 
00062       const FEDRawData& data2 = rawdata->FEDData(GTPEId);
00063       size=data2.size();
00064 
00065       if (size>0 ) {
00066           cout << "FED# " << setw(4) << GTPEId << " " << setw(8) << size << " bytes " << endl;
00067           if(evf::evtn::gtpe_board_sense(data2.data()))
00068             {
00069               cout << "FED# " << setw(4) << GTPEId << " is the real GTPE block " << endl;
00070               cout << "Event # " << evf::evtn::gtpe_get(data2.data()) << endl;
00071               cout << "LS # " << evf::evtn::gtpe_getlbn(data2.data()) << endl;
00072               cout << "ORBIT # " << evf::evtn::gtpe_getorbit(data2.data()) << endl;
00073               cout << "BX # " << evf::evtn::gtpe_getbx(data2.data()) << endl;
00074             }
00075           }
00076 
00077 //        CPPUNIT_ASSERT(trailer.check()==true);
00078 //        CPPUNIT_ASSERT(trailer.lenght()==(int)data.size()/8);
00079     }
00080   };
00081 DEFINE_FWK_MODULE(GlobalNumbersAnalysis);
00082 }
00083