CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/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: 2011/03/03 22:05:50 $
00008  * $Revision: 1.22 $
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 class EcalSRSettings;
00023 
00024 static const char endcapDccMap[401] = {
00025   "       777777       "      
00026   "    666777777888    "      
00027   "   66667777778888   "      
00028   "  6666667777888888  "
00029   " 666666677778888888 "
00030   " 566666677778888880 "             //    Z          
00031   " 555666667788888000 "             //     x-----> X 
00032   "55555566677888000000"             //     |         
00033   "555555566  880000000"             //     |         
00034   "55555555    00000000"//_          //     |         
00035   "55555554    10000000"             //     V Y       
00036   "554444444  111111100"
00037   "44444444332211111111"
00038   " 444444333222111111 "
00039   " 444443333222211111 "
00040   " 444433333222221111 "
00041   "  4443333322222111  "
00042   "   43333332222221   "
00043   "    333333222222    "
00044   "       333222       "};
00045 
00046 class EESelectiveReadoutTask: public edm::EDAnalyzer{
00047 
00048 public:
00049 
00051 EESelectiveReadoutTask(const edm::ParameterSet& ps);
00052 
00054 virtual ~EESelectiveReadoutTask();
00055 
00056 protected:
00057 
00059 void analyze(const edm::Event& e, const edm::EventSetup& c);
00060 
00062 void beginJob(void);
00063 
00065 void endJob(void);
00066 
00068 void beginRun(const edm::Run& r, const edm::EventSetup& c);
00069 
00071 void endRun(const edm::Run& r, const edm::EventSetup& c);
00072 
00074 void reset(void);
00075 
00077 void setup(void);
00078 
00080 void cleanup(void);
00081 
00083 static const int nECALDcc = 54;
00084 static const int nEEDcc = 18;
00085 static const int nEBDcc = 36;
00086 static const int kByte = 1024;
00087 
00089 static const int nDccChs = 68;
00090 
00092 static const int nEeRus = 2*(34+32+33+33+32+34+33+34+33);
00093 
00095 static const int nEndcaps = 2;
00096 
00098 static const int nEeX = 100;
00099 
00101 static const int nEeY = 100;
00102  
00104 static const int scEdge = 5;
00105 
00107 static const int nTtEta = 56;
00108 
00110 static const int nTtPhi = 72;
00111 
00113 static const int bytesPerCrystal = 24;
00114 
00116 int nCrySC[20][20][2];
00117 
00120 int nCryTT[108][41];
00121 
00123 int nEvtFullReadout[20][20][2];
00124 
00126 int nEvtRUForced[20][20][2];
00127 
00129 int nEvtZS1Readout[20][20][2];
00130 
00132 int nEvtZSReadout[20][20][2];
00133 
00135 int nEvtCompleteReadoutIfZS[20][20][2];
00136 
00138 int nEvtDroppedReadoutIfFR[20][20][2];
00139 
00141 int nEvtAnyReadout[20][20][2];
00142 
00144 int nEvtHighInterest[100][100][2];
00145 
00147 int nEvtMediumInterest[100][100][2];
00148 
00150 int nEvtLowInterest[100][100][2];
00151 
00153 int nEvtAnyInterest[100][100][2];
00154 
00155 
00156 private:
00157 
00159 enum subdet_t {EB, EE};
00160 
00164  void anaDigi(const EEDataFrame& frame, const EESrFlagCollection& srFlagColl, uint16_t statusCode);
00165 
00169 void anaDigiInit();
00170 
00175 unsigned dccNum(const DetId& xtalId) const;
00176 
00181 unsigned dccNumOfRU(const EcalScDetId& scId) const;
00182 
00188 const EcalScDetId readOutUnitOf(const EEDetId& xtalId) const;
00189   
00193 int iXY2cIndex(int iX) const{
00194   return iX-1;
00195 }
00196 
00199 int cIndex2iXY(int iX0) const{
00200   return iX0+1;
00201 }
00202 
00207 double getEeEventSize(double nReadXtals) const;
00208 
00212 double getDccOverhead(subdet_t subdet) const{
00213   //  return (subdet==EB?34:25)*8;
00214   return (subdet==EB?34:52)*8;
00215 }
00216 
00222 double getDccEventSize(int iDcc0, double nReadXtals) const{
00223   subdet_t subdet;
00224   if(iDcc0<9 || iDcc0>=45){
00225     subdet = EE;
00226   } else{
00227     subdet = EB;
00228   }
00229   return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
00230 }
00231 
00237 int dccPhiIndexOfRU(int i, int j) const;
00238 
00244 inline int dccPhiIndex(int i, int j) const {
00245   return dccPhiIndexOfRU(i/5, j/5);
00246 }
00247 
00253 int dccIndex(int iDet, int i, int j) const;
00254 
00260 void configFirWeights(std::vector<double> weightsForZsFIR);
00261 
00272 static int dccZsFIR(const EcalDataFrame& frame,
00273                     const std::vector<int>& firWeights,
00274                     int firstFIRSample,
00275                     bool* saturated = 0);
00276   
00277 
00282 static std::vector<int> getFIRWeights(const std::vector<double>&
00283                                       normalizedWeights);
00284 
00285 
00291 int getCrystalCount(int iDcc, int iDccCh);
00292 
00295 int nEe_[2];
00296 
00299 int nEeLI_[2];
00300 
00303 int nEeHI_[2];
00304 
00307 int nPerDcc_[nECALDcc];
00308 
00311 int nPerRu_[nECALDcc][nDccChs];   
00312 
00315 int nRuPerDcc_[nECALDcc];
00316 
00319 bool eeRuActive_[nEndcaps][nEeX/scEdge][nEeY/scEdge];
00320 
00323 std::vector<int> firWeights_;
00324 
00328 int firstFIRSample_;
00329 
00330 int ievt_;
00331 
00332 DQMStore* dqmStore_;
00333 
00334 std::string prefixME_;
00335 
00336 bool enableCleanup_;
00337 
00338 bool mergeRuns_;
00339 
00340 edm::InputTag EEDigiCollection_;
00341 edm::InputTag EEUnsuppressedDigiCollection_;
00342 edm::InputTag EcalRecHitCollection_;
00343 edm::InputTag EESRFlagCollection_;
00344 edm::InputTag EcalTrigPrimDigiCollection_;
00345 edm::InputTag FEDRawDataCollection_;
00346 
00347 float xbins[19];
00348 float ybins[133];
00349 
00350 MonitorElement* EEDccEventSize_;
00351 MonitorElement* EEDccEventSizeMap_;
00352 MonitorElement* EETowerSize_[2];
00353 MonitorElement* EETTFMismatch_[2];
00354 MonitorElement* EEReadoutUnitForcedBitMap_[2];
00355 MonitorElement* EEFullReadoutSRFlagMap_[2];
00356 MonitorElement* EEFullReadoutSRFlagCount_[2];
00357 MonitorElement* EEZeroSuppression1SRFlagMap_[2];
00358 MonitorElement* EEHighInterestTriggerTowerFlagMap_[2];
00359 MonitorElement* EEMediumInterestTriggerTowerFlagMap_[2];
00360 MonitorElement* EELowInterestTriggerTowerFlagMap_[2];
00361 MonitorElement* EETTFlags_[2];
00362 MonitorElement* EECompleteZSMap_[2];
00363 MonitorElement* EECompleteZSCount_[2];
00364 MonitorElement* EEDroppedFRMap_[2];
00365 MonitorElement* EEDroppedFRCount_[2];
00366 MonitorElement* EEEventSize_[2];
00367 MonitorElement* EEHighInterestPayload_[2];
00368 MonitorElement* EELowInterestPayload_[2];
00369 MonitorElement* EEHighInterestZsFIR_[2];
00370 MonitorElement* EELowInterestZsFIR_[2];
00371 
00372 bool init_;
00373 
00374 bool useCondDb_;
00375 const EcalSRSettings* settings_;
00376 
00377 };
00378 
00379 #endif