00001 #ifndef EESelectiveReadoutTask_H
00002 #define EESelectiveReadoutTask_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "FWCore/Framework/interface/EDAnalyzer.h"
00015 #include "FWCore/Framework/interface/Event.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017
00018 class MonitorElement;
00019 class DQMStore;
00020
00021 static const char endcapDccMap[401] = {
00022 " 777777 "
00023 " 666777777888 "
00024 " 66667777778888 "
00025 " 6666667777888888 "
00026 " 666666677778888888 "
00027 " 566666677778888880 "
00028 " 555666667788888000 "
00029 "55555566677888000000"
00030 "555555566 880000000"
00031 "55555555 00000000"
00032 "55555554 10000000"
00033 "554444444 111111100"
00034 "44444444332211111111"
00035 " 444444333222111111 "
00036 " 444443333222211111 "
00037 " 444433333222221111 "
00038 " 4443333322222111 "
00039 " 43333332222221 "
00040 " 333333222222 "
00041 " 333222 "};
00042
00043 class EESelectiveReadoutTask: public edm::EDAnalyzer{
00044
00045 public:
00046
00048 EESelectiveReadoutTask(const edm::ParameterSet& ps);
00049
00051 virtual ~EESelectiveReadoutTask();
00052
00053 protected:
00054
00056 void analyze(const edm::Event& e, const edm::EventSetup& c);
00057
00059 void beginJob(const edm::EventSetup& c);
00060
00062 void endJob(void);
00063
00065 void beginRun(const edm::Run& r, const edm::EventSetup& c);
00066
00068 void endRun(const edm::Run& r, const edm::EventSetup& c);
00069
00071 void reset(void);
00072
00074 void setup(void);
00075
00077 void cleanup(void);
00078
00080 static const int nECALDcc = 54;
00081 static const int nEEDcc = 18;
00082 static const int nEBDcc = 36;
00083 static const int kByte = 1024;
00084
00086 static const int nEeRus = 2*(34+32+33+33+32+34+33+34+33);
00087
00089 static const int nEndcaps = 2;
00090
00092 static const int nEeX = 100;
00093
00095 static const int nEeY = 100;
00096
00098 static const int scEdge = 5;
00099
00101 static const int nTtEta = 56;
00102
00104 static const int nTtPhi = 72;
00105
00107 static const int bytesPerCrystal = 24;
00108
00109 private:
00110
00112 enum subdet_t {EB, EE};
00113
00117 void anaDigi(const EEDataFrame& frame, const EESrFlagCollection& srFlagColl);
00118
00122 void anaDigiInit();
00123
00128 unsigned dccNum(const DetId& xtalId) const;
00129
00135 EcalScDetId readOutUnitOf(const EEDetId& xtalId) const;
00136
00140 int iXY2cIndex(int iX) const{
00141 return iX-1;
00142 }
00143
00146 int cIndex2iXY(int iX0) const{
00147 return iX0+1;
00148 }
00149
00154 double getEeEventSize(double nReadXtals) const;
00155
00159 double getDccOverhead(subdet_t subdet) const{
00160
00161 return (subdet==EB?34:52)*8;
00162 }
00163
00169 double getDccEventSize(int iDcc0, double nReadXtals) const{
00170 subdet_t subdet;
00171 if(iDcc0<9 || iDcc0>=45){
00172 subdet = EE;
00173 } else{
00174 subdet = EB;
00175 }
00176 return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
00177 }
00178
00184 int dccPhiIndexOfRU(int i, int j) const;
00185
00191 inline int dccPhiIndex(int i, int j) const {
00192 return dccPhiIndexOfRU(i/5, j/5);
00193 }
00194
00200 int dccIndex(int iDet, int i, int j) const;
00201
00204 int nEe_[2];
00205
00208 int nEeLI_[2];
00209
00212 int nEeHI_[2];
00213
00216 int nPerDcc_[nECALDcc];
00217
00220 int nRuPerDcc_[nECALDcc];
00221
00224 bool eeRuActive_[nEndcaps][nEeX/scEdge][nEeY/scEdge];
00225
00226 int ievt_;
00227
00228 DQMStore* dqmStore_;
00229
00230 std::string prefixME_;
00231
00232 bool enableCleanup_;
00233
00234 bool mergeRuns_;
00235
00236 edm::InputTag EEDigiCollection_;
00237 edm::InputTag EEUnsuppressedDigiCollection_;
00238 edm::InputTag EcalRecHitCollection_;
00239 edm::InputTag EESRFlagCollection_;
00240 edm::InputTag EcalTrigPrimDigiCollection_;
00241 edm::InputTag FEDRawDataCollection_;
00242
00243 MonitorElement* EEDccEventSize_;
00244 MonitorElement* EEReadoutUnitForcedBitMap_[2];
00245 MonitorElement* EEFullReadoutSRFlagMap_[2];
00246 MonitorElement* EEHighInterestTriggerTowerFlagMap_[2];
00247 MonitorElement* EELowInterestTriggerTowerFlagMap_[2];
00248 MonitorElement* EEEventSize_[2];
00249 MonitorElement* EEHighInterestPayload_[2];
00250 MonitorElement* EELowInterestPayload_[2];
00251
00252 bool init_;
00253
00254 };
00255
00256 #endif