CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/EcalBarrelMonitorTasks/interface/EBSelectiveReadoutTask.h

Go to the documentation of this file.
00001 #ifndef EBSelectiveReadoutTask_H
00002 #define EBSelectiveReadoutTask_H
00003 
00004 /*
00005  * \file EBSelectiveReadoutTask.h
00006  *
00007  * $Date: 2011/03/03 22:05:50 $
00008  * $Revision: 1.19 $
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 
00018 
00019 class MonitorElement;
00020 class DQMStore;
00021 class EcalSRSettings;
00022 
00023 class EBSelectiveReadoutTask: public edm::EDAnalyzer{
00024 
00025 public:
00026 
00028 EBSelectiveReadoutTask(const edm::ParameterSet& ps);
00029 
00031 virtual ~EBSelectiveReadoutTask();
00032 
00033 protected:
00034 
00036 void analyze(const edm::Event& e, const edm::EventSetup& c);
00037 
00039 void beginJob(void);
00040 
00042 void endJob(void);
00043 
00045 void beginRun(const edm::Run& r, const edm::EventSetup& c);
00046 
00048 void endRun(const edm::Run& r, const edm::EventSetup& c);
00049 
00051 void reset(void);
00052 
00054 void setup(void);
00055 
00057 void cleanup(void);
00058 
00060 static const int nTTEta = 34;
00061 static const int nTTPhi = 72;
00062 static const int nECALDcc = 54;
00063 static const int nEBDcc = 36;
00064 static const int kByte = 1024;
00065 
00067 static const int nDccChs = 68;
00068 
00070 static const int nEbRus = 36*68;
00071 
00073 static const int nEbEta = 170;
00074 
00076 static const int nEbPhi = 360;
00077 
00079 static const int ebTtEdge = 5;
00080  
00082 static const int scEdge = 5;
00083 
00085 static const int nTtEta = 56;
00086 
00088 static const int nTtPhi = 72;
00089 
00091 static const int bytesPerCrystal = 24;
00092 
00094 int nCryTower[72][34];
00095 
00097 int nEvtFullReadout[72][34];
00098 
00100 int nEvtRUForced[72][34];
00101 
00103 int nEvtAnyReadout[72][34];
00104 
00106 int nEvtZS1Readout[72][34];
00107 
00109 int nEvtZSReadout[72][34];
00110 
00112 int nEvtCompleteReadoutIfZS[72][34];
00113 
00115 int nEvtDroppedReadoutIfFR[72][34];
00116 
00118 int nEvtHighInterest[72][34];
00119 
00121 int nEvtMediumInterest[72][34];
00122 
00124 int nEvtLowInterest[72][34];
00125 
00127 int nEvtAnyInterest[72][34];
00128 
00129 private:
00130 
00132 enum subdet_t {EB, EE};
00133 
00137 void anaDigi(const EBDataFrame& frame, const EBSrFlagCollection& srFlagColl, uint16_t statusCode);
00138 
00142 void anaDigiInit();
00143 
00148 unsigned dccNum(const DetId& xtalId) const;
00149 
00153 int iEta2cIndex(int iEta) const{
00154   return (iEta<0)?iEta+85:iEta+84;
00155 }
00156 
00160 int iPhi2cIndex(int iPhi) const{
00161   return iPhi-1;
00162 }
00163 
00169 EcalTrigTowerDetId readOutUnitOf(const EBDetId& xtalId) const;
00170   
00174 int iXY2cIndex(int iX) const{
00175   return iX-1;
00176 }
00177 
00180 int cIndex2iXY(int iX0) const{
00181   return iX0+1;
00182 }
00183 
00186 int cIndex2iEta(int i) const{
00187   return (i<85)?i-85:i-84;
00188 }
00189 
00192 int cIndex2iPhi(int i) const {
00193   return i+1;
00194 }
00195 
00200 double getEbEventSize(double nReadXtals) const;
00201 
00205 double getDccOverhead(subdet_t subdet) const{
00206   //  return (subdet==EB?34:25)*8;
00207   return (subdet==EB?34:52)*8;
00208 }
00209 
00215 double getDccEventSize(int iDcc0, double nReadXtals) const{
00216   subdet_t subdet;
00217   if(iDcc0<9 || iDcc0>=45){
00218     subdet = EE;
00219   } else{
00220     subdet = EB;
00221   }
00222   return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
00223 }
00224 
00230 int dccPhiIndexOfRU(int i, int j) const;
00231 
00237 int dccPhiIndex(int i, int j) const {
00238   return dccPhiIndexOfRU(i/5, j/5);
00239 }
00240 
00246 int dccIndex(int i, int j) const;
00247 
00253 void configFirWeights(std::vector<double> weightsForZsFIR);
00254 
00265 static int dccZsFIR(const EcalDataFrame& frame,
00266                     const std::vector<int>& firWeights,
00267                     int firstFIRSample,
00268                     bool* saturated = 0);
00269   
00270 
00275 static std::vector<int> getFIRWeights(const std::vector<double>&
00276                                       normalizedWeights);
00277 
00283 int getCrystalCount() { return 25; }
00284 
00285 
00288 int nEb_;
00289 
00292 int nEbLI_;
00293 
00296 int nEbHI_;
00297 
00300 int nPerDcc_[nECALDcc];
00301 
00304 int nPerRu_[nECALDcc][nDccChs];   
00305 
00308 int nRuPerDcc_[nECALDcc];
00309 
00312 bool ebRuActive_[nEbEta/ebTtEdge][nEbPhi/ebTtEdge];
00313 
00316 std::vector<int> firWeights_;
00317 
00321 int firstFIRSample_;
00322 
00323 int ievt_;
00324 
00325 DQMStore* dqmStore_;
00326 
00327 std::string prefixME_;
00328 
00329 bool enableCleanup_;
00330 
00331 bool mergeRuns_;
00332 
00333 edm::InputTag EBDigiCollection_;
00334 edm::InputTag EBUnsuppressedDigiCollection_;
00335 edm::InputTag EcalRecHitCollection_;
00336 edm::InputTag EBSRFlagCollection_;
00337 edm::InputTag EcalTrigPrimDigiCollection_;
00338 edm::InputTag FEDRawDataCollection_;
00339 
00340 float xbins[37];
00341 float ybins[89];
00342 
00343 MonitorElement* EBDccEventSize_;
00344 MonitorElement* EBDccEventSizeMap_;
00345 MonitorElement* EBTowerSize_;
00346 MonitorElement* EBTTFMismatch_;
00347 MonitorElement* EBReadoutUnitForcedBitMap_;
00348 MonitorElement* EBFullReadoutSRFlagMap_;
00349 MonitorElement* EBFullReadoutSRFlagCount_;
00350 MonitorElement* EBZeroSuppression1SRFlagMap_;
00351 MonitorElement* EBHighInterestTriggerTowerFlagMap_;
00352 MonitorElement* EBMediumInterestTriggerTowerFlagMap_;
00353 MonitorElement* EBLowInterestTriggerTowerFlagMap_;
00354 MonitorElement* EBTTFlags_;
00355 MonitorElement* EBCompleteZSMap_;
00356 MonitorElement* EBCompleteZSCount_;
00357 MonitorElement* EBDroppedFRMap_;
00358 MonitorElement* EBDroppedFRCount_;
00359 MonitorElement* EBEventSize_;
00360 MonitorElement* EBHighInterestPayload_;
00361 MonitorElement* EBLowInterestPayload_;
00362 MonitorElement* EBHighInterestZsFIR_;
00363 MonitorElement* EBLowInterestZsFIR_;
00364 
00365 bool init_;
00366 
00367 bool useCondDb_;
00368 const EcalSRSettings* settings_;
00369 
00370 };
00371 
00372 #endif