CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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: 2010/11/10 10:43:29 $
00008  * $Revision: 1.18 $
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 class MonitorElement;
00019 class DQMStore;
00020 
00021 class EBSelectiveReadoutTask: public edm::EDAnalyzer{
00022 
00023 public:
00024 
00026 EBSelectiveReadoutTask(const edm::ParameterSet& ps);
00027 
00029 virtual ~EBSelectiveReadoutTask();
00030 
00031 protected:
00032 
00034 void analyze(const edm::Event& e, const edm::EventSetup& c);
00035 
00037 void beginJob(void);
00038 
00040 void endJob(void);
00041 
00043 void beginRun(const edm::Run& r, const edm::EventSetup& c);
00044 
00046 void endRun(const edm::Run& r, const edm::EventSetup& c);
00047 
00049 void reset(void);
00050 
00052 void setup(void);
00053 
00055 void cleanup(void);
00056 
00058 static const int nTTEta = 34;
00059 static const int nTTPhi = 72;
00060 static const int nECALDcc = 54;
00061 static const int nEBDcc = 36;
00062 static const int kByte = 1024;
00063 
00065 static const int nDccChs = 68;
00066 
00068 static const int nEbRus = 36*68;
00069 
00071 static const int nEbEta = 170;
00072 
00074 static const int nEbPhi = 360;
00075 
00077 static const int ebTtEdge = 5;
00078  
00080 static const int scEdge = 5;
00081 
00083 static const int nTtEta = 56;
00084 
00086 static const int nTtPhi = 72;
00087 
00089 static const int bytesPerCrystal = 24;
00090 
00092 int nCryTower[72][34];
00093 
00095 int nEvtFullReadout[72][34];
00096 
00098 int nEvtRUForced[72][34];
00099 
00101 int nEvtAnyReadout[72][34];
00102 
00104 int nEvtZS1Readout[72][34];
00105 
00107 int nEvtZSReadout[72][34];
00108 
00110 int nEvtCompleteReadoutIfZS[72][34];
00111 
00113 int nEvtDroppedReadoutIfFR[72][34];
00114 
00116 int nEvtHighInterest[72][34];
00117 
00119 int nEvtMediumInterest[72][34];
00120 
00122 int nEvtLowInterest[72][34];
00123 
00125 int nEvtAnyInterest[72][34];
00126 
00127 private:
00128 
00130 enum subdet_t {EB, EE};
00131 
00135 void anaDigi(const EBDataFrame& frame, const EBSrFlagCollection& srFlagColl, uint16_t statusCode);
00136 
00140 void anaDigiInit();
00141 
00146 unsigned dccNum(const DetId& xtalId) const;
00147 
00151 int iEta2cIndex(int iEta) const{
00152   return (iEta<0)?iEta+85:iEta+84;
00153 }
00154 
00158 int iPhi2cIndex(int iPhi) const{
00159   return iPhi-1;
00160 }
00161 
00167 EcalTrigTowerDetId readOutUnitOf(const EBDetId& xtalId) const;
00168   
00172 int iXY2cIndex(int iX) const{
00173   return iX-1;
00174 }
00175 
00178 int cIndex2iXY(int iX0) const{
00179   return iX0+1;
00180 }
00181 
00184 int cIndex2iEta(int i) const{
00185   return (i<85)?i-85:i-84;
00186 }
00187 
00190 int cIndex2iPhi(int i) const {
00191   return i+1;
00192 }
00193 
00198 double getEbEventSize(double nReadXtals) const;
00199 
00203 double getDccOverhead(subdet_t subdet) const{
00204   //  return (subdet==EB?34:25)*8;
00205   return (subdet==EB?34:52)*8;
00206 }
00207 
00213 double getDccEventSize(int iDcc0, double nReadXtals) const{
00214   subdet_t subdet;
00215   if(iDcc0<9 || iDcc0>=45){
00216     subdet = EE;
00217   } else{
00218     subdet = EB;
00219   }
00220   return getDccOverhead(subdet)+nReadXtals*bytesPerCrystal+nRuPerDcc_[iDcc0]*8;
00221 }
00222 
00228 int dccPhiIndexOfRU(int i, int j) const;
00229 
00235 int dccPhiIndex(int i, int j) const {
00236   return dccPhiIndexOfRU(i/5, j/5);
00237 }
00238 
00244 int dccIndex(int i, int j) const;
00245 
00251 void configFirWeights(std::vector<double> weightsForZsFIR);
00252 
00263 static int dccZsFIR(const EcalDataFrame& frame,
00264                     const std::vector<int>& firWeights,
00265                     int firstFIRSample,
00266                     bool* saturated = 0);
00267   
00268 
00273 static std::vector<int> getFIRWeights(const std::vector<double>&
00274                                       normalizedWeights);
00275 
00281 int getCrystalCount() { return 25; }
00282 
00283 
00286 int nEb_;
00287 
00290 int nEbLI_;
00291 
00294 int nEbHI_;
00295 
00298 int nPerDcc_[nECALDcc];
00299 
00302 int nPerRu_[nECALDcc][nDccChs];   
00303 
00306 int nRuPerDcc_[nECALDcc];
00307 
00310 bool ebRuActive_[nEbEta/ebTtEdge][nEbPhi/ebTtEdge];
00311 
00314 std::vector<int> firWeights_;
00315 
00319 int firstFIRSample_;
00320 
00321 int ievt_;
00322 
00323 DQMStore* dqmStore_;
00324 
00325 std::string prefixME_;
00326 
00327 bool enableCleanup_;
00328 
00329 bool mergeRuns_;
00330 
00331 edm::InputTag EBDigiCollection_;
00332 edm::InputTag EBUnsuppressedDigiCollection_;
00333 edm::InputTag EcalRecHitCollection_;
00334 edm::InputTag EBSRFlagCollection_;
00335 edm::InputTag EcalTrigPrimDigiCollection_;
00336 edm::InputTag FEDRawDataCollection_;
00337 
00338 float xbins[37];
00339 float ybins[89];
00340 
00341 MonitorElement* EBDccEventSize_;
00342 MonitorElement* EBDccEventSizeMap_;
00343 MonitorElement* EBTowerSize_;
00344 MonitorElement* EBTTFMismatch_;
00345 MonitorElement* EBReadoutUnitForcedBitMap_;
00346 MonitorElement* EBFullReadoutSRFlagMap_;
00347 MonitorElement* EBFullReadoutSRFlagCount_;
00348 MonitorElement* EBZeroSuppression1SRFlagMap_;
00349 MonitorElement* EBHighInterestTriggerTowerFlagMap_;
00350 MonitorElement* EBMediumInterestTriggerTowerFlagMap_;
00351 MonitorElement* EBLowInterestTriggerTowerFlagMap_;
00352 MonitorElement* EBTTFlags_;
00353 MonitorElement* EBCompleteZSMap_;
00354 MonitorElement* EBCompleteZSCount_;
00355 MonitorElement* EBDroppedFRMap_;
00356 MonitorElement* EBDroppedFRCount_;
00357 MonitorElement* EBEventSize_;
00358 MonitorElement* EBHighInterestPayload_;
00359 MonitorElement* EBLowInterestPayload_;
00360 MonitorElement* EBHighInterestZsFIR_;
00361 MonitorElement* EBLowInterestZsFIR_;
00362 
00363 bool init_;
00364 
00365 };
00366 
00367 #endif