Go to the documentation of this file.00001
00002
00003
00004
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
00017
00018 #include "FWCore/Framework/interface/Frameworkfwd.h"
00019 #include "FWCore/Framework/interface/EDAnalyzer.h"
00020
00032 class EcalDumpRaw : public edm::EDAnalyzer {
00033
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
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
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
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 l1aHistory_;
00112
00113 int maxEvt_;
00114 int profileFedId_;
00115 int profileRuId_;
00116 int l1aMinX_;
00117 int l1aMaxX_;
00118 int dccCh_;
00119 std::vector<uint32_t> lastOrbit_;
00120 static const unsigned nDccs_ = 54;
00121 static const unsigned fedStart_ = 601;
00122 static const int maxTpgsPerTcc_ = 68;
00123 static const int maxTccsPerDcc_ = 4;
00124
00125
00127
00129 static const int ebmTcc_ = 0;
00130 static const int ebpTcc_ = 1;
00131 static const int eeInnerTcc_ = 2;
00132 static const int eeOuterTcc_ = 3;
00133 static const int nTccTypes_ = 4;
00135
00138 static const int ttId_[nTccTypes_][maxTpgsPerTcc_];
00139
00140 unsigned fedId_;
00141 unsigned dccId_;
00142 unsigned side_;
00143 unsigned eventId_;
00144 std::vector<unsigned> eventList_;
00145 unsigned minEventId_;
00146 unsigned maxEventId_;
00147 unsigned orbit0_;
00148 uint32_t orbit_;
00149 bool orbit0Set_;
00150 int bx_;
00151 int l1a_;
00152 int l1amin_;
00153 int l1amax_;
00154 int simpleTrigType_;
00155 int detailedTrigType_;
00156
00157 std::vector<std::vector<uint32_t> > l1as_;
00158 std::vector<std::vector<uint32_t> > orbits_;
00159 std::vector<std::vector<int> > tpg_;
00160 std::vector<int> nTpgs_;
00161 std::vector<int> dccChStatus_;
00162 int iRu_;
00163 int srpL1a_;
00164 int tccL1a_;
00165
00166 int nTts_;
00167
00168 int tccBlockLen64_;
00169 static const int nRu_ = 70;
00170 std::vector<int> feL1a_;
00171 int srpBx_;
00172 int tccBx_;
00174 int tccType_;
00175 std::vector<int> feBx_;
00176 std::vector<int> feRuId_;
00177 int iTow_;
00178 std::ofstream dumpFile_;
00179 bool pulsePerRu_;
00180 bool pulsePerLmod_;
00181 bool pulsePerLme_;
00182 int tccId_;
00183
00184 int iTcc_;
00185 };
00186
00187 #endif //ECALDUMPRAW_H not defined