CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/SimCalorimetry/EcalSelectiveReadoutAlgos/interface/EcalSelectiveReadoutSuppressor.h

Go to the documentation of this file.
00001 #ifndef EcalSelectiveReadoutSuppressor_h
00002 #define EcalSelectiveReadoutSuppressor_h
00003 
00004 #include <vector>
00005 #include "boost/multi_array.hpp"
00006 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00007 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00008 #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h"
00009 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011 #include "SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadout.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013 #include "CondFormats/EcalObjects/interface/EcalSRSettings.h"
00014 
00015 #include <memory>
00016 
00017 class EcalSelectiveReadoutSuppressor{
00018 public:
00023   EcalSelectiveReadoutSuppressor(const edm::ParameterSet & params, const EcalSRSettings* settings);
00024   
00025   enum {BARREL, ENDCAP};
00026 
00030   static int getFIRTapCount(){ return nFIRTaps;}
00031   
00035   void setTriggerMap(const EcalTrigTowerConstituentsMap * map);
00036 
00040   void setElecMap(const EcalElectronicsMapping * map);
00041 
00042   
00045   void setGeometry(const CaloGeometry * caloGeometry);
00046 
00054   void run(const edm::EventSetup& eventSetup,
00055            const EcalTrigPrimDigiCollection & trigPrims,
00056            EBDigiCollection & barrelDigis,
00057            EEDigiCollection & endcapDigis);
00058 
00073   void run(const edm::EventSetup& eventSetup,
00074            const EcalTrigPrimDigiCollection & trigPrims,
00075            const EBDigiCollection & barrelDigis,
00076            const EEDigiCollection & endcapDigis,
00077            EBDigiCollection* selectedBarrelDigis,
00078            EEDigiCollection* selectedEndcapDigis,
00079            EBSrFlagCollection* ebSrFlags,
00080            EESrFlagCollection* eeSrFlags);
00081 
00084   EcalSelectiveReadout* getEcalSelectiveReadout(){
00085     return ecalSelectiveReadout.get();
00086   }
00087 
00094   void printTTFlags(std::ostream& os, int iEvent = -1,
00095                     bool withHeader=true) const;
00096   
00097  private:
00098 
00105   bool accept(const edm::DataFrame& frame, int thr);
00106   
00108 
00110   void initCellThresholds(double barrelLowInterest, double endcapLowInterest,
00111                           double barrelHighInterest, double endcapHighInterest);
00119   int internalThreshold(double thresholdInGeV, int iSubDet) const;
00120 
00138   std::vector<int> getFIRWeigths();
00139 
00145   int iEta2cIndex(int iEta) const{
00146     return (iEta<0)?iEta+85:iEta+84;
00147   }
00148   
00154   int iPhi2cIndex(int iPhi) const{
00155     return iPhi-1;
00156   }
00157 
00163   int iTTEta2cIndex(int iEta) const{
00164     return (iEta<0)?iEta+28:iEta+27;
00165   }
00166   
00172   int iTTPhi2cIndex(int iPhi) const{
00173     return iPhi-1;
00174   }
00175 
00181   void setTtFlags(const edm::EventSetup& eventSetup,
00182                   const EBDigiCollection& ebDigis,
00183                   const EEDigiCollection& eeDigis);
00184 
00188   void setTtFlags(const EcalTrigPrimDigiCollection & trigPrims);
00189 
00190   template<class T>
00191   double frame2Energy(const T& frame, int timeOffset = 0) const;
00192 
00193 
00194 //   /** Help function to get SR flag from ZS threshold using min/max convention
00195 //    * for SUPPRESS and FULL_READOUT: see zsThreshold.
00196 //    * @param thr ZS threshold in thrUnit
00197 //    * @param flag for Zero suppression: EcalSrFlag::SRF_ZS1 or
00198 //    * EcalSrFlag::SRF_ZS2
00199 //    * @return the SR flag
00200 //    */
00201 //   int thr2Srf(int thr, int zsFlag) const;
00202   
00205   const static size_t nEndcaps = 2;
00206 
00209   const static size_t nEndcapTriggerTowersInEta = 11;
00210   
00213   const static size_t nBarrelTriggerTowersInEta = 34;
00214   
00217   const static size_t nTriggerTowersInEta
00218   = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta;
00219   
00222   const static size_t nTriggerTowersInPhi = 72;
00223 
00224 
00227   std::auto_ptr<EcalSelectiveReadout> ecalSelectiveReadout;
00228 
00229   const EcalTrigTowerConstituentsMap * theTriggerMap;
00230      
00233   EcalSelectiveReadout::ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi];
00234 
00238   int firstFIRSample;
00239   
00242   std::vector<int> firWeights;
00243 
00247   static const int nFIRTaps;
00248 
00251   std::vector<float> weights;
00252 
00255   bool symetricZS;
00256   
00263   int zsThreshold[2][8];
00264 
00269   double thrUnit[2];
00270 
00273   bool trigPrimBypass_;
00274 
00280   int trigPrimBypassMode_;
00281 
00285   std::vector<int> actions_;
00286   
00291   bool ttThresOnCompressedEt_;
00292   
00296   bool trigPrimBypassWithPeakFinder_; 
00297   
00301   double trigPrimBypassLTH_;
00302 
00306   double trigPrimBypassHTH_;
00307 
00308 
00315   int srFlags[2][8];
00316 
00319   EcalSelectiveReadout::ttFlag_t defaultTtf_;
00320 
00323   int ievt_;
00324 };
00325 #endif