CMS 3D CMS Logo

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

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