CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/EventFilter/EcalRawToDigi/interface/EcalDumpRaw.h

Go to the documentation of this file.
00001 /*
00002  * $Id: EcalDumpRaw.h,v 1.2 2010/06/30 09:10:57 pgras Exp $
00003  *
00004  * Author: Ph Gras. CEA/IRFU - Saclay
00005  */
00006 
00007 #ifndef ECALDUMPRAW_H
00008 #define ECALDUMPRAW_H
00009 
00010 #include <vector>
00011 #include <iostream>
00012 #include <fstream>
00013 #include <sstream>
00014 #include <string>
00015 #include <inttypes.h>
00016 //#include "pgras/PGUtilities/interface/PGHisto.h"
00017 
00018 #include "FWCore/Framework/interface/Frameworkfwd.h"
00019 #include "FWCore/Framework/interface/EDAnalyzer.h"
00020 
00032 class EcalDumpRaw : public edm::EDAnalyzer {
00033   //ctors
00034 public:
00035   explicit EcalDumpRaw(const edm::ParameterSet&);
00036   ~EcalDumpRaw();
00037 
00038 
00039   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00040 
00041   void analyzeEB(const edm::Event&, const edm::EventSetup&) const;
00042   void analyzeEE(const edm::Event&, const edm::EventSetup&) const;
00043   void endJob();  
00044   //methods
00045 public:
00046 private:
00047   void analyzeFed(int fedId);
00048   void analyzeApd();
00049   std::string toNth(int n);
00050   bool decode(const uint32_t* data, int iWord32, std::ostream& out);
00051   double max(std::vector<double> a, unsigned& pos){
00052     pos = 0;
00053     double m = a[pos];
00054     for(unsigned i = 1; i < a.size(); ++i){
00055       if(a[i]>m){ m = a[i]; pos = i;}
00056     }
00057     return m;
00058   }
00059   double min(std::vector<double> a){
00060     double m = a[0];
00061     for(unsigned i = 1; i < a.size(); ++i){
00062       if(a[i]<m) m = a[i];
00063     }
00064     return m;
00065   }
00066   static int lme(int dccId1, int side);
00067 
00068   template<class T>
00069   std::string toString(T val){
00070     std::stringstream s;
00071     s << val;
00072     return s.str();
00073   }
00074 
00075   static int sideOfRu(int ru1);
00076   
00077   static int modOfRu(int ru1);
00078 
00079   static int lmodOfRu(int ru1);
00080 
00081   std::string srRange(int offset) const;
00082 
00083   std::string ttfTag(int tccType, unsigned iSeq) const;
00084 
00085   std::string tpgTag(int tccType, unsigned iSeq) const;
00086   
00087   //fields
00088 private:
00089   int      verbosity_;
00090   bool     writeDcc_;
00091   int      beg_fed_id_;
00092   int      end_fed_id_;
00093   int      first_event_;
00094   int      last_event_;
00095   std::string   filename_;
00096   int      iEvent_;
00097 
00098   unsigned iTowerWord64_;
00099   unsigned iSrWord64_;
00100   unsigned iTccWord64_;
00101   enum {inDaqHeader, inDccHeader, inTccBlock, inSrBlock, inTowerBlock}
00102   decodeState_;
00103   size_t towerBlockLength_;
00104 
00105   std::vector<double> adc_;
00106 
00107   static const int nSamples = 10;
00108   double amplCut_;
00109   bool dump_;
00110   bool dumpAdc_;
00111   //  bool doHisto_;
00112   int maxEvt_;
00113   int profileFedId_;
00114   int profileRuId_;
00115   int l1aMinX_;
00116   int l1aMaxX_;
00117   int dccCh_;
00118   std::vector<uint32_t> lastOrbit_;
00119   static const unsigned nDccs_ = 54;
00120   static const unsigned fedStart_ = 601;
00121   static const int maxTpgsPerTcc_ = 68;
00122   static const int maxTccsPerDcc_ = 4;
00123 
00124 
00126 
00128   static const int ebmTcc_    = 0;
00129   static const int ebpTcc_    = 1;
00130   static const int eeInnerTcc_   = 2;
00131   static const int eeOuterTcc_  = 3;
00132   static const int nTccTypes_ = 4;
00134 
00137   static const int ttId_[nTccTypes_][maxTpgsPerTcc_];
00138   
00139   unsigned fedId_;
00140   unsigned dccId_;
00141   unsigned side_;
00142   unsigned eventId_;
00143   std::vector<unsigned> eventList_;
00144   unsigned minEventId_;
00145   unsigned maxEventId_;
00146   unsigned orbit0_;
00147   uint32_t orbit_;
00148   bool orbit0Set_;
00149   int bx_;
00150   int l1a_;
00151   int l1amin_;
00152   int l1amax_;
00153   int simpleTrigType_;
00154   int detailedTrigType_;
00155   //  PGHisto histo_;
00156   std::vector<std::vector<uint32_t> > l1as_;
00157   std::vector<std::vector<uint32_t> > orbits_;
00158   std::vector<std::vector<int> > tpg_;
00159   std::vector<int> nTpgs_;
00160   int iRu_;
00161   int srpL1a_;
00162   int tccL1a_;
00163   //Number of TPGs in TCC block currently parsed:
00164   int nTts_;
00165   //Length of TCC block currently parsed:
00166   int tccBlockLen64_;
00167   static const int nRu_ = 70;
00168   std::vector<int> feL1a_;
00169   int srpBx_;
00170   int tccBx_;
00172   int tccType_;
00173   std::vector<int> feBx_;
00174   std::vector<int> feRuId_;
00175   int iTow_;
00176   std::ofstream dumpFile_;
00177   bool pulsePerRu_;
00178   bool pulsePerLmod_;
00179   bool pulsePerLme_;
00180   int tccId_;
00181   //tcc sequence number of currenlty parsed tower block of one DCC
00182   int iTcc_;
00183 };
00184 
00185 #endif //ECALDUMPRAW_H not defined