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 "FWCore/ParameterSet/interface/ParameterSet.h" 00010 #include "SimCalorimetry/EcalSelectiveReadoutAlgos/src/EcalSelectiveReadout.h" 00011 #include "FWCore/Framework/interface/EventSetup.h" 00012 #include <memory> 00013 00014 class EcalSelectiveReadoutSuppressor{ 00015 public: 00019 EcalSelectiveReadoutSuppressor(const edm::ParameterSet & params); 00020 00021 enum {BARREL, ENDCAP}; 00022 00026 static int getFIRTapCount(){ return nFIRTaps;} 00027 00031 void setTriggerMap(const EcalTrigTowerConstituentsMap * map); 00032 00035 void setGeometry(const CaloGeometry * caloGeometry); 00036 00044 void run(const edm::EventSetup& eventSetup, 00045 const EcalTrigPrimDigiCollection & trigPrims, 00046 EBDigiCollection & barrelDigis, 00047 EEDigiCollection & endcapDigis); 00048 00059 void run(const edm::EventSetup& eventSetup, 00060 const EcalTrigPrimDigiCollection & trigPrims, 00061 const EBDigiCollection & barrelDigis, 00062 const EEDigiCollection & endcapDigis, 00063 EBDigiCollection & selectedBarrelDigis, 00064 EEDigiCollection & selectedEndcapDigis, 00065 EBSrFlagCollection& ebSrFlags, 00066 EESrFlagCollection& eeSrFlags); 00067 00070 EcalSelectiveReadout* getEcalSelectiveReadout(){ 00071 return ecalSelectiveReadout.get(); 00072 } 00073 00080 void printTTFlags(std::ostream& os, int iEvent = -1, 00081 bool withHeader=true) const; 00082 00083 private: 00084 00091 bool accept(const edm::DataFrame& frame, int thr); 00092 00094 00096 void initCellThresholds(double barrelLowInterest, double endcapLowInterest, 00097 double barrelHighInterest, double endcapHighInterest); 00105 int internalThreshold(double thresholdInGeV, int iSubDet) const; 00106 00124 std::vector<int> getFIRWeigths(); 00125 00131 int iEta2cIndex(int iEta) const{ 00132 return (iEta<0)?iEta+85:iEta+84; 00133 } 00134 00140 int iPhi2cIndex(int iPhi) const{ 00141 return iPhi-1; 00142 } 00143 00149 int iTTEta2cIndex(int iEta) const{ 00150 return (iEta<0)?iEta+28:iEta+27; 00151 } 00152 00158 int iTTPhi2cIndex(int iPhi) const{ 00159 return iPhi-1; 00160 } 00161 00167 void setTtFlags(const edm::EventSetup& eventSetup, 00168 const EBDigiCollection& ebDigis, 00169 const EEDigiCollection& eeDigis); 00170 00174 void setTtFlags(const EcalTrigPrimDigiCollection & trigPrims); 00175 00176 template<class T> 00177 double frame2Energy(const T& frame, int timeOffset = 0) const; 00178 00179 00187 int thr2Srf(int thr, int zsFlag) const; 00188 00191 const static size_t nEndcaps = 2; 00192 00195 const static size_t nEndcapTriggerTowersInEta = 11; 00196 00199 const static size_t nBarrelTriggerTowersInEta = 34; 00200 00203 const static size_t nTriggerTowersInEta 00204 = 2*nEndcapTriggerTowersInEta+nBarrelTriggerTowersInEta; 00205 00208 const static size_t nTriggerTowersInPhi = 72; 00209 00210 00213 std::auto_ptr<EcalSelectiveReadout> ecalSelectiveReadout; 00214 00215 const EcalTrigTowerConstituentsMap * theTriggerMap; 00216 00219 EcalSelectiveReadout::ttFlag_t ttFlags[nTriggerTowersInEta][nTriggerTowersInPhi]; 00220 00224 int firstFIRSample; 00225 00228 std::vector<int> firWeights; 00229 00233 static const int nFIRTaps; 00234 00237 std::vector<double> weights; 00238 00241 bool symetricZS; 00242 00249 int zsThreshold[2][4]; 00250 00255 double thrUnit[2]; 00256 00259 bool trigPrimBypass_; 00260 00264 bool trigPrimBypassWithPeakFinder_; 00265 00269 double trigPrimBypassLTH_; 00270 00274 double trigPrimBypassHTH_; 00275 00281 int srFlags[2][4]; 00282 }; 00283 #endif