CMS 3D CMS Logo

RPCFileReader.h

Go to the documentation of this file.
00001 #ifndef RPCFILEREADER_RPCFILEREADER_H
00002 #define RPCFILEREADER_RPCFILEREADER_H
00003 
00012 #include <memory>
00013 #include <string>
00014 #include <cctype>
00015 
00016 #include "FWCore/Framework/interface/Frameworkfwd.h"
00017 #include "FWCore/Sources/interface/ExternalInputSource.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "FWCore/Framework/interface/MakerMacros.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 
00022 #include "IORawData/RPCFileReader/interface/RPCPacData.h"
00023 
00024 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00025 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00026 
00027 
00028 class RPCFileReader : public edm::ExternalInputSource {
00029 
00030  public:
00031   explicit RPCFileReader(edm::ParameterSet const& pset, edm::InputSourceDescription const& desc);
00032 
00033   ~RPCFileReader();
00034   
00035   virtual bool produce(edm::Event &);
00036   virtual void setRunAndEventInfo();
00037 
00038  private:
00039 
00040   //typedefs
00041   typedef struct{unsigned int year; std::string month; unsigned int day, hour, min, sec;} Time;
00042   typedef struct{int ptCode, quality, sign;} LogCone;
00043   typedef unsigned short Word16;
00044   typedef unsigned long long Word64;
00045 
00046   //data members
00047   int run_, event_, bxn_;
00048   Time timeStamp_;
00049   std::vector<std::vector<LogCone> > theLogCones_;//(12)
00050   std::vector<std::vector<std::vector<std::vector<RPCPacData> > > > linkData_;//(3,18,3)
00051 
00052   bool isOpen_, noMoreData_;
00053   int eventPos_[2];
00054   int fileCounter_, eventCounter_;
00055 
00056   bool debug_,saveOutOfTime_,pacTrigger_,maskChannels_;
00057 
00058   unsigned int triggerFedId_;//, tbNum_;
00059   std::vector<unsigned int> tbNums_;
00060 
00061   // consts
00062   //FIXME: Checked
00063   const static int RPC_PAC_TRIGGER_DELAY=11;
00064   const static int RPC_PAC_L1ACCEPT_BX=2;
00065   
00066   const static int LAST_BX=6; 
00067   const static int FIRST_BX=-2; 
00068 
00069   std::vector<std::vector<bool> > maskedChannels;
00070 
00071   // methods
00072   void readDataFromAsciiFile(std::string fileName, int *pos);
00073   
00074   Word16 buildCDWord(RPCPacData linkData);
00075   Word16 buildSLDWord(unsigned int tbNum, unsigned int linkNum);
00076   Word16 buildSBXDWord(unsigned int bxn);
00077   Word16 buildEmptyWord();
00078     
00079   FEDRawData* rpcDataFormatter();
00080 
00081   bool isHexNumber(std::string str){//utility to check if string is hex
00082     for(unsigned int i=0; i<str.size(); i++)
00083       if(! isxdigit(str[i])) return false;
00084     return true;
00085   }
00086 
00087 };
00088 
00089 #endif //RPCFILEREADER_RPCFILEREADER_H

Generated on Tue Jun 9 17:39:26 2009 for CMSSW by  doxygen 1.5.4