00001 #ifndef FastL1CaloSim_FastL1Region_h
00002 #define FastL1CaloSim_FastL1Region_h
00003
00004
00005
00006
00007
00015
00016
00017
00018
00019
00020
00021
00022 #include "FWCore/Framework/interface/Frameworkfwd.h"
00023 #include "FWCore/Framework/interface/Event.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 #include "FWCore/Framework/interface/MakerMacros.h"
00026 #include "FWCore/Framework/interface/EventSetup.h"
00027
00028 #include <string>
00029 #include <iostream>
00030 #include <iomanip>
00031 #include <vector>
00032 #include <list>
00033
00034 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00035 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00036 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00037 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00038 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00039 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00040 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00041
00042 #include "FWCore/Framework/interface/ESHandle.h"
00043 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00044 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00045
00046 #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h"
00047
00048 #include "FastSimulation/L1CaloTriggerProducer/interface/FastL1RegionMap.h"
00049
00050 #include "FastSimDataFormats/External/interface/FastL1BitInfo.h"
00051
00052 struct FastL1Config {
00053 bool DoJetCorr;
00054 bool DoEMCorr;
00055
00056 double JetSeedEtThreshold;
00057 double EMSeedEnThreshold;
00058
00059 double EMActiveLevel;
00060 double HadActiveLevel;
00061 double EMNoiseLevel;
00062 double HadNoiseLevel;
00063
00064 double noTauVetoLevel;
00065 double hOeThreshold;
00066 double FGEBThreshold;
00067 double FGEEThreshold;
00068 double noFGThreshold;
00069 double QuietRegionThreshold;
00070 double MuonNoiseLevel;
00071 double CrystalEBThreshold;
00072 double CrystalEEThreshold;
00073
00074 double TowerEMLSB;
00075 double TowerHadLSB;
00076 double EMLSB;
00077 double JetLSB;
00078
00079 double TowerEBThreshold;
00080 double TowerEEThreshold;
00081 double TowerHBThreshold;
00082 double TowerHEThreshold;
00083
00084 double TowerEBScale;
00085 double TowerEEScale;
00086 double TowerHBScale;
00087 double TowerHEScale;
00088
00089 std::vector<edm::InputTag> EmInputs;
00090 edm::InputTag TowerInput;
00091
00092 edm::InputTag EcalTPInput;
00093 edm::InputTag HcalTPInput;
00094
00095 edm::FileInPath HcalLUT;
00096 };
00097
00098
00099 class CaloTowerConstituentsMap;
00100 class CaloTopology;
00101 class CaloGeometry;
00102
00103
00104
00105
00106
00107
00108
00109 class FastL1Region {
00110
00111 public:
00112 FastL1Region();
00113 ~FastL1Region();
00114
00115 void SetParameters(FastL1Config);
00116 void FillTower(const CaloTower& t, int& tid);
00117 void FillTowerZero(const CaloTower& t, int& tid);
00118 void FillTower_Scaled(const CaloTower& t, int& tid, bool doRCTTrunc = true);
00119 void FillEMCrystals(const CaloTowerConstituentsMap* theTowerConstituentsMap,
00120 const CaloTopology* calotopo,
00121 const CaloGeometry* cGeom,
00122 const EcalRecHitCollection* ec0,
00123 const EcalRecHitCollection* ec1,
00124 FastL1RegionMap* m_RMap);
00125
00126
00127 void Dump();
00128 void SetEtaPhiIndex(int eta,int phi,int ind)
00129 { ieta=eta; iphi=phi; id=ind; };
00130
00131 int GetiEta() { return ieta; };
00132 int GetiPhi() { return iphi; };
00133 int GetId() { return id; };
00134
00135 int GetNorthId();
00136 int GetSouthId();
00137 int GetWestId();
00138 int GetEastId();
00139 int GetNWId();
00140 int GetSWId();
00141 int GetNEId();
00142 int GetSEId();
00143
00144 void SetRegionBits(edm::Event const& e,bool bitinfo);
00145 void SetTowerBits();
00146 void SetRegionEnergy();
00147
00148 bool GetTauBit() { return tauBit; };
00149 bool GetQuietBit() { return quietBit; };
00150 bool GetMIPBit() { return mipBit; };
00151 bool GetFGBit(int i) { if(i>=0 && i<16) {return fgBit[i];} else { return false; } };
00152 bool GetHOEBit(int i) { if(i>=0 && i<16) { return hOeBit[i]; } else { return false; } };
00153 bool GetHCFGBit(int i) { if(i>=0 && i<16) return hcfgBit[i]; else return false; };
00154
00155 CaloTowerCollection GetCaloTowers() { return Towers; };
00156 void SetEMCrystalEnergy(int itwr, int icell, double en) { EMCrystalEnergy[itwr][icell] = en; };
00157 double GetEMCrystalEnergy(int itwr, int icell) { return EMCrystalEnergy[itwr][icell]; };
00158
00159 double SumE() { return CalcSumE(); };
00160 double SumEt() { return CalcSumEt(); };
00161 double CalcSumE();
00162 double CalcSumEt();
00163 double GetJetE() { return jetE; };
00164 double GetJetEt() { return jetEt; };
00165 void SetJetE(double jE) { jetE = jE; };
00166 void SetJetEt(double jEt) { jetEt = jEt; };
00167
00168 double GetJetE3x3() { return jetE3x3; };
00169 double GetJetEt3x3() { return jetEt3x3; };
00170 void SetJetE3x3(double jE) { jetE3x3 = jE; };
00171 void SetJetEt3x3(double jEt) { jetEt3x3 = jEt; };
00172
00173 std::pair<double, double> getRegionCenterEtaPhi(const edm::EventSetup& c);
00174
00175 std::pair<int, int> GetTowerNorthEtaPhi(int ieta, int iphi);
00176
00177 FastL1BitInfo getBitInfo() { return BitInfo; }
00178
00179
00180 FastL1BitInfo BitInfo;
00181
00182 void SetFGBit(int twrid,bool FGBIT);
00183 void SetHCFGBit(int twrid,bool FGBIT);
00184 void SetHOEBit(int twrid,bool FGBIT);
00185
00186 private:
00187 void SetTauBit(edm::Event const& e, bool bitinfo);
00188 void SetFGBit();
00189 void SetHOEBit();
00190 void SetQuietBit();
00191 void SetMIPBit();
00192 void SetHCFGBit();
00193
00194
00195
00196
00197
00198
00199
00200 CaloTowerCollection Towers;
00201
00202 double EMCrystalEnergy[16][25];
00203
00204
00205
00206 double jetE;
00207 double jetEt;
00208 double jetE3x3;
00209 double jetEt3x3;
00210
00211 int id;
00212 int ieta;
00213 int iphi;
00214
00215 bool tauBit;
00216 bool quietBit;
00217 bool mipBit;
00218
00219 bool fgBit[16];
00220 bool hOeBit[16];
00221 bool hcfgBit[16];
00222
00223 double sumEt;
00224 double sumE;
00225
00226 FastL1Config Config;
00227 };
00228
00229
00230 double
00231 corrJetEt(double et, double eta);
00232
00233
00234 double
00235 corrJetEt1(double et, double eta);
00236
00237
00238 double
00239 corrJetEt2(double et, double eta);
00240
00241
00242 double
00243 corrEmEt(double et, int eta);
00244
00245
00246 double
00247 RCTEnergyTrunc(double et, double Resol = 1., double thres = 1024.);
00248
00249 double
00250 GCTEnergyTrunc(double et, double LSB = 1., bool doEM=false);
00251
00252 #endif