CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DQM/EcalEndcapMonitorTasks/interface/EESelectiveReadoutTask.h

Go to the documentation of this file.
00001 #ifndef EESelectiveReadoutTask_H
00002 #define EESelectiveReadoutTask_H
00003 
00004 /*
00005  * \file EESelectiveReadoutTask.h
00006  *
00007  * $Date: 2010/11/10 10:43:29 $
00008  * $Revision: 1.21 $
00009  * \author P. Gras
00010  * \author E. Di Marco
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 #include "DataFormats/EcalDetId/interface/EcalScDetId.h"
00018 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00019 
00020 class MonitorElement;
00021 class DQMStore;
00022 
00023 static const char endcapDccMap[401] = {
00024   "       777777       "      
00025   "    666777777888    "      
00026   "   66667777778888   "      
00027   "  6666667777888888  "
00028   " 666666677778888888 "
00029   " 566666677778888880 "             //    Z          
00030   " 555666667788888000 "             //     x-----> X 
00031   "55555566677888000000"             //     |         
00032   "555555566  880000000"             //     |         
00033   "55555555    00000000"//_          //     |         
00034   "55555554    10000000"             //     V Y       
00035   "554444444  111111100"
00036   "44444444332211111111"
00037   " 444444333222111111 "
00038   " 444443333222211111 "
00039   " 444433333222221111 "
00040   "  4443333322222111  "
00041   "   43333332222221   "
00042   "    333333222222    "
00043   "       333222       "};
00044 
00045 class EESelectiveReadoutTask: public edm::EDAnalyzer{
00046 
00047 public:
00048 
00050 EESelectiveReadoutTask(const edm::ParameterSet& ps);
00051 
00053 virtual ~EESelectiveReadoutTask();
00054 
00055 protected:
00056 
00058 void analyze(const edm::Event& e, const edm::EventSetup& c);
00059 
00061 void beginJob(void);
00062 
00064 void endJob(void);
00065 
00067 void beginRun(const edm::Run& r, const edm::EventSetup& c);
00068 
00070 void endRun(const edm::Run& r, const edm::EventSetup& c);
00071 
00073 void reset(void);
00074 
00076 void setup(void);
00077 
00079 void cleanup(void);
00080 
00082 static const int nECALDcc = 54;
00083 static const int nEEDcc = 18;
00084 static const int nEBDcc = 36;
00085 static const int kByte = 1024;
00086 
00088 static const int nDccChs = 68;
00089 
00091 static const int nEeRus = 2*(34+32+33+33+32+34+33+34+33);
00092 
00094 static const int nEndcaps = 2;
00095 
00097 static const int nEeX = 100;
00098 
00100 static const int nEeY = 100;
00101  
00103 static const int scEdge = 5;
00104 
00106 static const int nTtEta = 56;
00107 
00109 static const int nTtPhi = 72;
00110 
00112 static const int bytesPerCrystal = 24;
00113 
00115 int nCrySC[20][20][2];
00116 
00119 int nCryTT[108][41];
00120 
00122 int nEvtFullReadout[20][20][2];
00123 
00125 int nEvtRUForced[20][20][2];
00126 
00128 int nEvtZS1Readout[20][20][2];
00129 
00131 int nEvtZSReadout[20][20][2];
00132 
00134 int nEvtCompleteReadoutIfZS[20][20][2];
00135 
00137 int nEvtDroppedReadoutIfFR[20][20][2];
00138 
00140 int nEvtAnyReadout[20][20][2];
00141 
00143 int nEvtHighInterest[100][100][2];
00144 
00146 int nEvtMediumInterest[100][100][2];
00147 
00149 int nEvtLowInterest[100][100][2];
00150 
00152 int nEvtAnyInterest[100][100][2];
00153 
00154 
00155 private:
00156 
00158 enum subdet_t {EB, EE};
00159 
00163  void anaDigi(const EEDataFrame& frame, const EESrFlagCollection& srFlagColl, uint16_t statusCode);
00164 
00168 void anaDigiInit();
00169 
00174 unsigned dccNum(const DetId& xtalId) const;
00175 
00180 unsigned dccNumOfRU(const EcalScDetId& scId) const;
00181 
00187 const EcalScDetId readOutUnitOf(const EEDetId& xtalId) const;
00188   
00192 int iXY2cIndex(int iX) const{
00193   return iX-1;
00194 }
00195 
00198 int cIndex2iXY(int iX0) const{
00199   return iX0+1;
00200 }
00201 
00206 double getEeEventSize(double nReadXtals) const;
00207 
00211 double getDccOverhead(subdet_t subdet) const{
00212   //  return (subdet==EB?34:25)*8;
00213   return (subdet==EB?34:52)*8;
00214 }
00215 
00221 double getDccEventSize(int iDcc0, double nReadXtals) const{
00222   subdet_t subdet;
00223   if(iDcc0<9 || iDcc0>=45){
00224     subdet = EE;
00225   } else{
00226     subdet = EB;
00227   }
00228   return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
00229 }
00230 
00236 int dccPhiIndexOfRU(int i, int j) const;
00237 
00243 inline int dccPhiIndex(int i, int j) const {
00244   return dccPhiIndexOfRU(i/5, j/5);
00245 }
00246 
00252 int dccIndex(int iDet, int i, int j) const;
00253 
00259 void configFirWeights(std::vector<double> weightsForZsFIR);
00260 
00271 static int dccZsFIR(const EcalDataFrame& frame,
00272                     const std::vector<int>& firWeights,
00273                     int firstFIRSample,
00274                     bool* saturated = 0);
00275   
00276 
00281 static std::vector<int> getFIRWeights(const std::vector<double>&
00282                                       normalizedWeights);
00283 
00284 
00290 int getCrystalCount(int iDcc, int iDccCh);
00291 
00294 int nEe_[2];
00295 
00298 int nEeLI_[2];
00299 
00302 int nEeHI_[2];
00303 
00306 int nPerDcc_[nECALDcc];
00307 
00310 int nPerRu_[nECALDcc][nDccChs];   
00311 
00314 int nRuPerDcc_[nECALDcc];
00315 
00318 bool eeRuActive_[nEndcaps][nEeX/scEdge][nEeY/scEdge];
00319 
00322 std::vector<int> firWeights_;
00323 
00327 int firstFIRSample_;
00328 
00329 int ievt_;
00330 
00331 DQMStore* dqmStore_;
00332 
00333 std::string prefixME_;
00334 
00335 bool enableCleanup_;
00336 
00337 bool mergeRuns_;
00338 
00339 edm::InputTag EEDigiCollection_;
00340 edm::InputTag EEUnsuppressedDigiCollection_;
00341 edm::InputTag EcalRecHitCollection_;
00342 edm::InputTag EESRFlagCollection_;
00343 edm::InputTag EcalTrigPrimDigiCollection_;
00344 edm::InputTag FEDRawDataCollection_;
00345 
00346 float xbins[19];
00347 float ybins[133];
00348 
00349 MonitorElement* EEDccEventSize_;
00350 MonitorElement* EEDccEventSizeMap_;
00351 MonitorElement* EETowerSize_[2];
00352 MonitorElement* EETTFMismatch_[2];
00353 MonitorElement* EEReadoutUnitForcedBitMap_[2];
00354 MonitorElement* EEFullReadoutSRFlagMap_[2];
00355 MonitorElement* EEFullReadoutSRFlagCount_[2];
00356 MonitorElement* EEZeroSuppression1SRFlagMap_[2];
00357 MonitorElement* EEHighInterestTriggerTowerFlagMap_[2];
00358 MonitorElement* EEMediumInterestTriggerTowerFlagMap_[2];
00359 MonitorElement* EELowInterestTriggerTowerFlagMap_[2];
00360 MonitorElement* EETTFlags_[2];
00361 MonitorElement* EECompleteZSMap_[2];
00362 MonitorElement* EECompleteZSCount_[2];
00363 MonitorElement* EEDroppedFRMap_[2];
00364 MonitorElement* EEDroppedFRCount_[2];
00365 MonitorElement* EEEventSize_[2];
00366 MonitorElement* EEHighInterestPayload_[2];
00367 MonitorElement* EELowInterestPayload_[2];
00368 MonitorElement* EEHighInterestZsFIR_[2];
00369 MonitorElement* EELowInterestZsFIR_[2];
00370 
00371 bool init_;
00372 
00373 };
00374 
00375 #endif